#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011 Free Software Foundation, Inc. timestamp='2011-08-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo or32-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: >private/lmamane/for-julien2412 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/animations/animationnodehelper.hxx124
-rw-r--r--include/apple_remote/RemoteControl.h113
-rw-r--r--include/apple_remote/RemoteMainController.h52
-rw-r--r--include/avmedia/avmediadllapi.h34
-rw-r--r--include/avmedia/mediaitem.hxx132
-rw-r--r--include/avmedia/mediaplayer.hxx76
-rw-r--r--include/avmedia/mediatoolbox.hxx60
-rw-r--r--include/avmedia/mediawindow.hxx123
-rw-r--r--include/basebmp/accessor.hxx113
-rw-r--r--include/basebmp/accessoradapters.hxx520
-rw-r--r--include/basebmp/accessorfunctors.hxx181
-rw-r--r--include/basebmp/accessortraits.hxx124
-rw-r--r--include/basebmp/basebmpdllapi.h32
-rw-r--r--include/basebmp/bitmapdevice.hxx719
-rw-r--r--include/basebmp/clippedlinerenderer.hxx411
-rw-r--r--include/basebmp/color.hxx93
-rw-r--r--include/basebmp/colorblendaccessoradapter.hxx142
-rw-r--r--include/basebmp/colormisc.hxx185
-rw-r--r--include/basebmp/colortraits.hxx144
-rw-r--r--include/basebmp/compositeiterator.hxx361
-rw-r--r--include/basebmp/debug.hxx57
-rw-r--r--include/basebmp/drawmodes.hxx49
-rw-r--r--include/basebmp/endian.hxx51
-rw-r--r--include/basebmp/fillimage.hxx63
-rw-r--r--include/basebmp/genericcolorimageaccessor.hxx76
-rw-r--r--include/basebmp/greylevelformats.hxx129
-rw-r--r--include/basebmp/iteratortraits.hxx49
-rw-r--r--include/basebmp/metafunctions.hxx226
-rw-r--r--include/basebmp/nonstandarditerator.hxx39
-rw-r--r--include/basebmp/packedpixeliterator.hxx671
-rw-r--r--include/basebmp/paletteformats.hxx139
-rw-r--r--include/basebmp/paletteimageaccessor.hxx162
-rw-r--r--include/basebmp/pixelformatadapters.hxx102
-rw-r--r--include/basebmp/pixeliterator.hxx349
-rw-r--r--include/basebmp/polypolygonrenderer.hxx360
-rw-r--r--include/basebmp/rgb24pixelformats.hxx92
-rw-r--r--include/basebmp/rgbmaskpixelformats.hxx331
-rw-r--r--include/basebmp/scaleimage.hxx189
-rw-r--r--include/basebmp/scanlineformats.hxx57
-rw-r--r--include/basebmp/stridedarrayiterator.hxx108
-rw-r--r--include/basebmp/tools.hxx85
-rw-r--r--include/basegfx/basegfxdllapi.h42
-rw-r--r--include/basegfx/color/bcolor.hxx229
-rw-r--r--include/basegfx/color/bcolormodifier.hxx137
-rw-r--r--include/basegfx/color/bcolortools.hxx52
-rw-r--r--include/basegfx/curve/b2dbeziertools.hxx57
-rw-r--r--include/basegfx/curve/b2dcubicbezier.hxx200
-rw-r--r--include/basegfx/matrix/b2dhommatrix.hxx139
-rw-r--r--include/basegfx/matrix/b2dhommatrixtools.hxx225
-rw-r--r--include/basegfx/matrix/b3dhommatrix.hxx155
-rw-r--r--include/basegfx/numeric/ftools.hxx198
-rw-r--r--include/basegfx/pixel/bpixel.hxx217
-rw-r--r--include/basegfx/point/b2dpoint.hxx146
-rw-r--r--include/basegfx/point/b2ipoint.hxx117
-rw-r--r--include/basegfx/point/b3dpoint.hxx145
-rw-r--r--include/basegfx/point/b3ipoint.hxx129
-rw-r--r--include/basegfx/polygon/b2dlinegeometry.hxx141
-rw-r--r--include/basegfx/polygon/b2dpolygon.hxx230
-rw-r--r--include/basegfx/polygon/b2dpolygonclipper.hxx70
-rw-r--r--include/basegfx/polygon/b2dpolygoncutandtouch.hxx58
-rw-r--r--include/basegfx/polygon/b2dpolygontools.hxx442
-rw-r--r--include/basegfx/polygon/b2dpolygontriangulator.hxx43
-rw-r--r--include/basegfx/polygon/b2dpolypolygon.hxx137
-rw-r--r--include/basegfx/polygon/b2dpolypolygoncutter.hxx153
-rw-r--r--include/basegfx/polygon/b2dpolypolygonfillrule.hxx54
-rw-r--r--include/basegfx/polygon/b2dpolypolygontools.hxx236
-rw-r--r--include/basegfx/polygon/b2dtrapezoid.hxx124
-rw-r--r--include/basegfx/polygon/b3dpolygon.hxx130
-rw-r--r--include/basegfx/polygon/b3dpolygontools.hxx135
-rw-r--r--include/basegfx/polygon/b3dpolypolygon.hxx117
-rw-r--r--include/basegfx/polygon/b3dpolypolygontools.hxx133
-rw-r--r--include/basegfx/range/b1drange.hxx174
-rw-r--r--include/basegfx/range/b1ibox.hxx164
-rw-r--r--include/basegfx/range/b1irange.hxx169
-rw-r--r--include/basegfx/range/b2dconnectedranges.hxx257
-rw-r--r--include/basegfx/range/b2dpolyrange.hxx94
-rw-r--r--include/basegfx/range/b2drange.hxx320
-rw-r--r--include/basegfx/range/b2drangeclipper.hxx45
-rw-r--r--include/basegfx/range/b2drectangle.hxx36
-rw-r--r--include/basegfx/range/b2ibox.hxx261
-rw-r--r--include/basegfx/range/b2irange.hxx287
-rw-r--r--include/basegfx/range/b2irectangle.hxx36
-rw-r--r--include/basegfx/range/b3drange.hxx273
-rw-r--r--include/basegfx/range/b3irange.hxx240
-rw-r--r--include/basegfx/range/basicbox.hxx127
-rw-r--r--include/basegfx/range/basicrange.hxx278
-rw-r--r--include/basegfx/raster/bpixelraster.hxx99
-rw-r--r--include/basegfx/raster/bzpixelraster.hxx90
-rw-r--r--include/basegfx/raster/rasterconvert3d.hxx340
-rw-r--r--include/basegfx/tools/b2dclipstate.hxx94
-rw-r--r--include/basegfx/tools/canvastools.hxx205
-rw-r--r--include/basegfx/tools/gradienttools.hxx405
-rw-r--r--include/basegfx/tools/keystoplerp.hxx92
-rw-r--r--include/basegfx/tools/lerp.hxx51
-rw-r--r--include/basegfx/tools/rectcliptools.hxx96
-rw-r--r--include/basegfx/tools/tools.hxx102
-rw-r--r--include/basegfx/tools/unopolypolygon.hxx110
-rw-r--r--include/basegfx/tools/unotools.hxx40
-rw-r--r--include/basegfx/tools/zoomtools.hxx50
-rw-r--r--include/basegfx/tuple/b2dtuple.hxx352
-rw-r--r--include/basegfx/tuple/b2i64tuple.hxx305
-rw-r--r--include/basegfx/tuple/b2ituple.hxx208
-rw-r--r--include/basegfx/tuple/b3dtuple.hxx421
-rw-r--r--include/basegfx/tuple/b3i64tuple.hxx336
-rw-r--r--include/basegfx/tuple/b3ituple.hxx335
-rw-r--r--include/basegfx/vector/b2dsize.hxx36
-rw-r--r--include/basegfx/vector/b2dvector.hxx254
-rw-r--r--include/basegfx/vector/b2enums.hxx70
-rw-r--r--include/basegfx/vector/b2isize.hxx36
-rw-r--r--include/basegfx/vector/b2ivector.hxx146
-rw-r--r--include/basegfx/vector/b3dvector.hxx322
-rw-r--r--include/basegfx/vector/b3ivector.hxx249
-rw-r--r--include/basic/basicdllapi.h23
-rw-r--r--include/basic/basicmanagerrepository.hxx142
-rw-r--r--include/basic/basmgr.hxx238
-rw-r--r--include/basic/basrdll.hxx52
-rw-r--r--include/basic/global.hxx28
-rw-r--r--include/basic/modsizeexceeded.hxx55
-rw-r--r--include/basic/sbdef.hxx68
-rw-r--r--include/basic/sberrors.hxx418
-rw-r--r--include/basic/sbmeth.hxx91
-rw-r--r--include/basic/sbmod.hxx164
-rw-r--r--include/basic/sbobjmod.hxx104
-rw-r--r--include/basic/sbprop.hxx67
-rw-r--r--include/basic/sbstar.hxx183
-rw-r--r--include/basic/sbstdobj.hxx136
-rw-r--r--include/basic/sbuno.hxx42
-rw-r--r--include/basic/sbx.hxx280
-rw-r--r--include/basic/sbxbase.hxx52
-rw-r--r--include/basic/sbxcore.hxx152
-rw-r--r--include/basic/sbxdef.hxx311
-rw-r--r--include/basic/sbxfac.hxx43
-rw-r--r--include/basic/sbxform.hxx173
-rw-r--r--include/basic/sbxmeth.hxx40
-rw-r--r--include/basic/sbxobj.hxx96
-rw-r--r--include/basic/sbxprop.hxx44
-rw-r--r--include/basic/sbxvar.hxx356
-rw-r--r--include/basic/vbahelper.hxx99
-rw-r--r--include/canvas/base/bitmapcanvasbase.hxx128
-rw-r--r--include/canvas/base/bufferedgraphicdevicebase.hxx276
-rw-r--r--include/canvas/base/cachedprimitivebase.hxx117
-rw-r--r--include/canvas/base/canvasbase.hxx474
-rw-r--r--include/canvas/base/canvascustomspritebase.hxx271
-rw-r--r--include/canvas/base/canvascustomspritehelper.hxx287
-rw-r--r--include/canvas/base/disambiguationhelper.hxx81
-rw-r--r--include/canvas/base/graphicdevicebase.hxx382
-rw-r--r--include/canvas/base/integerbitmapbase.hxx145
-rw-r--r--include/canvas/base/sprite.hxx116
-rw-r--r--include/canvas/base/spritecanvasbase.hxx193
-rw-r--r--include/canvas/base/spritesurface.hxx70
-rw-r--r--include/canvas/canvastools.hxx587
-rw-r--r--include/canvas/canvastoolsdllapi.h35
-rw-r--r--include/canvas/debug.hxx59
-rw-r--r--include/canvas/elapsedtime.hxx173
-rw-r--r--include/canvas/parametricpolypolygon.hxx161
-rw-r--r--include/canvas/propertysethelper.hxx152
-rw-r--r--include/canvas/rendering/bitmap.hxx314
-rw-r--r--include/canvas/rendering/icachedprimitive.hxx60
-rw-r--r--include/canvas/rendering/icolorbuffer.hxx88
-rw-r--r--include/canvas/rendering/irendermodule.hxx143
-rw-r--r--include/canvas/rendering/isurface.hxx82
-rw-r--r--include/canvas/rendering/isurfaceproxy.hxx107
-rw-r--r--include/canvas/rendering/isurfaceproxymanager.hxx74
-rw-r--r--include/canvas/spriteredrawmanager.hxx429
-rw-r--r--include/canvas/vclwrapper.hxx141
-rw-r--r--include/canvas/verbosetrace.hxx32
-rw-r--r--include/canvas/verifyinput.hxx667
-rw-r--r--include/codemaker/codemaker.hxx38
-rw-r--r--include/codemaker/commoncpp.hxx63
-rw-r--r--include/codemaker/commonjava.hxx42
-rw-r--r--include/codemaker/exceptiontree.hxx120
-rw-r--r--include/codemaker/generatedtypeset.hxx73
-rw-r--r--include/codemaker/global.hxx135
-rw-r--r--include/codemaker/options.hxx75
-rw-r--r--include/codemaker/typemanager.hxx76
-rw-r--r--include/codemaker/unotype.hxx91
-rw-r--r--include/comphelper/ChainablePropertySet.hxx138
-rw-r--r--include/comphelper/ChainablePropertySetInfo.hxx69
-rw-r--r--include/comphelper/IdPropArrayHelper.hxx117
-rw-r--r--include/comphelper/InlineContainer.hxx143
-rw-r--r--include/comphelper/MasterPropertySet.hxx143
-rw-r--r--include/comphelper/MasterPropertySetInfo.hxx59
-rw-r--r--include/comphelper/PropertyInfoHash.hxx65
-rw-r--r--include/comphelper/SelectionMultiplex.hxx105
-rw-r--r--include/comphelper/SettingsHelper.hxx113
-rw-r--r--include/comphelper/TypeGeneration.hxx122
-rw-r--r--include/comphelper/accessiblecomponenthelper.hxx140
-rw-r--r--include/comphelper/accessiblecontexthelper.hxx345
-rw-r--r--include/comphelper/accessibleeventnotifier.hxx161
-rw-r--r--include/comphelper/accessiblekeybindinghelper.hxx75
-rw-r--r--include/comphelper/accessibleselectionhelper.hxx124
-rw-r--r--include/comphelper/accessibletexthelper.hxx178
-rw-r--r--include/comphelper/accessiblewrapper.hxx410
-rw-r--r--include/comphelper/accimplaccess.hxx141
-rw-r--r--include/comphelper/anycompare.hxx219
-rw-r--r--include/comphelper/anytostring.hxx43
-rw-r--r--include/comphelper/asyncnotification.hxx184
-rw-r--r--include/comphelper/attributelist.hxx66
-rw-r--r--include/comphelper/basicio.hxx99
-rw-r--r--include/comphelper/broadcasthelper.hxx63
-rw-r--r--include/comphelper/classids.hxx388
-rw-r--r--include/comphelper/comphelperdllapi.h33
-rw-r--r--include/comphelper/componentbase.hxx154
-rw-r--r--include/comphelper/componentcontext.hxx243
-rw-r--r--include/comphelper/componentguard.hxx63
-rw-r--r--include/comphelper/componentmodule.hxx261
-rw-r--r--include/comphelper/configuration.hxx331
-rw-r--r--include/comphelper/configurationhelper.hxx240
-rw-r--r--include/comphelper/container.hxx80
-rw-r--r--include/comphelper/containermultiplexer.hxx106
-rw-r--r--include/comphelper/docpasswordhelper.hxx353
-rw-r--r--include/comphelper/docpasswordrequest.hxx122
-rw-r--r--include/comphelper/documentconstants.hxx171
-rw-r--r--include/comphelper/documentinfo.hxx51
-rw-r--r--include/comphelper/embeddedobjectcontainer.hxx181
-rw-r--r--include/comphelper/enumhelper.hxx143
-rw-r--r--include/comphelper/eventattachermgr.hxx52
-rw-r--r--include/comphelper/evtlistenerhlp.hxx50
-rw-r--r--include/comphelper/evtmethodhelper.hxx32
-rw-r--r--include/comphelper/extract.hxx158
-rw-r--r--include/comphelper/fileformat.h34
-rw-r--r--include/comphelper/flagguard.hxx78
-rw-r--r--include/comphelper/genericpropertyset.hxx34
-rw-r--r--include/comphelper/guarding.hxx56
-rw-r--r--include/comphelper/ihwrapnofilter.hxx99
-rw-r--r--include/comphelper/implbase_var.hxx436
-rw-r--r--include/comphelper/implementationreference.hxx267
-rw-r--r--include/comphelper/interaction.hxx161
-rw-r--r--include/comphelper/listenernotification.hxx298
-rw-r--r--include/comphelper/logging.hxx726
-rw-r--r--include/comphelper/make_shared_from_uno.hxx68
-rw-r--r--include/comphelper/makesequence.hxx80
-rw-r--r--include/comphelper/mediadescriptor.hxx310
-rw-r--r--include/comphelper/mimeconfighelper.hxx141
-rw-r--r--include/comphelper/namecontainer.hxx35
-rw-r--r--include/comphelper/namedvaluecollection.hxx376
-rw-r--r--include/comphelper/newarray.hxx51
-rw-r--r--include/comphelper/numberedcollection.hxx176
-rw-r--r--include/comphelper/numbers.hxx67
-rw-r--r--include/comphelper/officeresourcebundle.hxx94
-rw-r--r--include/comphelper/ofopxmlhelper.hxx130
-rw-r--r--include/comphelper/optional.hxx81
-rw-r--r--include/comphelper/oslfile2streamwrap.hxx89
-rw-r--r--include/comphelper/processfactory.hxx84
-rw-r--r--include/comphelper/propagg.hxx325
-rw-r--r--include/comphelper/proparrhlp.hxx175
-rw-r--r--include/comphelper/property.hxx205
-rw-r--r--include/comphelper/propertybag.hxx227
-rw-r--r--include/comphelper/propertycontainer.hxx90
-rw-r--r--include/comphelper/propertycontainerhelper.hxx203
-rw-r--r--include/comphelper/propertysethelper.hxx91
-rw-r--r--include/comphelper/propertysetinfo.hxx87
-rw-r--r--include/comphelper/propertystatecontainer.hxx114
-rw-r--r--include/comphelper/propmultiplex.hxx109
-rw-r--r--include/comphelper/propstate.hxx105
-rw-r--r--include/comphelper/proxyaggregation.hxx221
-rw-r--r--include/comphelper/scoped_disposing_ptr.hxx160
-rw-r--r--include/comphelper/scopeguard.hxx64
-rw-r--r--include/comphelper/seekableinput.hxx77
-rw-r--r--include/comphelper/seqstream.hxx139
-rw-r--r--include/comphelper/sequence.hxx369
-rw-r--r--include/comphelper/sequenceashashmap.hxx313
-rw-r--r--include/comphelper/sequenceasvector.hxx247
-rw-r--r--include/comphelper/servicedecl.hxx409
-rw-r--r--include/comphelper/servicehelper.hxx107
-rw-r--r--include/comphelper/serviceinfohelper.hxx54
-rw-r--r--include/comphelper/sharedmutex.hxx86
-rw-r--r--include/comphelper/stillreadwriteinteraction.hxx56
-rw-r--r--include/comphelper/stl_types.hxx273
-rw-r--r--include/comphelper/stlunosequence.hxx81
-rw-r--r--include/comphelper/storagehelper.hxx200
-rw-r--r--include/comphelper/streamsection.hxx78
-rw-r--r--include/comphelper/string.hxx466
-rw-r--r--include/comphelper/synchronousdispatch.hxx66
-rw-r--r--include/comphelper/syntaxhighlight.hxx162
-rw-r--r--include/comphelper/types.hxx174
-rw-r--r--include/comphelper/uno3.hxx275
-rw-r--r--include/comphelper/unwrapargs.hxx138
-rw-r--r--include/comphelper/weak.hxx56
-rw-r--r--include/comphelper/weakbag.hxx86
-rw-r--r--include/comphelper/weakeventlistener.hxx182
-rw-r--r--include/comphelper/xmltools.hxx28
-rw-r--r--include/connectivity/BlobHelper.hxx44
-rw-r--r--include/connectivity/CommonTools.hxx215
-rw-r--r--include/connectivity/ConnectionWrapper.hxx92
-rw-r--r--include/connectivity/DriversConfig.hxx80
-rw-r--r--include/connectivity/FValue.hxx539
-rw-r--r--include/connectivity/IParseContext.hxx104
-rw-r--r--include/connectivity/OSubComponent.hxx86
-rw-r--r--include/connectivity/PColumn.hxx154
-rw-r--r--include/connectivity/ParameterCont.hxx52
-rw-r--r--include/connectivity/SQLStatementHelper.hxx43
-rw-r--r--include/connectivity/StdTypeDefs.hxx40
-rw-r--r--include/connectivity/TColumnsHelper.hxx63
-rw-r--r--include/connectivity/TIndex.hxx49
-rw-r--r--include/connectivity/TIndexColumns.hxx44
-rw-r--r--include/connectivity/TIndexes.hxx50
-rw-r--r--include/connectivity/TKey.hxx47
-rw-r--r--include/connectivity/TKeyColumns.hxx44
-rw-r--r--include/connectivity/TKeys.hxx59
-rw-r--r--include/connectivity/TTableHelper.hxx166
-rw-r--r--include/connectivity/conncleanup.hxx90
-rw-r--r--include/connectivity/dbcharset.hxx164
-rw-r--r--include/connectivity/dbconversion.hxx213
-rw-r--r--include/connectivity/dbexception.hxx353
-rw-r--r--include/connectivity/dbmetadata.hxx192
-rw-r--r--include/connectivity/dbtools.hxx787
-rw-r--r--include/connectivity/dbtoolsdllapi.hxx35
-rw-r--r--include/connectivity/filtermanager.hxx123
-rw-r--r--include/connectivity/formattedcolumnvalue.hxx110
-rw-r--r--include/connectivity/parameters.hxx417
-rw-r--r--include/connectivity/paramwrapper.hxx200
-rw-r--r--include/connectivity/predicateinput.hxx125
-rw-r--r--include/connectivity/sdbcx/IRefreshable.hxx59
-rw-r--r--include/connectivity/sdbcx/VCatalog.hxx125
-rw-r--r--include/connectivity/sdbcx/VCollection.hxx237
-rw-r--r--include/connectivity/sdbcx/VColumn.hxx118
-rw-r--r--include/connectivity/sdbcx/VDescriptor.hxx95
-rw-r--r--include/connectivity/sdbcx/VGroup.hxx103
-rw-r--r--include/connectivity/sdbcx/VIndex.hxx106
-rw-r--r--include/connectivity/sdbcx/VIndexColumn.hxx65
-rw-r--r--include/connectivity/sdbcx/VKey.hxx121
-rw-r--r--include/connectivity/sdbcx/VKeyColumn.hxx67
-rw-r--r--include/connectivity/sdbcx/VTable.hxx141
-rw-r--r--include/connectivity/sdbcx/VTypeDef.hxx40
-rw-r--r--include/connectivity/sdbcx/VUser.hxx100
-rw-r--r--include/connectivity/sdbcx/VView.hxx101
-rw-r--r--include/connectivity/sqlerror.hxx317
-rw-r--r--include/connectivity/sqliterator.hxx356
-rw-r--r--include/connectivity/sqlnode.hxx466
-rw-r--r--include/connectivity/sqlparse.hxx253
-rw-r--r--include/connectivity/standardsqlstate.hxx68
-rw-r--r--include/connectivity/statementcomposer.hxx102
-rw-r--r--include/connectivity/virtualdbtools.hxx371
-rw-r--r--include/connectivity/warningscontainer.hxx102
-rw-r--r--include/cosv/bstream.hxx143
-rw-r--r--include/cosv/comdline.hxx63
-rw-r--r--include/cosv/comfunc.hxx67
-rw-r--r--include/cosv/csv_env.hxx148
-rw-r--r--include/cosv/csv_ostream.hxx127
-rw-r--r--include/cosv/csv_precomp.h40
-rw-r--r--include/cosv/dirchain.hxx146
-rw-r--r--include/cosv/file.hxx114
-rw-r--r--include/cosv/openclose.hxx137
-rw-r--r--include/cosv/persist.hxx98
-rw-r--r--include/cosv/ploc.hxx106
-rw-r--r--include/cosv/ploc_dir.hxx109
-rw-r--r--include/cosv/plocroot.hxx73
-rw-r--r--include/cosv/std_outp.hxx123
-rw-r--r--include/cosv/str_types.hxx85
-rw-r--r--include/cosv/streamstr.hxx310
-rw-r--r--include/cosv/string.hxx501
-rw-r--r--include/cosv/stringdata.hxx128
-rw-r--r--include/cosv/tpl/dyn.hxx232
-rw-r--r--include/cosv/tpl/processor.hxx129
-rw-r--r--include/cosv/tpl/swelist.hxx362
-rw-r--r--include/cosv/tpl/tpltools.hxx154
-rw-r--r--include/cosv/tpl/vvector.hxx535
-rw-r--r--include/cosv/x.hxx64
-rw-r--r--include/cppcanvas/basegfxfactory.hxx89
-rw-r--r--include/cppcanvas/bitmap.hxx74
-rw-r--r--include/cppcanvas/bitmapcanvas.hxx60
-rw-r--r--include/cppcanvas/canvas.hxx106
-rw-r--r--include/cppcanvas/canvasgraphic.hxx157
-rw-r--r--include/cppcanvas/color.hxx89
-rw-r--r--include/cppcanvas/cppcanvasdllapi.h30
-rw-r--r--include/cppcanvas/customsprite.hxx47
-rw-r--r--include/cppcanvas/font.hxx55
-rw-r--r--include/cppcanvas/polypolygon.hxx87
-rw-r--r--include/cppcanvas/renderer.hxx144
-rw-r--r--include/cppcanvas/sprite.hxx110
-rw-r--r--include/cppcanvas/spritecanvas.hxx76
-rw-r--r--include/cppcanvas/text.hxx45
-rw-r--r--include/cppcanvas/vclfactory.hxx102
-rw-r--r--include/drawinglayer/XShapeDumper.hxx71
-rw-r--r--include/drawinglayer/animation/animationtiming.hxx141
-rw-r--r--include/drawinglayer/attribute/fillbitmapattribute.hxx84
-rw-r--r--include/drawinglayer/attribute/fillgradientattribute.hxx107
-rw-r--r--include/drawinglayer/attribute/fillhatchattribute.hxx98
-rw-r--r--include/drawinglayer/attribute/fontattribute.hxx98
-rw-r--r--include/drawinglayer/attribute/lineattribute.hxx85
-rw-r--r--include/drawinglayer/attribute/linestartendattribute.hxx81
-rw-r--r--include/drawinglayer/attribute/materialattribute3d.hxx85
-rw-r--r--include/drawinglayer/attribute/sdrallattribute3d.hxx76
-rw-r--r--include/drawinglayer/attribute/sdrfillattribute.hxx87
-rw-r--r--include/drawinglayer/attribute/sdrfillbitmapattribute.hxx96
-rw-r--r--include/drawinglayer/attribute/sdrlightattribute3d.hxx83
-rw-r--r--include/drawinglayer/attribute/sdrlightingattribute3d.hxx87
-rw-r--r--include/drawinglayer/attribute/sdrlineattribute.hxx91
-rw-r--r--include/drawinglayer/attribute/sdrlinestartendattribute.hxx90
-rw-r--r--include/drawinglayer/attribute/sdrobjectattribute3d.hxx99
-rw-r--r--include/drawinglayer/attribute/sdrsceneattribute3d.hxx82
-rw-r--r--include/drawinglayer/attribute/sdrshadowattribute.hxx81
-rw-r--r--include/drawinglayer/attribute/strokeattribute.hxx75
-rw-r--r--include/drawinglayer/drawinglayerdllapi.h24
-rw-r--r--include/drawinglayer/geometry/viewinformation2d.hxx181
-rw-r--r--include/drawinglayer/geometry/viewinformation3d.hxx175
-rw-r--r--include/drawinglayer/primitive2d/animatedprimitive2d.hxx171
-rw-r--r--include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx86
-rw-r--r--include/drawinglayer/primitive2d/baseprimitive2d.hxx296
-rw-r--r--include/drawinglayer/primitive2d/bitmapprimitive2d.hxx80
-rw-r--r--include/drawinglayer/primitive2d/borderlineprimitive2d.hxx144
-rw-r--r--include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx67
-rw-r--r--include/drawinglayer/primitive2d/controlprimitive2d.hxx113
-rw-r--r--include/drawinglayer/primitive2d/cropprimitive2d.hxx102
-rw-r--r--include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx78
-rw-r--r--include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx121
-rw-r--r--include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx111
-rw-r--r--include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx122
-rw-r--r--include/drawinglayer/primitive2d/epsprimitive2d.hxx81
-rw-r--r--include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx109
-rw-r--r--include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx89
-rw-r--r--include/drawinglayer/primitive2d/graphicprimitive2d.hxx95
-rw-r--r--include/drawinglayer/primitive2d/gridprimitive2d.hxx119
-rw-r--r--include/drawinglayer/primitive2d/groupprimitive2d.hxx95
-rw-r--r--include/drawinglayer/primitive2d/helplineprimitive2d.hxx114
-rw-r--r--include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx64
-rw-r--r--include/drawinglayer/primitive2d/invertprimitive2d.hxx59
-rw-r--r--include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/maskprimitive2d.hxx79
-rw-r--r--include/drawinglayer/primitive2d/mediaprimitive2d.hxx97
-rw-r--r--include/drawinglayer/primitive2d/metafileprimitive2d.hxx94
-rw-r--r--include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx79
-rw-r--r--include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx73
-rw-r--r--include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx104
-rw-r--r--include/drawinglayer/primitive2d/patternfillprimitive2d.hxx81
-rw-r--r--include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx83
-rw-r--r--include/drawinglayer/primitive2d/polygonprimitive2d.hxx310
-rw-r--r--include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx382
-rw-r--r--include/drawinglayer/primitive2d/primitivetools2d.hxx192
-rw-r--r--include/drawinglayer/primitive2d/sceneprimitive2d.hxx159
-rw-r--r--include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx71
-rw-r--r--include/drawinglayer/primitive2d/shadowprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/structuretagprimitive2d.hxx71
-rw-r--r--include/drawinglayer/primitive2d/svggradientprimitive2d.hxx413
-rw-r--r--include/drawinglayer/primitive2d/textbreakuphelper.hxx84
-rw-r--r--include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx147
-rw-r--r--include/drawinglayer/primitive2d/texteffectprimitive2d.hxx106
-rw-r--r--include/drawinglayer/primitive2d/textenumsprimitive2d.hxx104
-rw-r--r--include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx212
-rw-r--r--include/drawinglayer/primitive2d/textlayoutdevice.hxx155
-rw-r--r--include/drawinglayer/primitive2d/textlineprimitive2d.hxx84
-rw-r--r--include/drawinglayer/primitive2d/textprimitive2d.hxx181
-rw-r--r--include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx152
-rw-r--r--include/drawinglayer/primitive2d/transformprimitive2d.hxx84
-rw-r--r--include/drawinglayer/primitive2d/transparenceprimitive2d.hxx88
-rw-r--r--include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx76
-rw-r--r--include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx87
-rw-r--r--include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx92
-rw-r--r--include/drawinglayer/primitive3d/baseprimitive3d.hxx213
-rw-r--r--include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx55
-rw-r--r--include/drawinglayer/primitive3d/groupprimitive3d.hxx81
-rw-r--r--include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx86
-rw-r--r--include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx66
-rw-r--r--include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx69
-rw-r--r--include/drawinglayer/primitive3d/polygonprimitive3d.hxx129
-rw-r--r--include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx108
-rw-r--r--include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx83
-rw-r--r--include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx69
-rw-r--r--include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx98
-rw-r--r--include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx137
-rw-r--r--include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx129
-rw-r--r--include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx147
-rw-r--r--include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx81
-rw-r--r--include/drawinglayer/primitive3d/sdrprimitive3d.hxx88
-rw-r--r--include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx80
-rw-r--r--include/drawinglayer/primitive3d/shadowprimitive3d.hxx84
-rw-r--r--include/drawinglayer/primitive3d/textureprimitive3d.hxx230
-rw-r--r--include/drawinglayer/primitive3d/transformprimitive3d.hxx74
-rw-r--r--include/drawinglayer/processor2d/baseprocessor2d.hxx196
-rw-r--r--include/drawinglayer/processor2d/canvasprocessor.hxx122
-rw-r--r--include/drawinglayer/processor2d/contourextractor2d.hxx68
-rw-r--r--include/drawinglayer/processor2d/hittestprocessor2d.hxx108
-rw-r--r--include/drawinglayer/processor2d/linegeometryextractor2d.hxx66
-rw-r--r--include/drawinglayer/processor2d/objectinfoextractor2d.hxx61
-rw-r--r--include/drawinglayer/processor2d/processorfromoutputdevice.hxx55
-rw-r--r--include/drawinglayer/processor2d/textaspolygonextractor2d.hxx98
-rw-r--r--include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx151
-rw-r--r--include/drawinglayer/processor2d/vclpixelprocessor2d.hxx63
-rw-r--r--include/drawinglayer/processor2d/vclprocessor2d.hxx136
-rw-r--r--include/drawinglayer/processor3d/baseprocessor3d.hxx75
-rw-r--r--include/drawinglayer/processor3d/cutfindprocessor3d.hxx91
-rw-r--r--include/drawinglayer/processor3d/defaultprocessor3d.hxx158
-rw-r--r--include/drawinglayer/processor3d/geometry2dextractor.hxx75
-rw-r--r--include/drawinglayer/processor3d/shadow3dextractor.hxx110
-rw-r--r--include/drawinglayer/processor3d/zbufferprocessor3d.hxx113
-rw-r--r--include/drawinglayer/texture/texture.hxx260
-rw-r--r--include/drawinglayer/texture/texture3d.hxx159
-rw-r--r--include/drawinglayer/tools/converters.hxx47
-rw-r--r--include/editeng/AccessibleComponentBase.hxx141
-rw-r--r--include/editeng/AccessibleContextBase.hxx388
-rw-r--r--include/editeng/AccessibleEditableTextPara.hxx386
-rw-r--r--include/editeng/AccessibleImageBullet.hxx219
-rw-r--r--include/editeng/AccessibleParaManager.hxx334
-rw-r--r--include/editeng/AccessibleSelectionBase.hxx67
-rw-r--r--include/editeng/AccessibleStaticTextBase.hxx277
-rw-r--r--include/editeng/AccessibleStringWrap.hxx57
-rw-r--r--include/editeng/LatinLookupTree.hxx74
-rw-r--r--include/editeng/LatinTreeNode.hxx48
-rw-r--r--include/editeng/LookupTree.hxx95
-rw-r--r--include/editeng/Node.hxx102
-rw-r--r--include/editeng/SpellPortions.hxx89
-rw-r--r--include/editeng/TreeHead.hxx49
-rw-r--r--include/editeng/UnoForbiddenCharsTable.hxx59
-rw-r--r--include/editeng/acorrcfg.hxx121
-rw-r--r--include/editeng/adjustitem.hxx130
-rw-r--r--include/editeng/autokernitem.hxx61
-rw-r--r--include/editeng/blinkitem.hxx59
-rw-r--r--include/editeng/borderline.hxx169
-rw-r--r--include/editeng/boxitem.hxx226
-rw-r--r--include/editeng/brushitem.hxx125
-rw-r--r--include/editeng/bulletitem.hxx146
-rw-r--r--include/editeng/charhiddenitem.hxx53
-rw-r--r--include/editeng/charreliefitem.hxx68
-rw-r--r--include/editeng/charrotateitem.hxx81
-rw-r--r--include/editeng/charscaleitem.hxx67
-rw-r--r--include/editeng/charsetcoloritem.hxx66
-rw-r--r--include/editeng/cmapitem.hxx76
-rw-r--r--include/editeng/colritem.hxx82
-rw-r--r--include/editeng/contouritem.hxx58
-rw-r--r--include/editeng/crossedoutitem.hxx79
-rw-r--r--include/editeng/editdata.hxx368
-rw-r--r--include/editeng/editeng.hxx586
-rw-r--r--include/editeng/editengdllapi.h34
-rw-r--r--include/editeng/editerr.hxx30
-rw-r--r--include/editeng/editids.hrc236
-rw-r--r--include/editeng/editobj.hxx130
-rw-r--r--include/editeng/editrids.hrc395
-rw-r--r--include/editeng/editstat.hxx139
-rw-r--r--include/editeng/editund2.hxx67
-rw-r--r--include/editeng/editview.hxx247
-rw-r--r--include/editeng/edtdlg.hxx102
-rw-r--r--include/editeng/eedata.hxx65
-rw-r--r--include/editeng/eeitem.hxx97
-rw-r--r--include/editeng/eeitemid.hxx129
-rw-r--r--include/editeng/eerdll.hxx55
-rw-r--r--include/editeng/emphasismarkitem.hxx73
-rw-r--r--include/editeng/escapementitem.hxx101
-rw-r--r--include/editeng/fhgtitem.hxx103
-rw-r--r--include/editeng/fieldupdater.hxx47
-rw-r--r--include/editeng/flditem.hxx420
-rw-r--r--include/editeng/flstitem.hxx70
-rw-r--r--include/editeng/fontitem.hxx98
-rw-r--r--include/editeng/forbiddencharacterstable.hxx56
-rw-r--r--include/editeng/forbiddenruleitem.hxx60
-rw-r--r--include/editeng/formatbreakitem.hxx90
-rw-r--r--include/editeng/frmdir.hxx53
-rw-r--r--include/editeng/frmdiritem.hxx68
-rw-r--r--include/editeng/fwdtitem.hxx98
-rw-r--r--include/editeng/hangulhanja.hxx288
-rw-r--r--include/editeng/hngpnctitem.hxx60
-rw-r--r--include/editeng/hyphenzoneitem.hxx93
-rw-r--r--include/editeng/itemtype.hxx64
-rw-r--r--include/editeng/justifyitem.hxx119
-rw-r--r--include/editeng/keepitem.hxx65
-rw-r--r--include/editeng/kernitem.hxx67
-rw-r--r--include/editeng/langitem.hxx71
-rw-r--r--include/editeng/lcolitem.hxx54
-rw-r--r--include/editeng/lineitem.hxx75
-rw-r--r--include/editeng/lrspitem.hxx165
-rw-r--r--include/editeng/lspcitem.hxx107
-rw-r--r--include/editeng/macros.hxx17
-rw-r--r--include/editeng/measfld.hxx57
-rw-r--r--include/editeng/memberids.hrc185
-rw-r--r--include/editeng/mutxhelp.hxx37
-rw-r--r--include/editeng/nhypitem.hxx53
-rw-r--r--include/editeng/nlbkitem.hxx56
-rw-r--r--include/editeng/numdef.hxx23
-rw-r--r--include/editeng/numitem.hxx356
-rw-r--r--include/editeng/opaqitem.hxx68
-rw-r--r--include/editeng/optitems.hxx102
-rw-r--r--include/editeng/orphitem.hxx61
-rw-r--r--include/editeng/outliner.hxx1001
-rw-r--r--include/editeng/outlobj.hxx93
-rw-r--r--include/editeng/paperinf.hxx67
-rw-r--r--include/editeng/paragraphdata.hxx64
-rw-r--r--include/editeng/paravertalignitem.hxx69
-rw-r--r--include/editeng/pbinitem.hxx68
-rw-r--r--include/editeng/pgrditem.hxx55
-rw-r--r--include/editeng/pmdlitem.hxx77
-rw-r--r--include/editeng/postitem.hxx76
-rw-r--r--include/editeng/prntitem.hxx70
-rw-r--r--include/editeng/protitem.hxx90
-rw-r--r--include/editeng/prszitem.hxx59
-rw-r--r--include/editeng/rsiditem.hxx43
-rw-r--r--include/editeng/scriptspaceitem.hxx61
-rw-r--r--include/editeng/scripttypeitem.hxx82
-rw-r--r--include/editeng/shaditem.hxx98
-rw-r--r--include/editeng/shdditem.hxx61
-rw-r--r--include/editeng/sizeitem.hxx74
-rw-r--r--include/editeng/spltitem.hxx68
-rw-r--r--include/editeng/splwrap.hxx151
-rw-r--r--include/editeng/svxacorr.hxx441
-rw-r--r--include/editeng/svxenum.hxx239
-rw-r--r--include/editeng/svxfont.hxx119
-rw-r--r--include/editeng/svxrtf.hxx424
-rw-r--r--include/editeng/swafopt.hxx134
-rw-r--r--include/editeng/tstpitem.hxx161
-rw-r--r--include/editeng/twolinesitem.hxx77
-rw-r--r--include/editeng/txtrange.hxx112
-rw-r--r--include/editeng/udlnitem.hxx119
-rw-r--r--include/editeng/ulspitem.hxx104
-rw-r--r--include/editeng/unoedhlp.hxx161
-rw-r--r--include/editeng/unoedprx.hxx176
-rw-r--r--include/editeng/unoedsrc.hxx540
-rw-r--r--include/editeng/unofdesc.hxx46
-rw-r--r--include/editeng/unofield.hxx113
-rw-r--r--include/editeng/unofored.hxx93
-rw-r--r--include/editeng/unoforou.hxx122
-rw-r--r--include/editeng/unoipset.hxx78
-rw-r--r--include/editeng/unolingu.hxx192
-rw-r--r--include/editeng/unonames.hxx43
-rw-r--r--include/editeng/unonrule.hxx87
-rw-r--r--include/editeng/unopracc.hxx66
-rw-r--r--include/editeng/unoprnms.hxx372
-rw-r--r--include/editeng/unotext.hxx661
-rw-r--r--include/editeng/unoviwou.hxx57
-rw-r--r--include/editeng/wghtitem.hxx76
-rw-r--r--include/editeng/widwitem.hxx61
-rw-r--r--include/editeng/writingmodeitem.hxx57
-rw-r--r--include/editeng/wrlmitem.hxx62
-rw-r--r--include/editeng/xmlcnitm.hxx83
-rw-r--r--include/filter/dllapi.h40
-rw-r--r--include/filter/msfilter/countryid.hxx311
-rw-r--r--include/filter/msfilter/dffpropset.hxx70
-rw-r--r--include/filter/msfilter/dffrecordheader.hxx63
-rw-r--r--include/filter/msfilter/escherex.hxx1721
-rw-r--r--include/filter/msfilter/mscodec.hxx370
-rw-r--r--include/filter/msfilter/msdffimp.hxx809
-rw-r--r--include/filter/msfilter/msfilterdllapi.h35
-rw-r--r--include/filter/msfilter/msocximex.hxx106
-rw-r--r--include/filter/msfilter/msoleexp.hxx53
-rw-r--r--include/filter/msfilter/mstoolbar.hxx359
-rw-r--r--include/filter/msfilter/msvbahelper.hxx106
-rw-r--r--include/filter/msfilter/rtfutil.hxx52
-rw-r--r--include/filter/msfilter/svdfppt.hxx1564
-rw-r--r--include/filter/msfilter/svxmsbas.hxx75
-rw-r--r--include/filter/msfilter/util.hxx81
-rw-r--r--include/formula/ExternalReferenceHelper.hxx41
-rw-r--r--include/formula/FormulaCompiler.hxx388
-rw-r--r--include/formula/FormulaOpCodeMapperObj.hxx84
-rw-r--r--include/formula/IControlReferenceHandler.hxx42
-rw-r--r--include/formula/IFunctionDescription.hxx170
-rw-r--r--include/formula/compiler.hrc423
-rw-r--r--include/formula/errorcodes.hxx119
-rw-r--r--include/formula/formdata.hxx83
-rw-r--r--include/formula/formula.hxx142
-rw-r--r--include/formula/formuladllapi.h34
-rw-r--r--include/formula/formulahelper.hxx80
-rw-r--r--include/formula/funcutl.hxx109
-rw-r--r--include/formula/grammar.hxx242
-rw-r--r--include/formula/omoduleclient.hxx43
-rw-r--r--include/formula/opcode.hxx420
-rw-r--r--include/formula/token.hxx428
-rw-r--r--include/formula/tokenarray.hxx287
-rw-r--r--include/framework/actiontriggerhelper.hxx67
-rw-r--r--include/framework/addonmenu.hxx127
-rw-r--r--include/framework/addonsoptions.hxx350
-rw-r--r--include/framework/bmkmenu.hxx69
-rw-r--r--include/framework/configimporter.hxx47
-rw-r--r--include/framework/documentundoguard.hxx63
-rw-r--r--include/framework/eventsconfiguration.hxx43
-rw-r--r--include/framework/framelistanalyzer.hxx195
-rw-r--r--include/framework/fwedllapi.h34
-rw-r--r--include/framework/iguard.hxx54
-rw-r--r--include/framework/imageproducer.hxx50
-rw-r--r--include/framework/imutex.hxx53
-rw-r--r--include/framework/interaction.hxx103
-rw-r--r--include/framework/menuconfiguration.hxx107
-rw-r--r--include/framework/menuextensionsupplier.hxx43
-rw-r--r--include/framework/preventduplicateinteraction.hxx236
-rw-r--r--include/framework/sfxhelperfunctions.hxx97
-rw-r--r--include/framework/statusbarconfiguration.hxx53
-rw-r--r--include/framework/titlehelper.hxx206
-rw-r--r--include/framework/toolboxconfiguration.hxx52
-rw-r--r--include/framework/undomanagerhelper.hxx159
-rw-r--r--include/i18nlangtag/i18nlangtagdllapi.h34
-rw-r--r--include/i18nlangtag/lang.h568
-rw-r--r--include/i18nlangtag/languagetag.hxx400
-rw-r--r--include/i18nlangtag/mslangid.hxx309
-rw-r--r--include/i18nutil/casefolding.hxx79
-rw-r--r--include/i18nutil/i18nutildllapi.h34
-rw-r--r--include/i18nutil/oneToOneMapping.hxx85
-rw-r--r--include/i18nutil/paper.hxx148
-rw-r--r--include/i18nutil/scripttypedetector.hxx38
-rw-r--r--include/i18nutil/unicode.hxx63
-rw-r--r--include/i18nutil/widthfolding.hxx54
-rw-r--r--include/jvmaccess/classpath.hxx139
-rw-r--r--include/jvmaccess/jvmaccessdllapi.h24
-rw-r--r--include/jvmaccess/unovirtualmachine.hxx104
-rw-r--r--include/jvmaccess/virtualmachine.hxx151
-rw-r--r--include/jvmfwk/framework.h835
-rw-r--r--include/jvmfwk/jvmfwkdllapi.h24
-rw-r--r--include/jvmfwk/jvmfwkplugindllapi.h24
-rw-r--r--include/jvmfwk/vendorplugin.h258
-rw-r--r--include/linguistic/hyphdta.hxx136
-rw-r--r--include/linguistic/lngdllapi.h35
-rw-r--r--include/linguistic/lngprophelp.hxx360
-rw-r--r--include/linguistic/lngprops.hxx55
-rw-r--r--include/linguistic/misc.hxx215
-rw-r--r--include/linguistic/spelldta.hxx117
-rw-r--r--include/o3tl/compat_functional.hxx151
-rw-r--r--include/o3tl/cow_wrapper.hxx322
-rw-r--r--include/o3tl/heap_ptr.hxx305
-rw-r--r--include/o3tl/lazy_update.hxx265
-rw-r--r--include/o3tl/range.hxx183
-rw-r--r--include/o3tl/sorted_vector.hxx237
-rw-r--r--include/o3tl/vector_pool.hxx123
-rw-r--r--include/oox/core/binarycodec.hxx316
-rw-r--r--include/oox/core/contexthandler.hxx117
-rw-r--r--include/oox/core/contexthandler2.hxx272
-rw-r--r--include/oox/core/fastparser.hxx97
-rw-r--r--include/oox/core/fasttokenhandler.hxx67
-rw-r--r--include/oox/core/filterbase.hxx293
-rw-r--r--include/oox/core/filterdetect.hxx162
-rw-r--r--include/oox/core/fragmenthandler.hxx131
-rw-r--r--include/oox/core/fragmenthandler2.hxx121
-rw-r--r--include/oox/core/recordparser.hxx90
-rw-r--r--include/oox/core/relations.hxx103
-rw-r--r--include/oox/core/relationshandler.hxx54
-rw-r--r--include/oox/core/xmlfilterbase.hxx256
-rw-r--r--include/oox/dllapi.h33
-rw-r--r--include/oox/drawingml/chart/axiscontext.hxx120
-rw-r--r--include/oox/drawingml/chart/axisconverter.hxx64
-rw-r--r--include/oox/drawingml/chart/axismodel.hxx105
-rw-r--r--include/oox/drawingml/chart/chartcontextbase.hxx95
-rw-r--r--include/oox/drawingml/chart/chartconverter.hxx104
-rw-r--r--include/oox/drawingml/chart/chartdrawingfragment.hxx115
-rw-r--r--include/oox/drawingml/chart/chartspaceconverter.hxx57
-rw-r--r--include/oox/drawingml/chart/chartspacefragment.hxx55
-rw-r--r--include/oox/drawingml/chart/chartspacemodel.hxx72
-rw-r--r--include/oox/drawingml/chart/converterbase.hxx153
-rw-r--r--include/oox/drawingml/chart/datasourcecontext.hxx94
-rw-r--r--include/oox/drawingml/chart/datasourceconverter.hxx71
-rw-r--r--include/oox/drawingml/chart/datasourcemodel.hxx65
-rw-r--r--include/oox/drawingml/chart/modelbase.hxx134
-rw-r--r--include/oox/drawingml/chart/objectformatter.hxx157
-rw-r--r--include/oox/drawingml/chart/plotareacontext.hxx83
-rw-r--r--include/oox/drawingml/chart/plotareaconverter.hxx103
-rw-r--r--include/oox/drawingml/chart/plotareamodel.hxx87
-rw-r--r--include/oox/drawingml/chart/seriescontext.hxx266
-rw-r--r--include/oox/drawingml/chart/seriesconverter.hxx167
-rw-r--r--include/oox/drawingml/chart/seriesmodel.hxx237
-rw-r--r--include/oox/drawingml/chart/titlecontext.hxx83
-rw-r--r--include/oox/drawingml/chart/titleconverter.hxx106
-rw-r--r--include/oox/drawingml/chart/titlemodel.hxx89
-rw-r--r--include/oox/drawingml/chart/typegroupcontext.hxx164
-rw-r--r--include/oox/drawingml/chart/typegroupconverter.hxx198
-rw-r--r--include/oox/drawingml/chart/typegroupmodel.hxx96
-rw-r--r--include/oox/drawingml/clrscheme.hxx62
-rw-r--r--include/oox/drawingml/clrschemecontext.hxx62
-rw-r--r--include/oox/drawingml/color.hxx144
-rw-r--r--include/oox/drawingml/colorchoicecontext.hxx80
-rw-r--r--include/oox/drawingml/connectorshapecontext.hxx41
-rw-r--r--include/oox/drawingml/customshapegeometry.hxx71
-rw-r--r--include/oox/drawingml/customshapeproperties.hxx189
-rw-r--r--include/oox/drawingml/diagram/diagram.hxx58
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx200
-rw-r--r--include/oox/drawingml/effectproperties.hxx53
-rw-r--r--include/oox/drawingml/effectpropertiescontext.hxx41
-rw-r--r--include/oox/drawingml/embeddedwavaudiofile.hxx51
-rw-r--r--include/oox/drawingml/fillproperties.hxx152
-rw-r--r--include/oox/drawingml/fillpropertiesgroupcontext.hxx208
-rw-r--r--include/oox/drawingml/graphicshapecontext.hxx110
-rw-r--r--include/oox/drawingml/guidcontext.hxx43
-rw-r--r--include/oox/drawingml/lineproperties.hxx74
-rw-r--r--include/oox/drawingml/linepropertiescontext.hxx52
-rw-r--r--include/oox/drawingml/objectdefaultcontext.hxx43
-rw-r--r--include/oox/drawingml/scene3dcontext.hxx47
-rw-r--r--include/oox/drawingml/shape.hxx273
-rw-r--r--include/oox/drawingml/shape3dproperties.hxx125
-rw-r--r--include/oox/drawingml/shapecontext.hxx53
-rw-r--r--include/oox/drawingml/shapegroupcontext.hxx46
-rw-r--r--include/oox/drawingml/shapepropertiescontext.hxx43
-rw-r--r--include/oox/drawingml/shapepropertymap.hxx147
-rw-r--r--include/oox/drawingml/shapestylecontext.hxx45
-rw-r--r--include/oox/drawingml/spdefcontext.hxx42
-rw-r--r--include/oox/drawingml/table/tablebackgroundstylecontext.hxx47
-rw-r--r--include/oox/drawingml/table/tablecell.hxx115
-rw-r--r--include/oox/drawingml/table/tablecellcontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablecontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablepartstylecontext.hxx47
-rw-r--r--include/oox/drawingml/table/tableproperties.hxx80
-rw-r--r--include/oox/drawingml/table/tablerow.hxx49
-rw-r--r--include/oox/drawingml/table/tablerowcontext.hxx49
-rw-r--r--include/oox/drawingml/table/tablestyle.hxx85
-rw-r--r--include/oox/drawingml/table/tablestylecellstylecontext.hxx48
-rw-r--r--include/oox/drawingml/table/tablestylecontext.hxx49
-rw-r--r--include/oox/drawingml/table/tablestylelist.hxx54
-rw-r--r--include/oox/drawingml/table/tablestylelistfragmenthandler.hxx56
-rw-r--r--include/oox/drawingml/table/tablestylepart.hxx73
-rw-r--r--include/oox/drawingml/table/tablestyletextstylecontext.hxx49
-rw-r--r--include/oox/drawingml/textbody.hxx73
-rw-r--r--include/oox/drawingml/textbodycontext.hxx63
-rw-r--r--include/oox/drawingml/textbodyproperties.hxx56
-rw-r--r--include/oox/drawingml/textbodypropertiescontext.hxx47
-rw-r--r--include/oox/drawingml/textcharacterproperties.hxx84
-rw-r--r--include/oox/drawingml/textcharacterpropertiescontext.hxx48
-rw-r--r--include/oox/drawingml/textfield.hxx62
-rw-r--r--include/oox/drawingml/textfieldcontext.hxx52
-rw-r--r--include/oox/drawingml/textfont.hxx73
-rw-r--r--include/oox/drawingml/textliststyle.hxx61
-rw-r--r--include/oox/drawingml/textliststylecontext.hxx45
-rw-r--r--include/oox/drawingml/textparagraph.hxx73
-rw-r--r--include/oox/drawingml/textparagraphproperties.hxx128
-rw-r--r--include/oox/drawingml/textparagraphpropertiescontext.hxx58
-rw-r--r--include/oox/drawingml/textrun.hxx62
-rw-r--r--include/oox/drawingml/textspacing.hxx69
-rw-r--r--include/oox/drawingml/theme.hxx116
-rw-r--r--include/oox/drawingml/themeelementscontext.hxx51
-rw-r--r--include/oox/drawingml/themefragmenthandler.hxx55
-rw-r--r--include/oox/drawingml/transform2dcontext.hxx52
-rw-r--r--include/oox/dump/dffdumper.hxx70
-rw-r--r--include/oox/dump/dumperbase.hxx1871
-rw-r--r--include/oox/dump/oledumper.hxx905
-rw-r--r--include/oox/dump/pptxdumper.hxx71
-rw-r--r--include/oox/dump/xlsbdumper.hxx136
-rw-r--r--include/oox/export/chartexport.hxx204
-rw-r--r--include/oox/export/drawingml.hxx160
-rw-r--r--include/oox/export/shapes.hxx170
-rw-r--r--include/oox/export/utils.hxx59
-rw-r--r--include/oox/export/vmlexport.hxx132
-rw-r--r--include/oox/helper/attributelist.hxx170
-rw-r--r--include/oox/helper/binaryinputstream.hxx438
-rw-r--r--include/oox/helper/binaryoutputstream.hxx189
-rw-r--r--include/oox/helper/binarystreambase.hxx187
-rw-r--r--include/oox/helper/containerhelper.hxx410
-rw-r--r--include/oox/helper/graphichelper.hxx168
-rw-r--r--include/oox/helper/helper.hxx334
-rw-r--r--include/oox/helper/modelobjecthelper.hxx125
-rw-r--r--include/oox/helper/progressbar.hxx138
-rw-r--r--include/oox/helper/propertymap.hxx111
-rw-r--r--include/oox/helper/propertyset.hxx146
-rw-r--r--include/oox/helper/refmap.hxx185
-rw-r--r--include/oox/helper/refvector.hxx195
-rw-r--r--include/oox/helper/storagebase.hxx191
-rw-r--r--include/oox/helper/textinputstream.hxx122
-rw-r--r--include/oox/helper/zipstorage.hxx88
-rw-r--r--include/oox/mathml/export.hxx40
-rw-r--r--include/oox/mathml/import.hxx46
-rw-r--r--include/oox/mathml/importutils.hxx254
-rw-r--r--include/oox/ole/axbinaryreader.hxx257
-rw-r--r--include/oox/ole/axbinarywriter.hxx194
-rw-r--r--include/oox/ole/axcontrol.hxx1031
-rw-r--r--include/oox/ole/axcontrolfragment.hxx74
-rw-r--r--include/oox/ole/axfontdata.hxx81
-rw-r--r--include/oox/ole/olehelper.hxx203
-rw-r--r--include/oox/ole/oleobjecthelper.hxx79
-rw-r--r--include/oox/ole/olestorage.hxx110
-rw-r--r--include/oox/ole/vbacontrol.hxx205
-rw-r--r--include/oox/ole/vbahelper.hxx98
-rw-r--r--include/oox/ole/vbainputstream.hxx74
-rw-r--r--include/oox/ole/vbamodule.hxx109
-rw-r--r--include/oox/ole/vbaproject.hxx206
-rw-r--r--include/oox/ppt/animationspersist.hxx126
-rw-r--r--include/oox/ppt/backgroundproperties.hxx44
-rw-r--r--include/oox/ppt/comments.hxx139
-rw-r--r--include/oox/ppt/customshowlistcontext.hxx53
-rw-r--r--include/oox/ppt/dgmimport.hxx62
-rw-r--r--include/oox/ppt/dgmlayout.hxx63
-rw-r--r--include/oox/ppt/headerfooter.hxx45
-rw-r--r--include/oox/ppt/layoutfragmenthandler.hxx42
-rw-r--r--include/oox/ppt/pptgraphicshapecontext.hxx40
-rw-r--r--include/oox/ppt/pptimport.hxx91
-rw-r--r--include/oox/ppt/pptshape.hxx73
-rw-r--r--include/oox/ppt/pptshapecontext.hxx40
-rw-r--r--include/oox/ppt/pptshapegroupcontext.hxx56
-rw-r--r--include/oox/ppt/pptshapepropertiescontext.hxx40
-rw-r--r--include/oox/ppt/presentationfragmenthandler.hxx72
-rw-r--r--include/oox/ppt/slidefragmenthandler.hxx60
-rw-r--r--include/oox/ppt/slidemastertextstylescontext.hxx45
-rw-r--r--include/oox/ppt/slidepersist.hxx161
-rw-r--r--include/oox/ppt/slidetimingcontext.hxx48
-rw-r--r--include/oox/ppt/slidetransition.hxx72
-rw-r--r--include/oox/ppt/slidetransitioncontext.hxx52
-rw-r--r--include/oox/ppt/soundactioncontext.hxx55
-rw-r--r--include/oox/ppt/timenode.hxx128
-rw-r--r--include/oox/ppt/timenodelistcontext.hxx65
-rw-r--r--include/oox/token/namespacemap.hxx43
-rw-r--r--include/oox/token/propertynames.hxx43
-rw-r--r--include/oox/token/tokenmap.hxx73
-rw-r--r--include/oox/vml/vmldrawing.hxx213
-rw-r--r--include/oox/vml/vmldrawingfragment.hxx60
-rw-r--r--include/oox/vml/vmlformatting.hxx248
-rw-r--r--include/oox/vml/vmlinputstream.hxx98
-rw-r--r--include/oox/vml/vmlshape.hxx439
-rw-r--r--include/oox/vml/vmlshapecontainer.hxx153
-rw-r--r--include/oox/vml/vmlshapecontext.hxx188
-rw-r--r--include/oox/vml/vmltextbox.hxx104
-rw-r--r--include/oox/vml/vmltextboxcontext.hxx78
-rw-r--r--include/package/Deflater.hxx65
-rw-r--r--include/package/Inflater.hxx57
-rw-r--r--include/package/packagedllapi.hxx22
-rw-r--r--include/registry/reader.h603
-rw-r--r--include/registry/reader.hxx624
-rw-r--r--include/registry/reflread.hxx513
-rw-r--r--include/registry/refltype.hxx80
-rw-r--r--include/registry/reflwrit.hxx350
-rw-r--r--include/registry/regdllapi.h33
-rw-r--r--include/registry/registry.h456
-rw-r--r--include/registry/registry.hxx1257
-rw-r--r--include/registry/regtype.h168
-rw-r--r--include/registry/types.h334
-rw-r--r--include/registry/version.h69
-rw-r--r--include/registry/writer.h262
-rw-r--r--include/registry/writer.hxx291
-rw-r--r--include/rsc/rsc-vcl-shared-types.hxx133
-rw-r--r--include/rsc/rscsfx.hxx56
-rw-r--r--include/sax/fastattribs.hxx85
-rw-r--r--include/sax/fshelper.hxx199
-rw-r--r--include/sax/saxdllapi.h33
-rw-r--r--include/sax/tools/converter.hxx206
-rw-r--r--include/sax/tools/documenthandleradapter.hxx254
-rw-r--r--include/sfx2/DocumentMetadataAccess.hxx208
-rw-r--r--include/sfx2/Metadatable.hxx181
-rw-r--r--include/sfx2/QuerySaveDocument.hxx38
-rw-r--r--include/sfx2/XmlIdRegistry.hxx84
-rw-r--r--include/sfx2/app.hxx278
-rw-r--r--include/sfx2/appuno.hxx108
-rw-r--r--include/sfx2/basedlgs.hxx238
-rw-r--r--include/sfx2/bindings.hxx248
-rw-r--r--include/sfx2/brokenpackageint.hxx48
-rw-r--r--include/sfx2/chalign.hxx57
-rw-r--r--include/sfx2/checkin.hxx35
-rw-r--r--include/sfx2/childwin.hxx370
-rw-r--r--include/sfx2/cntids.hrc49
-rw-r--r--include/sfx2/controlwrapper.hxx644
-rw-r--r--include/sfx2/ctrlitem.hxx100
-rw-r--r--include/sfx2/dialogs.hrc30
-rw-r--r--include/sfx2/dinfdlg.hxx501
-rw-r--r--include/sfx2/dinfedt.hxx40
-rw-r--r--include/sfx2/dispatch.hxx308
-rw-r--r--include/sfx2/dllapi.h36
-rw-r--r--include/sfx2/docfac.hxx125
-rw-r--r--include/sfx2/docfile.hxx286
-rw-r--r--include/sfx2/docfilt.hxx126
-rw-r--r--include/sfx2/docinf.hxx74
-rw-r--r--include/sfx2/docinsert.hxx71
-rw-r--r--include/sfx2/dockwin.hxx130
-rw-r--r--include/sfx2/docmacromode.hxx328
-rw-r--r--include/sfx2/docstoragemodifylistener.hxx86
-rw-r--r--include/sfx2/doctempl.hxx139
-rw-r--r--include/sfx2/event.hxx136
-rw-r--r--include/sfx2/evntconf.hxx120
-rw-r--r--include/sfx2/fcontnr.hxx153
-rw-r--r--include/sfx2/filedlghelper.hxx262
-rw-r--r--include/sfx2/frame.hxx290
-rw-r--r--include/sfx2/frmdescr.hxx259
-rw-r--r--include/sfx2/frmhtml.hxx47
-rw-r--r--include/sfx2/frmhtmlw.hxx82
-rw-r--r--include/sfx2/genlink.hxx50
-rw-r--r--include/sfx2/hintpost.hxx68
-rw-r--r--include/sfx2/htmlmode.hxx32
-rw-r--r--include/sfx2/imagemgr.hxx34
-rw-r--r--include/sfx2/imgmgr.hxx53
-rw-r--r--include/sfx2/infobar.hxx83
-rw-r--r--include/sfx2/ipclient.hxx95
-rw-r--r--include/sfx2/itemconnect.hxx578
-rw-r--r--include/sfx2/itemwrapper.hxx206
-rw-r--r--include/sfx2/linkmgr.hxx195
-rw-r--r--include/sfx2/linksrc.hxx121
-rw-r--r--include/sfx2/lnkbase.hxx176
-rw-r--r--include/sfx2/macropg.hxx137
-rw-r--r--include/sfx2/mailmodelapi.hxx136
-rw-r--r--include/sfx2/mgetempl.hxx93
-rw-r--r--include/sfx2/mieclip.hxx56
-rw-r--r--include/sfx2/minfitem.hxx72
-rw-r--r--include/sfx2/mnuitem.hxx121
-rw-r--r--include/sfx2/mnumgr.hxx111
-rw-r--r--include/sfx2/module.hxx115
-rw-r--r--include/sfx2/msg.hxx333
-rw-r--r--include/sfx2/msgpool.hxx84
-rw-r--r--include/sfx2/navigat.hxx55
-rw-r--r--include/sfx2/new.hxx75
-rw-r--r--include/sfx2/newstyle.hxx56
-rw-r--r--include/sfx2/objface.hxx125
-rw-r--r--include/sfx2/objitem.hxx47
-rw-r--r--include/sfx2/objsh.hxx824
-rw-r--r--include/sfx2/opengrf.hxx58
-rw-r--r--include/sfx2/passwd.hxx123
-rw-r--r--include/sfx2/printer.hxx75
-rw-r--r--include/sfx2/printopt.hxx109
-rw-r--r--include/sfx2/prnmon.hxx60
-rw-r--r--include/sfx2/progress.hxx74
-rw-r--r--include/sfx2/querystatus.hxx55
-rw-r--r--include/sfx2/request.hxx125
-rw-r--r--include/sfx2/securitypage.hxx49
-rw-r--r--include/sfx2/sfx.hrc289
-rw-r--r--include/sfx2/sfxbasecontroller.hxx386
-rw-r--r--include/sfx2/sfxbasemodel.hxx1554
-rw-r--r--include/sfx2/sfxcommands.h70
-rw-r--r--include/sfx2/sfxdefs.hxx27
-rw-r--r--include/sfx2/sfxdlg.hxx158
-rw-r--r--include/sfx2/sfxhelp.hxx65
-rw-r--r--include/sfx2/sfxhtml.hxx112
-rw-r--r--include/sfx2/sfxmodelfactory.hxx67
-rw-r--r--include/sfx2/sfxresid.hxx37
-rw-r--r--include/sfx2/sfxsids.hrc753
-rw-r--r--include/sfx2/sfxstatuslistener.hxx88
-rw-r--r--include/sfx2/sfxuno.hxx638
-rw-r--r--include/sfx2/shell.hxx371
-rw-r--r--include/sfx2/signaturestate.hxx38
-rw-r--r--include/sfx2/stbitem.hxx142
-rw-r--r--include/sfx2/styfitem.hxx99
-rw-r--r--include/sfx2/styledlg.hxx52
-rw-r--r--include/sfx2/tabdlg.hxx306
-rw-r--r--include/sfx2/tabpage.hrc33
-rw-r--r--include/sfx2/taskpane.hxx233
-rw-r--r--include/sfx2/tbxctrl.hxx412
-rw-r--r--include/sfx2/templateabstractview.hxx147
-rw-r--r--include/sfx2/templatecontaineritem.hxx46
-rw-r--r--include/sfx2/templateinfodlg.hxx50
-rw-r--r--include/sfx2/templatelocalview.hxx104
-rw-r--r--include/sfx2/templatelocnames.hrc54
-rw-r--r--include/sfx2/templateproperties.hxx29
-rw-r--r--include/sfx2/templateremoteview.hxx48
-rw-r--r--include/sfx2/templaterepository.hxx46
-rw-r--r--include/sfx2/templateviewitem.hxx61
-rw-r--r--include/sfx2/templdlg.hxx84
-rw-r--r--include/sfx2/thumbnailview.hxx332
-rw-r--r--include/sfx2/thumbnailviewitem.hxx134
-rw-r--r--include/sfx2/titledockwin.hxx161
-rw-r--r--include/sfx2/tplpitem.hxx51
-rw-r--r--include/sfx2/unoctitm.hxx198
-rw-r--r--include/sfx2/userinputinterception.hxx75
-rw-r--r--include/sfx2/viewfac.hxx61
-rw-r--r--include/sfx2/viewfrm.hxx335
-rw-r--r--include/sfx2/viewsh.hxx343
-rw-r--r--include/sfx2/zoomitem.hxx83
-rw-r--r--include/shell/kde_headers.h99
-rw-r--r--include/shell/tde_defines.h109
-rw-r--r--include/shell/tde_headers.h97
-rw-r--r--include/sot/exchange.hxx224
-rw-r--r--include/sot/factory.hxx76
-rw-r--r--include/sot/filelist.hxx65
-rw-r--r--include/sot/formats.hxx182
-rw-r--r--include/sot/object.hxx307
-rw-r--r--include/sot/sotdata.hxx57
-rw-r--r--include/sot/sotdllapi.h34
-rw-r--r--include/sot/stg.hxx366
-rw-r--r--include/sot/storage.hxx223
-rw-r--r--include/sot/storinfo.hxx61
-rw-r--r--include/store/store.h405
-rw-r--r--include/store/store.hxx605
-rw-r--r--include/store/storedllapi.h32
-rw-r--r--include/store/types.h160
-rw-r--r--include/svl/PasswordHelper.hxx46
-rw-r--r--include/svl/adrparse.hxx78
-rw-r--r--include/svl/aeitem.hxx63
-rw-r--r--include/svl/asiancfg.hxx70
-rw-r--r--include/svl/brdcst.hxx68
-rw-r--r--include/svl/broadcast.hxx58
-rw-r--r--include/svl/cenumitm.hxx170
-rw-r--r--include/svl/cintitem.hxx274
-rw-r--r--include/svl/cjkoptions.hxx70
-rw-r--r--include/svl/cntwall.hxx71
-rw-r--r--include/svl/cntwids.hrc208
-rw-r--r--include/svl/converter.hxx36
-rw-r--r--include/svl/ctloptions.hxx87
-rw-r--r--include/svl/ctypeitm.hxx73
-rw-r--r--include/svl/custritm.hxx85
-rw-r--r--include/svl/dateitem.hxx76
-rw-r--r--include/svl/documentlockfile.hxx63
-rw-r--r--include/svl/eitem.hxx62
-rw-r--r--include/svl/filenotation.hxx64
-rw-r--r--include/svl/filerec.hxx1031
-rw-r--r--include/svl/flagitem.hxx69
-rw-r--r--include/svl/folderrestriction.hxx47
-rw-r--r--include/svl/fstathelper.hxx59
-rw-r--r--include/svl/globalnameitem.hxx52
-rw-r--r--include/svl/hint.hxx59
-rw-r--r--include/svl/ilstitem.hxx56
-rw-r--r--include/svl/imageitm.hxx51
-rw-r--r--include/svl/inethist.hxx125
-rw-r--r--include/svl/inettype.hxx304
-rw-r--r--include/svl/instrm.hxx73
-rw-r--r--include/svl/intitem.hxx163
-rw-r--r--include/svl/isethint.hxx45
-rw-r--r--include/svl/itemiter.hxx61
-rw-r--r--include/svl/itempool.hxx259
-rw-r--r--include/svl/itemprop.hxx203
-rw-r--r--include/svl/itemset.hxx191
-rw-r--r--include/svl/languageoptions.hxx113
-rw-r--r--include/svl/lckbitem.hxx56
-rw-r--r--include/svl/listener.hxx58
-rw-r--r--include/svl/listeneriter.hxx65
-rw-r--r--include/svl/lngmisc.hxx56
-rw-r--r--include/svl/lockfilecommon.hxx69
-rw-r--r--include/svl/lstner.hxx69
-rw-r--r--include/svl/macitem.hxx215
-rw-r--r--include/svl/mailenum.hxx88
-rw-r--r--include/svl/memberid.hrc61
-rw-r--r--include/svl/metitem.hxx46
-rw-r--r--include/svl/nfkeytab.hxx122
-rw-r--r--include/svl/nfsymbol.hxx63
-rw-r--r--include/svl/nfversi.hxx64
-rw-r--r--include/svl/nranges.hxx65
-rw-r--r--include/svl/numuno.hxx92
-rw-r--r--include/svl/ondemand.hxx384
-rw-r--r--include/svl/outstrm.hxx59
-rw-r--r--include/svl/ownlist.hxx90
-rw-r--r--include/svl/pickerhistoryaccess.hxx45
-rw-r--r--include/svl/poolcach.hxx62
-rw-r--r--include/svl/poolitem.hxx415
-rw-r--r--include/svl/ptitem.hxx70
-rw-r--r--include/svl/rectitem.hxx69
-rw-r--r--include/svl/restrictedpaths.hxx75
-rw-r--r--include/svl/rngitem.hxx83
-rw-r--r--include/svl/sfontitm.hxx207
-rw-r--r--include/svl/sharecontrolfile.hxx77
-rw-r--r--include/svl/slstitm.hxx73
-rw-r--r--include/svl/smplhint.hxx93
-rw-r--r--include/svl/solar.hrc207
-rw-r--r--include/svl/srchdefs.hxx42
-rw-r--r--include/svl/srchitem.hxx287
-rw-r--r--include/svl/stritem.hxx48
-rw-r--r--include/svl/strmadpt.hxx127
-rw-r--r--include/svl/style.hrc34
-rw-r--r--include/svl/style.hxx386
-rw-r--r--include/svl/stylepool.hxx91
-rw-r--r--include/svl/stylesheetuser.hxx38
-rw-r--r--include/svl/svdde.hxx416
-rw-r--r--include/svl/svl.hrc114
-rw-r--r--include/svl/svldllapi.h34
-rw-r--r--include/svl/szitem.hxx68
-rw-r--r--include/svl/undo.hxx474
-rw-r--r--include/svl/urihelper.hxx165
-rw-r--r--include/svl/urlbmk.hxx62
-rw-r--r--include/svl/urlfilter.hxx56
-rw-r--r--include/svl/visitem.hxx87
-rw-r--r--include/svl/whiter.hxx48
-rw-r--r--include/svl/xmlement.hxx34
-rw-r--r--include/svl/zforlist.hxx1037
-rw-r--r--include/svl/zformat.hxx712
-rw-r--r--include/svtools/AccessibleBrowseBoxObjType.hxx52
-rw-r--r--include/svtools/DocumentInfoPreview.hxx73
-rw-r--r--include/svtools/DocumentToGraphicRenderer.hxx62
-rw-r--r--include/svtools/GraphicExportOptionsDialog.hxx78
-rw-r--r--include/svtools/PlaceEditDialog.hxx92
-rw-r--r--include/svtools/QueryFolderName.hxx57
-rw-r--r--include/svtools/ServerDetailsControls.hxx148
-rw-r--r--include/svtools/acceleratorexecute.hxx246
-rw-r--r--include/svtools/accessibilityoptions.hxx72
-rw-r--r--include/svtools/accessiblefactory.hxx184
-rw-r--r--include/svtools/accessibletable.hxx203
-rw-r--r--include/svtools/accessibletableprovider.hxx241
-rw-r--r--include/svtools/addresstemplate.hxx144
-rw-r--r--include/svtools/apearcfg.hxx97
-rw-r--r--include/svtools/asynclink.hxx66
-rw-r--r--include/svtools/bindablecontrolhelper.hxx52
-rw-r--r--include/svtools/borderhelper.hxx47
-rw-r--r--include/svtools/brwbox.hxx831
-rw-r--r--include/svtools/brwhead.hxx46
-rw-r--r--include/svtools/calendar.hxx451
-rw-r--r--include/svtools/cliplistener.hxx54
-rw-r--r--include/svtools/collatorres.hxx42
-rw-r--r--include/svtools/colorcfg.hxx138
-rw-r--r--include/svtools/colrdlg.hxx60
-rw-r--r--include/svtools/contextmenuhelper.hxx116
-rw-r--r--include/svtools/controldims.hrc93
-rw-r--r--include/svtools/ctrlbox.hxx552
-rw-r--r--include/svtools/ctrltool.hxx241
-rw-r--r--include/svtools/dialogclosedlistener.hxx69
-rw-r--r--include/svtools/dialogcontrolling.hxx293
-rw-r--r--include/svtools/editbrowsebox.hxx685
-rw-r--r--include/svtools/editimplementation.hxx144
-rw-r--r--include/svtools/editsyntaxhighlighter.hxx56
-rw-r--r--include/svtools/ehdl.hxx77
-rw-r--r--include/svtools/embedhlp.hxx124
-rw-r--r--include/svtools/embedtransfer.hxx57
-rw-r--r--include/svtools/extcolorcfg.hxx111
-rw-r--r--include/svtools/extensionlistbox.hxx98
-rw-r--r--include/svtools/filechangedchecker.hxx54
-rw-r--r--include/svtools/filectrl.hxx96
-rw-r--r--include/svtools/filedlg2.hrc23
-rw-r--r--include/svtools/fileurlbox.hxx68
-rw-r--r--include/svtools/fileview.hxx258
-rw-r--r--include/svtools/fmtfield.hxx319
-rw-r--r--include/svtools/fontsubstconfig.hxx61
-rw-r--r--include/svtools/framestatuslistener.hxx101
-rw-r--r--include/svtools/generictoolboxcontroller.hxx61
-rw-r--r--include/svtools/genericunodialog.hxx185
-rw-r--r--include/svtools/grfmgr.hxx624
-rw-r--r--include/svtools/headbar.hxx377
-rw-r--r--include/svtools/helpid.hrc97
-rw-r--r--include/svtools/helpopt.hxx65
-rw-r--r--include/svtools/htmlcfg.hxx94
-rw-r--r--include/svtools/htmlkywd.hxx796
-rw-r--r--include/svtools/htmlout.hxx118
-rw-r--r--include/svtools/htmltokn.h561
-rw-r--r--include/svtools/hyperlabel.hxx87
-rw-r--r--include/svtools/imagemgr.hrc147
-rw-r--r--include/svtools/imagemgr.hxx79
-rw-r--r--include/svtools/imageresourceaccess.hxx81
-rw-r--r--include/svtools/imap.hxx151
-rw-r--r--include/svtools/imapcirc.hxx75
-rw-r--r--include/svtools/imapobj.hxx145
-rw-r--r--include/svtools/imappoly.hxx81
-rw-r--r--include/svtools/imaprect.hxx73
-rw-r--r--include/svtools/imgdef.hxx36
-rw-r--r--include/svtools/indexentryres.hxx42
-rw-r--r--include/svtools/inetimg.hxx78
-rw-r--r--include/svtools/inettbc.hxx97
-rw-r--r--include/svtools/insdlg.hxx79
-rw-r--r--include/svtools/itemdel.hxx30
-rw-r--r--include/svtools/ivctrl.hxx353
-rw-r--r--include/svtools/javacontext.hxx82
-rw-r--r--include/svtools/javainteractionhandler.hxx75
-rw-r--r--include/svtools/langhelp.hxx30
-rw-r--r--include/svtools/langtab.hxx57
-rw-r--r--include/svtools/localresaccess.hxx75
-rw-r--r--include/svtools/menuoptions.hxx128
-rw-r--r--include/svtools/miscopt.hxx150
-rw-r--r--include/svtools/optionsdrawinglayer.hxx198
-rw-r--r--include/svtools/parhtml.hxx289
-rw-r--r--include/svtools/parrtf.hxx85
-rw-r--r--include/svtools/place.hxx42
-rw-r--r--include/svtools/popupmenucontrollerbase.hxx131
-rw-r--r--include/svtools/popupwindowcontroller.hxx79
-rw-r--r--include/svtools/printoptions.hxx120
-rw-r--r--include/svtools/prnsetup.hxx93
-rw-r--r--include/svtools/restartdialog.hxx47
-rw-r--r--include/svtools/roadmap.hxx123
-rw-r--r--include/svtools/roadmapwizard.hxx246
-rw-r--r--include/svtools/rtfkeywd.hxx1212
-rw-r--r--include/svtools/rtfout.hxx58
-rw-r--r--include/svtools/rtftoken.h1265
-rw-r--r--include/svtools/ruler.hxx802
-rw-r--r--include/svtools/sampletext.hxx49
-rw-r--r--include/svtools/scriptedtext.hxx95
-rw-r--r--include/svtools/scrwin.hxx93
-rw-r--r--include/svtools/sfxecode.hxx113
-rw-r--r--include/svtools/slidesorterbaropt.hxx98
-rw-r--r--include/svtools/soerr.hxx74
-rw-r--r--include/svtools/sores.hxx103
-rw-r--r--include/svtools/statusbarcontroller.hxx141
-rw-r--r--include/svtools/stdctrl.hxx41
-rw-r--r--include/svtools/stdmenu.hxx161
-rw-r--r--include/svtools/stringtransfer.hxx76
-rw-r--r--include/svtools/svlbitm.hxx257
-rw-r--r--include/svtools/svmedit.hxx45
-rw-r--r--include/svtools/svmedit2.hxx46
-rw-r--r--include/svtools/svparser.hxx278
-rw-r--r--include/svtools/svtabbx.hxx255
-rw-r--r--include/svtools/svtdllapi.h34
-rw-r--r--include/svtools/svtools.hrc324
-rw-r--r--include/svtools/svtresid.hxx38
-rw-r--r--include/svtools/svxbox.hxx178
-rw-r--r--include/svtools/tabbar.hxx557
-rw-r--r--include/svtools/table/defaultinputhandler.hxx65
-rw-r--r--include/svtools/table/gridtablerenderer.hxx121
-rw-r--r--include/svtools/table/tablecontrol.hxx218
-rw-r--r--include/svtools/table/tablecontrolinterface.hxx257
-rw-r--r--include/svtools/table/tableinputhandler.hxx73
-rw-r--r--include/svtools/table/tablemodel.hxx539
-rw-r--r--include/svtools/table/tablerenderer.hxx285
-rw-r--r--include/svtools/table/tablesort.hxx89
-rw-r--r--include/svtools/table/tabletypes.hxx64
-rw-r--r--include/svtools/templatefoldercache.hxx102
-rw-r--r--include/svtools/templdlg.hxx81
-rw-r--r--include/svtools/textwindowpeer.hxx65
-rw-r--r--include/svtools/toolbarmenu.hxx140
-rw-r--r--include/svtools/toolboxcontroller.hxx162
-rw-r--r--include/svtools/toolpanel/decklayouter.hxx99
-rw-r--r--include/svtools/toolpanel/drawerlayouter.hxx97
-rw-r--r--include/svtools/toolpanel/paneltabbar.hxx96
-rw-r--r--include/svtools/toolpanel/refbase.hxx75
-rw-r--r--include/svtools/toolpanel/tabalignment.hxx42
-rw-r--r--include/svtools/toolpanel/tabitemcontent.hxx43
-rw-r--r--include/svtools/toolpanel/tablayouter.hxx99
-rw-r--r--include/svtools/toolpanel/toolpanel.hxx138
-rw-r--r--include/svtools/toolpanel/toolpaneldeck.hxx194
-rw-r--r--include/svtools/toolpanelopt.hxx99
-rw-r--r--include/svtools/transfer.hxx521
-rw-r--r--include/svtools/treelist.hxx366
-rw-r--r--include/svtools/treelistbox.hxx806
-rwxr-xr-xinclude/svtools/treelistentries.hxx20
-rw-r--r--include/svtools/treelistentry.hxx104
-rw-r--r--include/svtools/unitconv.hxx54
-rw-r--r--include/svtools/unoevent.hxx320
-rw-r--r--include/svtools/unoimap.hxx39
-rw-r--r--include/svtools/urlcontrol.hxx53
-rw-r--r--include/svtools/valueset.hxx391
-rw-r--r--include/svtools/viewdataentry.hxx81
-rw-r--r--include/svtools/wizardmachine.hxx385
-rw-r--r--include/svtools/wizdlg.hxx301
-rw-r--r--include/svtools/xwindowitem.hxx58
-rw-r--r--include/svx/AccessibleControlShape.hxx210
-rw-r--r--include/svx/AccessibleGraphicShape.hxx117
-rw-r--r--include/svx/AccessibleOLEShape.hxx123
-rw-r--r--include/svx/AccessibleShape.hxx397
-rw-r--r--include/svx/AccessibleShapeInfo.hxx103
-rw-r--r--include/svx/AccessibleShapeTreeInfo.hxx197
-rw-r--r--include/svx/AccessibleTableShape.hxx126
-rw-r--r--include/svx/AccessibleTextHelper.hxx425
-rw-r--r--include/svx/ActionDescriptionProvider.hxx59
-rw-r--r--include/svx/ChildrenManager.hxx210
-rw-r--r--include/svx/DescriptionGenerator.hxx200
-rw-r--r--include/svx/EnhancedCustomShape2d.hxx228
-rw-r--r--include/svx/EnhancedCustomShapeFunctionParser.hxx208
-rw-r--r--include/svx/EnhancedCustomShapeGeometry.hxx95
-rw-r--r--include/svx/EnhancedCustomShapeTypeNames.hxx33
-rw-r--r--include/svx/IAccessibleParent.hxx89
-rw-r--r--include/svx/IAccessibleViewForwarder.hxx126
-rw-r--r--include/svx/IAccessibleViewForwarderListener.hxx70
-rw-r--r--include/svx/ParseContext.hxx80
-rw-r--r--include/svx/ShapeTypeHandler.hxx220
-rw-r--r--include/svx/SmartTagCtl.hxx78
-rw-r--r--include/svx/SmartTagItem.hxx87
-rw-r--r--include/svx/SmartTagMgr.hxx226
-rw-r--r--include/svx/SpellDialogChildWindow.hxx119
-rw-r--r--include/svx/SvxShapeTypes.hxx75
-rw-r--r--include/svx/UnoNamespaceMap.hxx36
-rw-r--r--include/svx/XPropertyTable.hxx39
-rw-r--r--include/svx/algitem.hxx122
-rw-r--r--include/svx/anchorid.hxx36
-rw-r--r--include/svx/bmpmask.hxx181
-rw-r--r--include/svx/camera3d.hxx78
-rw-r--r--include/svx/charmap.hxx134
-rw-r--r--include/svx/charthelper.hxx52
-rw-r--r--include/svx/checklbx.hxx81
-rw-r--r--include/svx/chrtitem.hxx334
-rw-r--r--include/svx/clipboardctl.hxx58
-rw-r--r--include/svx/clipfmtitem.hxx57
-rw-r--r--include/svx/colrctrl.hxx135
-rw-r--r--include/svx/compressgraphicdialog.hxx95
-rw-r--r--include/svx/connctrl.hxx66
-rw-r--r--include/svx/contdlg.hxx98
-rw-r--r--include/svx/ctredlin.hxx391
-rw-r--r--include/svx/cube3d.hxx88
-rw-r--r--include/svx/dataaccessdescriptor.hxx136
-rw-r--r--include/svx/databaselocationinput.hxx88
-rw-r--r--include/svx/databaseregistrationui.hxx47
-rw-r--r--include/svx/dbaexchange.hxx290
-rw-r--r--include/svx/dbaobjectex.hxx78
-rw-r--r--include/svx/dbcharsethelper.hxx59
-rw-r--r--include/svx/dbtoolsclient.hxx204
-rw-r--r--include/svx/def3d.hxx48
-rw-r--r--include/svx/deflt3d.hxx129
-rw-r--r--include/svx/dialcontrol.hxx140
-rw-r--r--include/svx/dialmgr.hxx39
-rw-r--r--include/svx/dialogs.hrc1031
-rw-r--r--include/svx/dlgctl3d.hxx204
-rw-r--r--include/svx/dlgctrl.hxx449
-rw-r--r--include/svx/dlgutil.hxx40
-rw-r--r--include/svx/drawitem.hxx213
-rw-r--r--include/svx/dstribut_enum.hxx42
-rw-r--r--include/svx/e3ditem.hxx65
-rw-r--r--include/svx/e3dsceneupdater.hxx68
-rw-r--r--include/svx/e3dundo.hxx112
-rw-r--r--include/svx/extedit.hxx53
-rw-r--r--include/svx/exthelpid.hrc34
-rw-r--r--include/svx/extrud3d.hxx102
-rw-r--r--include/svx/extrusionbar.hxx55
-rw-r--r--include/svx/extrusioncolorcontrol.hxx50
-rw-r--r--include/svx/f3dchild.hxx44
-rw-r--r--include/svx/fillctrl.hxx99
-rw-r--r--include/svx/flagsdef.hxx97
-rw-r--r--include/svx/float3d.hxx291
-rw-r--r--include/svx/fmdmod.hxx40
-rw-r--r--include/svx/fmdpage.hxx67
-rw-r--r--include/svx/fmglob.hxx59
-rw-r--r--include/svx/fmgridcl.hxx206
-rw-r--r--include/svx/fmgridif.hxx544
-rw-r--r--include/svx/fmmodel.hxx93
-rw-r--r--include/svx/fmobjfac.hxx44
-rw-r--r--include/svx/fmpage.hxx82
-rw-r--r--include/svx/fmresids.hrc227
-rw-r--r--include/svx/fmsearch.hxx77
-rw-r--r--include/svx/fmshell.hxx181
-rw-r--r--include/svx/fmsrccfg.hxx147
-rw-r--r--include/svx/fmsrcimp.hxx390
-rw-r--r--include/svx/fmtools.hxx225
-rw-r--r--include/svx/fmview.hxx164
-rw-r--r--include/svx/fntctl.hxx58
-rw-r--r--include/svx/fntctrl.hxx97
-rw-r--r--include/svx/fntszctl.hxx58
-rw-r--r--include/svx/fontlb.hxx105
-rw-r--r--include/svx/fontwork.hxx182
-rw-r--r--include/svx/fontworkbar.hxx55
-rw-r--r--include/svx/fontworkgallery.hxx124
-rw-r--r--include/svx/formatpaintbrushctrl.hxx67
-rw-r--r--include/svx/framebordertype.hxx58
-rw-r--r--include/svx/framelink.hxx699
-rw-r--r--include/svx/framelinkarray.hxx479
-rw-r--r--include/svx/frmdirlbox.hxx97
-rw-r--r--include/svx/frmsel.hxx202
-rw-r--r--include/svx/galbrws.hxx89
-rw-r--r--include/svx/galctrl.hxx167
-rw-r--r--include/svx/gallery.hxx120
-rw-r--r--include/svx/gallery1.hxx171
-rw-r--r--include/svx/galmisc.hxx223
-rw-r--r--include/svx/galtheme.hxx225
-rw-r--r--include/svx/globl3d.hxx42
-rw-r--r--include/svx/grafctrl.hxx183
-rw-r--r--include/svx/graphctl.hxx160
-rw-r--r--include/svx/graphichelper.hxx40
-rw-r--r--include/svx/grfcrop.hxx74
-rw-r--r--include/svx/grfflt.hxx61
-rw-r--r--include/svx/gridctrl.hxx606
-rw-r--r--include/svx/hdft.hxx127
-rw-r--r--include/svx/helperhittest3d.hxx102
-rw-r--r--include/svx/hlnkitem.hxx103
-rw-r--r--include/svx/hyperdlg.hxx49
-rw-r--r--include/svx/ifaceids.hxx38
-rw-r--r--include/svx/imapdlg.hxx180
-rw-r--r--include/svx/insctrl.hxx51
-rw-r--r--include/svx/ipolypolygoneditorcontroller.hxx72
-rw-r--r--include/svx/itemwin.hxx186
-rw-r--r--include/svx/itextprovider.hxx42
-rw-r--r--include/svx/langbox.hxx93
-rw-r--r--include/svx/lathe3d.hxx114
-rw-r--r--include/svx/layctrl.hxx69
-rw-r--r--include/svx/lboxctrl.hxx77
-rw-r--r--include/svx/linectrl.hxx168
-rw-r--r--include/svx/linkwarn.hxx47
-rw-r--r--include/svx/measctrl.hxx59
-rw-r--r--include/svx/modctrl.hxx59
-rw-r--r--include/svx/msdffdef.hxx1184
-rw-r--r--include/svx/numfmtsh.hxx229
-rw-r--r--include/svx/numinf.hxx87
-rw-r--r--include/svx/numvset.hxx117
-rw-r--r--include/svx/obj3d.hxx319
-rw-r--r--include/svx/objfac3d.hxx50
-rw-r--r--include/svx/ofaitem.hxx78
-rw-r--r--include/svx/optgenrl.hxx42
-rw-r--r--include/svx/optgrid.hxx170
-rw-r--r--include/svx/orienthelper.hxx121
-rw-r--r--include/svx/pagectrl.hxx164
-rw-r--r--include/svx/pageitem.hxx134
-rw-r--r--include/svx/paraprev.hxx102
-rw-r--r--include/svx/passwd.hxx71
-rw-r--r--include/svx/pfiledlg.hxx51
-rw-r--r--include/svx/polygn3d.hxx72
-rw-r--r--include/svx/polypolygoneditor.hxx68
-rw-r--r--include/svx/polysc3d.hxx45
-rw-r--r--include/svx/postattr.hxx122
-rw-r--r--include/svx/prtqry.hxx34
-rw-r--r--include/svx/pszctrl.hxx51
-rw-r--r--include/svx/rectenum.hxx40
-rw-r--r--include/svx/relfld.hxx55
-rw-r--r--include/svx/rotmodit.hxx62
-rw-r--r--include/svx/rubydialog.hxx177
-rw-r--r--include/svx/ruler.hxx259
-rw-r--r--include/svx/rulritem.hxx278
-rw-r--r--include/svx/scene3d.hxx239
-rw-r--r--include/svx/sdangitm.hxx49
-rw-r--r--include/svx/sdasaitm.hxx71
-rw-r--r--include/svx/sdasitm.hxx132
-rw-r--r--include/svx/sderitm.hxx36
-rw-r--r--include/svx/sdgcoitm.hxx80
-rw-r--r--include/svx/sdgcpitm.hxx48
-rw-r--r--include/svx/sdggaitm.hxx49
-rw-r--r--include/svx/sdginitm.hxx46
-rw-r--r--include/svx/sdgluitm.hxx63
-rw-r--r--include/svx/sdgmoitm.hxx56
-rw-r--r--include/svx/sdgtritm.hxx45
-rw-r--r--include/svx/sdmetitm.hxx51
-rw-r--r--include/svx/sdooitm.hxx48
-rw-r--r--include/svx/sdprcitm.hxx65
-rw-r--r--include/svx/sdr/animation/animationstate.hxx75
-rw-r--r--include/svx/sdr/animation/objectanimator.hxx49
-rw-r--r--include/svx/sdr/animation/scheduler.hxx148
-rw-r--r--include/svx/sdr/attribute/sdrfilltextattribute.hxx65
-rw-r--r--include/svx/sdr/attribute/sdrformtextattribute.hxx83
-rw-r--r--include/svx/sdr/attribute/sdrformtextoutlineattribute.hxx74
-rw-r--r--include/svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx69
-rw-r--r--include/svx/sdr/attribute/sdrlineshadowtextattribute.hxx67
-rw-r--r--include/svx/sdr/attribute/sdrshadowtextattribute.hxx64
-rw-r--r--include/svx/sdr/attribute/sdrtextattribute.hxx122
-rw-r--r--include/svx/sdr/contact/displayinfo.hxx107
-rw-r--r--include/svx/sdr/contact/objectcontact.hxx221
-rw-r--r--include/svx/sdr/contact/objectcontactofobjlistpainter.hxx145
-rw-r--r--include/svx/sdr/contact/objectcontactofpageview.hxx144
-rw-r--r--include/svx/sdr/contact/viewcontact.hxx168
-rw-r--r--include/svx/sdr/contact/viewcontactofe3d.hxx109
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dcube.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dextrude.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dlathe.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dpolygon.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dscene.hxx114
-rw-r--r--include/svx/sdr/contact/viewcontactofe3dsphere.hxx61
-rw-r--r--include/svx/sdr/contact/viewcontactofgraphic.hxx86
-rw-r--r--include/svx/sdr/contact/viewcontactofgroup.hxx67
-rw-r--r--include/svx/sdr/contact/viewcontactofmasterpagedescriptor.hxx77
-rw-r--r--include/svx/sdr/contact/viewcontactofpageobj.hxx68
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrcaptionobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrcircobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdredgeobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrmeasureobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrmediaobj.hxx83
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrobj.hxx96
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrobjcustomshape.hxx65
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrole2obj.hxx77
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrpage.hxx303
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrpathobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactofsdrrectobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewcontactoftextobj.hxx57
-rw-r--r--include/svx/sdr/contact/viewcontactofunocontrol.hxx92
-rw-r--r--include/svx/sdr/contact/viewcontactofvirtobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewobjectcontact.hxx147
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofe3d.hxx74
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofe3dscene.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofgraphic.hxx73
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofgroup.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofmasterpagedescriptor.hxx57
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofpageobj.hxx63
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrmediaobj.hxx66
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrobj.hxx62
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx54
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofsdrpage.hxx238
-rw-r--r--include/svx/sdr/contact/viewobjectcontactofunocontrol.hxx131
-rw-r--r--include/svx/sdr/contact/viewobjectcontactredirector.hxx66
-rw-r--r--include/svx/sdr/event/eventhandler.hxx132
-rw-r--r--include/svx/sdr/overlay/overlayanimatedbitmapex.hxx92
-rw-r--r--include/svx/sdr/overlay/overlaybitmapex.hxx66
-rw-r--r--include/svx/sdr/overlay/overlaycrosshair.hxx51
-rw-r--r--include/svx/sdr/overlay/overlayhatchrect.hxx71
-rw-r--r--include/svx/sdr/overlay/overlayhelpline.hxx60
-rw-r--r--include/svx/sdr/overlay/overlayline.hxx59
-rw-r--r--include/svx/sdr/overlay/overlaymanager.hxx151
-rw-r--r--include/svx/sdr/overlay/overlaymanagerbuffered.hxx98
-rw-r--r--include/svx/sdr/overlay/overlayobject.hxx196
-rw-r--r--include/svx/sdr/overlay/overlayobjectcell.hxx62
-rw-r--r--include/svx/sdr/overlay/overlayobjectlist.hxx78
-rw-r--r--include/svx/sdr/overlay/overlaypolypolygon.hxx58
-rw-r--r--include/svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx62
-rw-r--r--include/svx/sdr/overlay/overlayrollingrectangle.hxx75
-rw-r--r--include/svx/sdr/overlay/overlayselection.hxx87
-rw-r--r--include/svx/sdr/overlay/overlaytools.hxx270
-rw-r--r--include/svx/sdr/overlay/overlaytriangle.hxx62
-rw-r--r--include/svx/sdr/primitive2d/primitiveFactory2d.hxx76
-rw-r--r--include/svx/sdr/primitive2d/sdrattributecreator.hxx133
-rw-r--r--include/svx/sdr/primitive2d/sdrcaptionprimitive2d.hxx79
-rw-r--r--include/svx/sdr/primitive2d/sdrconnectorprimitive2d.hxx68
-rw-r--r--include/svx/sdr/primitive2d/sdrcustomshapeprimitive2d.hxx89
-rw-r--r--include/svx/sdr/primitive2d/sdrdecompositiontools.hxx80
-rw-r--r--include/svx/sdr/primitive2d/sdrellipseprimitive2d.hxx112
-rw-r--r--include/svx/sdr/primitive2d/sdrgrafprimitive2d.hxx76
-rw-r--r--include/svx/sdr/primitive2d/sdrmeasureprimitive2d.hxx125
-rw-r--r--include/svx/sdr/primitive2d/sdrole2primitive2d.hxx70
-rw-r--r--include/svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx80
-rw-r--r--include/svx/sdr/primitive2d/sdrpathprimitive2d.hxx72
-rw-r--r--include/svx/sdr/primitive2d/sdrprimitivetools.hxx49
-rw-r--r--include/svx/sdr/primitive2d/sdrrectangleprimitive2d.hxx81
-rw-r--r--include/svx/sdr/primitive2d/sdrtextprimitive2d.hxx338
-rw-r--r--include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx56
-rw-r--r--include/svx/sdr/primitive3d/sdrattributecreator3d.hxx55
-rw-r--r--include/svx/sdr/properties/attributeproperties.hxx96
-rw-r--r--include/svx/sdr/properties/captionproperties.hxx67
-rw-r--r--include/svx/sdr/properties/circleproperties.hxx67
-rw-r--r--include/svx/sdr/properties/connectorproperties.hxx63
-rw-r--r--include/svx/sdr/properties/customshapeproperties.hxx86
-rw-r--r--include/svx/sdr/properties/defaultproperties.hxx104
-rw-r--r--include/svx/sdr/properties/e3dcompoundproperties.hxx71
-rw-r--r--include/svx/sdr/properties/e3dextrudeproperties.hxx58
-rw-r--r--include/svx/sdr/properties/e3dlatheproperties.hxx58
-rw-r--r--include/svx/sdr/properties/e3dproperties.hxx64
-rw-r--r--include/svx/sdr/properties/e3dsceneproperties.hxx88
-rw-r--r--include/svx/sdr/properties/e3dsphereproperties.hxx57
-rw-r--r--include/svx/sdr/properties/emptyproperties.hxx96
-rw-r--r--include/svx/sdr/properties/graphicproperties.hxx67
-rw-r--r--include/svx/sdr/properties/groupproperties.hxx121
-rw-r--r--include/svx/sdr/properties/itemsettools.hxx68
-rw-r--r--include/svx/sdr/properties/measureproperties.hxx67
-rw-r--r--include/svx/sdr/properties/oleproperties.hxx58
-rw-r--r--include/svx/sdr/properties/pageproperties.hxx73
-rw-r--r--include/svx/sdr/properties/properties.hxx193
-rw-r--r--include/svx/sdr/properties/rectangleproperties.hxx61
-rw-r--r--include/svx/sdr/properties/textproperties.hxx93
-rw-r--r--include/svx/sdr/table/tabledesign.hxx48
-rw-r--r--include/svx/sdrhittesthelper.hxx68
-rw-r--r--include/svx/sdrmasterpagedescriptor.hxx94
-rw-r--r--include/svx/sdrobjectfilter.hxx51
-rw-r--r--include/svx/sdrobjectuser.hxx56
-rw-r--r--include/svx/sdrpageuser.hxx56
-rw-r--r--include/svx/sdrpagewindow.hxx131
-rw-r--r--include/svx/sdrpaintwindow.hxx151
-rw-r--r--include/svx/sdshcitm.hxx36
-rw-r--r--include/svx/sdshitm.hxx36
-rw-r--r--include/svx/sdshtitm.hxx36
-rw-r--r--include/svx/sdsxyitm.hxx45
-rw-r--r--include/svx/sdtaaitm.hxx41
-rw-r--r--include/svx/sdtacitm.hxx34
-rw-r--r--include/svx/sdtaditm.hxx55
-rw-r--r--include/svx/sdtagitm.hxx45
-rw-r--r--include/svx/sdtaiitm.hxx39
-rw-r--r--include/svx/sdtaitm.hxx82
-rw-r--r--include/svx/sdtakitm.hxx97
-rw-r--r--include/svx/sdtayitm.hxx38
-rw-r--r--include/svx/sdtcfitm.hxx36
-rw-r--r--include/svx/sdtditm.hxx54
-rw-r--r--include/svx/sdtfchim.hxx47
-rw-r--r--include/svx/sdtfsitm.hxx67
-rw-r--r--include/svx/sdtmfitm.hxx63
-rw-r--r--include/svx/sdynitm.hxx46
-rw-r--r--include/svx/selctrl.hxx46
-rw-r--r--include/svx/selectioncontroller.hxx79
-rw-r--r--include/svx/shapeproperty.hxx51
-rw-r--r--include/svx/shapepropertynotifier.hxx141
-rw-r--r--include/svx/simptabl.hxx157
-rw-r--r--include/svx/sphere3d.hxx80
-rw-r--r--include/svx/srchdlg.hxx282
-rw-r--r--include/svx/stddlg.hxx43
-rw-r--r--include/svx/strarray.hxx40
-rw-r--r--include/svx/subtoolboxcontrol.hxx48
-rw-r--r--include/svx/svdattr.hxx57
-rw-r--r--include/svx/svdattrx.hxx71
-rw-r--r--include/svx/svdcrtv.hxx200
-rw-r--r--include/svx/svddef.hxx306
-rw-r--r--include/svx/svddrag.hxx184
-rw-r--r--include/svx/svddrgmt.hxx320
-rw-r--r--include/svx/svddrgv.hxx302
-rw-r--r--include/svx/svdedtv.hxx450
-rw-r--r--include/svx/svdedxv.hxx292
-rw-r--r--include/svx/svdetc.hxx266
-rw-r--r--include/svx/svdfield.hxx29
-rw-r--r--include/svx/svdglev.hxx111
-rw-r--r--include/svx/svdglob.hxx48
-rw-r--r--include/svx/svdglue.hxx147
-rw-r--r--include/svx/svdhdl.hxx515
-rw-r--r--include/svx/svdhlpln.hxx107
-rw-r--r--include/svx/svditer.hxx79
-rw-r--r--include/svx/svdlayer.hxx171
-rw-r--r--include/svx/svdmark.hxx298
-rw-r--r--include/svx/svdmodel.hxx712
-rw-r--r--include/svx/svdmrkv.hxx500
-rw-r--r--include/svx/svdoashp.hxx263
-rw-r--r--include/svx/svdoattr.hxx83
-rw-r--r--include/svx/svdobj.hxx1135
-rw-r--r--include/svx/svdocapt.hxx161
-rw-r--r--include/svx/svdocirc.hxx146
-rw-r--r--include/svx/svdoedge.hxx434
-rw-r--r--include/svx/svdograf.hxx203
-rw-r--r--include/svx/svdogrp.hxx118
-rw-r--r--include/svx/svdomeas.hxx210
-rw-r--r--include/svx/svdomedia.hxx88
-rw-r--r--include/svx/svdoole2.hxx195
-rw-r--r--include/svx/svdopage.hxx70
-rw-r--r--include/svx/svdopath.hxx193
-rw-r--r--include/svx/svdorect.hxx126
-rw-r--r--include/svx/svdotable.hxx326
-rw-r--r--include/svx/svdotext.hxx595
-rw-r--r--include/svx/svdouno.hxx155
-rw-r--r--include/svx/svdoutl.hxx52
-rw-r--r--include/svx/svdovirt.hxx157
-rw-r--r--include/svx/svdpage.hxx605
-rw-r--r--include/svx/svdpagv.hxx268
-rw-r--r--include/svx/svdpntv.hxx554
-rw-r--r--include/svx/svdpoev.hxx99
-rw-r--r--include/svx/svdpool.hxx54
-rw-r--r--include/svx/svdsnpv.hxx330
-rw-r--r--include/svx/svdsob.hxx117
-rw-r--r--include/svx/svdstr.hrc718
-rw-r--r--include/svx/svdtext.hxx82
-rw-r--r--include/svx/svdtrans.hxx304
-rw-r--r--include/svx/svdtypes.hxx162
-rw-r--r--include/svx/svdundo.hxx879
-rw-r--r--include/svx/svdview.hxx324
-rw-r--r--include/svx/svdviter.hxx98
-rw-r--r--include/svx/svdxcgv.hxx133
-rw-r--r--include/svx/svx3ditems.hxx371
-rw-r--r--include/svx/svxcommands.h154
-rw-r--r--include/svx/svxdlg.hxx499
-rw-r--r--include/svx/svxdllapi.h34
-rw-r--r--include/svx/svxerr.hxx96
-rw-r--r--include/svx/svxgrahicitem.hxx48
-rw-r--r--include/svx/svxids.hrc950
-rw-r--r--include/svx/svxitems.hrc117
-rw-r--r--include/svx/swframeexample.hxx95
-rw-r--r--include/svx/swframeposstrings.hxx87
-rw-r--r--include/svx/swframevalidation.hxx80
-rw-r--r--include/svx/sxallitm.hxx63
-rw-r--r--include/svx/sxcaitm.hxx52
-rw-r--r--include/svx/sxcecitm.hxx87
-rw-r--r--include/svx/sxcgitm.hxx37
-rw-r--r--include/svx/sxciaitm.hxx45
-rw-r--r--include/svx/sxcikitm.hxx49
-rw-r--r--include/svx/sxcllitm.hxx52
-rw-r--r--include/svx/sxctitm.hxx46
-rw-r--r--include/svx/sxekitm.hxx52
-rw-r--r--include/svx/sxelditm.hxx58
-rw-r--r--include/svx/sxenditm.hxx72
-rw-r--r--include/svx/sxfiitm.hxx48
-rw-r--r--include/svx/sxlayitm.hxx50
-rw-r--r--include/svx/sxlogitm.hxx45
-rw-r--r--include/svx/sxmbritm.hxx40
-rw-r--r--include/svx/sxmfsitm.hxx36
-rw-r--r--include/svx/sxmkitm.hxx49
-rw-r--r--include/svx/sxmlhitm.hxx79
-rw-r--r--include/svx/sxmoitm.hxx35
-rw-r--r--include/svx/sxmovitm.hxx45
-rw-r--r--include/svx/sxmsitm.hxx37
-rw-r--r--include/svx/sxmspitm.hxx45
-rw-r--r--include/svx/sxmsuitm.hxx34
-rw-r--r--include/svx/sxmtaitm.hxx45
-rw-r--r--include/svx/sxmtfitm.hxx52
-rw-r--r--include/svx/sxmtpitm.hxx71
-rw-r--r--include/svx/sxmtritm.hxx43
-rw-r--r--include/svx/sxmuitm.hxx48
-rw-r--r--include/svx/sxoneitm.hxx63
-rw-r--r--include/svx/sxonitm.hxx38
-rw-r--r--include/svx/sxopitm.hxx42
-rw-r--r--include/svx/sxraitm.hxx36
-rw-r--r--include/svx/sxreaitm.hxx48
-rw-r--r--include/svx/sxreoitm.hxx48
-rw-r--r--include/svx/sxroaitm.hxx36
-rw-r--r--include/svx/sxrooitm.hxx36
-rw-r--r--include/svx/sxsaitm.hxx36
-rw-r--r--include/svx/sxsalitm.hxx45
-rw-r--r--include/svx/sxsiitm.hxx37
-rw-r--r--include/svx/sxsoitm.hxx45
-rw-r--r--include/svx/sxtraitm.hxx63
-rw-r--r--include/svx/tabarea.hxx52
-rw-r--r--include/svx/tabline.hxx53
-rw-r--r--include/svx/tbcontrl.hxx389
-rw-r--r--include/svx/tbxalign.hxx48
-rw-r--r--include/svx/tbxcolor.hxx64
-rw-r--r--include/svx/tbxcolorupdate.hxx76
-rw-r--r--include/svx/tbxctl.hxx55
-rw-r--r--include/svx/tbxcustomshapes.hxx61
-rw-r--r--include/svx/tbxdraw.hxx66
-rw-r--r--include/svx/txencbox.hxx107
-rw-r--r--include/svx/txenctab.hxx44
-rw-r--r--include/svx/ucsubset.hrc255
-rw-r--r--include/svx/ucsubset.hxx80
-rw-r--r--include/svx/unoapi.hxx97
-rw-r--r--include/svx/unofill.hxx37
-rw-r--r--include/svx/unomaster.hxx62
-rw-r--r--include/svx/unomid.hxx108
-rw-r--r--include/svx/unomod.hxx62
-rw-r--r--include/svx/unomodel.hxx101
-rw-r--r--include/svx/unopage.hxx144
-rw-r--r--include/svx/unopool.hxx90
-rw-r--r--include/svx/unoprov.hxx122
-rw-r--r--include/svx/unoshape.hxx868
-rw-r--r--include/svx/unoshcol.hxx92
-rw-r--r--include/svx/unoshprp.hxx537
-rw-r--r--include/svx/unoshtxt.hxx91
-rw-r--r--include/svx/verttexttbxctrl.hxx57
-rw-r--r--include/svx/view3d.hxx266
-rw-r--r--include/svx/viewlayoutitem.hxx55
-rw-r--r--include/svx/viewpt3d.hxx116
-rw-r--r--include/svx/wrapfield.hxx51
-rw-r--r--include/svx/xattr.hxx38
-rw-r--r--include/svx/xbitmap.hxx66
-rw-r--r--include/svx/xbtmpit.hxx75
-rw-r--r--include/svx/xcolit.hxx61
-rw-r--r--include/svx/xdash.hxx71
-rw-r--r--include/svx/xdef.hxx97
-rw-r--r--include/svx/xenum.hxx53
-rw-r--r--include/svx/xexch.hxx59
-rw-r--r--include/svx/xfillit.hxx42
-rw-r--r--include/svx/xfillit0.hxx57
-rw-r--r--include/svx/xflasit.hxx48
-rw-r--r--include/svx/xflbckit.hxx52
-rw-r--r--include/svx/xflbmpit.hxx48
-rw-r--r--include/svx/xflbmsli.hxx44
-rw-r--r--include/svx/xflbmsxy.hxx70
-rw-r--r--include/svx/xflbmtit.hxx44
-rw-r--r--include/svx/xflboxy.hxx60
-rw-r--r--include/svx/xflbstit.hxx44
-rw-r--r--include/svx/xflbtoxy.hxx60
-rw-r--r--include/svx/xflclit.hxx56
-rw-r--r--include/svx/xflftrit.hxx62
-rw-r--r--include/svx/xflgrit.hxx67
-rw-r--r--include/svx/xflhtit.hxx67
-rw-r--r--include/svx/xfltrit.hxx48
-rw-r--r--include/svx/xftadit.hxx49
-rw-r--r--include/svx/xftdiit.hxx44
-rw-r--r--include/svx/xftmrit.hxx44
-rw-r--r--include/svx/xftouit.hxx43
-rw-r--r--include/svx/xftsfit.hxx48
-rw-r--r--include/svx/xftshcit.hxx46
-rw-r--r--include/svx/xftshit.hxx49
-rw-r--r--include/svx/xftshtit.hxx43
-rw-r--r--include/svx/xftshxy.hxx60
-rw-r--r--include/svx/xftstit.hxx44
-rw-r--r--include/svx/xgrad.hxx83
-rw-r--r--include/svx/xgrscit.hxx48
-rw-r--r--include/svx/xhatch.hxx59
-rw-r--r--include/svx/xit.hxx76
-rw-r--r--include/svx/xlineit.hxx46
-rw-r--r--include/svx/xlineit0.hxx52
-rw-r--r--include/svx/xlinjoit.hxx54
-rw-r--r--include/svx/xlnasit.hxx49
-rw-r--r--include/svx/xlncapit.hxx55
-rw-r--r--include/svx/xlnclit.hxx52
-rw-r--r--include/svx/xlndsit.hxx69
-rw-r--r--include/svx/xlnedcit.hxx49
-rw-r--r--include/svx/xlnedit.hxx65
-rw-r--r--include/svx/xlnedwit.hxx52
-rw-r--r--include/svx/xlnstcit.hxx49
-rw-r--r--include/svx/xlnstit.hxx65
-rw-r--r--include/svx/xlnstwit.hxx52
-rw-r--r--include/svx/xlntrit.hxx48
-rw-r--r--include/svx/xlnwtit.hxx49
-rw-r--r--include/svx/xmleohlp.hxx148
-rw-r--r--include/svx/xmlexchg.hxx95
-rw-r--r--include/svx/xmlgrhlp.hxx158
-rw-r--r--include/svx/xmlsecctrl.hxx51
-rw-r--r--include/svx/xoutbmp.hxx73
-rw-r--r--include/svx/xpoly.hxx181
-rw-r--r--include/svx/xpool.hxx54
-rw-r--r--include/svx/xsetit.hxx45
-rw-r--r--include/svx/xsflclit.hxx50
-rw-r--r--include/svx/xtable.hxx501
-rw-r--r--include/svx/xtextit.hxx41
-rw-r--r--include/svx/xtextit0.hxx66
-rw-r--r--include/svx/zoom_def.hxx29
-rw-r--r--include/svx/zoomctrl.hxx48
-rw-r--r--include/svx/zoomsliderctrl.hxx53
-rw-r--r--include/svx/zoomslideritem.hxx60
-rw-r--r--include/test/beans/xpropertyset.hxx70
-rw-r--r--include/test/bootstrapfixture.hxx56
-rw-r--r--include/test/container/xelementaccess.hxx35
-rw-r--r--include/test/container/xindexaccess.hxx36
-rw-r--r--include/test/container/xnamecontainer.hxx38
-rw-r--r--include/test/container/xnamed.hxx35
-rw-r--r--include/test/container/xnamereplace.hxx39
-rw-r--r--include/test/sheet/cellproperties.hxx32
-rw-r--r--include/test/sheet/datapilotfield.hxx34
-rw-r--r--include/test/sheet/tableautoformatfield.hxx30
-rw-r--r--include/test/sheet/xcellrangedata.hxx32
-rw-r--r--include/test/sheet/xcellrangereferrer.hxx36
-rw-r--r--include/test/sheet/xcellrangesquery.hxx40
-rw-r--r--include/test/sheet/xdatabaserange.hxx37
-rw-r--r--include/test/sheet/xdatapilotdescriptor.hxx50
-rw-r--r--include/test/sheet/xdatapilotfieldgrouping.hxx32
-rw-r--r--include/test/sheet/xdatapilottable.hxx36
-rw-r--r--include/test/sheet/xdatapilottable2.hxx55
-rw-r--r--include/test/sheet/xgoalseek.hxx31
-rw-r--r--include/test/sheet/xnamedrange.hxx58
-rw-r--r--include/test/sheet/xnamedranges.hxx65
-rw-r--r--include/test/sheet/xprintareas.hxx59
-rw-r--r--include/test/sheet/xsheetannotation.hxx60
-rw-r--r--include/test/sheet/xsheetannotations.hxx56
-rw-r--r--include/test/sheet/xsheetoutline.hxx57
-rw-r--r--include/test/sheet/xspreadsheetdocument.hxx35
-rw-r--r--include/test/sheet/xspreadsheets2.hxx84
-rw-r--r--include/test/testdllapi.hxx33
-rw-r--r--include/test/text/xtext.hxx39
-rw-r--r--include/test/text/xtextcontent.hxx38
-rw-r--r--include/test/text/xtextfield.hxx31
-rw-r--r--include/test/unoapi_test.hxx41
-rw-r--r--include/test/util/xreplaceable.hxx38
-rw-r--r--include/test/util/xsearchable.hxx37
-rw-r--r--include/test/xmldiff.hxx16
-rw-r--r--include/toolkit/awt/animatedimagespeer.hxx99
-rw-r--r--include/toolkit/awt/scrollabledialog.hxx83
-rw-r--r--include/toolkit/awt/vclxaccessiblecomponent.hxx155
-rw-r--r--include/toolkit/awt/vclxbitmap.hxx80
-rw-r--r--include/toolkit/awt/vclxcontainer.hxx76
-rw-r--r--include/toolkit/awt/vclxdevice.hxx118
-rw-r--r--include/toolkit/awt/vclxfont.hxx89
-rw-r--r--include/toolkit/awt/vclxgraphics.hxx130
-rw-r--r--include/toolkit/awt/vclxmenu.hxx184
-rw-r--r--include/toolkit/awt/vclxpointer.hxx78
-rw-r--r--include/toolkit/awt/vclxprinter.hxx219
-rw-r--r--include/toolkit/awt/vclxregion.hxx89
-rw-r--r--include/toolkit/awt/vclxspinbutton.hxx93
-rw-r--r--include/toolkit/awt/vclxsystemdependentwindow.hxx60
-rw-r--r--include/toolkit/awt/vclxtabpagecontainer.hxx81
-rw-r--r--include/toolkit/awt/vclxtabpagemodel.hxx73
-rw-r--r--include/toolkit/awt/vclxtoolkit.hxx206
-rw-r--r--include/toolkit/awt/vclxtopwindow.hxx114
-rw-r--r--include/toolkit/awt/vclxwindow.hxx235
-rw-r--r--include/toolkit/awt/vclxwindows.hxx1242
-rw-r--r--include/toolkit/awt/xsimpleanimation.hxx70
-rw-r--r--include/toolkit/awt/xthrobber.hxx73
-rw-r--r--include/toolkit/controls/accessiblecontrolcontext.hxx129
-rw-r--r--include/toolkit/controls/animatedimages.hxx138
-rw-r--r--include/toolkit/controls/controlmodelcontainerbase.hxx271
-rw-r--r--include/toolkit/controls/dialogcontrol.hxx268
-rw-r--r--include/toolkit/controls/eventcontainer.hxx131
-rw-r--r--include/toolkit/controls/formattedcontrol.hxx124
-rw-r--r--include/toolkit/controls/geometrycontrolmodel.hxx262
-rw-r--r--include/toolkit/controls/geometrycontrolmodel_impl.hxx82
-rw-r--r--include/toolkit/controls/roadmapcontrol.hxx200
-rw-r--r--include/toolkit/controls/roadmapentry.hxx83
-rw-r--r--include/toolkit/controls/spinningprogress.hxx62
-rw-r--r--include/toolkit/controls/stdtabcontroller.hxx87
-rw-r--r--include/toolkit/controls/stdtabcontrollermodel.hxx138
-rw-r--r--include/toolkit/controls/tabpagecontainer.hxx139
-rw-r--r--include/toolkit/controls/tabpagemodel.hxx89
-rw-r--r--include/toolkit/controls/tkscrollbar.hxx118
-rw-r--r--include/toolkit/controls/tksimpleanimation.hxx95
-rw-r--r--include/toolkit/controls/tkspinbutton.hxx121
-rw-r--r--include/toolkit/controls/tkthrobber.hxx103
-rw-r--r--include/toolkit/controls/unocontrol.hxx237
-rw-r--r--include/toolkit/controls/unocontrolbase.hxx62
-rw-r--r--include/toolkit/controls/unocontrolcontainer.hxx160
-rw-r--r--include/toolkit/controls/unocontrolcontainermodel.hxx59
-rw-r--r--include/toolkit/controls/unocontrolmodel.hxx186
-rw-r--r--include/toolkit/controls/unocontrols.hxx1518
-rw-r--r--include/toolkit/dllapi.h34
-rw-r--r--include/toolkit/helper/accessibilityclient.hxx66
-rw-r--r--include/toolkit/helper/accessiblefactory.hxx134
-rw-r--r--include/toolkit/helper/convert.hxx61
-rw-r--r--include/toolkit/helper/emptyfontdescriptor.hxx49
-rw-r--r--include/toolkit/helper/externallock.hxx38
-rw-r--r--include/toolkit/helper/formpdfexport.hxx55
-rw-r--r--include/toolkit/helper/imagealign.hxx53
-rw-r--r--include/toolkit/helper/listenermultiplexer.hxx268
-rw-r--r--include/toolkit/helper/macros.hxx305
-rw-r--r--include/toolkit/helper/mutexandbroadcasthelper.hxx44
-rw-r--r--include/toolkit/helper/mutexhelper.hxx44
-rw-r--r--include/toolkit/helper/property.hxx254
-rw-r--r--include/toolkit/helper/servicenames.hxx118
-rw-r--r--include/toolkit/helper/tkresmgr.hxx71
-rw-r--r--include/toolkit/helper/unopropertyarrayhelper.hxx58
-rw-r--r--include/toolkit/helper/unowrapper.hxx86
-rw-r--r--include/toolkit/helper/vclunohelper.hxx155
-rw-r--r--include/toolkit/unohlp.hxx3
-rw-r--r--include/tools/StringListResource.hxx50
-rw-r--r--include/tools/appendunixshellword.hxx47
-rw-r--r--include/tools/b3dtrans.hxx259
-rw-r--r--include/tools/bigint.hxx311
-rw-r--r--include/tools/cachestr.hxx67
-rw-r--r--include/tools/color.hxx215
-rw-r--r--include/tools/config.hxx81
-rw-r--r--include/tools/contnr.hxx33
-rw-r--r--include/tools/date.hxx152
-rw-r--r--include/tools/datetime.hxx112
-rw-r--r--include/tools/debug.hxx496
-rw-r--r--include/tools/diagnose_ex.h186
-rw-r--r--include/tools/errcode.hxx313
-rw-r--r--include/tools/errinf.hxx181
-rw-r--r--include/tools/extendapplicationenvironment.hxx35
-rw-r--r--include/tools/fldunit.hxx29
-rw-r--r--include/tools/fontenum.hxx125
-rw-r--r--include/tools/fract.hxx143
-rw-r--r--include/tools/gen.hxx692
-rw-r--r--include/tools/getprocessworkingdir.hxx40
-rw-r--r--include/tools/globname.hxx108
-rw-r--r--include/tools/helpers.hxx29
-rw-r--r--include/tools/inetmime.hxx1261
-rw-r--r--include/tools/inetmsg.hxx518
-rw-r--r--include/tools/inetstrm.hxx222
-rw-r--r--include/tools/line.hxx59
-rw-r--r--include/tools/lineend.hxx33
-rw-r--r--include/tools/link.hxx144
-rw-r--r--include/tools/mapunit.hxx30
-rw-r--r--include/tools/mempool.hxx106
-rw-r--r--include/tools/multisel.hxx186
-rw-r--r--include/tools/pathutils.hxx87
-rw-r--r--include/tools/poly.hxx285
-rw-r--r--include/tools/postsys.h234
-rw-r--r--include/tools/presys.h34
-rw-r--r--include/tools/pstm.hxx245
-rw-r--r--include/tools/rc.h216
-rw-r--r--include/tools/rc.hxx96
-rw-r--r--include/tools/rcid.h125
-rw-r--r--include/tools/ref.hxx256
-rw-r--r--include/tools/resary.hxx61
-rw-r--r--include/tools/resid.hxx156
-rw-r--r--include/tools/resmgr.hxx223
-rw-r--r--include/tools/rtti.hxx125
-rw-r--r--include/tools/shl.hxx88
-rw-r--r--include/tools/simplerm.hxx83
-rw-r--r--include/tools/solar.h154
-rw-r--r--include/tools/solarmutex.hxx38
-rw-r--r--include/tools/stream.hxx779
-rw-r--r--include/tools/string.hxx411
-rw-r--r--include/tools/svborder.hxx98
-rw-r--r--include/tools/tempfile.hxx66
-rw-r--r--include/tools/tenccvt.hxx58
-rw-r--r--include/tools/time.hxx136
-rw-r--r--include/tools/tools.h32
-rw-r--r--include/tools/toolsdllapi.h34
-rw-r--r--include/tools/unqidx.hxx73
-rw-r--r--include/tools/urlobj.hxx1783
-rw-r--r--include/tools/vcompat.hxx56
-rw-r--r--include/tools/vector2d.hxx107
-rw-r--r--include/tools/weakbase.h146
-rw-r--r--include/tools/weakbase.hxx176
-rw-r--r--include/tools/wintypes.hxx325
-rw-r--r--include/tools/wldcrd.hxx62
-rw-r--r--include/tools/zcodec.hxx110
-rw-r--r--include/touch/touch.h44
-rw-r--r--include/tubes/collaboration.hxx50
-rw-r--r--include/tubes/conference.hxx83
-rw-r--r--include/tubes/constants.h54
-rw-r--r--include/tubes/file-transfer-helper.h125
-rw-r--r--include/tubes/manager.hxx155
-rw-r--r--include/tubes/tubesdllapi.h16
-rw-r--r--include/ucbhelper/activedatasink.hxx69
-rw-r--r--include/ucbhelper/activedatastreamer.hxx64
-rw-r--r--include/ucbhelper/cancelcommandexecution.hxx104
-rw-r--r--include/ucbhelper/commandenvironment.hxx94
-rw-r--r--include/ucbhelper/content.hxx719
-rw-r--r--include/ucbhelper/contenthelper.hxx504
-rw-r--r--include/ucbhelper/contentidentifier.hxx84
-rw-r--r--include/ucbhelper/contentinfo.hxx162
-rw-r--r--include/ucbhelper/fd_inputstream.hxx130
-rw-r--r--include/ucbhelper/fileidentifierconverter.hxx114
-rw-r--r--include/ucbhelper/getcomponentcontext.hxx47
-rw-r--r--include/ucbhelper/interactionrequest.hxx721
-rw-r--r--include/ucbhelper/interceptedinteraction.hxx334
-rw-r--r--include/ucbhelper/macros.hxx761
-rw-r--r--include/ucbhelper/propertyvalueset.hxx275
-rw-r--r--include/ucbhelper/providerhelper.hxx278
-rw-r--r--include/ucbhelper/proxydecider.hxx138
-rw-r--r--include/ucbhelper/registerucb.hxx122
-rw-r--r--include/ucbhelper/resultset.hxx573
-rw-r--r--include/ucbhelper/resultsethelper.hxx204
-rw-r--r--include/ucbhelper/resultsetmetadata.hxx470
-rw-r--r--include/ucbhelper/simpleauthenticationrequest.hxx149
-rw-r--r--include/ucbhelper/simplecertificatevalidationrequest.hxx63
-rw-r--r--include/ucbhelper/simpleinteractionrequest.hxx90
-rw-r--r--include/ucbhelper/simpleioerrorrequest.hxx69
-rw-r--r--include/ucbhelper/simplenameclashresolverequest.hxx77
-rw-r--r--include/ucbhelper/std_inputstream.hxx115
-rw-r--r--include/ucbhelper/std_outputstream.hxx71
-rw-r--r--include/ucbhelper/ucbhelperdllapi.h34
-rw-r--r--include/udm/html/htmlitem.hxx342
-rw-r--r--include/udm/xml/xmlitem.hxx339
-rw-r--r--include/unoidl/detail/dllapi.hxx26
-rw-r--r--include/unoidl/detail/unoidldllapi.hxx26
-rw-r--r--include/unoidl/legacyprovider.hxx48
-rw-r--r--include/unoidl/unoidl.hxx642
-rw-r--r--include/unoidl/unoidlprovider.hxx60
-rw-r--r--include/unotest/bootstrapfixturebase.hxx81
-rw-r--r--include/unotest/detail/unotestdllapi.hxx34
-rw-r--r--include/unotest/filters-test.hxx74
-rw-r--r--include/unotest/gettestargument.hxx39
-rw-r--r--include/unotest/macros_test.hxx40
-rw-r--r--include/unotest/officeconnection.hxx64
-rw-r--r--include/unotest/toabsolutefileurl.hxx39
-rw-r--r--include/unotest/uniquepipename.hxx37
-rw-r--r--include/unotools/accessiblerelationsethelper.hxx153
-rw-r--r--include/unotools/accessiblestatesethelper.hxx161
-rw-r--r--include/unotools/atom.hxx70
-rw-r--r--include/unotools/bootstrap.hxx120
-rw-r--r--include/unotools/calendarwrapper.hxx131
-rw-r--r--include/unotools/caserotate.hxx34
-rw-r--r--include/unotools/charclass.hxx225
-rw-r--r--include/unotools/closeveto.hxx60
-rw-r--r--include/unotools/cmdoptions.hxx167
-rw-r--r--include/unotools/collatorwrapper.hxx74
-rw-r--r--include/unotools/compatibility.hxx240
-rw-r--r--include/unotools/componentresmodule.hxx180
-rw-r--r--include/unotools/configitem.hxx195
-rw-r--r--include/unotools/configmgr.hxx93
-rw-r--r--include/unotools/confignode.hxx325
-rw-r--r--include/unotools/configpaths.hxx170
-rw-r--r--include/unotools/configvaluecontainer.hxx183
-rw-r--r--include/unotools/datetime.hxx59
-rw-r--r--include/unotools/defaultoptions.hxx47
-rw-r--r--include/unotools/desktopterminationobserver.hxx72
-rw-r--r--include/unotools/digitgroupingiterator.hxx198
-rw-r--r--include/unotools/docinfohelper.hxx40
-rw-r--r--include/unotools/dynamicmenuoptions.hxx138
-rw-r--r--include/unotools/eventcfg.hxx113
-rw-r--r--include/unotools/eventlisteneradapter.hxx64
-rw-r--r--include/unotools/extendedsecurityoptions.hxx121
-rw-r--r--include/unotools/fltrcfg.hxx91
-rw-r--r--include/unotools/fontcfg.hxx221
-rw-r--r--include/unotools/fontcvt.hxx73
-rw-r--r--include/unotools/fontdefs.hxx95
-rw-r--r--include/unotools/fontoptions.hxx129
-rw-r--r--include/unotools/historyoptions.hxx204
-rw-r--r--include/unotools/idhelper.hxx199
-rw-r--r--include/unotools/intlwrapper.hxx98
-rw-r--r--include/unotools/itemholderbase.hxx104
-rw-r--r--include/unotools/lingucfg.hxx228
-rw-r--r--include/unotools/linguprops.hxx114
-rw-r--r--include/unotools/localedatawrapper.hxx362
-rw-r--r--include/unotools/localfilehelper.hxx60
-rw-r--r--include/unotools/localisationoptions.hxx136
-rw-r--r--include/unotools/misccfg.hxx57
-rw-r--r--include/unotools/moduleoptions.hxx206
-rw-r--r--include/unotools/nativenumberwrapper.hxx64
-rw-r--r--include/unotools/numberformatcodewrapper.hxx68
-rw-r--r--include/unotools/options.hxx95
-rw-r--r--include/unotools/optionsdlg.hxx47
-rw-r--r--include/unotools/pathoptions.hxx130
-rw-r--r--include/unotools/printwarningoptions.hxx121
-rw-r--r--include/unotools/progresshandlerwrap.hxx50
-rw-r--r--include/unotools/readwritemutexguard.hxx106
-rw-r--r--include/unotools/saveopt.hxx129
-rw-r--r--include/unotools/searchopt.hxx111
-rw-r--r--include/unotools/securityoptions.hxx261
-rw-r--r--include/unotools/sharedunocomponent.hxx364
-rw-r--r--include/unotools/streamhelper.hxx78
-rw-r--r--include/unotools/streamsection.hxx78
-rw-r--r--include/unotools/streamwrap.hxx173
-rw-r--r--include/unotools/syslocale.hxx79
-rw-r--r--include/unotools/syslocaleoptions.hxx177
-rw-r--r--include/unotools/tempfile.hxx154
-rw-r--r--include/unotools/textsearch.hxx186
-rw-r--r--include/unotools/transliterationwrapper.hxx133
-rw-r--r--include/unotools/ucbhelper.hxx76
-rw-r--r--include/unotools/ucblockbytes.hxx198
-rw-r--r--include/unotools/ucbstreamhelper.hxx73
-rw-r--r--include/unotools/unotoolsdllapi.h34
-rw-r--r--include/unotools/useroptions.hxx97
-rw-r--r--include/unotools/viewoptions.hxx318
-rw-r--r--include/unotools/xmlaccelcfg.hxx110
-rw-r--r--include/vbahelper/helperdecl.hxx49
-rw-r--r--include/vbahelper/vbaaccesshelper.hxx73
-rw-r--r--include/vbahelper/vbaapplicationbase.hxx69
-rw-r--r--include/vbahelper/vbacollectionimpl.hxx352
-rw-r--r--include/vbahelper/vbadialogbase.hxx45
-rw-r--r--include/vbahelper/vbadialogsbase.hxx45
-rw-r--r--include/vbahelper/vbadllapi.h34
-rw-r--r--include/vbahelper/vbadocumentbase.hxx65
-rw-r--r--include/vbahelper/vbadocumentsbase.hxx60
-rw-r--r--include/vbahelper/vbaeventshelperbase.hxx184
-rw-r--r--include/vbahelper/vbafontbase.hxx96
-rw-r--r--include/vbahelper/vbaglobalbase.hxx45
-rw-r--r--include/vbahelper/vbahelper.hxx256
-rw-r--r--include/vbahelper/vbahelperinterface.hxx185
-rw-r--r--include/vbahelper/vbapagesetupbase.hxx61
-rw-r--r--include/vbahelper/vbapropvalue.hxx54
-rw-r--r--include/vbahelper/vbashape.hxx109
-rw-r--r--include/vbahelper/vbashaperange.hxx82
-rw-r--r--include/vbahelper/vbashapes.hxx74
-rw-r--r--include/vbahelper/vbatextframe.hxx61
-rw-r--r--include/vbahelper/vbawindowbase.hxx76
-rw-r--r--include/vcl/FilterConfigItem.hxx87
-rw-r--r--include/vcl/GraphicNativeMetadata.hxx39
-rw-r--r--include/vcl/GraphicNativeTransform.hxx42
-rw-r--r--include/vcl/ImageListProvider.hxx51
-rw-r--r--include/vcl/abstdlg.hxx84
-rw-r--r--include/vcl/accel.hxx105
-rw-r--r--include/vcl/alpha.hxx149
-rw-r--r--include/vcl/animate.hxx238
-rw-r--r--include/vcl/apptypes.hxx51
-rw-r--r--include/vcl/bitmap.hxx896
-rw-r--r--include/vcl/bitmapex.hxx389
-rw-r--r--include/vcl/bmpacc.hxx454
-rw-r--r--include/vcl/btndlg.hxx105
-rw-r--r--include/vcl/builder.hxx365
-rw-r--r--include/vcl/button.hxx574
-rw-r--r--include/vcl/canvastools.hxx175
-rw-r--r--include/vcl/cmdevt.hxx466
-rw-r--r--include/vcl/combobox.h31
-rw-r--r--include/vcl/combobox.hxx227
-rw-r--r--include/vcl/configsettings.hxx66
-rw-r--r--include/vcl/controllayout.hxx79
-rw-r--r--include/vcl/ctrl.hxx195
-rw-r--r--include/vcl/cursor.hxx114
-rw-r--r--include/vcl/cvtgrf.hxx57
-rw-r--r--include/vcl/cvtsvm.hxx102
-rw-r--r--include/vcl/decoview.hxx102
-rw-r--r--include/vcl/dialog.hxx185
-rw-r--r--include/vcl/displayconnectiondispatch.hxx46
-rw-r--r--include/vcl/dllapi.h40
-rw-r--r--include/vcl/dndhelp.hxx119
-rw-r--r--include/vcl/dockingarea.hxx59
-rw-r--r--include/vcl/dockwin.hxx420
-rw-r--r--include/vcl/edit.hxx265
-rw-r--r--include/vcl/embeddedfontshelper.hxx89
-rw-r--r--include/vcl/event.hxx522
-rw-r--r--include/vcl/evntpost.hxx51
-rw-r--r--include/vcl/extoutdevdata.hxx41
-rw-r--r--include/vcl/field.hxx832
-rw-r--r--include/vcl/fixed.hxx208
-rw-r--r--include/vcl/fixedhyper.hxx127
-rw-r--r--include/vcl/floatwin.hxx152
-rw-r--r--include/vcl/fltcall.hxx68
-rw-r--r--include/vcl/fntstyle.hxx47
-rw-r--r--include/vcl/font.hxx137
-rw-r--r--include/vcl/fontcapabilities.hxx204
-rw-r--r--include/vcl/fontmanager.hxx578
-rw-r--r--include/vcl/fpicker.hrc36
-rw-r--r--include/vcl/gdimtf.hxx248
-rw-r--r--include/vcl/gfxlink.hxx180
-rw-r--r--include/vcl/gradient.hxx118
-rw-r--r--include/vcl/graph.h74
-rw-r--r--include/vcl/graph.hxx201
-rw-r--r--include/vcl/graphicfilter.hxx325
-rw-r--r--include/vcl/graphictools.hxx348
-rw-r--r--include/vcl/group.hxx61
-rw-r--r--include/vcl/hatch.hxx89
-rw-r--r--include/vcl/help.hxx120
-rw-r--r--include/vcl/helper.hxx59
-rw-r--r--include/vcl/i18nhelp.hxx87
-rw-r--r--include/vcl/image.hxx145
-rw-r--r--include/vcl/imagerepository.hxx68
-rw-r--r--include/vcl/imgctrl.hxx57
-rw-r--r--include/vcl/impdel.hxx81
-rw-r--r--include/vcl/inputctx.hxx82
-rw-r--r--include/vcl/introwin.hxx44
-rw-r--r--include/vcl/jobdata.hxx85
-rw-r--r--include/vcl/jobset.hxx74
-rw-r--r--include/vcl/keycod.hxx132
-rw-r--r--include/vcl/keycodes.hxx186
-rw-r--r--include/vcl/layout.hxx702
-rw-r--r--include/vcl/lazydelete.hxx299
-rw-r--r--include/vcl/lineinfo.hxx127
-rw-r--r--include/vcl/longcurr.hxx134
-rw-r--r--include/vcl/lstbox.h57
-rw-r--r--include/vcl/lstbox.hxx250
-rw-r--r--include/vcl/mapmod.hxx110
-rw-r--r--include/vcl/menu.hxx494
-rw-r--r--include/vcl/menubtn.hxx98
-rw-r--r--include/vcl/metaact.hxx1319
-rw-r--r--include/vcl/metric.hxx152
-rw-r--r--include/vcl/mnemonic.hxx82
-rw-r--r--include/vcl/mnemonicengine.hxx154
-rw-r--r--include/vcl/morebtn.hxx88
-rw-r--r--include/vcl/msgbox.hxx172
-rw-r--r--include/vcl/octree.hxx127
-rw-r--r--include/vcl/oldprintadaptor.hxx46
-rw-r--r--include/vcl/outdev.hxx1170
-rw-r--r--include/vcl/pdfextoutdevdata.hxx492
-rw-r--r--include/vcl/pdfwriter.hxx1310
-rw-r--r--include/vcl/pngread.hxx64
-rw-r--r--include/vcl/pngwrite.hxx61
-rw-r--r--include/vcl/pointr.hxx53
-rw-r--r--include/vcl/popupmenuwindow.hxx44
-rw-r--r--include/vcl/ppdparser.hxx311
-rw-r--r--include/vcl/prgsbar.hxx89
-rw-r--r--include/vcl/print.hxx688
-rw-r--r--include/vcl/printerinfomanager.hxx239
-rw-r--r--include/vcl/prntypes.hxx89
-rw-r--r--include/vcl/ptrstyle.hxx134
-rw-r--r--include/vcl/quickselectionengine.hxx94
-rw-r--r--include/vcl/regband.hxx142
-rw-r--r--include/vcl/region.hxx155
-rw-r--r--include/vcl/salbtype.hxx887
-rw-r--r--include/vcl/salctype.hxx71
-rw-r--r--include/vcl/salgtype.hxx84
-rw-r--r--include/vcl/salnativewidgets.hxx476
-rw-r--r--include/vcl/scopedbitmapaccess.hxx94
-rw-r--r--include/vcl/scrbar.hxx166
-rw-r--r--include/vcl/seleng.hxx232
-rw-r--r--include/vcl/settings.hxx1104
-rw-r--r--include/vcl/slider.hxx122
-rw-r--r--include/vcl/solarmutex.hxx71
-rw-r--r--include/vcl/sound.hxx39
-rw-r--r--include/vcl/spin.h38
-rw-r--r--include/vcl/spin.hxx110
-rw-r--r--include/vcl/spinfld.hxx111
-rw-r--r--include/vcl/split.hxx116
-rw-r--r--include/vcl/splitwin.hxx241
-rw-r--r--include/vcl/status.hxx198
-rw-r--r--include/vcl/stdtext.hxx47
-rw-r--r--include/vcl/strhelper.hxx74
-rw-r--r--include/vcl/svapp.hxx538
-rw-r--r--include/vcl/svgdata.hxx86
-rw-r--r--include/vcl/syschild.hxx65
-rw-r--r--include/vcl/sysdata.hxx272
-rw-r--r--include/vcl/syswin.hxx270
-rw-r--r--include/vcl/tabctrl.hxx208
-rw-r--r--include/vcl/tabdlg.hxx64
-rw-r--r--include/vcl/tabpage.hxx65
-rw-r--r--include/vcl/taskpanelist.hxx48
-rw-r--r--include/vcl/textdata.hxx172
-rw-r--r--include/vcl/texteng.hxx322
-rw-r--r--include/vcl/textview.hxx208
-rw-r--r--include/vcl/threadex.hxx261
-rw-r--r--include/vcl/throbber.hxx94
-rw-r--r--include/vcl/timer.hxx81
-rw-r--r--include/vcl/toolbox.hxx606
-rw-r--r--include/vcl/txtattr.hxx227
-rw-r--r--include/vcl/unohelp.hxx63
-rw-r--r--include/vcl/unohelp2.hxx77
-rw-r--r--include/vcl/unowrap.hxx86
-rw-r--r--include/vcl/vclenum.hxx137
-rw-r--r--include/vcl/vclevent.hxx289
-rw-r--r--include/vcl/vclmain.hxx27
-rw-r--r--include/vcl/vclmedit.hxx142
-rw-r--r--include/vcl/virdev.hxx142
-rw-r--r--include/vcl/waitobj.hxx47
-rw-r--r--include/vcl/wall.hxx133
-rw-r--r--include/vcl/window.hxx1279
-rw-r--r--include/vcl/wmf.hxx70
-rw-r--r--include/vcl/wrkwin.hxx105
-rw-r--r--include/vcl/xtextedt.hxx69
-rw-r--r--include/xmloff/DashStyle.hxx66
-rw-r--r--include/xmloff/DocumentSettingsContext.hxx57
-rw-r--r--include/xmloff/EnumPropertyHdl.hxx46
-rw-r--r--include/xmloff/GradientStyle.hxx68
-rw-r--r--include/xmloff/HatchStyle.hxx65
-rw-r--r--include/xmloff/ImageStyle.hxx54
-rw-r--r--include/xmloff/MarkerStyle.hxx67
-rw-r--r--include/xmloff/NamedBoolPropertyHdl.hxx56
-rw-r--r--include/xmloff/PageMasterStyleMap.hxx168
-rw-r--r--include/xmloff/ProgressBarHelper.hxx70
-rw-r--r--include/xmloff/PropertySetInfoHash.hxx59
-rw-r--r--include/xmloff/PropertySetInfoKey.hxx61
-rw-r--r--include/xmloff/SchXMLExportHelper.hxx67
-rw-r--r--include/xmloff/SchXMLImportHelper.hxx153
-rw-r--r--include/xmloff/SchXMLSeriesHelper.hxx73
-rw-r--r--include/xmloff/SettingsExportHelper.hxx104
-rw-r--r--include/xmloff/SinglePropertySetInfoCache.hxx73
-rw-r--r--include/xmloff/WordWrapPropertyHdl.hxx47
-rw-r--r--include/xmloff/XMLBase64ImportContext.hxx57
-rw-r--r--include/xmloff/XMLCharContext.hxx65
-rw-r--r--include/xmloff/XMLConstantsPropertyHandler.hxx63
-rw-r--r--include/xmloff/XMLEmbeddedObjectExportFilter.hxx85
-rw-r--r--include/xmloff/XMLEventExport.hxx133
-rw-r--r--include/xmloff/XMLEventsImportContext.hxx131
-rw-r--r--include/xmloff/XMLFilterServiceNames.h40
-rw-r--r--include/xmloff/XMLFontAutoStylePool.hxx73
-rw-r--r--include/xmloff/XMLFontStylesContext.hxx89
-rw-r--r--include/xmloff/XMLGraphicsDefaultStyle.hxx56
-rw-r--r--include/xmloff/XMLPageExport.hxx105
-rw-r--r--include/xmloff/XMLSettingsExportContext.hxx62
-rw-r--r--include/xmloff/XMLShapeStyleContext.hxx70
-rw-r--r--include/xmloff/XMLStringVector.hxx32
-rw-r--r--include/xmloff/XMLTextListAutoStylePool.hxx77
-rw-r--r--include/xmloff/XMLTextMasterPageContext.hxx89
-rw-r--r--include/xmloff/XMLTextMasterPageExport.hxx68
-rw-r--r--include/xmloff/XMLTextMasterStylesContext.hxx55
-rw-r--r--include/xmloff/XMLTextShapeImportHelper.hxx51
-rw-r--r--include/xmloff/XMLTextShapeStyleContext.hxx66
-rw-r--r--include/xmloff/XMLTextTableContext.hxx53
-rw-r--r--include/xmloff/animationexport.hxx53
-rw-r--r--include/xmloff/animexp.hxx45
-rw-r--r--include/xmloff/attrlist.hxx86
-rw-r--r--include/xmloff/contextid.hxx48
-rw-r--r--include/xmloff/controlpropertyhdl.hxx136
-rw-r--r--include/xmloff/dllapi.h34
-rw-r--r--include/xmloff/families.hxx110
-rw-r--r--include/xmloff/formlayerexport.hxx189
-rw-r--r--include/xmloff/formlayerimport.hxx136
-rw-r--r--include/xmloff/i18nmap.hxx73
-rw-r--r--include/xmloff/maptype.hxx68
-rw-r--r--include/xmloff/nmspmap.hxx170
-rw-r--r--include/xmloff/numehelp.hxx116
-rw-r--r--include/xmloff/odffields.hxx53
-rw-r--r--include/xmloff/prhdlfac.hxx103
-rw-r--r--include/xmloff/prstylei.hxx99
-rw-r--r--include/xmloff/settingsstore.hxx59
-rw-r--r--include/xmloff/shapeexport.hxx331
-rw-r--r--include/xmloff/shapeimport.hxx426
-rw-r--r--include/xmloff/styleexp.hxx127
-rw-r--r--include/xmloff/table/XMLTableExport.hxx106
-rw-r--r--include/xmloff/table/XMLTableImport.hxx72
-rw-r--r--include/xmloff/txtimp.hxx725
-rw-r--r--include/xmloff/txtimppr.hxx75
-rw-r--r--include/xmloff/txtparae.hxx728
-rw-r--r--include/xmloff/txtprmap.hxx204
-rw-r--r--include/xmloff/txtstyli.hxx112
-rw-r--r--include/xmloff/uniref.hxx224
-rw-r--r--include/xmloff/unoatrcn.hxx79
-rw-r--r--include/xmloff/unointerfacetouniqueidentifiermapper.hxx77
-rw-r--r--include/xmloff/xformsexport.hxx54
-rw-r--r--include/xmloff/xformsimport.hxx79
-rw-r--r--include/xmloff/xmlaustp.hxx124
-rw-r--r--include/xmloff/xmlcnimp.hxx74
-rw-r--r--include/xmloff/xmlement.hxx51
-rw-r--r--include/xmloff/xmlerror.hxx147
-rw-r--r--include/xmloff/xmlevent.hxx145
-rw-r--r--include/xmloff/xmlexp.hxx659
-rw-r--r--include/xmloff/xmlexppr.hxx188
-rw-r--r--include/xmloff/xmlictxt.hxx101
-rw-r--r--include/xmloff/xmlimp.hxx525
-rw-r--r--include/xmloff/xmlimppr.hxx192
-rw-r--r--include/xmloff/xmlmetae.hxx120
-rw-r--r--include/xmloff/xmlmetai.hxx69
-rw-r--r--include/xmloff/xmlmultiimagehelper.hxx59
-rw-r--r--include/xmloff/xmlnmspe.hxx106
-rw-r--r--include/xmloff/xmlnume.hxx94
-rw-r--r--include/xmloff/xmlnumfe.hxx134
-rw-r--r--include/xmloff/xmlnumfi.hxx214
-rw-r--r--include/xmloff/xmlnumi.hxx104
-rw-r--r--include/xmloff/xmlprcon.hxx70
-rw-r--r--include/xmloff/xmlprhdl.hxx58
-rw-r--r--include/xmloff/xmlprmap.hxx181
-rw-r--r--include/xmloff/xmlreg.hxx36
-rw-r--r--include/xmloff/xmlscripti.hxx54
-rw-r--r--include/xmloff/xmlstyle.hxx265
-rw-r--r--include/xmloff/xmltabe.hxx53
-rw-r--r--include/xmloff/xmltkmap.hxx59
-rw-r--r--include/xmloff/xmltoken.hxx3212
-rw-r--r--include/xmloff/xmltypes.hxx283
-rw-r--r--include/xmloff/xmluconv.hxx230
-rw-r--r--include/xmlreader/README28
-rw-r--r--include/xmlreader/detail/xmlreaderdllapi.hxx35
-rw-r--r--include/xmlreader/pad.hxx53
-rw-r--r--include/xmlreader/span.hxx79
-rw-r--r--include/xmlreader/xmlreader.hxx193
-rw-r--r--include/xmlscript/xml_helper.hxx139
-rw-r--r--include/xmlscript/xmldlg_imexp.hxx81
-rw-r--r--include/xmlscript/xmllib_imexp.hxx88
-rw-r--r--include/xmlscript/xmlmod_imexp.hxx59
-rw-r--r--include/xmlscript/xmlns.h39
-rw-r--r--include/xmlscript/xmlscriptdllapi.h33
2384 files changed, 357820 insertions, 0 deletions
diff --git a/include/animations/animationnodehelper.hxx b/include/animations/animationnodehelper.hxx
new file mode 100644
index 000000000000..d6f000d5dd40
--- /dev/null
+++ b/include/animations/animationnodehelper.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
+#define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+
+#include <vector>
+
+/* Declaration and definition of AnimationNode helper */
+
+namespace anim
+{
+ // TODO(Q1): this could possibly be implemented with a somewhat
+ // more lightweight template, by having the actual worker receive
+ // only a function pointer, and a thin templated wrapper around
+ // that which converts member functions into that.
+
+ /** Apply given functor to every animation node child.
+
+ @param xNode
+ Parent node
+
+ @param rFunctor
+ Functor to apply. The functor must have an appropriate
+ operator()( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode >& ) member.
+
+ @return true, if the functor was successfully applied to
+ all children, false otherwise.
+ */
+ template< typename Functor > inline bool for_each_childNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ Functor& rFunctor )
+ {
+ try
+ {
+ // get an XEnumerationAccess to the children
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+ xEnumerationAccess( xNode,
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+ xEnumeration( xEnumerationAccess->createEnumeration(),
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ while( xEnumeration->hasMoreElements() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+ xChildNode( xEnumeration->nextElement(),
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ rFunctor( xChildNode );
+ }
+
+ return true;
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ return false;
+ }
+ }
+
+
+ /** pushes the given node to the given vector and recursivly calls itself for each child node.
+ */
+ inline void create_deep_vector( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
+ std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > >& rVector )
+ {
+ rVector.push_back( xNode );
+
+ try
+ {
+ // get an XEnumerationAccess to the children
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess >
+ xEnumerationAccess( xNode,
+ ::com::sun::star::uno::UNO_QUERY );
+
+ if( xEnumerationAccess.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration >
+ xEnumeration( xEnumerationAccess->createEnumeration(),
+ ::com::sun::star::uno::UNO_QUERY );
+
+ if( xEnumeration.is() )
+ {
+ while( xEnumeration->hasMoreElements() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
+ xChildNode( xEnumeration->nextElement(),
+ ::com::sun::star::uno::UNO_QUERY_THROW );
+
+ create_deep_vector( xChildNode, rVector );
+ }
+ }
+ }
+ }
+ catch( ::com::sun::star::uno::Exception& )
+ {
+ }
+ }
+}
+
+#endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/apple_remote/RemoteControl.h b/include/apple_remote/RemoteControl.h
new file mode 100644
index 000000000000..6e2c67765890
--- /dev/null
+++ b/include/apple_remote/RemoteControl.h
@@ -0,0 +1,113 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+ * RemoteControl.h
+ * RemoteControlWrapper
+ *
+ * Created by Martin Kahr on 11.03.06 under a MIT-style license.
+ * Copyright (c) 2006 martinkahr.com. All rights reserved.
+ *
+ * Code modified and adapted to OpenOffice.org
+ * by Eric Bachard on 11.08.2008 under the same License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+// notifaction names that are being used to signal that an application wants to
+// have access to the remote control device or if the application has finished
+// using the remote control device
+extern NSString* REQUEST_FOR_REMOTE_CONTROL_NOTIFCATION;
+extern NSString* FINISHED_USING_REMOTE_CONTROL_NOTIFICATION;
+
+// keys used in user objects for distributed notifications
+extern NSString* kRemoteControlDeviceName;
+extern NSString* kApplicationIdentifier;
+extern NSString* kTargetApplicationIdentifier;
+
+// we have a 6 bit offset to make a hold event out of a normal event
+#define EVENT_TO_HOLD_EVENT_OFFSET 6
+
+@class RemoteControl;
+
+typedef enum _RemoteControlEventIdentifier {
+ // normal events
+ kRemoteButtonPlus =1<<1,
+ kRemoteButtonMinus =1<<2,
+ kRemoteButtonMenu =1<<3,
+ kRemoteButtonPlay =1<<4,
+ kRemoteButtonRight =1<<5,
+ kRemoteButtonLeft =1<<6,
+
+ // hold events
+ kRemoteButtonPlus_Hold =1<<7,
+ kRemoteButtonMinus_Hold =1<<8,
+ kRemoteButtonMenu_Hold =1<<9,
+ kRemoteButtonPlay_Hold =1<<10,
+ kRemoteButtonRight_Hold =1<<11,
+ kRemoteButtonLeft_Hold =1<<12,
+
+ // special events (not supported by all devices)
+ kRemoteControl_Switched =1<<13,
+
+ // New values for the "metallic" Remote (2009 model)
+ kMetallicRemote2009ButtonPlay =1<<14,
+ kMetallicRemote2009ButtonMiddlePlay =1<<15
+
+} RemoteControlEventIdentifier;
+
+@interface NSObject(RemoteControlDelegate)
+
+- (void) sendRemoteButtonEvent: (RemoteControlEventIdentifier) event pressedDown: (BOOL) pressedDown remoteControl: (RemoteControl*) remoteControl;
+
+@end
+
+/*
+ Base Interface for Remote Control devices
+*/
+@interface RemoteControl : NSObject {
+ id delegate;
+}
+
+// returns nil if the remote control device is not available
+- (id) initWithDelegate: (id) remoteControlDelegate;
+
+- (void) setListeningToRemote: (BOOL) value;
+- (BOOL) isListeningToRemote;
+
+- (BOOL) isOpenInExclusiveMode;
+- (void) setOpenInExclusiveMode: (BOOL) value;
+
+- (void) startListening: (id) sender;
+- (void) stopListening: (id) sender;
+
+// is this remote control sending the given event?
+- (BOOL) sendsEventForButtonIdentifier: (RemoteControlEventIdentifier) identifier;
+
+// sending of notifications between applications
++ (void) sendFinishedNotifcationForAppIdentifier: (NSString*) identifier;
++ (void) sendRequestForRemoteControlNotification;
+
+// name of the device
++ (const char*) remoteControlDeviceName;
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/apple_remote/RemoteMainController.h b/include/apple_remote/RemoteMainController.h
new file mode 100644
index 000000000000..5fde4639c155
--- /dev/null
+++ b/include/apple_remote/RemoteMainController.h
@@ -0,0 +1,52 @@
+/* -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*****************************************************************************
+ * RemoteMainController.h
+ *
+ *
+ * Created by Martin Kahr on 11.03.06 under a MIT-style license.
+ * Copyright (c) 2006 martinkahr.com. All rights reserved.
+ *
+ * Code modified and adapted to OpenOffice.org
+ * by Eric Bachard on 11.08.2008 under the same License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#define AppleRemoteControlEvent 15
+
+@class RemoteControl;
+@class MultiClickRemoteBehavior;
+
+//static void sendTheEvent( unichar, int );
+
+@interface MainController : NSObject {
+@public // else remoteControl is not reachable from GetSalData()->mpMainController
+ RemoteControl* remoteControl;
+@private
+ MultiClickRemoteBehavior* remoteControlBehavior;
+}
+- (RemoteControl*) remoteControl;
+- (MultiClickRemoteBehavior*) remoteBehavior;
+
+@end
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/avmediadllapi.h b/include/avmedia/avmediadllapi.h
new file mode 100644
index 000000000000..351b82854a7f
--- /dev/null
+++ b/include/avmedia/avmediadllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_AVMEDIADLLAPI_H
+#define INCLUDED_AVMEDIADLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(AVMEDIA_DLLIMPLEMENTATION)
+#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define AVMEDIA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define AVMEDIA_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_AVMEDIADLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediaitem.hxx b/include/avmedia/mediaitem.hxx
new file mode 100644
index 000000000000..f14281999307
--- /dev/null
+++ b/include/avmedia/mediaitem.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef AVMEDIA_MEDIAITEM_HXX
+#define AVMEDIA_MEDIAITEM_HXX
+
+#include <boost/scoped_ptr.hpp>
+
+#include <tools/rtti.hxx>
+#include <svl/poolitem.hxx>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_SETMASK_NONE ((sal_uInt32)(0x00000000))
+#define AVMEDIA_SETMASK_STATE ((sal_uInt32)(0x00000001))
+#define AVMEDIA_SETMASK_DURATION ((sal_uInt32)(0x00000002))
+#define AVMEDIA_SETMASK_TIME ((sal_uInt32)(0x00000004))
+#define AVMEDIA_SETMASK_LOOP ((sal_uInt32)(0x00000008))
+#define AVMEDIA_SETMASK_MUTE ((sal_uInt32)(0x00000010))
+#define AVMEDIA_SETMASK_VOLUMEDB ((sal_uInt32)(0x00000020))
+#define AVMEDIA_SETMASK_ZOOM ((sal_uInt32)(0x00000040))
+#define AVMEDIA_SETMASK_URL ((sal_uInt32)(0x00000080))
+#define AVMEDIA_SETMASK_ALL ((sal_uInt32)(0xffffffff))
+
+class SvStream;
+
+namespace avmedia
+{
+
+//---------------
+// - MediaState -
+// --------------
+
+enum MediaState
+{
+ MEDIASTATE_STOP = 0,
+ MEDIASTATE_PLAY = 1,
+ MEDIASTATE_PLAYFFW = 2,
+ MEDIASTATE_PAUSE = 3
+};
+
+// -------------
+// - MediaItem -
+// -------------
+
+class AVMEDIA_DLLPUBLIC MediaItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit MediaItem( sal_uInt16 const i_nWhich = 0,
+ sal_uInt32 const nMaskSet = AVMEDIA_SETMASK_NONE );
+ MediaItem( const MediaItem& rMediaItem );
+ virtual ~MediaItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreUnit,
+ SfxMapUnit ePresUnit,
+ OUString& rText,
+ const IntlWrapper *pIntl ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ void merge( const MediaItem& rMediaItem );
+
+ sal_uInt32 getMaskSet() const;
+
+ void setState( MediaState eState );
+ MediaState getState() const;
+
+ void setDuration( double fDuration );
+ double getDuration() const;
+
+ void setTime( double fTime );
+ double getTime() const;
+
+ void setLoop( bool bLoop );
+ bool isLoop() const;
+
+ void setMute( bool bMute );
+ bool isMute() const;
+
+ void setVolumeDB( sal_Int16 nDB );
+ sal_Int16 getVolumeDB() const;
+
+ void setZoom( ::com::sun::star::media::ZoomLevel eZoom );
+ ::com::sun::star::media::ZoomLevel getZoom() const;
+
+ void setURL( const OUString& rURL,
+ OUString const*const pTempURL);
+ const OUString& getURL() const;
+
+ const OUString& getTempURL() const;
+
+private:
+
+ struct Impl;
+ ::boost::scoped_ptr<Impl> m_pImpl;
+};
+
+typedef ::avmedia::MediaItem avmedia_MediaItem;
+
+bool AVMEDIA_DLLPUBLIC EmbedMedia(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel>
+ const& xModel,
+ OUString const& rSourceURL,
+ OUString & o_rEmbeddedURL);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx
new file mode 100644
index 000000000000..b823f7c63b67
--- /dev/null
+++ b/include/avmedia/mediaplayer.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _AVMEDIA_MEDIACHILD_HXX
+#define _AVMEDIA_MEDIACHILD_HXX
+
+#include <sfx2/ctrlitem.hxx>
+#include <sfx2/dockwin.hxx>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_MEDIAWINDOW() \
+(static_cast< ::avmedia::MediaFloater* >( ( \
+SfxViewFrame::Current() && SfxViewFrame::Current()->GetChildWindow(::avmedia::MediaPlayer::GetChildWindowId())) ? \
+SfxViewFrame::Current()->GetChildWindow(::avmedia::MediaPlayer::GetChildWindowId())->GetWindow() : \
+NULL))
+
+namespace avmedia
+{
+
+class AVMEDIA_DLLPUBLIC MediaPlayer : public SfxChildWindow
+{
+public:
+ MediaPlayer( Window*, sal_uInt16, SfxBindings*, SfxChildWinInfo* );
+ ~MediaPlayer();
+
+ SFX_DECL_CHILDWINDOW_WITHID( MediaPlayer );
+};
+
+class MediaWindow;
+
+class AVMEDIA_DLLPUBLIC MediaFloater : public SfxDockingWindow
+{
+public:
+
+ MediaFloater( SfxBindings* pBindings, SfxChildWindow* pCW, Window* pParent );
+ ~MediaFloater();
+
+ void setURL( const OUString& rURL, bool bPlayImmediately );
+ const OUString& getURL() const;
+
+ void dispatchCurrentURL();
+
+protected:
+
+ virtual void Resize();
+ virtual void ToggleFloatingMode();
+
+private:
+
+ MediaWindow* mpMediaWindow;
+ Size maLastSize;
+
+ AVMEDIA_DLLPRIVATE void implInit();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediatoolbox.hxx b/include/avmedia/mediatoolbox.hxx
new file mode 100644
index 000000000000..570167024aff
--- /dev/null
+++ b/include/avmedia/mediatoolbox.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _AVMEDIA_MEDIATOOLBOX_HXX
+#define _AVMEDIA_MEDIATOOLBOX_HXX
+
+#include <svl/lstner.hxx>
+#include <sfx2/tbxctrl.hxx>
+#include <avmedia/avmediadllapi.h>
+
+namespace avmedia
+{
+
+// -------------------------------
+// - SvxGrafFilterToolBoxControl -
+// -------------------------------
+
+class MediaItem;
+
+class AVMEDIA_DLLPUBLIC MediaToolBoxControl : public SfxToolBoxControl
+{
+ friend class MediaToolBoxControl_Impl;
+
+public:
+
+ SFX_DECL_TOOLBOX_CONTROL();
+
+ MediaToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbX );
+ ~MediaToolBoxControl();
+
+ virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
+ virtual Window* CreateItemWindow( Window* pParent );
+
+private:
+
+ AVMEDIA_DLLPRIVATE void implUpdateMediaControl();
+ AVMEDIA_DLLPRIVATE void implExecuteMediaControl( const MediaItem& rItem );
+};
+
+}
+
+#endif // _AVMEDIA_MEDIATOOLBOX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/avmedia/mediawindow.hxx b/include/avmedia/mediawindow.hxx
new file mode 100644
index 000000000000..a5cb5dc8e7a8
--- /dev/null
+++ b/include/avmedia/mediawindow.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _AVMEDIA_MEDIAWINDOW_HXX
+#define _AVMEDIA_MEDIAWINDOW_HXX
+
+#include <memory>
+#include <vector>
+#include <tools/gen.hxx>
+#include <com/sun/star/media/ZoomLevel.hpp>
+#include <com/sun/star/media/XPlayer.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <avmedia/avmediadllapi.h>
+
+#define AVMEDIA_FRAMEGRABBER_DEFAULTFRAME -1.0
+
+class Window;
+class KeyEvent;
+class MouseEvent;
+class CommandEvent;
+class PopupMenu;
+class Pointer;
+struct AcceptDropEvent;
+struct ExecuteDropEvent;
+
+
+namespace avmedia
+{
+ typedef ::std::vector< ::std::pair< OUString, OUString > > FilterNameVector;
+
+ class MediaItem;
+
+ namespace priv { class MediaWindowImpl; }
+
+ class AVMEDIA_DLLPUBLIC MediaWindow
+ {
+ public:
+ MediaWindow( Window* parent, bool bInternalMediaControl );
+ virtual ~MediaWindow();
+
+ void setURL( const OUString& rURL );
+ const OUString& getURL() const;
+
+ bool isValid() const;
+ Size getPreferredSize() const;
+
+ Window* getWindow() const;
+
+ void setPosSize( const Rectangle& rNewRect );
+
+ void setPointer( const Pointer& rPointer );
+
+ bool start();
+
+ void updateMediaItem( MediaItem& rItem ) const;
+ void executeMediaItem( const MediaItem& rItem );
+
+ void show();
+ void hide();
+
+ public:
+
+ virtual void MouseMove( const MouseEvent& rMEvt );
+ virtual void MouseButtonDown( const MouseEvent& rMEvt );
+ virtual void MouseButtonUp( const MouseEvent& rMEvt );
+
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void KeyUp( const KeyEvent& rKEvt );
+
+ virtual void Command( const CommandEvent& rCEvt );
+
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
+ public:
+
+ static void getMediaFilters( FilterNameVector& rFilterNameVector );
+ /// @param o_pbLink if not 0, this is an "insert" dialog: display link
+ /// checkbox and store its state in *o_pbLink
+ static bool executeMediaURLDialog( Window* pParent,
+ OUString& rURL, bool *const o_pbLink );
+ static void executeFormatErrorBox( Window* pParent );
+ static bool isMediaURL( const OUString& rURL, bool bDeep = false, Size* pPreferredSizePixel = NULL );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::media::XPlayer > createPlayer( const OUString& rURL );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > grabFrame( const OUString& rURL,
+ bool bAllowToCreateReplacementGraphic = false,
+ double fMediaTime = AVMEDIA_FRAMEGRABBER_DEFAULTFRAME );
+
+ private:
+
+ // default: disabled copy/assignment
+ AVMEDIA_DLLPRIVATE MediaWindow(const MediaWindow&);
+ AVMEDIA_DLLPRIVATE MediaWindow& operator =( const MediaWindow& );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxIFace;
+ priv::MediaWindowImpl* mpImpl;
+ };
+}
+
+#endif // _AVMEDIA_MEDIAWINDOW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessor.hxx b/include/basebmp/accessor.hxx
new file mode 100644
index 000000000000..0ef3b5716465
--- /dev/null
+++ b/include/basebmp/accessor.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSOR_HXX
+#define INCLUDED_BASEBMP_ACCESSOR_HXX
+
+#include <vigra/numerictraits.hxx>
+
+namespace basebmp
+{
+
+/** Standard accessor type
+
+ Accesses the iterator values the standard way (i.e. via
+ *operator()/operator[])
+ */
+template<typename ValueType> class StandardAccessor
+{
+public:
+ typedef ValueType value_type;
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return *i;
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return i[diff];
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ *i = vigra::detail::RequiresExplicitCast<value_type>::cast(value);
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ i[diff] = vigra::detail::RequiresExplicitCast<value_type>::cast(value);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+/** Non-standard accessor type
+
+ Uses getter/setter methods at the given iterator type, to access
+ the underlying values.
+ */
+template<typename ValueType> class NonStandardAccessor
+{
+public:
+ typedef ValueType value_type;
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return i.get();
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return i.get(diff);
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ i.set( vigra::detail::RequiresExplicitCast<value_type>::cast(value) );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ i.set( vigra::detail::RequiresExplicitCast<value_type>::cast(value),
+ diff );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessoradapters.hxx b/include/basebmp/accessoradapters.hxx
new file mode 100644
index 000000000000..f4a05dc331c2
--- /dev/null
+++ b/include/basebmp/accessoradapters.hxx
@@ -0,0 +1,520 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSORADAPTERS_HXX
+#define INCLUDED_BASEBMP_ACCESSORADAPTERS_HXX
+
+#include <vigra/numerictraits.hxx>
+
+namespace basebmp
+{
+
+/** Interpose given accessor's set and get methods with two unary
+ functors.
+
+ @tpl WrappedAccessor
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example).
+
+ @tpl GetterFunctor
+ An Adaptable Unary Function (i.e. providing result_type and
+ argument_type typedefs)
+
+ @tpl SetterFunctor
+ An Adaptable Unary Function (i.e. providing result_type and
+ argument_type typedefs)
+ */
+template< class WrappedAccessor,
+ typename GetterFunctor,
+ typename SetterFunctor > class UnaryFunctionAccessorAdapter
+{
+public:
+ typedef typename GetterFunctor::result_type value_type;
+ typedef typename SetterFunctor::argument_type argument_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A, typename G, typename S> friend class UnaryFunctionAccessorAdapter;
+#endif
+
+ // we don't derive from wrapped type, to avoid ambiguities
+ // regarding templatized getter/setter methods.
+ WrappedAccessor maAccessor;
+ GetterFunctor maGetterFunctor;
+ SetterFunctor maSetterFunctor;
+
+public:
+ UnaryFunctionAccessorAdapter() :
+ maAccessor(),
+ maGetterFunctor(),
+ maSetterFunctor()
+ {}
+
+ template< class A > explicit
+ UnaryFunctionAccessorAdapter( UnaryFunctionAccessorAdapter< A,
+ GetterFunctor,
+ SetterFunctor > const& rSrc ) :
+ maAccessor( rSrc.maAccessor ),
+ maGetterFunctor( rSrc.maGetterFunctor ),
+ maSetterFunctor( rSrc.maSetterFunctor )
+ {}
+
+ template< class T > explicit UnaryFunctionAccessorAdapter( T const& accessor ) :
+ maAccessor( accessor ),
+ maGetterFunctor(),
+ maSetterFunctor()
+ {}
+
+ template< class T > UnaryFunctionAccessorAdapter( T accessor,
+ GetterFunctor getterFunctor,
+ SetterFunctor setterFunctor) :
+ maAccessor( accessor ),
+ maGetterFunctor( getterFunctor ),
+ maSetterFunctor( setterFunctor )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor const& getWrappedAccessor() const { return maAccessor; }
+ WrappedAccessor& getWrappedAccessor() { return maAccessor; }
+
+ // -------------------------------------------------------
+
+ value_type getter(typename GetterFunctor::argument_type v) const
+ {
+ return maGetterFunctor(v);
+ }
+ typename SetterFunctor::result_type setter(argument_type v) const
+ {
+ return maSetterFunctor(v);
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return maGetterFunctor( maAccessor(i) );
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return maGetterFunctor( maAccessor(i,diff) );
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ maAccessor.set(
+ maSetterFunctor(
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value) ),
+ i );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ maAccessor.set(
+ maSetterFunctor(
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value) ),
+ i,
+ diff );
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+
+/** Interpose given accessor's set methods with a binary function,
+ taking both old and new value.
+
+ The wrappee's getter methods kept as-is.
+
+ @tpl WrappedAccessor
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, must provide a nested typedef value_type.
+
+ @tpl SetterFunctor
+ An adaptable binary function (i.e. providing nested typedefs for
+ result_type and first and second argument type)
+ */
+template< class WrappedAccessor,
+ typename SetterFunctor > class BinarySetterFunctionAccessorAdapter
+{
+public:
+ typedef typename WrappedAccessor::value_type value_type;
+ typedef typename SetterFunctor::second_argument_type argument_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A, typename S> friend class BinarySetterFunctionAccessorAdapter;
+#endif
+
+ WrappedAccessor maAccessor;
+ SetterFunctor maFunctor;
+
+public:
+ BinarySetterFunctionAccessorAdapter() :
+ maAccessor(),
+ maFunctor()
+ {}
+
+ template< class A > explicit
+ BinarySetterFunctionAccessorAdapter(
+ BinarySetterFunctionAccessorAdapter< A,
+ SetterFunctor > const& rSrc ) :
+ maAccessor( rSrc.maAccessor ),
+ maFunctor( rSrc.maFunctor )
+ {}
+
+ template< class T > explicit BinarySetterFunctionAccessorAdapter( T const& accessor ) :
+ maAccessor( accessor ),
+ maFunctor()
+ {}
+
+ template< class T > BinarySetterFunctionAccessorAdapter( T accessor,
+ SetterFunctor functor ) :
+ maAccessor( accessor ),
+ maFunctor( functor )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor const& getWrappedAccessor() const { return maAccessor; }
+ WrappedAccessor& getWrappedAccessor() { return maAccessor; }
+
+ // -------------------------------------------------------
+
+ typename SetterFunctor::result_type setter(
+ typename SetterFunctor::first_argument_type v1,
+ argument_type v2 ) const
+ {
+ return maSetterFunctor(v1,v2);
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return maAccessor(i);
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return maAccessor(i,diff);
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ maAccessor.set(
+ maFunctor(maAccessor(i),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ maAccessor.set(
+ maFunctor(maAccessor(i,diff),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i,
+ diff );
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+
+/** Write through a CompositeIterator's first wrapped iterator, by
+ piping the first wrapped iterator value, the second iterator
+ value, and the specified new value through a ternary function.
+
+ Passed iterator must fulfill the CompositeIterator concept. Note
+ that the getter/setter methods are not templatized regarding the
+ iterator type, to make the mask calculation optimization below
+ safe (see the maskedAccessor template metafunction below)
+
+ @tpl WrappedAccessor1
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, the type must provide a nested typedef
+ value_type (the selection of WrappedAccessor1 as the provider for
+ that typedef is rather arbitrary. Could have been
+ WrappedAccessor2, too. So sue me)
+
+ @tpl Functor
+ An adaptable ternary function (i.e. providing nested typedefs for
+ result_type and first, second and third argument type)
+ */
+template< class WrappedAccessor1,
+ class WrappedAccessor2,
+ typename Functor > class TernarySetterFunctionAccessorAdapter
+{
+public:
+ typedef typename WrappedAccessor1::value_type value_type;
+ typedef typename Functor::third_argument_type argument_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A1, class A2, typename F> friend class TernarySetterFunctionAccessorAdapter;
+#endif
+
+ WrappedAccessor1 ma1stAccessor;
+ WrappedAccessor2 ma2ndAccessor;
+ Functor maFunctor;
+
+public:
+ TernarySetterFunctionAccessorAdapter() :
+ ma1stAccessor(),
+ ma2ndAccessor(),
+ maFunctor()
+ {}
+
+ template< class T > explicit TernarySetterFunctionAccessorAdapter( T const& accessor ) :
+ ma1stAccessor( accessor ),
+ ma2ndAccessor(),
+ maFunctor()
+ {}
+
+ template< class A1, class A2 > explicit
+ TernarySetterFunctionAccessorAdapter(
+ TernarySetterFunctionAccessorAdapter< A1,
+ A2,
+ Functor > const& rSrc ) :
+ ma1stAccessor( rSrc.ma1stAccessor ),
+ ma2ndAccessor( rSrc.ma2ndAccessor ),
+ maFunctor( rSrc.maFunctor )
+ {}
+
+ template< class T1, class T2 >
+ TernarySetterFunctionAccessorAdapter( T1 accessor1,
+ T2 accessor2 ) :
+ ma1stAccessor( accessor1 ),
+ ma2ndAccessor( accessor2 ),
+ maFunctor()
+ {}
+
+ template< class T1, class T2 >
+ TernarySetterFunctionAccessorAdapter( T1 accessor1,
+ T2 accessor2,
+ Functor func ) :
+ ma1stAccessor( accessor1 ),
+ ma2ndAccessor( accessor2 ),
+ maFunctor( func )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor1 const& get1stWrappedAccessor() const { return ma1stAccessor; }
+ WrappedAccessor1& get1stWrappedAccessor() { return ma1stAccessor; }
+
+ WrappedAccessor2 const& get2ndWrappedAccessor() const { return ma2ndAccessor; }
+ WrappedAccessor2& get2ndWrappedAccessor() { return ma2ndAccessor; }
+
+ // -------------------------------------------------------
+
+ typename Functor::result_type setter(
+ typename Functor::first_argument_type v1,
+ typename Functor::second_argument_type v2,
+ argument_type v3 ) const
+ {
+ return maSetterFunctor(v1,v2,v3);
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return ma1stAccessor(i.first());
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return ma1stAccessor(i.second(),diff);
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ ma1stAccessor.set(
+ maFunctor(ma1stAccessor(i.first()),
+ ma2ndAccessor(i.second()),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i.first() );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ ma1stAccessor.set(
+ maFunctor(ma1stAccessor(i.first(), diff),
+ ma2ndAccessor(i.second(),diff),
+ vigra::detail::RequiresExplicitCast<argument_type>::cast(value)),
+ i.first(),
+ diff );
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+
+/** Access two distinct images simultaneously
+
+ Passed iterator must fulfill the CompositeIterator concept
+ (i.e. wrap the two image's iterators into one
+ CompositeIterator). The getter and setter methods expect and
+ return a pair of values, with types equal to the two accessors
+ value types
+
+ @tpl WrappedAccessor1
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, the type must provide a nested typedef
+ value_type.
+
+ @tpl WrappedAccessor2
+ Wrapped type must provide the usual get and set accessor methods,
+ with the usual signatures (see StandardAccessor for a conforming
+ example). Furthermore, the type must provide a nested typedef
+ value_type.
+ */
+template< class WrappedAccessor1,
+ class WrappedAccessor2 > class JoinImageAccessorAdapter
+{
+public:
+ // TODO(F3): Need numeric traits and a few free functions to
+ // actually calculate with a pair (semantic: apply every operation
+ // individually to the contained types)
+ typedef std::pair<typename WrappedAccessor1::value_type,
+ typename WrappedAccessor2::value_type> value_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A1, class A2> friend class JoinImageAccessorAdapter;
+#endif
+
+ WrappedAccessor1 ma1stAccessor;
+ WrappedAccessor2 ma2ndAccessor;
+
+public:
+ JoinImageAccessorAdapter() :
+ ma1stAccessor(),
+ ma2ndAccessor()
+ {}
+
+ template< class T > explicit JoinImageAccessorAdapter( T const& accessor ) :
+ ma1stAccessor( accessor ),
+ ma2ndAccessor()
+ {}
+
+ template< class A1, class A2 > explicit
+ JoinImageAccessorAdapter(
+ JoinImageAccessorAdapter< A1,
+ A2 > const& rSrc ) :
+ ma1stAccessor( rSrc.ma1stAccessor ),
+ ma2ndAccessor( rSrc.ma2ndAccessor )
+ {}
+
+ template< class T1, class T2 >
+ JoinImageAccessorAdapter( T1 accessor1,
+ T2 accessor2 ) :
+ ma1stAccessor( accessor1 ),
+ ma2ndAccessor( accessor2 )
+ {}
+
+ // -------------------------------------------------------
+
+ WrappedAccessor1 const& get1stWrappedAccessor() const { return ma1stAccessor; }
+ WrappedAccessor1& get1stWrappedAccessor() { return ma1stAccessor; }
+
+ WrappedAccessor2 const& get2ndWrappedAccessor() const { return ma2ndAccessor; }
+ WrappedAccessor2& get2ndWrappedAccessor() { return ma2ndAccessor; }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return std::make_pair(ma1stAccessor(i.first()),
+ ma2ndAccessor(i.second()));
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return std::make_pair(ma1stAccessor(i.first(),diff),
+ ma2ndAccessor(i.second(),diff));
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ ma1stAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor1::value_type>::cast(
+ value.first),
+ i.first() );
+ ma2ndAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor2::value_type>::cast(
+ value.second),
+ i.second() );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ ma1stAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor1::value_type>::cast(
+ value.first),
+ i.first(),
+ diff );
+ ma2ndAccessor.set(
+ vigra::detail::RequiresExplicitCast<typename WrappedAccessor2::value_type>::cast(
+ value.second),
+ i.second(),
+ diff );
+ }
+
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSORADAPTERS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessorfunctors.hxx b/include/basebmp/accessorfunctors.hxx
new file mode 100644
index 000000000000..58550b010512
--- /dev/null
+++ b/include/basebmp/accessorfunctors.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSORFUNCTORS_HXX
+#define INCLUDED_BASEBMP_ACCESSORFUNCTORS_HXX
+
+#include <osl/diagnose.h>
+#include <basebmp/metafunctions.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+// Some common accessor functors
+// ------------------------------------------------------------
+
+
+/// combine two values via XOR
+template< typename T > struct XorFunctor : public std::binary_function<T,T,T>
+{
+ T operator()( T v1, T v2 ) const { return v1 ^ v2; }
+};
+
+//-----------------------------------------------------------------------------
+
+/// Base class, passing on the arg types
+template< typename T, typename M > struct MaskFunctorBase :
+ public TernaryFunctorBase<T,M,T,T> {};
+
+
+/** Let a mask flag decide between two values
+
+ @tpl polarity
+ Mask polarity. When true, a false in the mask denotes
+ transparency, i.e. the original value will display. And vice
+ versa.
+ */
+template< typename T,
+ typename M,
+ bool polarity > struct GenericOutputMaskFunctor : public MaskFunctorBase<T,M>
+{
+ /// Ternary mask operation - selects v1 for !m == polarity, v2 otherwise
+ T operator()( T v1, M m, T v2 ) const
+ {
+ return !m == polarity ? v1 : v2;
+ }
+};
+
+/** Let a mask bit decide between two values (specialization for
+ integer mask types)
+ */
+template< typename T,
+ typename M,
+ bool polarity > struct IntegerOutputMaskFunctor;
+template< typename T,
+ typename M > struct IntegerOutputMaskFunctor<T,M,true> : public MaskFunctorBase<T,M>
+{
+ /** Mask v with state of m
+
+ @return v2, if m != 0, v1 otherwise.
+ */
+ T operator()( T v1, M m, T v2 ) const
+ {
+ typedef typename make_unsigned<T>::type unsigned_T;
+
+ // mask will be 0, iff m == 0, and 1 otherwise
+ const T mask( unsigned_cast<T>(m | -m) >> (sizeof(unsigned_T)*8 - 1) );
+ return v1*(M)(1-mask) + v2*mask;
+ }
+};
+template< typename T,
+ typename M > struct IntegerOutputMaskFunctor<T,M,false> : public MaskFunctorBase<T,M>
+{
+ /** Mask v with state of m
+
+ @return v2, if m != 0, v1 otherwise.
+ */
+ T operator()( T v1, M m, T v2 ) const
+ {
+ typedef typename make_unsigned<T>::type unsigned_T;
+
+ // mask will be 0, iff m == 0, and 1 otherwise
+ const T mask( unsigned_cast<T>(m | -m) >> (sizeof(unsigned_T)*8 - 1) );
+ return v1*mask + v2*(M)(1-mask);
+ }
+};
+
+/** Let a mask bit decide between two values (specialization for
+ binary-valued mask types)
+ */
+template< typename T, typename M, bool polarity > struct FastIntegerOutputMaskFunctor;
+template< typename T, typename M > struct FastIntegerOutputMaskFunctor<T,M,true> :
+ public MaskFunctorBase<T,M>
+{
+ /// Specialization, only valid if mask can only attain 0 or 1
+ T operator()( T v1, M m, T v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return v1*(M)(1-m) + v2*m;
+ }
+};
+template< typename T, typename M > struct FastIntegerOutputMaskFunctor<T,M,false> :
+ public MaskFunctorBase<T,M>
+{
+ /// Specialization, only valid if mask can only attain 0 or 1
+ T operator()( T v1, M m, T v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return v1*m + v2*(M)(1-m);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+/** Split a pair value from a JoinImageAccessorAdapter into its
+ individual values, and pass it on to a ternary functor
+
+ This wrapper is an adaptable binary functor, and can thus be used
+ with a BinarySetterFunctionAccessorAdapter. Useful e.g. for
+ out-of-image alpha channel, or a masked image.
+
+ @tpl Functor
+ An adaptable ternary functor (as can e.g. be passed to the
+ TernarySetterFunctionAccessorAdapter)
+ */
+template< typename Functor > struct BinaryFunctorSplittingWrapper :
+ public std::binary_function<typename Functor::first_argument_type,
+ std::pair<typename Functor::third_argument_type,
+ typename Functor::second_argument_type>,
+ typename Functor::result_type>
+{
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A> friend struct BinaryFunctorSplittingWrapper;
+#endif
+ Functor maFunctor;
+
+public:
+ BinaryFunctorSplittingWrapper() : maFunctor() {}
+
+ template< class A > explicit
+ BinaryFunctorSplittingWrapper(
+ BinaryFunctorSplittingWrapper<A> const& src ) : maFunctor(src.maFunctor) {}
+
+ template< class F > explicit
+ BinaryFunctorSplittingWrapper( F const& func ) : maFunctor(func) {}
+
+ typename Functor::result_type operator()(
+ typename Functor::first_argument_type v1,
+ std::pair< typename Functor::third_argument_type,
+ typename Functor::second_argument_type > const& v2 ) const
+ {
+ return maFunctor( v1, v2.second, v2.first );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSORFUNCTORS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/accessortraits.hxx b/include/basebmp/accessortraits.hxx
new file mode 100644
index 000000000000..4ce9e6926e35
--- /dev/null
+++ b/include/basebmp/accessortraits.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ACCESSORTRAITS_HXX
+#define INCLUDED_BASEBMP_ACCESSORTRAITS_HXX
+
+#include <basebmp/accessorfunctors.hxx>
+#include <basebmp/accessoradapters.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+struct FastMask;
+struct NoFastMask;
+
+/// Metafunction to select output mask functor from iterator and mask value type
+template< typename T, typename M, bool polarity, typename DUMMY > struct outputMaskFunctorSelector : public
+ ifBothScalarIntegral< T, M,
+ IntegerOutputMaskFunctor< T, M, polarity >,
+ GenericOutputMaskFunctor< T, M, polarity > >
+{
+};
+template< typename T, typename M, bool polarity > struct outputMaskFunctorSelector< T, M, polarity, FastMask > : public
+ ifBothScalarIntegral< T, M,
+ FastIntegerOutputMaskFunctor< T, M, polarity >,
+ GenericOutputMaskFunctor< T, M, polarity > >
+{
+};
+
+/** Metafunction providing a point of configuration for iterators
+ capable of employing the fast output mask functor.
+
+ Specialize this metafunction for your case, and pass FastMask to
+ the outputMaskFunctorSelector.
+ */
+template< class Accessor,
+ class MaskAccessor,
+ class Iterator,
+ class MaskIterator,
+ bool polarity > struct maskedAccessorSelector
+{
+ typedef TernarySetterFunctionAccessorAdapter<
+ Accessor,
+ MaskAccessor,
+ typename outputMaskFunctorSelector<
+ typename Accessor::value_type,
+ typename MaskAccessor::value_type,
+ polarity,
+ NoFastMask > ::type >
+ type;
+};
+
+//-----------------------------------------------------------------------------
+
+/** Traits template for Accessor
+
+ Provides wrapped types for color lookup, raw pixel access, xor and
+ mask accessors.
+ */
+template< class Accessor > struct AccessorTraits
+{
+ /// value type of described accessor
+ typedef typename Accessor::value_type value_type;
+
+ /// Retrieve stand-alone color lookup function for given Accessor type
+ typedef project2nd< Accessor, value_type > color_lookup;
+
+ /// Retrieve raw pixel data accessor for given Accessor type
+ typedef Accessor raw_accessor;
+
+ /// Retrieve wrapped accessor for XOR setter access
+ typedef BinarySetterFunctionAccessorAdapter<
+ Accessor,
+ XorFunctor< value_type > > xor_accessor;
+
+ /** Retrieve masked accessor for given types
+
+ A masked accessor works like a filter, where the mask gates
+ the accessor's setter methods (if the mask contains a 0 at a
+ given iterator position, the original value is
+ preserved. Otherwise, the new value gets set).
+
+ @attention be careful when retrieving a masked accessor for a
+ set of types, and using it for a different one - there are
+ partial specializations that take an optimized functor for
+ certain mask accessors.
+ */
+ template< class MaskAccessor,
+ class Iterator,
+ class MaskIterator,
+ bool polarity > struct masked_accessor :
+ public maskedAccessorSelector< Accessor,
+ MaskAccessor,
+ Iterator,
+ MaskIterator,
+ polarity >
+ {};
+
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ACCESSORTRAITS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/basebmpdllapi.h b/include/basebmp/basebmpdllapi.h
new file mode 100644
index 000000000000..c44eee01ce7b
--- /dev/null
+++ b/include/basebmp/basebmpdllapi.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_BASEBMPDLLAPI_H
+#define INCLUDED_BASEBMP_BASEBMPDLLAPI_H
+
+#if defined BASEBMP_DLLIMPLEMENTATION
+#define BASEBMP_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASEBMP_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASEBMP_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_BASEBMP_BASEBMPDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/bitmapdevice.hxx b/include/basebmp/bitmapdevice.hxx
new file mode 100644
index 000000000000..941b01c840c3
--- /dev/null
+++ b/include/basebmp/bitmapdevice.hxx
@@ -0,0 +1,719 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_BITMAPDEVICE_HXX
+#define INCLUDED_BASEBMP_BITMAPDEVICE_HXX
+
+#include <sal/types.h>
+#include <basebmp/drawmodes.hxx>
+#include <basebmp/basebmpdllapi.h>
+
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/noncopyable.hpp>
+#include <vector>
+
+namespace basegfx
+{
+ class B2IPoint;
+ class B2DPoint;
+ class B2IVector;
+ class B2IBox;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+namespace basebmp
+{
+
+// Temporary. Use like the tools color object
+class Color;
+typedef boost::shared_ptr< class BitmapDevice > BitmapDeviceSharedPtr;
+typedef boost::shared_ptr< struct IBitmapDeviceDamageTracker > IBitmapDeviceDamageTrackerSharedPtr;
+typedef boost::shared_array< sal_uInt8 > RawMemorySharedArray;
+typedef boost::shared_ptr< const std::vector<Color> > PaletteMemorySharedVector;
+
+struct ImplBitmapDevice;
+
+/// Interface for getting damage tracking events
+struct IBitmapDeviceDamageTracker
+{
+ /// gets called when said region is clobbered
+ virtual void damaged(const basegfx::B2IBox& rDamageRect) const = 0;
+
+protected:
+ ~IBitmapDeviceDamageTracker() {}
+};
+
+/** Definition of BitmapDevice interface
+
+ Use the createBitmapDevice() function to create instances.
+
+ Implementation note: the clip mask and bitmap parameter instances
+ of BitmapDevice that are passed to individual BitmapDevice
+ instances work best with 1 bit grey masks for the clip and a
+ format matching that of the target BitmapDevice for the other
+ parameters. The alpha mask passed to the drawMaskedColor() methods
+ works best when given as an eight bit grey bitmap. Everything else
+ is accepted, but potentially slow.
+ */
+class BASEBMP_DLLPUBLIC BitmapDevice : public boost::enable_shared_from_this<BitmapDevice>,
+ private boost::noncopyable
+{
+public:
+ /** Query size of device in pixel columns (X) and rows (Y, "scanlines")
+ */
+ basegfx::B2IVector getSize() const;
+
+ /** Query whether buffer starts with 0th scanline
+
+ @return true, if the buffer memory starts with the 0th
+ scanline, and false if it starts with the last one. The latter
+ is e.g. the typical scan line ordering for the Windows BMP
+ format.
+ */
+ bool isTopDown() const;
+
+ /** Query the size of the whole frame buffer
+
+ @ return the size of the whole frame buffer, the same as
+ getSize() unless this is a "subset" device.
+ */
+ basegfx::B2IVector getBufferSize() const;
+
+ /** Query type of scanline memory format
+ */
+ sal_Int32 getScanlineFormat() const;
+
+ /** Query byte offset to get from scanline n to scanline n+1
+
+ @return the scanline stride in bytes.
+ */
+ sal_Int32 getScanlineStride() const;
+
+ /** Get pointer to frame buffer
+
+ @return a shared ptr to the bitmap buffer memory. As this is a
+ shared ptr, you can freely store and use the pointer, even
+ after this object has been deleted.
+ */
+ RawMemorySharedArray getBuffer() const;
+
+ /// Query current damage tracking object (if any)
+ IBitmapDeviceDamageTrackerSharedPtr getDamageTracker() const;
+
+ /** Set new damage tracking object
+
+ @param rDamage
+ Object implementing the IBitmapDeviceDamageTracker interface -
+ everytime some area of the surface gets clobbered, that object
+ gets notified.
+ */
+ void setDamageTracker( const IBitmapDeviceDamageTrackerSharedPtr& rDamage );
+
+ /** Get pointer to palette
+
+ The returned pointer is const on purpose, since the
+ BitmapDevice might internally cache lookup information. Don't
+ modify the returned data, unless you want to enter the realm
+ of completely undefined behaviour.
+
+ @return shared pointer to vector of Color entries.
+ */
+ PaletteMemorySharedVector getPalette() const;
+
+ /** Clear whole device with given color
+
+ This method works like a fill with the given color value,
+ resulting in a bitmap uniformly colored in fillColor.
+ */
+ void clear( Color fillColor );
+
+ /** Set given pixel to specified color
+
+ @param rPt
+ Pixel to set
+
+ @param pixelColor
+ Color value to set the pixel to
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+ */
+ void setPixel( const basegfx::B2IPoint& rPt,
+ Color pixelColor,
+ DrawMode drawMode );
+
+ /** Set given pixel to specified color
+
+ @param rPt
+ Pixel to set
+
+ @param pixelColor
+ Color value to set the pixel to
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+
+ @param rClip
+ Clip mask to use. If the clip mask is 1 at the given pixel
+ position, no change will take place.
+ */
+ void setPixel( const basegfx::B2IPoint& rPt,
+ Color pixelColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Get color value at given pixel
+ */
+ Color getPixel( const basegfx::B2IPoint& rPt );
+
+ /** Get underlying pixel data value at given position
+
+ This method returns the raw pixel data. In the case of
+ paletted bitmaps, this is the palette index, not the final
+ color value.
+ */
+ sal_uInt32 getPixelData( const basegfx::B2IPoint& rPt );
+
+ /** Draw a line
+
+ @param rPt1
+ Start point of the line
+
+ @param rPt2
+ End point of the line. If the analytical line from rP1 to rPt2
+ (with the actual pixel positions assumed to be the center of
+ the pixel) is exactly in the middle between two pixel, this
+ method always selects the pixel closer to rPt1.
+
+ @param lineColor
+ Color value to draw the line with
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+ */
+ void drawLine( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ Color lineColor,
+ DrawMode drawMode );
+
+ /** Draw a line
+
+ @param rPt1
+ Start point of the line
+
+ @param rPt2
+ End point of the line. If the analytical line from rP1 to rPt2
+ (with the actual pixel positions assumed to be the center of
+ the pixel) is exactly in the middle between two pixel, this
+ method always selects the pixel closer to rPt1.
+
+ @param lineColor
+ Color value to draw the line with
+
+ @param drawMode
+ Draw mode to use when changing the pixel value
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawLine( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw a polygon
+
+ @param rPoly
+ Polygon to draw. Depending on the value returned by rPoly's
+ isClosed() method, the resulting line polygon will be drawn
+ closed or not.
+
+ @param lineColor
+ Color value to draw the polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void drawPolygon( const basegfx::B2DPolygon& rPoly,
+ Color lineColor,
+ DrawMode drawMode );
+
+ /** Draw a polygon
+
+ @param rPoly
+ Polygon to draw. Depending on the value returned by rPoly's
+ isClosed() method, the resulting line polygon will be drawn
+ closed or not.
+
+ @param lineColor
+ Color value to draw the polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawPolygon( const basegfx::B2DPolygon& rPoly,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Fill a poly-polygon
+
+ @param rPoly
+ Poly-polygon to fill. Regardless of the value returned by
+ rPoly's isClosed() method, the resulting filled poly-polygon
+ is always considered closed. As usual, when filling a shape,
+ the rightmost and bottommost pixel are not filled, compared to
+ the drawPolygon() method. For example, the rectangle
+ (0,0),(1,1) will have four pixel set, when drawn via
+ drawPolygon(), and only one pixel, when filled via
+ fillPolyPolygon().
+
+ @param fillColor
+ Color value to fill the poly-polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode );
+
+ /** Fill a poly-polygon
+
+ @param rPoly
+ Poly-polygon to fill. Regardless of the value returned by
+ rPoly's isClosed() method, the resulting filled poly-polygon
+ is always considered closed. As usual, when filling a shape,
+ the rightmost and bottommost pixel are not filled, compared to
+ the drawPolygon() method. For example, the rectangle
+ (0,0),(1,1) will have four pixel set, when drawn via
+ drawPolygon(), and only one pixel, when filled via
+ fillPolyPolygon().
+
+ @param fillColor
+ Color value to fill the poly-polygon with
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void fillPolyPolygon( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw another bitmap into this device
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode );
+
+ /** Draw another bitmap into this device
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw a color with an alpha-modulation bitmap into this device
+
+ This method takes a fixed color value, and an alpha mask. For
+ each pixel in the alpha mask, the given color value is blended
+ with the corresponding alpha value against the content of this
+ object.
+
+ @param aSrcColor
+ Color value to use for blending
+
+ @param rAlphaMask
+ Alpha mask to use for blending. It is permitted that alpha
+ mask and this bitmap are the same object.
+
+ @param rSrcRect
+ Rectangle within the alpha mask to take the pixel from.
+ Please note that the destination rectangle is interpreted
+ excluding the rightmost pixel column and the bottommost pixel
+ row, this is much like polygon filling. As a result, filling a
+ given rectangle with fillPolyPolygon(), and using the same
+ rectangle as the source rectangle of this method, will affect
+ exactly the same set of pixel.
+
+ @param rDstPoint
+ Destination point, where to start placing the pixel from the
+ source rectangle
+ */
+ void drawMaskedColor( Color aSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint );
+
+ /** Draw a color with an alpha-modulation bitmap into this device
+
+ This method takes a fixed color value, and an alpha mask. For
+ each pixel in the alpha mask, the given color value is blended
+ with the corresponding alpha value against the content of this
+ object.
+
+ @param aSrcColor
+ Color value to use for blending
+
+ @param rAlphaMask
+ Alpha mask to use for blending. It is permitted that alpha
+ mask and this bitmap are the same object.
+
+ @param rSrcRect
+ Rectangle within the alpha mask to take the pixel from.
+ Please note that the destination rectangle is interpreted
+ excluding the rightmost pixel column and the bottommost pixel
+ row, this is much like polygon filling. As a result, filling a
+ given rectangle with fillPolyPolygon(), and using the same
+ rectangle as the source rectangle of this method, will affect
+ exactly the same set of pixel.
+
+ @param rDstPoint
+ Destination point, where to start placing the pixel from the
+ source rectangle
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawMaskedColor( Color aSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint,
+ const BitmapDeviceSharedPtr& rClip );
+
+ /** Draw another bitmap through a mask into this device
+
+ This method renders a source bitmap into this device, much
+ like the drawBitmap() method. The only difference is the
+ additional mask parameter, which operates much like an
+ additional clip mask: pixel with value zero in this mask
+ result in destination pixel not being modified.
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rMask
+ Bitmap to use as a mask. Pixel with value != zero in this mask
+ will result in destination pixel not being affected by the
+ blit operation.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+ */
+ void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode );
+
+ /** Draw another bitmap through a mask into this device
+
+ This method renders a source bitmap into this device, much
+ like the drawBitmap() method. The only difference is the
+ additional mask parameter, which operates much like an
+ additional clip mask: pixel with value != zero in this mask
+ result in destination pixel not being modified.
+
+ @param rSrcBitmap
+ Bitmap to render into this one. It is permitted that source
+ and destination bitmap are the same.
+
+ @param rMask
+ Bitmap to use as a mask. Pixel with value != zero in this mask
+ will result in destination pixel not being affected by the
+ blit operation.
+
+ @param rSrcRect
+ Rectangle within the source bitmap to take the pixel from.
+
+ @param rDstRect
+ Rectangle in the destination bitmap to put the pixel
+ into. Source and destination rectangle are permitted to have
+ differing sizes; this method will scale the source pixel
+ accordingly. Please note that both source and destination
+ rectangle are interpreted excluding the rightmost pixel column
+ and the bottommost pixel row, this is much like polygon
+ filling. As a result, filling a given rectangle with
+ fillPolyPolygon(), and using the same rectangle as the
+ destination rectangle of this method, will affect exactly the
+ same set of pixel.
+
+ @param drawMode
+ Draw mode to use when changing pixel values
+
+ @param rClip
+ Clip mask to use. Pixel where the corresponding clip mask
+ pixel is 1 will not be modified.
+ */
+ void drawMaskedBitmap( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip );
+
+protected:
+ BASEBMP_DLLPRIVATE BitmapDevice( const basegfx::B2IBox& rBounds,
+ const basegfx::B2IVector& rBufferSize,
+ sal_Int32 nScanlineFormat,
+ sal_Int32 nScanlineStride,
+ sal_uInt8* pFirstScanline,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
+ BASEBMP_DLLPRIVATE virtual ~BitmapDevice();
+
+private:
+ BASEBMP_DLLPRIVATE virtual bool isCompatibleBitmap( const BitmapDeviceSharedPtr& bmp ) const = 0;
+ BASEBMP_DLLPRIVATE virtual bool isCompatibleClipMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
+ BASEBMP_DLLPRIVATE virtual bool isCompatibleAlphaMask( const BitmapDeviceSharedPtr& bmp ) const = 0;
+
+ BASEBMP_DLLPRIVATE virtual void clear_i( Color fillColor,
+ const basegfx::B2IBox& rBounds ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
+ Color lineColor,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void setPixel_i( const basegfx::B2IPoint& rPt,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual Color getPixel_i( const basegfx::B2IPoint& rPt ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual sal_uInt32 getPixelData_i( const basegfx::B2IPoint& rPt ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawLine_i( const basegfx::B2IPoint& rPt1,
+ const basegfx::B2IPoint& rPt2,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawPolygon_i( const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2IBox& rBounds,
+ Color lineColor,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode,
+ const basegfx::B2IBox& rBounds ) = 0;
+ BASEBMP_DLLPRIVATE virtual void fillPolyPolygon_i( const basegfx::B2DPolyPolygon& rPoly,
+ Color fillColor,
+ DrawMode drawMode,
+ const basegfx::B2IBox& rBounds,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ // must work with *this == rSrcBitmap!
+ BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ // must work with *this == rSrcBitmap!
+ BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawMaskedColor_i( Color rSrcColor,
+ const BitmapDeviceSharedPtr& rAlphaMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IPoint& rDstPoint,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ // must work with *this == rSrcBitmap!
+ BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode ) = 0;
+ BASEBMP_DLLPRIVATE virtual void drawMaskedBitmap_i( const BitmapDeviceSharedPtr& rSrcBitmap,
+ const BitmapDeviceSharedPtr& rMask,
+ const basegfx::B2IBox& rSrcRect,
+ const basegfx::B2IBox& rDstRect,
+ DrawMode drawMode,
+ const BitmapDeviceSharedPtr& rClip ) = 0;
+
+ BASEBMP_DLLPRIVATE virtual IBitmapDeviceDamageTrackerSharedPtr getDamageTracker_i() const = 0;
+ BASEBMP_DLLPRIVATE virtual void setDamageTracker_i( const IBitmapDeviceDamageTrackerSharedPtr& rDamage ) = 0;
+
+ BitmapDeviceSharedPtr getGenericRenderer() const;
+
+ boost::scoped_ptr< ImplBitmapDevice > mpImpl;
+};
+
+/** Function to create a BitmapDevice for given scanline format
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat );
+
+/** Function to create a BitmapDevice for given scanline format
+ with the given palette
+
+ Note: the provided palette must have sufficient size, to satisfy
+ lookups for the whole range of pixel values from the specified
+ format.
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const PaletteMemorySharedVector& rPalette );
+
+/** Function to create a BitmapDevice for given scanline format
+ from the given piece of raw memory and palette
+
+ Note: the provided memory must have sufficient size, to store the
+ image of the specified area and format.
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC createBitmapDevice( const basegfx::B2IVector& rSize,
+ bool bTopDown,
+ sal_Int32 nScanlineFormat,
+ const RawMemorySharedArray& rMem,
+ const PaletteMemorySharedVector& rPalette );
+
+
+/** Function to retrieve a subsetted BitmapDevice to the same
+ memory.
+
+ Note that there is no coordinate system translation or offsetting
+ involved.
+
+ This method creates a second bitmap device instance, which renders
+ to the same memory as the original, with the same pixel coordinate
+ pairs refering to the same pixels in the memory buffer, but with
+ rendering clipped to a rectangular area. Useful to implement
+ rectangular clips (usually faster than setting up a 1bpp clip
+ mask).
+
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC subsetBitmapDevice( const BitmapDeviceSharedPtr& rProto,
+ const basegfx::B2IBox& rSubset );
+
+/** Function to clone a BitmapDevice from a given prototype.
+
+ All attributes (like scanline format and top-down state) are
+ copied, only the size can be varied. Note that the prototype's
+ bitmap content is <em>not</em> copied, only a palette (if any).
+ */
+BitmapDeviceSharedPtr BASEBMP_DLLPUBLIC cloneBitmapDevice( const basegfx::B2IVector& rSize,
+ const BitmapDeviceSharedPtr& rProto );
+
+}
+
+#endif /* INCLUDED_BASEBMP_BITMAPDEVICE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/clippedlinerenderer.hxx b/include/basebmp/clippedlinerenderer.hxx
new file mode 100644
index 000000000000..92ca167730f5
--- /dev/null
+++ b/include/basebmp/clippedlinerenderer.hxx
@@ -0,0 +1,411 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_CLIPPEDLINERENDERER_HXX
+#define INCLUDED_BASEBMP_CLIPPEDLINERENDERER_HXX
+
+#include <basegfx/tools/rectcliptools.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/range/b2ibox.hxx>
+
+#include <vigra/diff2d.hxx>
+#include <vigra/iteratortraits.hxx>
+
+namespace basebmp
+{
+
+// factored-out bresenham setup code, which is used from two different
+// places in renderClippedLine() below. Admittedly messy for the long
+// parameter list...
+inline bool prepareClip( sal_Int32 a1,
+ sal_Int32 a2,
+ sal_Int32 b1,
+ sal_Int32 da,
+ sal_Int32 db,
+ sal_Int32& o_as,
+ sal_Int32& o_bs,
+ int sa,
+ int sb,
+ sal_Int32& io_rem,
+ int& o_n,
+ sal_uInt32 clipCode1,
+ sal_uInt32 clipCount1,
+ sal_uInt32 clipCode2,
+ sal_uInt32 clipCount2,
+ sal_Int32 aMin,
+ sal_uInt32 aMinFlag,
+ sal_Int32 aMax,
+ sal_uInt32 aMaxFlag,
+ sal_Int32 bMin,
+ sal_uInt32 bMinFlag,
+ sal_Int32 bMax,
+ sal_uInt32 bMaxFlag,
+ bool bRoundTowardsPt2,
+ bool& o_bUseAlternateBresenham )
+{
+ int ca(0), cb(0);
+ if( clipCode1 )
+ {
+ if( clipCode1 & aMinFlag )
+ {
+ ca = 2*db*(aMin - a1);
+ o_as = aMin;
+ }
+ else if( clipCode1 & aMaxFlag )
+ {
+ ca = 2*db*(a1 - aMax);
+ o_as = aMax;
+ }
+
+ if( clipCode1 & bMinFlag )
+ {
+ cb = 2*da*(bMin - b1);
+ o_bs = bMin;
+ }
+ else if( clipCode1 & bMaxFlag )
+ {
+ cb = 2*da*(b1 - bMax);
+ o_bs = bMax;
+ }
+
+ if( clipCount1 == 2 )
+ clipCode1 &= (ca + da < cb + !bRoundTowardsPt2) ? ~(aMinFlag|aMaxFlag) : ~(bMinFlag|bMaxFlag);
+
+ if( clipCode1 & (aMinFlag|aMaxFlag) )
+ {
+ cb = (ca + da - !bRoundTowardsPt2) / (2*da);
+
+ if( sb >= 0 )
+ {
+ o_bs = b1 + cb;
+ if( o_bs > bMax )
+ return false; // fully clipped
+ }
+ else
+ {
+ o_bs = b1 - cb;
+ if( o_bs < bMin )
+ return false; // fully clipped
+ }
+
+ io_rem += ca - 2*da*cb;
+ }
+ else
+ {
+ ca = (cb - da + 2*db - bRoundTowardsPt2) / (2*db);
+ if( sa >= 0 )
+ {
+ o_as = a1 + ca;
+ if( o_as > aMax )
+ return false; // fully clipped
+ }
+ else
+ {
+ o_as = a1 - ca;
+ if( o_as < aMin )
+ return false; // fully clipped
+ }
+
+ io_rem += 2*db*ca - cb;
+ }
+ }
+ else
+ {
+ o_as = a1; o_bs = b1;
+ }
+
+ if( clipCode2 )
+ {
+ if( clipCount2 == 2 )
+ {
+ ca = 2*db*((clipCode2 & aMinFlag) ? a1 - aMin : aMax - a1);
+ cb = 2*da*((clipCode2 & bMinFlag) ? b1 - bMin : bMax - b1);
+ clipCode2 &= (cb + da < ca + bRoundTowardsPt2) ? ~(aMinFlag|aMaxFlag) : ~(bMinFlag|bMaxFlag);
+ }
+
+ if( clipCode2 & (aMinFlag|aMaxFlag) )
+ o_n = (clipCode2 & aMinFlag) ? o_as - aMin : aMax - o_as;
+ else
+ {
+ o_n = (clipCode2 & bMinFlag) ? o_bs - bMin : bMax - o_bs;
+ o_bUseAlternateBresenham = true;
+ }
+ }
+ else
+ o_n = (a2 >= o_as) ? a2 - o_as : o_as - a2;
+
+ return true; // at least one pixel to render
+}
+
+
+/** Render line to image iterators, clip against given rectangle
+
+ This method renders a line from aPt1 to aPt2, clipped against
+ rClipRect (the clipping will take place pixel-perfect, i.e. as if
+ the original bresenham-rendered line would have been clipped each
+ pixel individually. No slight shifts compared to unclipped lines).
+
+ @param aPt1
+ Start point of the line
+
+ @param aPt2
+ End point of the line
+
+ @param rClipRect
+ Rectangle to clip against
+
+ @param color
+ Color value to render the line with
+
+ @param begin
+ left-top image iterator
+
+ @param end
+ right-bottom image iterator
+
+ @param acc
+ Image accessor
+
+ @param bRoundTowardsPt2
+ Rounding mode to use. Giving false here results in line pixel tend
+ towards pt1, i.e. when a pixel exactly hits the middle between two
+ pixel, the pixel closer to pt1 will be chosen. Giving true here
+ makes renderClippedLine() choose pt2 in those cases.
+ */
+template< class Iterator, class Accessor >
+void renderClippedLine( basegfx::B2IPoint aPt1,
+ basegfx::B2IPoint aPt2,
+ const basegfx::B2IBox& rClipRect,
+ typename Accessor::value_type color,
+ Iterator begin,
+ Accessor acc,
+ bool bRoundTowardsPt2=false )
+{
+ // Algorithm according to Steven Eker's 'Pixel-perfect line clipping',
+ // Graphics Gems V, pp. 314-322
+ sal_uInt32 clipCode1 = basegfx::tools::getCohenSutherlandClipFlags(aPt1,
+ rClipRect);
+ sal_uInt32 clipCode2 = basegfx::tools::getCohenSutherlandClipFlags(aPt2,
+ rClipRect);
+
+ if( clipCode1 & clipCode2 )
+ return; // line fully clipped away, both endpoints share a half-plane
+
+ sal_uInt32 clipCount1 = basegfx::tools::getNumberOfClipPlanes(clipCode1);
+ sal_uInt32 clipCount2 = basegfx::tools::getNumberOfClipPlanes(clipCode2);
+
+ if( (clipCode1 != 0 && clipCode2 == 0)
+ || (clipCount1 == 2 && clipCount2 == 1) )
+ {
+ std::swap(clipCount2,clipCount1);
+ std::swap(clipCode2,clipCode1);
+ std::swap(aPt1,aPt2);
+ bRoundTowardsPt2 = !bRoundTowardsPt2;
+ }
+
+ const sal_Int32 x1 = aPt1.getX();
+ const sal_Int32 x2 = aPt2.getX();
+ const sal_Int32 y1 = aPt1.getY();
+ const sal_Int32 y2 = aPt2.getY();
+
+ // TODO(E1): This might overflow
+ sal_Int32 adx = x2 - x1;
+ int sx = 1;
+ if( adx < 0 )
+ {
+ adx *= -1;
+ sx = -1;
+ }
+
+ // TODO(E1): This might overflow
+ sal_Int32 ady = y2 - y1;
+ int sy = 1;
+ if( ady < 0 )
+ {
+ ady *= -1;
+ sy = -1;
+ }
+
+ int n = 0;
+ sal_Int32 xs = x1;
+ sal_Int32 ys = y1;
+ bool bUseAlternateBresenham=false;
+ if( adx >= ady )
+ {
+ // semi-horizontal line
+ sal_Int32 rem = 2*ady - adx - !bRoundTowardsPt2;
+
+ if( !prepareClip(x1, x2, y1, adx, ady, xs, ys, sx, sy,
+ rem, n, clipCode1, clipCount1, clipCode2, clipCount2,
+ rClipRect.getMinX(), basegfx::tools::RectClipFlags::LEFT,
+ rClipRect.getMaxX()-1, basegfx::tools::RectClipFlags::RIGHT,
+ rClipRect.getMinY(), basegfx::tools::RectClipFlags::TOP,
+ rClipRect.getMaxY()-1, basegfx::tools::RectClipFlags::BOTTOM,
+ bRoundTowardsPt2, bUseAlternateBresenham ) )
+ return; // line fully clipped away, no active pixel inside rect
+
+ Iterator currIter( begin + vigra::Diff2D(0,ys) );
+ typename vigra::IteratorTraits<Iterator>::row_iterator
+ rowIter( currIter.rowIterator() + xs );
+
+ adx *= 2;
+ ady *= 2;
+
+ if( bUseAlternateBresenham )
+ {
+ while(true)
+ {
+ acc.set(color, rowIter);
+
+ if( rem >= 0 )
+ {
+ // this is intended - we clip endpoint against y
+ // plane, so n here denotes y range to render
+ if( --n < 0 )
+ break;
+
+ ys += sy;
+ xs += sx;
+ rem -= adx;
+
+ currIter.y += sy;
+ rowIter = currIter.rowIterator() + xs;
+ }
+ else
+ {
+ xs += sx;
+ rowIter += sx;
+ }
+
+ rem += ady;
+ }
+ }
+ else
+ {
+ while(true)
+ {
+ acc.set(color, rowIter);
+
+ if( --n < 0 )
+ break;
+
+ if( rem >= 0 )
+ {
+ ys += sy;
+ xs += sx;
+ rem -= adx;
+
+ currIter.y += sy;
+ rowIter = currIter.rowIterator() + xs;
+ }
+ else
+ {
+ xs += sx;
+ rowIter += sx;
+ }
+
+ rem += ady;
+ }
+ }
+ }
+ else
+ {
+ // semi-vertical line
+ sal_Int32 rem = 2*adx - ady - !bRoundTowardsPt2;
+
+ if( !prepareClip(y1, y2, x1, ady, adx, ys, xs, sy, sx,
+ rem, n, clipCode1, clipCount1, clipCode2, clipCount2,
+ rClipRect.getMinY(), basegfx::tools::RectClipFlags::TOP,
+ rClipRect.getMaxY()-1, basegfx::tools::RectClipFlags::BOTTOM,
+ rClipRect.getMinX(), basegfx::tools::RectClipFlags::LEFT,
+ rClipRect.getMaxX()-1, basegfx::tools::RectClipFlags::RIGHT,
+ bRoundTowardsPt2, bUseAlternateBresenham ) )
+ return; // line fully clipped away, no active pixel inside rect
+
+ Iterator currIter( begin + vigra::Diff2D(xs,0) );
+ typename vigra::IteratorTraits<Iterator>::column_iterator
+ colIter( currIter.columnIterator() + ys );
+
+ adx *= 2;
+ ady *= 2;
+
+ if( bUseAlternateBresenham )
+ {
+ while(true)
+ {
+ acc.set(color, colIter);
+
+ if( rem >= 0 )
+ {
+ // this is intended - we clip endpoint against x
+ // plane, so n here denotes x range to render
+ if( --n < 0 )
+ break;
+
+ xs += sx;
+ ys += sy;
+ rem -= ady;
+
+ currIter.x += sx;
+ colIter = currIter.columnIterator() + ys;
+ }
+ else
+ {
+ ys += sy;
+ colIter += sy;
+ }
+
+ rem += adx;
+ }
+ }
+ else
+ {
+ while(true)
+ {
+ acc.set(color, colIter);
+
+ if( --n < 0 )
+ break;
+
+ if( rem >= 0 )
+ {
+ xs += sx;
+ ys += sy;
+ rem -= ady;
+
+ currIter.x += sx;
+ colIter = currIter.columnIterator() + ys;
+ }
+ else
+ {
+ ys += sy;
+ colIter += sy;
+ }
+
+ rem += adx;
+ }
+ }
+ }
+}
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_CLIPPEDLINERENDERER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/color.hxx b/include/basebmp/color.hxx
new file mode 100644
index 000000000000..52451fff7fed
--- /dev/null
+++ b/include/basebmp/color.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLOR_HXX
+#define INCLUDED_BASEBMP_COLOR_HXX
+
+#include <sal/types.h>
+#include <rtl/math.hxx>
+
+namespace basebmp
+{
+
+class Color
+{
+private:
+ sal_uInt32 mnColor;
+
+public:
+ typedef sal_uInt32 value_type;
+ typedef sal_uInt8 component_type;
+
+ Color() : mnColor(0) {}
+ explicit Color( sal_uInt32 nVal ) : mnColor(nVal) {}
+ Color( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue ) :
+ mnColor( ((sal_uInt32)nRed << 16) | ((sal_uInt32)nGreen << 8) | nBlue )
+ {}
+
+ void setRed( sal_uInt8 nRed ) { mnColor &= ~0x00FF0000UL; mnColor |= (sal_uInt32)nRed << 16; }
+ void setGreen( sal_uInt8 nGreen ) { mnColor &= ~0x0000FF00UL; mnColor |= (sal_uInt32)nGreen << 8; }
+ void setBlue( sal_uInt8 nBlue ) { mnColor &= ~0x000000FFUL; mnColor |= nBlue; }
+
+ void setGrey( sal_uInt8 nGreyVal ) { mnColor = (sal_uInt32)nGreyVal << 16 | (sal_uInt32)nGreyVal << 8 | nGreyVal; }
+
+ sal_uInt8 getRed() const { return 0xFF & (sal_uInt8)(mnColor >> 16); }
+ sal_uInt8 getGreen() const { return 0xFF & (sal_uInt8)(mnColor >> 8); }
+ sal_uInt8 getBlue() const { return 0xFF & (sal_uInt8)mnColor; }
+
+ sal_uInt8 getGreyscale() const { return (sal_uInt8)((getBlue()*28UL +
+ getGreen()*151 +
+ getRed()*77) / 256); }
+
+ sal_uInt32 toInt32() const { return mnColor; }
+
+ bool operator!() const { return mnColor == 0; }
+ Color operator&( sal_uInt32 nMask ) const { return Color(mnColor & nMask); }
+ Color operator^( Color col ) const { return Color(col.getRed()^getRed(),
+ col.getGreen()^getGreen(),
+ col.getBlue()^getBlue()); }
+ Color operator-( Color col ) const { return Color((sal_uInt8)abs((int)getRed()-col.getRed()),
+ (sal_uInt8)abs((int)getGreen()-col.getGreen()),
+ (sal_uInt8)abs((int)getBlue()-col.getBlue())); }
+ Color operator+( Color col ) const { return Color(getRed()+col.getRed(),
+ getGreen()+col.getGreen(),
+ getBlue()+col.getBlue()); }
+ Color operator*( Color col ) const { return Color((sal_uInt8)((sal_uInt32)col.getRed()*getRed()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)col.getGreen()*getGreen()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)col.getBlue()*getBlue()/SAL_MAX_UINT8)); }
+ Color operator*( sal_uInt8 n ) const { return Color((sal_uInt8)((sal_uInt32)n*getRed()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)n*getGreen()/SAL_MAX_UINT8),
+ (sal_uInt8)((sal_uInt32)n*getBlue()/SAL_MAX_UINT8)); }
+ Color operator*( double n ) const { return Color((sal_uInt8)(n*getRed()+.5),
+ (sal_uInt8)(n*getGreen()+.5),
+ (sal_uInt8)(n*getBlue()+.5)); }
+ bool operator==( const Color& rhs ) const { return (getRed()==rhs.getRed() &&
+ getGreen()==rhs.getGreen() &&
+ getBlue()==rhs.getBlue()); }
+ bool operator!=( const Color& rhs ) const { return !(*this==rhs); }
+ double magnitude() const { return sqrt((double)getRed()*getRed()
+ + getGreen()*getGreen()
+ + getBlue()*getBlue()); }
+};
+
+} // namespace vigra
+
+#endif /* INCLUDED_BASEBMP_COLOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/colorblendaccessoradapter.hxx b/include/basebmp/colorblendaccessoradapter.hxx
new file mode 100644
index 000000000000..c4511c709844
--- /dev/null
+++ b/include/basebmp/colorblendaccessoradapter.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLORBLENDACCESSORADAPTER_HXX
+#define INCLUDED_BASEBMP_COLORBLENDACCESSORADAPTER_HXX
+
+#include <basebmp/colortraits.hxx>
+
+namespace basebmp
+{
+
+/** Accessor adapter that blends input value against fixed color value
+
+ Used to blend an alpha mask 'through' a fixed color value into the
+ destination.
+
+ The getter functors return a constant value (usually the zero of
+ the value type, this preserves the original destination content
+ when blitting through a mask) - there really isn't no other
+ sensible default behaviour for these methods.
+ */
+template< class WrappedAccessor,
+ typename AlphaType,
+ bool polarity > class ConstantColorBlendSetterAccessorAdapter
+{
+public:
+ typedef AlphaType alpha_type;
+ typedef AlphaType value_type;
+ typedef typename WrappedAccessor::value_type color_type;
+
+private:
+ typename ColorTraits< color_type >::
+ template blend_functor<alpha_type,polarity>::type maFunctor;
+ WrappedAccessor maWrappee;
+ color_type maBlendColor;
+ value_type maGetterValue;
+
+public:
+ ConstantColorBlendSetterAccessorAdapter() :
+ maFunctor(),
+ maWrappee(),
+ maBlendColor(),
+ maGetterValue()
+ {}
+
+ template< class T > explicit ConstantColorBlendSetterAccessorAdapter( T acc ) :
+ maFunctor(),
+ maWrappee(acc),
+ maBlendColor(),
+ maGetterValue()
+ {}
+
+ template< class T > ConstantColorBlendSetterAccessorAdapter( T acc,
+ color_type col ) :
+ maFunctor(),
+ maWrappee(acc),
+ maBlendColor(col),
+ maGetterValue()
+ {}
+
+ template< class T > ConstantColorBlendSetterAccessorAdapter( T acc,
+ color_type col,
+ value_type val ) :
+ maFunctor(),
+ maWrappee(acc),
+ maBlendColor(col),
+ maGetterValue(val)
+ {}
+
+ // -------------------------------------------------------
+
+ void setColor( color_type col ) { maBlendColor=col; }
+ color_type getColor() { return maBlendColor; }
+ void setGetterValue( value_type val ) { maGetterValue=val; }
+ value_type getGetterValue() { return maGetterValue; }
+
+ // -------------------------------------------------------
+
+ WrappedAccessor const& getWrappedAccessor() const { return maWrappee; }
+ WrappedAccessor& getWrappedAccessor() { return maWrappee; }
+
+ // -------------------------------------------------------
+
+ /// @return constant value, regardless of iterator content
+ template< typename IteratorType > value_type operator()(SAL_UNUSED_PARAMETER IteratorType const& ) const
+ {
+ return maGetterValue;
+ }
+ /// @return constant value, regardless of iterator content
+ template< typename IteratorType, class Difference >
+ value_type operator()(SAL_UNUSED_PARAMETER IteratorType const& , SAL_UNUSED_PARAMETER Difference const& ) const
+ {
+ return maGetterValue;
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, typename IteratorType >
+ void set(V const& value, IteratorType const& i) const
+ {
+ maWrappee.set(
+ maFunctor(
+ vigra::detail::RequiresExplicitCast<alpha_type>::cast(value),
+ maWrappee(i),
+ maBlendColor),
+ i );
+ }
+
+ template< typename V, typename IteratorType, class Difference >
+ void set(V const& value, IteratorType const& i, Difference const& diff) const
+ {
+ maWrappee.set(
+ maFunctor(
+ vigra::detail::RequiresExplicitCast<alpha_type>::cast(value),
+ maWrappee(i,diff),
+ maBlendColor),
+ i,
+ diff );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_COLORBLENDACCESSORADAPTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/colormisc.hxx b/include/basebmp/colormisc.hxx
new file mode 100644
index 000000000000..d2142968d3ba
--- /dev/null
+++ b/include/basebmp/colormisc.hxx
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLORMISC_HXX
+#define INCLUDED_BASEBMP_COLORMISC_HXX
+
+#include <osl/diagnose.h>
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessortraits.hxx>
+#include <vigra/mathutil.hxx>
+
+// Contents of this header moved out of color.hxx, as it is not useful
+// for the general public (drags in vigra and other template
+// functionality, that shouldn't be necessary for the ordinary client
+// of BitmapDevice etc.)
+
+namespace basebmp
+{
+
+template< bool polarity > struct ColorBitmaskOutputMaskFunctor;
+template<> struct ColorBitmaskOutputMaskFunctor<true> : MaskFunctorBase<Color,sal_uInt8>
+{
+ Color operator()( Color v1, sal_uInt8 m, Color v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return Color(v1.toInt32()*(sal_uInt8)(1-m) + v2.toInt32()*m);
+ }
+};
+template<> struct ColorBitmaskOutputMaskFunctor<false> : MaskFunctorBase<Color,sal_uInt8>
+{
+ Color operator()( Color v1, sal_uInt8 m, Color v2 ) const
+ {
+ OSL_ASSERT(m<=1);
+
+ return Color(v1.toInt32()*m + v2.toInt32()*(sal_uInt8)(1-m));
+ }
+};
+
+/// Specialized output mask functor for Color value type
+template<bool polarity> struct outputMaskFunctorSelector< Color, sal_uInt8, polarity, FastMask >
+{
+ typedef ColorBitmaskOutputMaskFunctor<polarity> type;
+};
+
+template< bool polarity > struct ColorBlendFunctor8
+ : public TernaryFunctorBase<sal_uInt8,Color,Color,Color>
+{
+ Color operator()( sal_uInt8 alpha,
+ Color v1,
+ Color v2 ) const
+ {
+ alpha = polarity ? alpha : 255 - alpha;
+
+ const sal_uInt8 v1_red( v1.getRed() );
+ const sal_uInt8 v1_green( v1.getGreen() );
+ const sal_uInt8 v1_blue( v1.getBlue() );
+
+ // using '>> 8' instead of '/ 0x100' is ill-advised (shifted
+ // value might be negative). Better rely on decent optimizer
+ // here...
+ return Color(((((sal_Int32)v2.getRed() - v1_red)*alpha) / 0x100) + v1_red,
+ ((((sal_Int32)v2.getGreen() - v1_green)*alpha) / 0x100) + v1_green,
+ ((((sal_Int32)v2.getBlue() - v1_blue)*alpha) / 0x100) + v1_blue);
+ }
+};
+
+template< bool polarity > struct ColorBlendFunctor32
+ : public TernaryFunctorBase<Color,Color,Color,Color>
+{
+ Color operator()( Color input,
+ Color v1,
+ Color v2 ) const
+ {
+ sal_uInt8 alpha = input.getGreyscale();
+ alpha = polarity ? alpha : 255 - alpha;
+
+ const sal_uInt8 v1_red( v1.getRed() );
+ const sal_uInt8 v1_green( v1.getGreen() );
+ const sal_uInt8 v1_blue( v1.getBlue() );
+
+ // using '>> 8' instead of '/ 0x100' is ill-advised (shifted
+ // value might be negative). Better rely on decent optimizer
+ // here...
+ return Color(((((sal_Int32)v2.getRed() - v1_red)*alpha) / 0x100) + v1_red,
+ ((((sal_Int32)v2.getGreen() - v1_green)*alpha) / 0x100) + v1_green,
+ ((((sal_Int32)v2.getBlue() - v1_blue)*alpha) / 0x100) + v1_blue);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template<> struct ColorTraits< Color >
+{
+ /// @return number of color channels
+ static int numChannels() { return 3; }
+
+ /// Type of a color component (i.e. the type of an individual channel)
+ typedef sal_uInt8 component_type;
+
+ /// Metafunction to select blend functor from color and alpha type
+ template< typename AlphaType, bool polarity > struct blend_functor;
+
+ /// Calculate normalized distance between color c1 and c2
+ static inline double distance( const Color& c1,
+ const Color& c2 )
+ {
+ return (c1 - c2).magnitude();
+ }
+
+ static inline component_type toGreyscale( const Color& c )
+ {
+ return c.getGreyscale();
+ }
+
+ static inline Color fromGreyscale( component_type c )
+ {
+ return Color(c,c,c);
+ }
+};
+
+/// The version for plain 8 bit alpha
+template<bool polarity> struct ColorTraits< Color >::blend_functor< sal_uInt8, polarity >
+{
+ typedef ColorBlendFunctor8<polarity> type;
+};
+
+/// The version taking grey value of a Color
+template<bool polarity> struct ColorTraits< Color >::blend_functor< Color, polarity >
+{
+ typedef ColorBlendFunctor32<polarity> type;
+};
+
+} // namespace basebmp
+
+namespace vigra
+{
+
+template<>
+struct NumericTraits<basebmp::Color>
+{
+ typedef basebmp::Color Type;
+ typedef basebmp::Color Promote;
+ typedef basebmp::Color RealPromote;
+ typedef std::complex<basebmp::Color> ComplexPromote;
+ typedef sal_uInt8 ValueType;
+
+ typedef VigraTrueType isIntegral;
+ typedef VigraFalseType isScalar;
+ typedef VigraTrueType isSigned;
+ typedef VigraTrueType isOrdered;
+ typedef VigraFalseType isComplex;
+
+ static Type zero() { return Type(); }
+ static Type one() { return Type(0x01010101); }
+ static Type nonZero() { return Type(0x01010101); }
+
+ static Promote toPromote(const Type& v) { return v; }
+ static RealPromote toRealPromote(const Type& v) { return v; }
+ static Type fromPromote(const Promote& v) { return v; }
+ static Type fromRealPromote(const RealPromote& v) { return v; }
+};
+
+} // namespace vigra
+
+#endif /* INCLUDED_BASEBMP_COLORMISC_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/colortraits.hxx b/include/basebmp/colortraits.hxx
new file mode 100644
index 000000000000..bcbc8f9b259d
--- /dev/null
+++ b/include/basebmp/colortraits.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COLORTRAITS_HXX
+#define INCLUDED_BASEBMP_COLORTRAITS_HXX
+
+#include <basebmp/accessoradapters.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <vigra/mathutil.hxx>
+
+namespace basebmp
+{
+
+/** Functor template, to calculate alpha blending between two
+ values. Float case.
+
+ @tpl polarity
+ When true, 0 means fully transparent, and 1 fully opaque. And vice
+ versa.
+ */
+template< typename ValueType,
+ typename AlphaType,
+ bool polarity > struct BlendFunctor;
+template< typename ValueType,
+ typename AlphaType > struct BlendFunctor<ValueType,AlphaType,true>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ const typename vigra::NumericTraits<AlphaType>::RealPromote fAlpha(
+ vigra::NumericTraits<AlphaType>::toRealPromote(alpha));
+ return (vigra::NumericTraits<AlphaType>::one()-fAlpha)*v1 + fAlpha*v2;
+ }
+};
+template< typename ValueType,
+ typename AlphaType > struct BlendFunctor<ValueType,AlphaType,false>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ const typename vigra::NumericTraits<AlphaType>::RealPromote fAlpha(
+ vigra::NumericTraits<AlphaType>::toRealPromote(alpha));
+ return fAlpha*v1 + (vigra::NumericTraits<AlphaType>::one()-fAlpha)*v2;
+ }
+};
+
+/** Functor template, to calculate alpha blending between two
+ values. Integer case.
+
+ @tpl polarity
+ When true, 0 means fully transparent, and 1 fully opaque. And vice
+ versa.
+ */
+template< typename ValueType,
+ typename AlphaType,
+ bool polarity > struct IntegerBlendFunctor;
+template< typename ValueType,
+ typename AlphaType > struct IntegerBlendFunctor<ValueType,AlphaType,true>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ return (vigra::NumericTraits<AlphaType>::toPromote(
+ vigra::NumericTraits<AlphaType>::max()-alpha)*v1 + alpha*v2) /
+ vigra::NumericTraits<AlphaType>::max();
+ }
+};
+template< typename ValueType,
+ typename AlphaType > struct IntegerBlendFunctor<ValueType,AlphaType,false>
+ : public TernaryFunctorBase<AlphaType,ValueType,ValueType,ValueType>
+{
+ ValueType operator()( AlphaType alpha,
+ ValueType v1,
+ ValueType v2 ) const
+ {
+ return (alpha*v1 +
+ vigra::NumericTraits<AlphaType>::toPromote(
+ vigra::NumericTraits<AlphaType>::max()-alpha)*v2) /
+ vigra::NumericTraits<AlphaType>::max();
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename ColorType > struct ColorTraits
+{
+ /// Metafunction to select blend functor from color and alpha type
+ template< typename AlphaType, bool polarity > struct blend_functor : public
+ ifScalarIntegral< AlphaType,
+ IntegerBlendFunctor< ColorType, AlphaType, polarity >,
+ BlendFunctor< ColorType, AlphaType, polarity > > {};
+
+ /// @return number of color channels
+ static int numChannels() { return 1; }
+
+ /// Type of a color component (i.e. the type of an individual channel)
+ typedef ColorType component_type;
+
+ /// Calculate normalized distance between color c1 and c2
+ static inline vigra::NormTraits<ColorType> distance( ColorType c1,
+ ColorType c2 )
+ {
+ return vigra::norm(c1 - c2);
+ }
+
+ static inline component_type toGreyscale( ColorType c )
+ {
+ return c;
+ }
+
+ static inline ColorType fromGreyscale( component_type c )
+ {
+ return c;
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_COLORTRAITS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/compositeiterator.hxx b/include/basebmp/compositeiterator.hxx
new file mode 100644
index 000000000000..4fb9c10f0bb4
--- /dev/null
+++ b/include/basebmp/compositeiterator.hxx
@@ -0,0 +1,361 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_COMPOSITEITERATOR_HXX
+#define INCLUDED_BASEBMP_COMPOSITEITERATOR_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+
+#include <basebmp/nonstandarditerator.hxx>
+#include <vigra/tuple.hxx>
+#include <vigra/iteratortraits.hxx>
+
+
+namespace basebmp
+{
+
+namespace detail
+{
+ template< typename T1, typename T2 > class ArithmeticProxy
+ {
+ public:
+ ArithmeticProxy(T1& val1, T2& val2) :
+ mpVal1( &val1 ),
+ mpVal2( &val2 )
+ {}
+
+ void operator++() { ++(*mpVal1); ++(*mpVal2); }
+ void operator++(int) { (*mpVal1)++; (*mpVal2)++; }
+ void operator--() { --(*mpVal1); --(*mpVal2); }
+ void operator--(int) { (*mpVal1)--; (*mpVal2)--; }
+ void operator+=(int d) {*mpVal1+=d; *mpVal2+=d; }
+ void operator-=(int d) {*mpVal1-=d; *mpVal2-=d; }
+
+ bool operator==(ArithmeticProxy const & rhs) const
+ { return *mpVal1==*rhs.mpVal1 && *mpVal2==*rhs.mpVal2; }
+
+ bool operator!=(ArithmeticProxy const & rhs) const
+ { return *mpVal1!=*rhs.mpVal1 || *mpVal2!=*rhs.mpVal2; }
+
+ bool operator<(ArithmeticProxy const & rhs) const
+ { return *mpVal1<*rhs.mpVal1 && *mpVal2<*rhs.mpVal2; }
+
+ bool operator<=(ArithmeticProxy const & rhs) const
+ { return *mpVal1<=*rhs.mpVal1 && *mpVal2<=*rhs.mpVal2; }
+
+ bool operator>(ArithmeticProxy const & rhs) const
+ { return *mpVal1>*rhs.mpVal1 && *mpVal2>*rhs.mpVal2; }
+
+ bool operator>=(ArithmeticProxy const & rhs) const
+ { return *mpVal1>=*rhs.mpVal1 && *mpVal2>=*rhs.mpVal2; }
+
+ int operator-(ArithmeticProxy const & rhs) const
+ { return *mpVal1 - *rhs.mpVal1; }
+
+ private:
+ T1* mpVal1;
+ T2* mpVal2;
+ };
+
+ template< typename Iterator1,
+ typename Iterator2,
+ typename ValueType,
+ typename DifferenceType,
+ typename IteratorCategory,
+ class Derived >
+ class CompositeIteratorBase : public NonStandardIterator
+ {
+ public:
+ typedef Iterator1 iterator1_type;
+ typedef Iterator2 iterator2_type;
+ typedef ValueType value_type;
+ typedef DifferenceType difference_type;
+ typedef IteratorCategory iterator_category;
+
+ protected:
+ iterator1_type maIter1;
+ iterator2_type maIter2;
+
+ private:
+ bool equal(CompositeIteratorBase const & rhs) const
+ {
+ return (maIter1 == rhs.maIter1) && (maIter2 == rhs.maIter2);
+ }
+
+ public:
+ CompositeIteratorBase() :
+ maIter1(),
+ maIter2()
+ {}
+
+ CompositeIteratorBase( const iterator1_type& rIter1, const iterator2_type& rIter2 ) :
+ maIter1( rIter1 ),
+ maIter2( rIter2 )
+ {}
+
+ bool operator==(Derived const & rhs) const
+ {
+ return equal(rhs);
+ }
+
+ bool operator!=(Derived const & rhs) const
+ {
+ return !equal(rhs);
+ }
+
+ difference_type operator-(Derived const & rhs) const
+ {
+ OSL_ASSERT( maIter1 - rhs.maIter1 == maIter2 - rhs.maIter2 );
+ return maIter1 - rhs.maIter1;
+ }
+
+ Derived & operator+=(difference_type const & s)
+ {
+ maIter1 += s;
+ maIter2 += s;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived & operator-=(difference_type const & s)
+ {
+ maIter1 -= s;
+ maIter2 -= s;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived operator+(difference_type const & s) const
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ ret += s;
+ return ret;
+ }
+
+ Derived operator-(difference_type const & s) const
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ ret -= s;
+ return ret;
+ }
+
+ Derived& operator++()
+ {
+ ++maIter1;
+ ++maIter2;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived& operator--()
+ {
+ --maIter1;
+ --maIter2;
+ return static_cast<Derived&>(*this);
+ }
+
+ Derived operator++(int)
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ ++maIter1;
+ ++maIter2;
+ return ret;
+ }
+
+ Derived operator--(int)
+ {
+ Derived ret(static_cast<Derived const&>(*this));
+ --maIter1;
+ --maIter2;
+ return ret;
+ }
+
+ value_type get() const
+ {
+ return value_type(maIter1.get(),
+ maIter2.get());
+ }
+
+ value_type get(difference_type const & d) const
+ {
+ return value_type(maIter1.get(d),
+ maIter2.get(d));
+ }
+
+ void set( value_type v ) const
+ {
+ maIter1.set(v);
+ maIter2.set(v);
+ }
+
+ void set( value_type v, difference_type const & d ) const
+ {
+ maIter1.set(v,d);
+ maIter2.set(v,d);
+ }
+
+ const iterator1_type& first() const { return maIter1; }
+ iterator1_type& first() { return maIter1; }
+
+ const iterator2_type& second() const { return maIter2; }
+ iterator2_type& second() { return maIter2; }
+ };
+}
+
+/** Provide the composition of two 1D image iterators
+
+ Use this template to compose two iterators into one (e.g. image
+ and mask). Operations are transitive, e.g. operator== only returns
+ true, if both wrapped iterator operator== have yielded true.
+
+ Note that both iterators must have compatible difference types. To
+ avoid funny effects, iterator ranges given by a CompositeIterator
+ should consist of wrapped iterators of similar range
+ */
+template< typename Iterator1,
+ typename Iterator2,
+ typename ValueType,
+ typename DifferenceType,
+ typename IteratorCategory >
+class CompositeIterator1D :
+ public detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory,
+ CompositeIterator1D<Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory> >
+{
+ typedef detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory,
+ CompositeIterator1D<Iterator1,
+ Iterator2,
+ ValueType,
+ DifferenceType,
+ IteratorCategory> > base_type;
+public:
+ CompositeIterator1D() :
+ base_type()
+ {}
+
+ CompositeIterator1D( const Iterator1& rIter1,
+ const Iterator2& rIter2 ) :
+ base_type( rIter1, rIter2 )
+ {}
+};
+
+/** Provide the composition of two 2D image iterators
+
+ Use this template to compose two iterators into one (e.g. image
+ and mask). Operations are transitive, e.g. operator== only returns
+ true, if both wrapped iterator operator== have yielded true.
+
+ Note that both iterators must have compatible difference types. To
+ avoid funny effects, iterator ranges given by a CompositeIterator
+ should consist of wrapped iterators of similar range
+ */
+template< typename Iterator1, typename Iterator2 > class CompositeIterator2D :
+ public detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ std::pair<
+ typename vigra::IteratorTraits<Iterator1>::value_type,
+ typename vigra::IteratorTraits<Iterator2>::value_type >,
+ typename vigra::IteratorTraits<Iterator1>::difference_type,
+ typename vigra::IteratorTraits<Iterator1>::iterator_category,
+ CompositeIterator2D<Iterator1, Iterator2> >
+{
+ typedef detail::CompositeIteratorBase< Iterator1,
+ Iterator2,
+ std::pair<
+ typename vigra::IteratorTraits<Iterator1>::value_type,
+ typename vigra::IteratorTraits<Iterator2>::value_type >,
+ typename vigra::IteratorTraits<Iterator1>::difference_type,
+ typename vigra::IteratorTraits<Iterator1>::iterator_category,
+ CompositeIterator2D<Iterator1, Iterator2> > base_type;
+public:
+ typedef CompositeIterator1D< typename Iterator1::row_iterator,
+ typename Iterator2::row_iterator,
+ typename base_type::value_type,
+ int,
+ typename base_type::iterator_category > row_iterator;
+ typedef CompositeIterator1D< typename Iterator1::column_iterator,
+ typename Iterator2::column_iterator,
+ typename base_type::value_type,
+ int,
+ typename base_type::iterator_category > column_iterator;
+
+ typedef detail::ArithmeticProxy< typename Iterator1::MoveX,
+ typename Iterator2::MoveX > MoveX;
+ typedef detail::ArithmeticProxy< typename Iterator1::MoveY,
+ typename Iterator2::MoveY > MoveY;
+
+ MoveX x;
+ MoveY y;
+
+ CompositeIterator2D() :
+ base_type(),
+ x(this->maIter1.x,this->maIter2.x),
+ y(this->maIter1.y,this->maIter2.y)
+ {}
+
+ CompositeIterator2D( const Iterator1& rIter1, const Iterator2& rIter2 ) :
+ base_type( rIter1, rIter2 ),
+ x(this->maIter1.x,this->maIter2.x),
+ y(this->maIter1.y,this->maIter2.y)
+ {}
+
+ CompositeIterator2D( const CompositeIterator2D& rOld ) :
+ base_type(rOld),
+ x(this->maIter1.x,this->maIter2.x),
+ y(this->maIter1.y,this->maIter2.y)
+ {}
+
+ CompositeIterator2D& operator=( const CompositeIterator2D& rNew )
+ {
+ this->maIter1 = rNew.maIter1;
+ this->maIter2 = rNew.maIter2;
+
+ x = MoveX(this->maIter1.x,
+ this->maIter2.x);
+ y = MoveY(this->maIter1.y,
+ this->maIter2.y);
+ }
+
+ row_iterator rowIterator() const
+ {
+ return row_iterator(this->maIter1.rowIterator(),
+ this->maIter2.rowIterator());
+ }
+
+ column_iterator columnIterator() const
+ {
+ return column_iterator(this->maIter1.columnIterator(),
+ this->maIter2.columnIterator());
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_COMPOSITEITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/debug.hxx b/include/basebmp/debug.hxx
new file mode 100644
index 000000000000..688daf41c834
--- /dev/null
+++ b/include/basebmp/debug.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_DEBUG_HXX
+#define INCLUDED_BASEBMP_DEBUG_HXX
+
+#include <iostream>
+#include <boost/shared_ptr.hpp>
+#include <basebmp/basebmpdllapi.h>
+
+namespace basebmp
+{
+ class BitmapDevice;
+
+ /** Dump content of BitmapDevice to given output stream.
+
+ @param rDevice
+ Device whose content should be dumped.
+
+ @param rOutputStream
+ Stream to write output to.
+
+ Used in vcl/headless/svpgdi.cxx when OSL_DEBUG_LEVEL > 2
+
+ Use like this:
+<pre>
+ #include <basebmp/debug.hxx>
+ #include <iostream>
+ #include <fstream>
+
+ std::ofstream output("/tmp/my_test.dump");
+ debugDump( pMyDevice, output );
+</pre>
+ */
+ void BASEBMP_DLLPUBLIC debugDump( const boost::shared_ptr< BitmapDevice >& rDevice,
+ ::std::ostream& rOutputStream );
+}
+
+#endif /* INCLUDED_BASEBMP_DEBUG_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/drawmodes.hxx b/include/basebmp/drawmodes.hxx
new file mode 100644
index 000000000000..a5f98ed3d418
--- /dev/null
+++ b/include/basebmp/drawmodes.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_DRAWMODES_HXX
+#define INCLUDED_BASEBMP_DRAWMODES_HXX
+
+/* Definition of Draw modes */
+
+namespace basebmp
+{
+ enum DrawMode
+ {
+ /** Default draw mode, which simply renders pixel in the
+ requested color
+ */
+ DrawMode_PAINT,
+
+ /** XOR draw mode, which XORs each existing pixel value with
+ the new color.
+
+ The result of this XOR operation strongly depends on the
+ underlying pixel format, as it is defined by the bitwise
+ XOR of the (potentially palette-looked-up) color value and
+ the existing pixel content (being it true color or a
+ palette index).
+ */
+ DrawMode_XOR
+ };
+}
+
+#endif /* INCLUDED_BASEBMP_DRAWMODES_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/endian.hxx b/include/basebmp/endian.hxx
new file mode 100644
index 000000000000..22c32b6077ac
--- /dev/null
+++ b/include/basebmp/endian.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ENDIAN_HXX
+#define INCLUDED_BASEBMP_ENDIAN_HXX
+
+#include <osl/endian.h>
+
+namespace basebmp
+{
+
+/// Swap the order of bytes for the given POD type
+template< typename T > inline T byteSwap( T );
+
+#define BASEBMP_BYTE_SWAP(Type,SwapFunc) \
+ template<> inline Type byteSwap<Type>( Type v ) \
+ { \
+ return SwapFunc(v); \
+ }
+
+// byteSwap<T> shall fail for any type T not in the list below
+BASEBMP_BYTE_SWAP(sal_Int8,)
+BASEBMP_BYTE_SWAP(sal_uInt8,)
+BASEBMP_BYTE_SWAP(sal_Int16,OSL_SWAPWORD)
+BASEBMP_BYTE_SWAP(sal_uInt16,OSL_SWAPWORD)
+BASEBMP_BYTE_SWAP(sal_Int32,OSL_SWAPDWORD)
+BASEBMP_BYTE_SWAP(sal_uInt32,OSL_SWAPDWORD)
+
+#undef BASEBMP_BYTE_SWAP
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ENDIAN_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/fillimage.hxx b/include/basebmp/fillimage.hxx
new file mode 100644
index 000000000000..815ec32539bf
--- /dev/null
+++ b/include/basebmp/fillimage.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_FILLIMAGE_HXX
+#define INCLUDED_BASEBMP_FILLIMAGE_HXX
+
+#include <vigra/tuple.hxx>
+#include <vigra/iteratortraits.hxx>
+
+namespace basebmp
+{
+
+template< class DestIterator, class DestAccessor, typename T >
+void fillImage( DestIterator begin,
+ DestIterator end,
+ DestAccessor ad,
+ T fillVal )
+{
+ const int width ( end.x - begin.x );
+ const int height( end.y - begin.y );
+
+ for( int y=0; y<height; ++y, ++begin.y )
+ {
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowIter( begin.rowIterator() );
+ const typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowEnd( rowIter + width );
+
+ // TODO(P2): Provide specialized span fill methods on the
+ // iterator/accessor
+ while( rowIter != rowEnd )
+ ad.set(fillVal, rowIter++);
+ }
+}
+
+template< class DestIterator, class DestAccessor, typename T >
+inline void fillImage( vigra::triple<DestIterator,DestIterator,DestAccessor> const& src,
+ T fillVal )
+{
+ fillImage(src.first,src.second,src.third,fillVal);
+}
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_FILLIMAGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/genericcolorimageaccessor.hxx b/include/basebmp/genericcolorimageaccessor.hxx
new file mode 100644
index 000000000000..5aaa95327176
--- /dev/null
+++ b/include/basebmp/genericcolorimageaccessor.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX
+#define INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/bitmapdevice.hxx>
+
+namespace basebmp
+{
+ /** Access a BitmapDevice generically
+
+ This accessor deals with an opaque BitmapDevice generically,
+ via getPixel()/setPixel() at the published interface.
+ */
+ class GenericColorImageAccessor
+ {
+ BitmapDeviceSharedPtr mpDevice;
+ DrawMode meDrawMode;
+
+ public:
+ typedef Color value_type;
+
+ explicit GenericColorImageAccessor( BitmapDeviceSharedPtr const& rTarget ) :
+ mpDevice(rTarget),
+ meDrawMode(DrawMode_PAINT)
+ {}
+
+ GenericColorImageAccessor( BitmapDeviceSharedPtr const& rTarget,
+ DrawMode eDrawMode ) :
+ mpDevice(rTarget),
+ meDrawMode(eDrawMode)
+ {}
+
+ template< typename Iterator >
+ Color operator()( Iterator const& i ) const
+ { return mpDevice->getPixel( basegfx::B2IPoint( i->x,i->y ) ); }
+
+ template< typename Iterator, typename Difference >
+ Color operator()( Iterator const& i, Difference const& diff) const
+ { return mpDevice->getPixel( basegfx::B2IPoint( i[diff]->x,
+ i[diff]->y ) ); }
+
+ template< typename Iterator >
+ void set(Color const& value, Iterator const& i) const
+ { return mpDevice->setPixel( basegfx::B2IPoint( i->x,i->y ),
+ value, meDrawMode ); }
+
+ template< class Iterator, class Difference >
+ void set(value_type const& value, Iterator const& i, Difference const& diff) const
+ { return mpDevice->setPixel( basegfx::B2IPoint( i[diff]->x,
+ i[diff]->y ),
+ value, meDrawMode ); }
+ };
+}
+
+#endif /* INCLUDED_BASEBMP_GENERICCOLORIMAGEACCESSOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/greylevelformats.hxx b/include/basebmp/greylevelformats.hxx
new file mode 100644
index 000000000000..3fcd90fcda5f
--- /dev/null
+++ b/include/basebmp/greylevelformats.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_GREYLEVELFORMATS_HXX
+#define INCLUDED_BASEBMP_GREYLEVELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/packedpixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+template< typename PixelType,
+ typename ColorType,
+ int UsedRange > struct GreylevelGetter :
+ public std::unary_function<PixelType, ColorType>
+{
+ ColorType operator()( PixelType const& c ) const
+ {
+ return ColorTraits<ColorType>::fromGreyscale(
+ vigra::NumericTraits<PixelType>::toPromote(c) *
+ vigra::NumericTraits<PixelType>::maxConst / UsedRange );
+ }
+};
+
+template< typename PixelType,
+ typename ColorType,
+ int UsedRange > struct GreylevelSetter :
+ public std::unary_function<ColorType, PixelType>
+{
+ PixelType operator()( ColorType const& c ) const
+ {
+ return vigra::NumericTraits<PixelType>::toPromote(
+ ColorTraits<ColorType>::toGreyscale(c)) *
+ UsedRange /
+ vigra::NumericTraits<PixelType>::maxConst;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< class Iterator,
+ class Accessor,
+ int UsedRange > struct PixelFormatTraitsTemplate_Greylevel
+{
+ typedef typename Iterator::value_type pixel_type;
+
+ typedef GreylevelGetter<pixel_type,
+ Color,
+ UsedRange> getter_type;
+ typedef GreylevelSetter<pixel_type,
+ Color,
+ UsedRange> setter_type;
+
+ typedef Iterator iterator_type;
+ typedef Accessor raw_accessor_type;
+ typedef AccessorSelector<
+ getter_type,
+ setter_type > accessor_selector;
+};
+
+template< int BitsPerPixel,
+ bool MsbFirst > struct PixelFormatTraitsTemplate_PackedGreylevel :
+ public PixelFormatTraitsTemplate_Greylevel<
+ PackedPixelIterator< sal_uInt8,
+ BitsPerPixel,
+ true >,
+ NonStandardAccessor< sal_uInt8 >,
+ (1UL << BitsPerPixel)-1 >
+{};
+
+//-----------------------------------------------------------------------------
+
+// 1bpp MSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<1, true> PixelFormatTraits_GREY1_MSB;
+
+// 1bpp LSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<1, false> PixelFormatTraits_GREY1_LSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_GREY1_MSB::getter_type,
+ PixelFormatTraits_GREY1_MSB::setter_type);
+
+
+// 4bpp MSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<4, true> PixelFormatTraits_GREY4_MSB;
+
+// 4bpp LSB
+typedef PixelFormatTraitsTemplate_PackedGreylevel<4, false> PixelFormatTraits_GREY4_LSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_GREY4_MSB::getter_type,
+ PixelFormatTraits_GREY4_MSB::setter_type);
+
+// 8bpp
+typedef PixelFormatTraitsTemplate_Greylevel<
+ PixelIterator< sal_uInt8 >,
+ StandardAccessor< sal_uInt8 >,
+ 255 > PixelFormatTraits_GREY8;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_GREY8::getter_type,
+ PixelFormatTraits_GREY8::setter_type);
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_GREYLEVELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/iteratortraits.hxx b/include/basebmp/iteratortraits.hxx
new file mode 100644
index 000000000000..5d87df7d5a85
--- /dev/null
+++ b/include/basebmp/iteratortraits.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_ITERATORTRAITS_HXX
+#define INCLUDED_BASEBMP_ITERATORTRAITS_HXX
+
+#include <basebmp/accessor.hxx>
+#include <basebmp/nonstandarditerator.hxx>
+
+namespace basebmp
+{
+
+template< class Iterator > struct IteratorTraits
+{
+ /// VigraTrueType, if iterator does not provide *operator()/operator[] methods
+ typedef typename vigra::IsDerivedFrom<Iterator,NonStandardIterator>::result
+ isNonStandardIterator;
+
+ /// Retrieve default accessor for this iterator (and given value type)
+ template< typename ValueType > struct defaultAccessor : public
+ // select according to non-standardness of iterator type
+ vigra::If< isNonStandardIterator,
+ NonStandardAccessor< ValueType >,
+ StandardAccessor< ValueType > >
+ {};
+
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_ITERATORTRAITS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/metafunctions.hxx b/include/basebmp/metafunctions.hxx
new file mode 100644
index 000000000000..e451dce8e4d9
--- /dev/null
+++ b/include/basebmp/metafunctions.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_METAFUNCTIONS_HXX
+#define INCLUDED_BASEBMP_METAFUNCTIONS_HXX
+
+#include <boost/mpl/integral_c.hpp>
+#include <vigra/metaprogramming.hxx>
+#include <vigra/numerictraits.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+// TODO(Q3): move to generic place (o3tl?)
+
+/** template meta function: add const qualifier to 2nd type, if given
+ 1st type has it
+*/
+template<typename A, typename B> struct clone_const
+{
+ typedef B type;
+};
+template<typename A, typename B> struct clone_const<const A,B>
+{
+ typedef const B type;
+};
+
+/** template meta function: add const qualifier to plain type (if not
+ already there)
+ */
+template <typename T> struct add_const
+{
+ typedef const T type;
+};
+template <typename T> struct add_const<const T>
+{
+ typedef const T type;
+};
+
+/// template meta function: remove const qualifier from plain type
+template <typename T> struct remove_const
+{
+ typedef T type;
+};
+template <typename T> struct remove_const<const T>
+{
+ typedef T type;
+};
+
+//--------------------------------------------------------------
+
+/// Base class for an adaptable ternary functor
+template< typename A1, typename A2, typename A3, typename R > struct TernaryFunctorBase
+{
+ typedef A1 first_argument_type;
+ typedef A2 second_argument_type;
+ typedef A3 third_argument_type;
+ typedef R result_type;
+};
+
+//--------------------------------------------------------------
+
+/** template meta function: ensure that given integer type is unsigned
+
+ If given integer type is already unsigned, return as-is -
+ otherwise, convert to unsigned type of same or greater range.
+ */
+template< typename T > struct make_unsigned;
+
+#define BASEBMP_MAKE_UNSIGNED(T,U) \
+ template<> struct make_unsigned<T> { \
+ typedef U type; \
+ };
+
+BASEBMP_MAKE_UNSIGNED(signed char,unsigned char)
+BASEBMP_MAKE_UNSIGNED(unsigned char,unsigned char)
+BASEBMP_MAKE_UNSIGNED(short,unsigned short)
+BASEBMP_MAKE_UNSIGNED(unsigned short,unsigned short)
+BASEBMP_MAKE_UNSIGNED(int,unsigned int)
+BASEBMP_MAKE_UNSIGNED(unsigned int,unsigned int)
+BASEBMP_MAKE_UNSIGNED(long,unsigned long)
+BASEBMP_MAKE_UNSIGNED(unsigned long,unsigned long)
+
+#undef BASEBMP_MAKE_UNSIGNED
+
+/// cast integer to unsigned type of similar size
+template< typename T > inline typename make_unsigned<T>::type unsigned_cast( T value )
+{
+ return static_cast< typename make_unsigned<T>::type >(value);
+}
+
+//--------------------------------------------------------------
+
+/// returns true, if given number is strictly less than 0
+template< typename T > inline bool is_negative( T x )
+{
+ return x < 0;
+}
+
+/// Overload for ints (branch-free)
+inline bool is_negative( int x )
+{
+ // force logic shift (result for signed shift right is undefined)
+ return static_cast<unsigned int>(x) >> (sizeof(int)*8-1);
+}
+
+//--------------------------------------------------------------
+
+/// Results in VigraTrueType, if T is of integer type and scalar
+template< typename T, typename trueCase, typename falseCase >
+struct ifScalarIntegral
+{
+ typedef
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isIntegral,
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isScalar,
+ trueCase,
+ falseCase >::type,
+ falseCase >::type type;
+};
+
+/// Results in VigraTrueType, if T is of non-integer type and scalar
+template< typename T, typename trueCase, typename falseCase >
+struct ifScalarNonIntegral
+{
+ typedef
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isIntegral,
+ falseCase,
+ typename vigra::If<
+ typename vigra::NumericTraits< T >::isScalar,
+ trueCase,
+ falseCase >::type >::type type;
+};
+
+/// Results in VigraTrueType, if both T1 and T2 are of integer type and scalar
+template< typename T1, typename T2, typename trueCase, typename falseCase >
+struct ifBothScalarIntegral
+{
+ typedef
+ typename ifScalarIntegral<
+ T1,
+ typename ifScalarIntegral<
+ T2,
+ trueCase,
+ falseCase >::type,
+ falseCase >::type type;
+};
+
+//--------------------------------------------------------------
+
+/// Count number of trailing zeros
+template< unsigned int val > struct numberOfTrailingZeros
+{
+ enum { next = val >> 1 };
+ enum { value = vigra::IfBool< (val & 1) == 0,
+ numberOfTrailingZeros<next>,
+ boost::mpl::integral_c< int,-1 > > ::type::value + 1 };
+};
+
+template<> struct numberOfTrailingZeros<0>
+{
+ enum { value = 0 };
+};
+
+//--------------------------------------------------------------
+
+/// Count number of one bits
+template< unsigned int val > struct bitcount
+{
+ enum { next = val >> 1 };
+ enum { value = bitcount<next>::value + (val & 1) };
+};
+
+template<> struct bitcount<0>
+{
+ enum { value = 0 };
+};
+
+//--------------------------------------------------------------
+
+/// Shift left for positive shift value, and right otherwise
+template< typename T > inline T shiftLeft( T v, int shift )
+{
+ return shift > 0 ? v << shift : v >> (-shift);
+}
+
+/// Shift right for positive shift value, and left otherwise
+template< typename T > inline T shiftRight( T v, int shift )
+{
+ return shift > 0 ? v >> shift : v << (-shift);
+}
+
+//--------------------------------------------------------------
+
+/// Replace non-std project2nd from SGI extensions
+template< typename T1, typename T2 >
+struct project2nd : public std::binary_function<T1, T2, T2>
+{
+ T2 operator() (const T1&, const T2& v) const { return v; }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_METAFUNCTIONS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/nonstandarditerator.hxx b/include/basebmp/nonstandarditerator.hxx
new file mode 100644
index 000000000000..ff51c59afcee
--- /dev/null
+++ b/include/basebmp/nonstandarditerator.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_NONSTANDARDITERATOR_HXX
+#define INCLUDED_BASEBMP_NONSTANDARDITERATOR_HXX
+
+#include <vigra/metaprogramming.hxx>
+
+namespace basebmp
+{
+ /// Base class defining pointer and reference types as VigraFalseType
+ struct NonStandardIterator
+ {
+ typedef vigra::VigraFalseType reference;
+ typedef vigra::VigraFalseType index_reference;
+ typedef vigra::VigraFalseType pointer;
+ };
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_NONSTANDARDITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/packedpixeliterator.hxx b/include/basebmp/packedpixeliterator.hxx
new file mode 100644
index 000000000000..89a88506bbcd
--- /dev/null
+++ b/include/basebmp/packedpixeliterator.hxx
@@ -0,0 +1,671 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PACKEDPIXELITERATOR_HXX
+#define INCLUDED_BASEBMP_PACKEDPIXELITERATOR_HXX
+
+#include <basebmp/metafunctions.hxx>
+#include <basebmp/stridedarrayiterator.hxx>
+#include <basebmp/nonstandarditerator.hxx>
+#include <basebmp/accessortraits.hxx>
+
+#include <boost/static_assert.hpp>
+#include <vigra/metaprogramming.hxx>
+#include <vigra/diff2d.hxx>
+
+namespace basebmp
+{
+
+/// Get bitmask for data at given intra-word position, for given bit depth
+template< typename value_type,
+ int bits_per_pixel,
+ bool MsbFirst,
+ typename difference_type >
+inline value_type get_mask( difference_type d )
+{
+ BOOST_STATIC_ASSERT(bits_per_pixel > 0);
+ BOOST_STATIC_ASSERT(sizeof(value_type)*8 % bits_per_pixel == 0);
+ BOOST_STATIC_ASSERT(sizeof(value_type)*8 / bits_per_pixel > 1);
+ BOOST_STATIC_ASSERT(vigra::TypeTraits<value_type>::isPOD::asBool);
+
+ const unsigned int nIntraWordPositions( sizeof(value_type)*8 / bits_per_pixel );
+
+ // create bits_per_pixel 1s shift to intra-word position
+ return ((~(~0 << bits_per_pixel)) << bits_per_pixel*(MsbFirst ?
+ (nIntraWordPositions-1 - (d % nIntraWordPositions)) :
+ (d % nIntraWordPositions)));
+}
+
+template< int num_intraword_positions, int bits_per_pixel, bool MsbFirst, typename difference_type > inline difference_type get_shift( difference_type remainder )
+{
+ return bits_per_pixel*(MsbFirst ?
+ (num_intraword_positions - 1 - remainder) :
+ remainder);
+}
+
+template< typename Valuetype,
+ int bits_per_pixel,
+ bool MsbFirst > class PackedPixelColumnIterator : public NonStandardIterator
+{
+public:
+ // no reference, no index_reference type here
+ typedef Valuetype value_type;
+ typedef int difference_type;
+ typedef image_traverser_tag iterator_category;
+
+ typedef typename remove_const<value_type>::type mask_type;
+ typedef value_type* pointer;
+ typedef StridedArrayIterator< value_type > MoveY;
+
+ enum {
+ /** The number of pixel within a single value_type value
+ */
+ num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
+ /** Bit mask for one pixel (least significant bits)
+ */
+ bit_mask=~(~0 << bits_per_pixel)
+ };
+
+private:
+ MoveY y;
+ mask_type mask_;
+ difference_type shift_;
+
+ void inc()
+ {
+ ++y;
+ }
+
+ void dec()
+ {
+ --y;
+ }
+
+ bool equal( PackedPixelColumnIterator const & rhs ) const
+ {
+ return rhs.y == y;
+ }
+
+ bool less( PackedPixelColumnIterator const & rhs ) const
+ {
+ return y < rhs.y;
+ }
+
+public:
+ PackedPixelColumnIterator() :
+ y(0),
+ mask_( get_mask<value_type, bits_per_pixel, MsbFirst, difference_type>(0) ),
+ shift_( get_shift<num_intraword_positions, bits_per_pixel, MsbFirst, difference_type>(0) )
+ {}
+
+ PackedPixelColumnIterator( const MoveY& base, difference_type remainder ) :
+ y(base),
+ mask_( get_mask<value_type, bits_per_pixel, MsbFirst>(remainder) ),
+ shift_( get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder) )
+ {}
+
+ PackedPixelColumnIterator& operator+=( difference_type d )
+ {
+ y += d;
+ return *this;
+ }
+
+ PackedPixelColumnIterator& operator-=( difference_type d )
+ {
+ y -= d;
+ return *this;
+ }
+
+ PackedPixelColumnIterator operator+( difference_type d )
+ {
+ PackedPixelColumnIterator res(*this);
+ res += d;
+ return res;
+ }
+
+ PackedPixelColumnIterator operator-( difference_type d )
+ {
+ PackedPixelColumnIterator res(*this);
+ res -= d;
+ return res;
+ }
+
+ PackedPixelColumnIterator& operator++()
+ {
+ inc();
+ return *this;
+ }
+
+ PackedPixelColumnIterator& operator--()
+ {
+ dec();
+ return *this;
+ }
+
+ PackedPixelColumnIterator operator++(int)
+ {
+ PackedPixelColumnIterator res(*this);
+ inc();
+ return res;
+ }
+
+ PackedPixelColumnIterator operator--(int)
+ {
+ PackedPixelColumnIterator res(*this);
+ dec();
+ return res;
+ }
+
+ bool operator==(PackedPixelColumnIterator const & rhs) const
+ {
+ return equal( rhs );
+ }
+
+ bool operator!=(PackedPixelColumnIterator const & rhs) const
+ {
+ return !equal( rhs );
+ }
+
+ bool operator<(PackedPixelColumnIterator const & rhs) const
+ {
+ return less(rhs);
+ }
+
+ bool operator<=(PackedPixelColumnIterator const & rhs) const
+ {
+ return !rhs.less(*this);
+ }
+
+ bool operator>(PackedPixelColumnIterator const & rhs) const
+ {
+ return rhs.less(*this);
+ }
+
+ bool operator>=(PackedPixelColumnIterator const & rhs) const
+ {
+ return !less(rhs);
+ }
+
+ difference_type operator-(PackedPixelColumnIterator const & rhs) const
+ {
+ return y - rhs.y;
+ }
+
+ value_type get() const
+ {
+ return unsigned_cast<value_type>(*y() & mask_) >> shift_;
+ }
+
+ value_type get(difference_type d) const
+ {
+ return unsigned_cast<value_type>(*y(d) & mask_) >> shift_;
+ }
+
+ void set( value_type v ) const
+ {
+ const value_type pixel_value( (v << shift_) & mask_ );
+ *y() = (*y() & ~mask_) | pixel_value;
+ }
+
+ void set( value_type v, difference_type d ) const
+ {
+ const value_type pixel_value( (v << shift_) & mask_ );
+ *y(d) = (*y(d) & ~mask_) | pixel_value;
+ }
+};
+
+template< typename Valuetype,
+ int bits_per_pixel,
+ bool MsbFirst > class PackedPixelRowIterator : public NonStandardIterator
+{
+public:
+ // no reference, no index_reference type here
+ typedef Valuetype value_type;
+ typedef int difference_type;
+ typedef image_traverser_tag iterator_category;
+
+ typedef typename remove_const<value_type>::type mask_type;
+ typedef value_type* pointer;
+
+ enum {
+ /** The number of pixel within a single value_type value
+ */
+ num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
+ /** Bit mask for one pixel (least significant bits)
+ */
+ bit_mask=~(~0 << bits_per_pixel)
+ };
+
+private:
+ pointer data_;
+ mask_type mask_;
+ difference_type remainder_;
+
+ void update_mask()
+ {
+ mask_ = get_mask<value_type, bits_per_pixel, MsbFirst>(remainder_);
+ }
+
+ void inc()
+ {
+ const difference_type newValue( remainder_ + 1 );
+ const difference_type data_offset( newValue / num_intraword_positions );
+
+ data_ += data_offset;
+ remainder_ = newValue % num_intraword_positions;
+
+ const mask_type shifted_mask(
+ MsbFirst ?
+ unsigned_cast<mask_type>(mask_) >> bits_per_pixel :
+ mask_ << bits_per_pixel );
+
+ // data_offset is 0 for shifted mask, and 1 for wrapped-around mask
+ mask_ = (1-data_offset)*shifted_mask + data_offset*(MsbFirst ?
+ bit_mask << bits_per_pixel*(num_intraword_positions-1) :
+ bit_mask);
+ }
+
+ void dec()
+ {
+ const difference_type newValue( remainder_ - 1 );
+ const bool isNegative( is_negative(newValue) );
+ const difference_type newRemainder( newValue % num_intraword_positions );
+
+ // calc data_ += newValue / num_intraword_positions;
+ // remainder_ = newRemainder;
+ // for newValue >= 0, and
+ // data_ += newValue / num_intraword_positions - 1;
+ // remainder_ = num_intraword_positions - newRemainder;
+ // (to force remainder_ to be positive).
+ // This is branch-free, if is_negative() is branch-free
+ const difference_type data_offset( newValue / num_intraword_positions - isNegative );
+ data_ += data_offset;
+ remainder_ = newRemainder + isNegative*num_intraword_positions;
+
+ const mask_type shifted_mask(
+ MsbFirst ?
+ mask_ << bits_per_pixel :
+ unsigned_cast<mask_type>(mask_) >> bits_per_pixel );
+
+ // data_offset is 0 for shifted mask, and 1 for wrapped-around mask
+ mask_ = (1-data_offset)*shifted_mask + data_offset*(MsbFirst ?
+ bit_mask :
+ bit_mask << bits_per_pixel*(num_intraword_positions-1));
+ }
+
+ bool equal( PackedPixelRowIterator const & rhs ) const
+ {
+ return rhs.data_ == data_ && rhs.remainder_ == remainder_;
+ }
+
+ bool less( PackedPixelRowIterator const & rhs ) const
+ {
+ return data_ == rhs.data_ ?
+ (remainder_ < rhs.remainder_) :
+ (data_ < rhs.data_);
+ }
+
+public:
+ PackedPixelRowIterator() :
+ data_(0),
+ mask_( get_mask<value_type, bits_per_pixel, MsbFirst, difference_type>(0) ),
+ remainder_(0)
+ {}
+
+ explicit PackedPixelRowIterator( pointer base, int x ) :
+ data_(base),
+ mask_(0),
+ remainder_(x % num_intraword_positions)
+ {
+ update_mask();
+ }
+
+ PackedPixelRowIterator& operator+=( difference_type d )
+ {
+ const difference_type newValue( remainder_ + d );
+ const bool isNegative( is_negative(newValue) );
+ const difference_type newRemainder( newValue % num_intraword_positions );
+
+ // calc data_ += newValue / num_intraword_positions;
+ // remainder_ = newRemainder;
+ // for newValue >= 0, and
+ // data_ += newValue / num_intraword_positions - 1;
+ // remainder_ = newRemainder + num_intraword_positions;
+ // (to force remainder_ to be positive).
+ // This is branch-free, if is_negative() is branch-free
+ data_ += newValue / num_intraword_positions - isNegative;
+ remainder_ = newRemainder + isNegative*num_intraword_positions;
+ update_mask();
+
+ return *this;
+ }
+
+ PackedPixelRowIterator& operator-=( difference_type d )
+ {
+ // forward to operator+= - which has to cope with negative
+ // values, anyway.
+ return *this += -d;
+ }
+
+ PackedPixelRowIterator operator+( difference_type d )
+ {
+ PackedPixelRowIterator res(*this);
+ res += d;
+ return res;
+ }
+
+ PackedPixelRowIterator operator-( difference_type d )
+ {
+ PackedPixelRowIterator res(*this);
+ res -= d;
+ return res;
+ }
+
+ PackedPixelRowIterator& operator++()
+ {
+ inc();
+ return *this;
+ }
+
+ PackedPixelRowIterator& operator--()
+ {
+ dec();
+ return *this;
+ }
+
+ PackedPixelRowIterator operator++(int)
+ {
+ PackedPixelRowIterator res(*this);
+ inc();
+ return res;
+ }
+
+ PackedPixelRowIterator operator--(int)
+ {
+ PackedPixelRowIterator res(*this);
+ dec();
+ return res;
+ }
+
+ bool operator==(PackedPixelRowIterator const & rhs) const
+ {
+ return equal( rhs );
+ }
+
+ bool operator!=(PackedPixelRowIterator const & rhs) const
+ {
+ return !equal( rhs );
+ }
+
+ bool operator<(PackedPixelRowIterator const & rhs) const
+ {
+ return less(rhs);
+ }
+
+ bool operator<=(PackedPixelRowIterator const & rhs) const
+ {
+ return !rhs.less(*this);
+ }
+
+ bool operator>(PackedPixelRowIterator const & rhs) const
+ {
+ return rhs.less(*this);
+ }
+
+ bool operator>=(PackedPixelRowIterator const & rhs) const
+ {
+ return !less(rhs);
+ }
+
+ difference_type operator-(PackedPixelRowIterator const & rhs) const
+ {
+ return (data_ - rhs.data_)*num_intraword_positions + (remainder_ - rhs.remainder_);
+ }
+
+ value_type get() const
+ {
+ return unsigned_cast<value_type>(*data_ & mask_) >>
+ get_shift<num_intraword_positions,
+ bits_per_pixel,
+ MsbFirst>(remainder_);
+ }
+
+ value_type get(difference_type d) const
+ {
+ PackedPixelRowIterator tmp(*this);
+ tmp += d;
+ return tmp.get();
+ }
+
+ void set( value_type v ) const
+ {
+ const value_type pixel_value(
+ (v <<
+ get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder_))
+ & mask_ );
+ *data_ = (*data_ & ~mask_) | pixel_value;
+ }
+
+ void set( value_type v, difference_type d ) const
+ {
+ PackedPixelRowIterator tmp(*this);
+ tmp += d;
+ tmp.set(v);
+ }
+};
+
+/** 2D image iterator for packed pixel formats
+
+ This iterator can be used for image formats that pack more than
+ one pixel into an machine data type (like one bit per pixel, eight
+ of which packed into one char)
+ */
+template< typename Valuetype,
+ int bits_per_pixel,
+ bool MsbFirst > class PackedPixelIterator : public NonStandardIterator
+{
+public:
+ // no reference, no index_reference type here
+ typedef Valuetype value_type;
+ typedef vigra::Diff2D difference_type;
+ typedef image_traverser_tag iterator_category;
+ typedef PackedPixelRowIterator<value_type,
+ bits_per_pixel,
+ MsbFirst> row_iterator;
+ typedef PackedPixelColumnIterator<value_type,
+ bits_per_pixel,
+ MsbFirst> column_iterator;
+
+ typedef value_type* pointer;
+ typedef int MoveX;
+ typedef StridedArrayIterator< value_type > MoveY;
+
+ enum {
+ /** The number of pixel within a single value_type value
+ */
+ num_intraword_positions=sizeof(value_type)*8/bits_per_pixel,
+ /** Bit mask for one pixel (least significant bits)
+ */
+ bit_mask=~(~0 << bits_per_pixel)
+ };
+
+ // TODO(F2): direction of iteration (ImageIterator can be made to
+ // run backwards)
+
+private:
+ pointer current() const
+ {
+ return y() + (x / num_intraword_positions);
+ }
+
+ pointer current(int dx, int dy) const
+ {
+ return y(dy) + ((x+dx)/num_intraword_positions);
+ }
+
+ bool equal(PackedPixelIterator const & rhs) const
+ {
+ return (x == rhs.x) && (y == rhs.y);
+ }
+
+public:
+ PackedPixelIterator() :
+ x(0),
+ y(0)
+ {}
+
+ PackedPixelIterator(pointer base, int ystride) :
+ x(0),
+ y(ystride,base)
+ {}
+
+ bool operator==(PackedPixelIterator const & rhs) const
+ {
+ return equal(rhs);
+ }
+
+ bool operator!=(PackedPixelIterator const & rhs) const
+ {
+ return !equal(rhs);
+ }
+
+ difference_type operator-(PackedPixelIterator const & rhs) const
+ {
+ return difference_type(x - rhs.x, y - rhs.y);
+ }
+
+ MoveX x;
+ MoveY y;
+
+ PackedPixelIterator & operator+=(difference_type const & s)
+ {
+ x += s.x;
+ y += s.y;
+ return *this;
+ }
+
+ PackedPixelIterator & operator-=(difference_type const & s)
+ {
+ x -= s.x;
+ y -= s.y;
+ return *this;
+ }
+
+ PackedPixelIterator operator+(difference_type const & s) const
+ {
+ PackedPixelIterator ret(*this);
+ ret += s;
+ return ret;
+ }
+
+ PackedPixelIterator operator-(difference_type const & s) const
+ {
+ PackedPixelIterator ret(*this);
+ ret -= s;
+ return ret;
+ }
+
+ row_iterator rowIterator() const
+ {
+ return row_iterator(current(),x);
+ }
+
+ column_iterator columnIterator() const
+ {
+ return column_iterator(MoveY(y,
+ x / num_intraword_positions),
+ x % num_intraword_positions);
+ }
+
+ value_type get() const
+ {
+ const int remainder( x % num_intraword_positions );
+
+ return (unsigned_cast<value_type>(*current() &
+ get_mask<value_type, bits_per_pixel, MsbFirst>(remainder))
+ >> get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder));
+ }
+
+ value_type get(difference_type const & d) const
+ {
+ const int remainder( x(d.x) % num_intraword_positions );
+
+ return (unsigned_cast<value_type>(*current(d.x,d.y) &
+ get_mask<value_type, bits_per_pixel, MsbFirst>(remainder))
+ >> get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder));
+ }
+
+ void set( value_type v ) const
+ {
+ const int remainder( x % num_intraword_positions );
+ const int mask( get_mask<value_type, bits_per_pixel, MsbFirst>(remainder) );
+ const value_type pixel_value(
+ (v <<
+ get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder))
+ & mask );
+ pointer p = current();
+ *p = (*p & ~mask) | pixel_value;
+ }
+
+ void set( value_type v, difference_type const & d ) const
+ {
+ const int remainder( (x + d.x) % num_intraword_positions );
+ const int mask( get_mask<value_type, bits_per_pixel, MsbFirst>(remainder) );
+ const value_type pixel_value(
+ (v <<
+ get_shift<num_intraword_positions, bits_per_pixel, MsbFirst>(remainder))
+ & mask );
+ pointer p = current(d.x,d.y);
+ *p = (*p & ~mask) | pixel_value;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+// partial specialization for the accessor traits masked_accessor
+// selector metafunction - can employ fast mask functor for the 1bpp
+// case.
+template< class Accessor,
+ class MaskAccessor,
+ class Iterator,
+ bool polarity,
+ bool MsbFirst > struct maskedAccessorSelector< Accessor,
+ MaskAccessor,
+ Iterator,
+ PackedPixelIterator< typename MaskAccessor::value_type,
+ 1,
+ MsbFirst >,
+ polarity >
+{
+ typedef TernarySetterFunctionAccessorAdapter<
+ Accessor,
+ MaskAccessor,
+ typename outputMaskFunctorSelector<
+ typename Accessor::value_type,
+ typename MaskAccessor::value_type,
+ polarity,
+ FastMask>::type >
+ type;
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PACKEDPIXELITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/paletteformats.hxx b/include/basebmp/paletteformats.hxx
new file mode 100644
index 000000000000..5c2c58d49b94
--- /dev/null
+++ b/include/basebmp/paletteformats.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PACKEDPIXELFORMATS_HXX
+#define INCLUDED_BASEBMP_PACKEDPIXELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/packedpixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+#include <basebmp/paletteimageaccessor.hxx>
+#include <basebmp/metafunctions.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+namespace basebmp
+{
+
+//-----------------------------------------------------------------------------
+
+/** Lookup index value for given color value in a PaletteImageAccessor
+ */
+template< class Accessor > struct ColorLookup
+{
+ typename Accessor::data_type operator()( const Accessor& acc,
+ typename Accessor::value_type v ) const
+ {
+ return acc.lookup(v);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+// partial specialization of AccessorTraits for PaletteAccessor
+template< class Accessor, typename ColorType > struct AccessorTraits<
+ PaletteImageAccessor< Accessor, ColorType > >
+{
+ /// value type of described accessor
+ typedef typename PaletteImageAccessor< Accessor, ColorType >::value_type value_type;
+
+ /// Retrieve stand-alone color lookup function for given Accessor type
+ typedef ColorLookup< PaletteImageAccessor< Accessor, ColorType > > color_lookup;
+
+ /// Retrieve raw pixel data accessor for given Accessor type
+ typedef Accessor raw_accessor;
+
+ /** accessor for XOR setter access is disabled, since the results
+ * are usually completely unintended - you'll usually want to
+ * wrap an xor_accessor with a PaletteAccessor, not the other way
+ * around.
+ */
+ typedef vigra::VigraFalseType xor_accessor;
+
+ /** accessor for masked setter access is disabled, since the
+ * results are usually completely unintended - you'll usually
+ * want to wrap a masked_accessor with a PaletteAccessor, not the
+ * other way around.
+ */
+ template< class MaskAccessor,
+ class Iterator,
+ class MaskIterator > struct masked_accessor
+ {
+ typedef vigra::VigraFalseType type;
+ };
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename ColorType > struct PaletteAccessorSelector
+{
+ template< class Accessor > struct wrap_accessor
+ {
+ typedef PaletteImageAccessor< Accessor, ColorType > type;
+ };
+};
+
+//-----------------------------------------------------------------------------
+
+template< class Iterator,
+ class Accessor > struct PixelFormatTraitsTemplate_Palette
+{
+ typedef typename Iterator::value_type pixel_type;
+ typedef Iterator iterator_type;
+ typedef Accessor raw_accessor_type;
+ typedef PaletteAccessorSelector<Color> accessor_selector;
+};
+
+template< int BitsPerPixel,
+ bool MsbFirst > struct PixelFormatTraitsTemplate_PackedPalette :
+ public PixelFormatTraitsTemplate_Palette<
+ PackedPixelIterator< sal_uInt8,
+ BitsPerPixel,
+ MsbFirst >,
+ NonStandardAccessor< sal_uInt8 > >
+{};
+
+//-----------------------------------------------------------------------------
+
+// 1bpp MSB
+typedef PixelFormatTraitsTemplate_PackedPalette<1, true> PixelFormatTraits_PAL1_MSB;
+
+// 1bpp LSB
+typedef PixelFormatTraitsTemplate_PackedPalette<1, false> PixelFormatTraits_PAL1_LSB;
+
+// 4bpp MSB
+typedef PixelFormatTraitsTemplate_PackedPalette<4, true> PixelFormatTraits_PAL4_MSB;
+
+// 4bpp LSB
+typedef PixelFormatTraitsTemplate_PackedPalette<4, false> PixelFormatTraits_PAL4_LSB;
+
+// 8bpp
+typedef PixelFormatTraitsTemplate_Palette<
+ PixelIterator< sal_uInt8 >,
+ StandardAccessor< sal_uInt8 > > PixelFormatTraits_PAL8;
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PACKEDPIXELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/paletteimageaccessor.hxx b/include/basebmp/paletteimageaccessor.hxx
new file mode 100644
index 000000000000..6f0164e64af6
--- /dev/null
+++ b/include/basebmp/paletteimageaccessor.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PALETTEIMAGEACCESSOR_HXX
+#define INCLUDED_BASEBMP_PALETTEIMAGEACCESSOR_HXX
+
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessortraits.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+#include <algorithm>
+#include <functional>
+
+namespace basebmp
+{
+
+/** Access pixel data via palette indirection
+
+ @tpl Accessor
+ Raw accessor, to be used to actually access the pixel values
+
+ @tpl ColorType
+ The color value type to use - e.g. the palette is an array of that
+ type
+ */
+template< class Accessor, typename ColorType > class PaletteImageAccessor
+{
+public:
+ typedef typename Accessor::value_type data_type;
+ typedef ColorType value_type;
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+// making all members public, if no member template friends
+private:
+ template<class A, typename C> friend class PaletteImageAccessor;
+#endif
+
+ Accessor maAccessor;
+ const value_type* mpPalette;
+ std::size_t mnNumEntries;
+
+public:
+ PaletteImageAccessor() :
+ maAccessor(),
+ mpPalette(0),
+ mnNumEntries(0)
+ {}
+
+ template< class A > explicit
+ PaletteImageAccessor( PaletteImageAccessor<A,ColorType> const& rSrc ) :
+ maAccessor( rSrc.maAccessor ),
+ mpPalette( rSrc.mpPalette ),
+ mnNumEntries( rSrc.mnNumEntries )
+ {}
+
+ PaletteImageAccessor( const value_type* pPalette,
+ std::size_t numEntries ) :
+ maAccessor(),
+ mpPalette(pPalette),
+ mnNumEntries(numEntries)
+ {}
+
+ template< class T > PaletteImageAccessor( T accessor,
+ const value_type* pPalette,
+ std::size_t numEntries ) :
+ maAccessor(accessor),
+ mpPalette(pPalette),
+ mnNumEntries(numEntries)
+ {}
+
+ // -------------------------------------------------------
+
+ Accessor const& getWrappedAccessor() const { return maAccessor; }
+ Accessor& getWrappedAccessor() { return maAccessor; }
+
+ // -------------------------------------------------------
+
+ data_type lookup(value_type const& v) const
+ {
+ // TODO(P3): use table-based/octree approach here!
+ const value_type* best_entry;
+ const value_type* palette_end( mpPalette+mnNumEntries );
+ if( (best_entry=std::find( mpPalette, palette_end, v)) != palette_end )
+ return best_entry-mpPalette;
+
+ const value_type* curr_entry( mpPalette );
+ best_entry = curr_entry;
+ while( curr_entry != palette_end )
+ {
+ if( ColorTraits<value_type>::distance(*curr_entry,
+ *best_entry)
+ > ColorTraits<value_type>::distance(*curr_entry,
+ v) )
+ {
+ best_entry = curr_entry;
+ }
+
+ ++curr_entry;
+ }
+
+ return best_entry-mpPalette;
+ }
+
+ // -------------------------------------------------------
+
+ template< class Iterator >
+ value_type operator()(Iterator const& i) const
+ {
+ return mpPalette[ maAccessor(i) ];
+ }
+
+ template< class Iterator, class Difference >
+ value_type operator()(Iterator const& i, Difference const& diff) const
+ {
+ return mpPalette[ maAccessor(i,diff) ];
+ }
+
+ // -------------------------------------------------------
+
+ template< typename V, class Iterator >
+ void set(V const& value, Iterator const& i) const
+ {
+ maAccessor.set(
+ lookup(
+ vigra::detail::RequiresExplicitCast<value_type>::cast(value) ),
+ i );
+ }
+
+ template< typename V, class Iterator, class Difference >
+ void set(V const& value, Iterator const& i, Difference const& diff) const
+ {
+ maAccessor.set(
+ lookup(
+ vigra::detail::RequiresExplicitCast<value_type>::cast(value) ),
+ i,
+ diff );
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PALETTEIMAGEACCESSOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/pixelformatadapters.hxx b/include/basebmp/pixelformatadapters.hxx
new file mode 100644
index 000000000000..09cc9368394d
--- /dev/null
+++ b/include/basebmp/pixelformatadapters.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PIXELFORMATADAPTERS_HXX
+#define INCLUDED_BASEBMP_PIXELFORMATADAPTERS_HXX
+
+#include <basebmp/accessortraits.hxx>
+#include <basebmp/accessoradapters.hxx>
+
+#include <vigra/metaprogramming.hxx>
+
+namespace basebmp
+{
+
+// convenience functionality, providing everything necessary for a new
+// pixel format. simply plug in two conversion functors from/to a
+// common color format.
+
+/** Accessor selection metafunction, used to wrap a given accessor
+ with one converting between the pixel and color types
+
+ Use the nested template's typedef type, to retrieve an
+ AccessorAdapter which operates on a pixel value accessor, and
+ provides color values to the outside.
+
+ Nested like this, to avoid template template parameters at other
+ places: an instantiated version of AccessorSelector can be passed
+ to other templates, which in turn can invoke the nested meta
+ function.
+ */
+template< typename Getter,
+ typename Setter > struct AccessorSelector
+{
+ template< typename Accessor > struct wrap_accessor
+ {
+ typedef UnaryFunctionAccessorAdapter< Accessor,
+ Getter,
+ Setter > type;
+ };
+};
+
+//-----------------------------------------------------------------------------
+
+/** Convert color value to pixel data type
+ */
+template< class Accessor, typename DataType > struct ColorConvert
+{
+ DataType operator()( const Accessor& acc,
+ typename Accessor::value_type v ) const
+ {
+ return acc.setter(v);
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+/** Macro generates partial specialization for color-conversion
+ UnaryFunctionAccessorAdapter, and the given getter/setter functors
+ */
+#define BASEBMP_SPECIALIZE_ACCESSORTRAITS(Getter,Setter) \
+template< class Accessor > struct AccessorTraits< \
+ UnaryFunctionAccessorAdapter< Accessor, \
+ Getter, \
+ Setter > > \
+{ \
+ typedef typename Accessor::value_type data_type; \
+ typedef UnaryFunctionAccessorAdapter< \
+ Accessor, \
+ Getter, \
+ Setter > accessor_type; \
+ typedef typename accessor_type::value_type value_type; \
+ typedef ColorConvert< accessor_type, \
+ data_type > color_lookup; \
+ typedef Accessor raw_accessor; \
+ typedef vigra::VigraFalseType xor_accessor; \
+ template< class MaskAccessor, \
+ class Iterator, \
+ class MaskIterator > struct masked_accessor\
+ { typedef vigra::VigraFalseType type; }; \
+}
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PIXELFORMATADAPTERS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/pixeliterator.hxx b/include/basebmp/pixeliterator.hxx
new file mode 100644
index 000000000000..e629af275dd9
--- /dev/null
+++ b/include/basebmp/pixeliterator.hxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_PIXELITERATOR_HXX
+#define INCLUDED_BASEBMP_PIXELITERATOR_HXX
+
+#include <basebmp/metafunctions.hxx>
+#include <basebmp/stridedarrayiterator.hxx>
+
+#include <vigra/metaprogramming.hxx>
+#include <vigra/diff2d.hxx>
+
+namespace basebmp
+{
+
+template< typename Valuetype > class PixelColumnIterator
+{
+public:
+ typedef Valuetype value_type;
+ typedef Valuetype& reference;
+ typedef reference index_reference;
+ typedef Valuetype* pointer;
+ typedef int difference_type;
+ typedef image_traverser_tag iterator_category;
+
+ typedef StridedArrayIterator< value_type > MoveY;
+
+private:
+ MoveY y;
+
+ bool equal( PixelColumnIterator const & rhs ) const
+ {
+ return rhs.y == y;
+ }
+
+ bool less( PixelColumnIterator const & rhs ) const
+ {
+ return y < rhs.y;
+ }
+
+public:
+ PixelColumnIterator() :
+ y(0)
+ {}
+
+ explicit PixelColumnIterator( const MoveY& pos ) :
+ y(pos)
+ {}
+
+ PixelColumnIterator( const MoveY& pos, int x ) :
+ y(pos,x)
+ {}
+
+ PixelColumnIterator& operator+=( difference_type d )
+ {
+ y += d;
+ return *this;
+ }
+
+ PixelColumnIterator& operator-=( difference_type d )
+ {
+ y -= d;
+ return *this;
+ }
+
+ PixelColumnIterator operator+( difference_type d )
+ {
+ PixelColumnIterator res(*this);
+ res += d;
+ return res;
+ }
+
+ PixelColumnIterator operator-( difference_type d )
+ {
+ PixelColumnIterator res(*this);
+ res -= d;
+ return res;
+ }
+
+ PixelColumnIterator& operator++()
+ {
+ ++y;
+ return *this;
+ }
+
+ PixelColumnIterator& operator--()
+ {
+ --y;
+ return *this;
+ }
+
+ PixelColumnIterator operator++(int)
+ {
+ PixelColumnIterator res(*this);
+ ++y;
+ return res;
+ }
+
+ PixelColumnIterator operator--(int)
+ {
+ PixelColumnIterator res(*this);
+ --y;
+ return res;
+ }
+
+ bool operator==(PixelColumnIterator const & rhs) const
+ {
+ return equal( rhs );
+ }
+
+ bool operator!=(PixelColumnIterator const & rhs) const
+ {
+ return !equal( rhs );
+ }
+
+ bool operator<(PixelColumnIterator const & rhs) const
+ {
+ return less(rhs);
+ }
+
+ bool operator<=(PixelColumnIterator const & rhs) const
+ {
+ return !rhs.less(*this);
+ }
+
+ bool operator>(PixelColumnIterator const & rhs) const
+ {
+ return rhs.less(*this);
+ }
+
+ bool operator>=(PixelColumnIterator const & rhs) const
+ {
+ return !less(rhs);
+ }
+
+ difference_type operator-(PixelColumnIterator const & rhs) const
+ {
+ return y - rhs.y;
+ }
+
+ value_type get() const
+ {
+ return *y();
+ }
+
+ value_type get(difference_type d) const
+ {
+ return *y(d);
+ }
+
+ void set( value_type v ) const
+ {
+ *y() = v;
+ }
+
+ void set( value_type v, difference_type d ) const
+ {
+ *y(d) = v;
+ }
+
+ reference operator*() const
+ {
+ return *y();
+ }
+
+ pointer operator->() const
+ {
+ return y();
+ }
+
+ reference operator[](difference_type d) const
+ {
+ return *y(d);
+ }
+
+ reference operator()(int dy) const
+ {
+ return *y(dy);
+ }
+};
+
+template< typename Valuetype > class PixelIterator
+{
+public:
+ typedef Valuetype value_type;
+ typedef Valuetype& reference;
+ typedef reference index_reference;
+ typedef Valuetype* pointer;
+ typedef vigra::Diff2D difference_type;
+ typedef image_traverser_tag iterator_category;
+ typedef pointer row_iterator;
+ typedef PixelColumnIterator<value_type> column_iterator;
+
+ typedef int MoveX;
+ typedef StridedArrayIterator< value_type > MoveY;
+
+ // TODO(F2): direction of iteration (ImageIterator can be made to
+ // run backwards)
+
+private:
+ bool equal(PixelIterator const & rhs) const
+ {
+ return (x == rhs.x) && (y == rhs.y);
+ }
+
+ pointer current() const
+ {
+ return y() + x;
+ }
+
+ pointer current(int dx, int dy) const
+ {
+ return y(dy) + x+dx;
+ }
+
+public:
+ PixelIterator() :
+ x(0),
+ y(0)
+ {}
+
+ PixelIterator(pointer base, int ystride) :
+ x(0),
+ y(ystride,base)
+ {}
+
+ bool operator==(PixelIterator const & rhs) const
+ {
+ return equal(rhs);
+ }
+
+ bool operator!=(PixelIterator const & rhs) const
+ {
+ return !equal(rhs);
+ }
+
+ difference_type operator-(PixelIterator const & rhs) const
+ {
+ return difference_type(x - rhs.x, y - rhs.y);
+ }
+
+ MoveX x;
+ MoveY y;
+
+ PixelIterator & operator+=(difference_type const & s)
+ {
+ x += s.x;
+ y += s.y;
+ return *this;
+ }
+
+ PixelIterator & operator-=(difference_type const & s)
+ {
+ x -= s.x;
+ y -= s.y;
+ return *this;
+ }
+
+ PixelIterator operator+(difference_type const & s) const
+ {
+ PixelIterator ret(*this);
+ ret += s;
+ return ret;
+ }
+
+ PixelIterator operator-(difference_type const & s) const
+ {
+ PixelIterator ret(*this);
+ ret -= s;
+ return ret;
+ }
+
+ row_iterator rowIterator() const
+ {
+ return row_iterator(y()+x);
+ }
+
+ column_iterator columnIterator() const
+ {
+ return column_iterator(y,x);
+ }
+
+ value_type get() const
+ {
+ return *current();
+ }
+
+ value_type get(difference_type const & d) const
+ {
+ return *current(d.y, d.x);
+ }
+
+ void set( value_type v ) const
+ {
+ *current() = v;
+ }
+
+ void set( value_type v, difference_type const & d ) const
+ {
+ *current(d.y,d.x) = v;
+ }
+
+ reference operator*() const
+ {
+ return *current();
+ }
+
+ pointer operator->() const
+ {
+ return current();
+ }
+
+ reference operator[]( const vigra::Diff2D& d ) const
+ {
+ return *current(d.x,d.y);
+ }
+
+ reference operator()(int dx, int dy) const
+ {
+ return *current(dx,dy);
+ }
+
+ pointer operator[](int dy) const
+ {
+ return y(dy) + x;
+ }
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_PIXELITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/polypolygonrenderer.hxx b/include/basebmp/polypolygonrenderer.hxx
new file mode 100644
index 000000000000..80f73ac01279
--- /dev/null
+++ b/include/basebmp/polypolygonrenderer.hxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_POLYPOLYGONRENDERER_HXX
+#define INCLUDED_BASEBMP_POLYPOLYGONRENDERER_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2ibox.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygonfillrule.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include <vigra/diff2d.hxx>
+#include <vigra/iteratortraits.hxx>
+
+#include <vector>
+
+
+namespace basebmp
+{
+ namespace detail
+ {
+ /// convert int32 to 32:32 fixed point
+ inline sal_Int64 toFractional( sal_Int32 v ) { return (sal_Int64)v << 32; }
+ /// convert double to 32:32 fixed point
+ inline sal_Int64 toFractional( double v ) { return (sal_Int64)(v*SAL_MAX_UINT32 + (v < 0.0 ? -0.5 : 0.5 )); }
+ /// convert 32:32 fixed point to int32 (truncate)
+ inline sal_Int32 toInteger( sal_Int64 v ) { return (sal_Int32)(v < 0 ? ~((~v) >> 32) : v >> 32); }
+ /// convert 32:32 fixed point to int32 (properly rounded)
+ inline sal_Int32 toRoundedInteger( sal_Int64 v ) { return toInteger(v) + (sal_Int32)((v&0x80000000) >> 31); }
+
+ /** internal vertex store -
+
+ Different from B2DPoint, since we don't need floating
+ point coords, but orientation of vertex and y counter
+ */
+ struct Vertex
+ {
+ sal_Int32 mnYCounter;
+ sal_Int64 mnX;
+ sal_Int64 mnXDelta;
+
+ bool mbDownwards; // needed for nonzero winding rule
+ // fills
+
+ Vertex() :
+ mnYCounter(0),
+ mnX(0),
+ mnXDelta(0),
+ mbDownwards(true)
+ {}
+ Vertex( basegfx::B2DPoint const& rPt1,
+ basegfx::B2DPoint const& rPt2,
+ bool bDownwards ) :
+ mnYCounter( basegfx::fround(rPt2.getY()) -
+ basegfx::fround(rPt1.getY()) ),
+ mnX( toFractional( basegfx::fround(rPt1.getX()) )),
+ mnXDelta( toFractional(
+ ((rPt2.getX() - rPt1.getX()) /
+ (double)mnYCounter) )),
+ mbDownwards(bDownwards)
+ {}
+ };
+
+ typedef std::vector< std::vector<Vertex> > VectorOfVectorOfVertices;
+ typedef std::vector< Vertex* > VectorOfVertexPtr;
+
+ /// non-templated setup of GET
+ sal_uInt32 setupGlobalEdgeTable( VectorOfVectorOfVertices& rGET,
+ basegfx::B2DPolyPolygon const& rPoly,
+ sal_Int32 nMinY );
+ /// sort rAETSrc, copy not-yet-ended edges over to rAETDest
+ void sortAET( VectorOfVertexPtr& rAETSrc,
+ VectorOfVertexPtr& rAETDest );
+
+ /// For the STL algorithms
+ struct RasterConvertVertexComparator
+ {
+ RasterConvertVertexComparator() {}
+
+ bool operator()( const Vertex& rLHS,
+ const Vertex& rRHS ) const
+ {
+ return rLHS.mnX < rRHS.mnX;
+ }
+
+ bool operator()( const Vertex* pLHS,
+ const Vertex* pRHS ) const
+ {
+ return pLHS->mnX < pRHS->mnX;
+ }
+ };
+
+ } // namespace detail
+
+
+ /** Raster-convert a poly-polygon.
+
+ This algorithm does not perform antialiasing, and thus
+ internally works with integer vertex coordinates.
+
+ @param begin
+ Left, top edge of the destination bitmap. This position is
+ considered (0,0) relative to all polygon vertices
+
+ @param ad
+ Accessor to set pixel values
+
+ @param fillColor
+ Color to use for filling
+
+ @param rClipRect
+ Clipping rectangle, relative to the begin iterator. No pixel outside
+ this clip rect will be modified.
+
+ @param rPoly
+ Polygon to fill
+ */
+ template< class DestIterator, class DestAccessor, typename T >
+ void renderClippedPolyPolygon( DestIterator begin,
+ DestAccessor ad,
+ T fillColor,
+ const basegfx::B2IBox& rClipRect,
+ basegfx::B2DPolyPolygon const& rPoly,
+ basegfx::FillRule eFillRule )
+ {
+ const sal_Int32 nClipX1( std::max((sal_Int32)0,rClipRect.getMinX()) );
+ const sal_Int32 nClipX2( rClipRect.getMaxX() );
+ const sal_Int32 nClipY1( std::max((sal_Int32)0,rClipRect.getMinY()) );
+ const sal_Int32 nClipY2( rClipRect.getMaxY() );
+ const sal_Int64 nClipX1_frac( detail::toFractional(nClipX1) );
+ const sal_Int64 nClipX2_frac( detail::toFractional(nClipX2) );
+
+ basegfx::B2DRange const aPolyBounds( basegfx::tools::getRange(rPoly) );
+
+ const sal_Int32 nMinY( basegfx::fround(aPolyBounds.getMinY()) );
+ const sal_Int32 nMaxY(
+ std::min(
+ nClipY2-1,
+ basegfx::fround(aPolyBounds.getMaxY())));
+
+ if( nMinY > nMaxY )
+ return; // really, nothing to do then.
+
+ detail::VectorOfVectorOfVertices aGET; // the Global Edge Table
+ aGET.resize( nMaxY - nMinY + 1 );
+
+ sal_uInt32 const nVertexCount(
+ detail::setupGlobalEdgeTable( aGET, rPoly, nMinY ) );
+
+
+ // Perform actual scan conversion
+ //----------------------------------------------------------------------
+
+ if( aGET.empty() )
+ return;
+
+ detail::VectorOfVertexPtr aAET1; // the Active Edge Table
+ detail::VectorOfVertexPtr aAET2;
+ detail::VectorOfVertexPtr* pAET = &aAET1;
+ detail::VectorOfVertexPtr* pAETOther = &aAET2;
+ aAET1.reserve( nVertexCount );
+ aAET2.reserve( nVertexCount );
+
+ // current scanline - initially, points to first scanline
+ // within the clip rect, or to the polygon's first scanline
+ // (whichever is greater)
+ DestIterator aScanline( begin +
+ vigra::Diff2D(
+ 0,
+ std::max(nMinY,
+ nClipY1)) );
+ detail::RasterConvertVertexComparator aComp;
+
+
+ // now process each of the nMaxY - nMinY + 1 scanlines
+ // ------------------------------------------------------------
+
+ for( sal_Int32 y=nMinY; y <= nMaxY; ++y )
+ {
+ if( !aGET[y-nMinY].empty() )
+ {
+ // merge AET with current scanline's new vertices (both
+ // are already correctly sorted)
+ detail::VectorOfVectorOfVertices::value_type::iterator vertex=aGET[y-nMinY].begin();
+ detail::VectorOfVectorOfVertices::value_type::iterator const end=aGET[y-nMinY].end();
+ while( vertex != end )
+ {
+ // find insertion pos by binary search, and put ptr
+ // into active edge vector
+ pAET->insert( std::lower_bound( pAET->begin(),
+ pAET->end(),
+ &(*vertex),
+ aComp ),
+ &(*vertex) );
+
+ ++vertex;
+ }
+ }
+
+ // with less than two active edges, no fill visible
+ if( pAET->size() >= 2 )
+ {
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowIter( aScanline.rowIterator() );
+
+ // process each span in current scanline, with
+ // even-odd fill rule
+ detail::VectorOfVertexPtr::iterator currVertex( pAET->begin() );
+ detail::VectorOfVertexPtr::iterator const lastVertex( pAET->end()-1 );
+ sal_uInt32 nCrossedEdges(0);
+ sal_Int32 nWindingNumber(0);
+ while( currVertex != lastVertex )
+ {
+ // TODO(P1): might be worth a try to extend the
+ // size()==2 case also to the actual filling
+ // here. YMMV.
+ detail::Vertex& rV1( **currVertex );
+ detail::Vertex const& rV2( **++currVertex );
+
+ nWindingNumber += -1 + 2*rV1.mbDownwards;
+
+ // calc fill status for both rules. might save a
+ // few percent runtime to specialize here...
+ const bool bEvenOddFill(
+ eFillRule == basegfx::FillRule_EVEN_ODD && !(nCrossedEdges & 0x01) );
+ const bool bNonZeroWindingFill(
+ eFillRule == basegfx::FillRule_NONZERO_WINDING_NUMBER && nWindingNumber != 0 );
+
+ // is span visible?
+ if( (bEvenOddFill || bNonZeroWindingFill) &&
+ y >= nClipY1 &&
+ rV1.mnX < nClipX2_frac &&
+ rV2.mnX > nClipX1_frac )
+ {
+ // clip span to horizontal bounds
+ sal_Int32 const nStartX(
+ std::max( nClipX1,
+ std::min( nClipX2-1,
+ detail::toRoundedInteger(rV1.mnX) )));
+ sal_Int32 const nEndX(
+ std::max( nClipX1,
+ std::min( nClipX2,
+ detail::toRoundedInteger(rV2.mnX) )));
+
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ currPix( rowIter + nStartX);
+ typename vigra::IteratorTraits<DestIterator>::row_iterator
+ rowEnd( rowIter + nEndX );
+
+ // TODO(P2): Provide specialized span fill methods on the
+ // iterator/accessor
+ while( currPix != rowEnd )
+ ad.set(fillColor, currPix++);
+ }
+
+ // step vertices
+ rV1.mnX += rV1.mnXDelta;
+ --rV1.mnYCounter;
+
+ ++nCrossedEdges;
+ }
+
+ // step vertex also for the last one
+ detail::Vertex& rLastV( **currVertex );
+ rLastV.mnX += rLastV.mnXDelta;
+ --rLastV.mnYCounter;
+
+
+ // prune AET from ended edges, and keep it sorted
+ // ---------------------------------------------------------
+
+ pAETOther->clear();
+ if( pAET->size() == 2 )
+ {
+ // the case of exactly two active edges is both
+ // sufficiently common (all 'simple' polygons have
+ // it), and further more would complicate the
+ // generic case below (which works with a sliding
+ // triple of vertices).
+ if( !aComp(*(*pAET)[0], *(*pAET)[1]) )
+ std::swap(*(*pAET)[0], *(*pAET)[1]);
+
+ if( (*pAET)[0]->mnYCounter > 0 )
+ pAETOther->push_back( (*pAET)[0] );
+ if( (*pAET)[1]->mnYCounter > 0 )
+ pAETOther->push_back( (*pAET)[1] );
+ }
+ else
+ {
+ bool bFallbackTaken(false);
+ currVertex = pAET->begin();
+ detail::VectorOfVertexPtr::iterator prevVertex( currVertex );
+ while( currVertex != lastVertex )
+ {
+ // try to get away with one linear swoop and
+ // simple neighbor swapping. this is an
+ // overwhelmingly common case - polygons with
+ // excessively crisscrossing edges (which on
+ // top of that cross more than one other edge
+ // per scanline) are seldom. And even if we
+ // get such a beast here, this extra loop has
+ // still only linear cost
+ if( aComp(**(currVertex+1),**currVertex) )
+ {
+ std::swap(*currVertex, *(currVertex+1));
+
+ if( aComp(**currVertex,**prevVertex) )
+ {
+ // one swap was not sufficient -
+ // fallback to generic sort algo, then
+ detail::sortAET(*pAET, *pAETOther);
+ bFallbackTaken = true;
+ break;
+ }
+ }
+
+ if( (*currVertex)->mnYCounter > 0 )
+ pAETOther->push_back( *currVertex );
+
+ prevVertex = currVertex++;
+ }
+
+ // don't forget to add last vertex (loop above
+ // only deals with n-1 vertices)
+ if( !bFallbackTaken && (*currVertex)->mnYCounter > 0 )
+ pAETOther->push_back( *currVertex );
+ }
+
+ std::swap( pAET, pAETOther );
+ }
+
+ if( y >= nClipY1 )
+ ++aScanline.y;
+ }
+ }
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_POLYPOLYGONRENDERER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/rgb24pixelformats.hxx b/include/basebmp/rgb24pixelformats.hxx
new file mode 100644
index 000000000000..c4f460cc5e10
--- /dev/null
+++ b/include/basebmp/rgb24pixelformats.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
+#define INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+
+#include <vigra/rgbvalue.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+template< typename PixelType, typename ColorType > struct RGBValueGetter :
+ public std::unary_function<PixelType, ColorType>
+{
+ ColorType operator()( PixelType const& c ) const
+ {
+ return ColorType(c.red(),c.green(),c.blue());
+ }
+};
+
+template< typename PixelType, typename ColorType > struct RGBValueSetter :
+ public std::unary_function<ColorType, PixelType>
+{
+ PixelType operator()( ColorType const& c ) const
+ {
+ PixelType res;
+ res.setRed(c.getRed());
+ res.setGreen(c.getGreen());
+ res.setBlue(c.getBlue());
+ return res;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename PixelType > struct PixelFormatTraitsTemplate_RGBValue
+{
+ typedef PixelType pixel_type;
+
+ typedef RGBValueGetter<pixel_type,
+ Color> getter_type;
+ typedef RGBValueSetter<pixel_type,
+ Color> setter_type;
+
+ typedef PixelIterator<pixel_type> iterator_type;
+ typedef StandardAccessor<pixel_type> raw_accessor_type;
+ typedef AccessorSelector<
+ getter_type, setter_type> accessor_selector;
+};
+
+//-----------------------------------------------------------------------------
+
+// 24bpp RGB
+typedef PixelFormatTraitsTemplate_RGBValue<
+ vigra::RGBValue<sal_uInt8> > PixelFormatTraits_RGB24;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB24::getter_type,
+ PixelFormatTraits_RGB24::setter_type);
+
+// 24bpp BGR
+typedef PixelFormatTraitsTemplate_RGBValue<
+ vigra::RGBValue<sal_uInt8,2,1,0> > PixelFormatTraits_BGR24;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGR24::getter_type,
+ PixelFormatTraits_BGR24::setter_type);
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_RGB24PIXELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/rgbmaskpixelformats.hxx b/include/basebmp/rgbmaskpixelformats.hxx
new file mode 100644
index 000000000000..19cf65f97e0d
--- /dev/null
+++ b/include/basebmp/rgbmaskpixelformats.hxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX
+#define INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX
+
+#include <basebmp/color.hxx>
+#include <basebmp/colortraits.hxx>
+#include <basebmp/accessor.hxx>
+#include <basebmp/pixeliterator.hxx>
+#include <basebmp/pixelformatadapters.hxx>
+#include <basebmp/metafunctions.hxx>
+#include <basebmp/endian.hxx>
+
+#include <vigra/numerictraits.hxx>
+#include <vigra/metaprogramming.hxx>
+
+#include <functional>
+
+namespace basebmp
+{
+
+/** Base class operating on RGB truecolor mask pixel
+
+ Use this template, if you have an (integer) pixel type, and three
+ bitmasks denoting where the channel bits are.
+
+ @tpl PixelType
+ Input pixel type to operate on
+
+ @tpl ColorType
+ Underlying color type, to convert the pixel values into
+
+ @tpl RedMask
+ Bitmask, to access the red bits in the data type
+
+ @tpl GreenMask
+ Bitmask, to access the green bits in the data type
+
+ @tpl BlueMask
+ Bitmask, to access the blue bits in the data type
+
+ @tpl SwapBytes
+ When true, the final pixel values will be byte-swapped before
+ passed on.
+ */
+template< typename PixelType,
+ typename ColorType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct RGBMaskFunctorBase
+{
+ typedef PixelType pixel_type;
+ typedef ColorType color_type;
+ typedef typename make_unsigned<pixel_type>::type unsigned_pixel_type;
+ typedef typename ColorTraits<ColorType>::component_type component_type;
+
+ // calc corrective shifts for all three channels in advance
+ enum {
+ red_shift = numberOfTrailingZeros<RedMask>::value,
+ green_shift = numberOfTrailingZeros<GreenMask>::value,
+ blue_shift = numberOfTrailingZeros<BlueMask>::value,
+
+ red_bits = bitcount<RedMask>::value,
+ green_bits = bitcount<GreenMask>::value,
+ blue_bits = bitcount<BlueMask>::value
+ };
+};
+
+template< typename PixelType,
+ typename ColorType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct RGBMaskGetter :
+ public RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes>,
+ public std::unary_function<PixelType, ColorType>
+{
+ typedef RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> base_type;
+
+ ColorType operator()( PixelType v ) const
+ {
+ v = SwapBytes ? byteSwap(v) : v;
+
+ const typename base_type::unsigned_pixel_type red (v & RedMask);
+ const typename base_type::unsigned_pixel_type green(v & GreenMask);
+ const typename base_type::unsigned_pixel_type blue (v & BlueMask);
+
+ // shift color nibbles to right-aligend position. ORing it
+ // channel value shifted twice the number of channel bits, to
+ // spread the value into the component_type range
+ ColorType res( (shiftRight(red,
+ base_type::red_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::red_bits)) |
+ (shiftRight(red,
+ base_type::red_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ 2*base_type::red_bits)),
+
+ (shiftRight(green,
+ base_type::green_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::green_bits)) |
+ (shiftRight(green,
+ base_type::green_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ 2*base_type::green_bits)),
+
+ (shiftRight(blue,
+ base_type::blue_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::blue_bits)) |
+ (shiftRight(blue,
+ base_type::blue_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ 2*base_type::blue_bits)) );
+ return res;
+ }
+};
+
+template< typename PixelType,
+ typename ColorType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct RGBMaskSetter :
+ public RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes>,
+ public std::unary_function<ColorType, PixelType>
+{
+ typedef RGBMaskFunctorBase<PixelType,
+ ColorType,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> base_type;
+
+ PixelType operator()( ColorType const& c ) const
+ {
+ const typename base_type::unsigned_pixel_type red (c.getRed());
+ const typename base_type::unsigned_pixel_type green(c.getGreen());
+ const typename base_type::unsigned_pixel_type blue (c.getBlue());
+
+ typename base_type::unsigned_pixel_type res(
+ (shiftLeft(red,
+ base_type::red_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::red_bits) & RedMask) |
+ (shiftLeft(green,
+ base_type::green_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::green_bits) & GreenMask) |
+ (shiftLeft(blue,
+ base_type::blue_shift-8*
+ (signed)sizeof(typename base_type::component_type)+
+ base_type::blue_bits) & BlueMask) );
+
+ return SwapBytes ? byteSwap(res) : res;
+ }
+};
+
+//-----------------------------------------------------------------------------
+
+template< typename PixelType,
+ unsigned int RedMask,
+ unsigned int GreenMask,
+ unsigned int BlueMask,
+ bool SwapBytes > struct PixelFormatTraitsTemplate_RGBMask
+{
+ typedef PixelType pixel_type;
+
+ typedef RGBMaskGetter<pixel_type,
+ Color,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> getter_type;
+ typedef RGBMaskSetter<pixel_type,
+ Color,
+ RedMask,
+ GreenMask,
+ BlueMask,
+ SwapBytes> setter_type;
+
+ typedef PixelIterator<pixel_type> iterator_type;
+ typedef StandardAccessor<pixel_type> raw_accessor_type;
+ typedef AccessorSelector<
+ getter_type, setter_type> accessor_selector;
+};
+
+//-----------------------------------------------------------------------------
+
+// Hopefully this is an understandable plaintext explanation that matches
+// reality...
+
+// BASEBMP_TRUECOLORMASK_LSB_SWAP means that on a big-endian platform, a pixel
+// value when viewed as an integer (16 or 32 bits) has to be byte-swapped for
+// the channels to match the masks. Or equivalently (I think), on a big-endian
+// platform, the masks need to be byte-swapped to be correct.
+
+// I.e. on a litte-endian platform the masks work as such.
+
+// BASEBMP_TRUECOLORMASK_MSB_SWAP means the opposite. The masks work as such
+// on big-endian platforms, on little-endian platforms the pixel needs to be
+// byte-swapped for the masks to work.
+
+// So in a sense these two names are "backward". It sounds to me as if
+// BASEBMP_TRUECOLORMASK_LSB_SWAP would mean "when on LSB, swap" ;)
+
+#ifdef OSL_LITENDIAN
+# define BASEBMP_TRUECOLORMASK_LSB_SWAP false
+# define BASEBMP_TRUECOLORMASK_MSB_SWAP true
+#else
+# ifdef OSL_BIGENDIAN
+# define BASEBMP_TRUECOLORMASK_LSB_SWAP true
+# define BASEBMP_TRUECOLORMASK_MSB_SWAP false
+# else
+# error Undetermined endianness!
+# endif
+#endif
+
+//-----------------------------------------------------------------------------
+
+// 16bpp MSB RGB
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt16,
+ 0xF800,
+ 0x07E0,
+ 0x001F,
+ BASEBMP_TRUECOLORMASK_MSB_SWAP > PixelFormatTraits_RGB16_565_MSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB16_565_MSB::getter_type,
+ PixelFormatTraits_RGB16_565_MSB::setter_type);
+
+// 16bpp LSB RGB
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt16,
+ 0xF800,
+ 0x07E0,
+ 0x001F,
+ BASEBMP_TRUECOLORMASK_LSB_SWAP > PixelFormatTraits_RGB16_565_LSB;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGB16_565_LSB::getter_type,
+ PixelFormatTraits_RGB16_565_LSB::setter_type);
+
+
+// 32bpp formats
+
+// The intent is that the order of channel names in the names of the 32bpp
+// format typedefs below correspond to the order of the channel bytes in
+// memory, if I understand correctly.... I think the point with the below
+// formats is that the channel byte order in memory is the same regardless of
+// platform byte order.
+
+// This one used to be called PixelFormatTraits_RGB32_888.
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ BASEBMP_TRUECOLORMASK_LSB_SWAP > PixelFormatTraits_BGRX32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_BGRX32_8888::getter_type,
+ PixelFormatTraits_BGRX32_8888::setter_type);
+
+// This one used to be called PixelFormatTraits_BGR32_888.
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
+ BASEBMP_TRUECOLORMASK_MSB_SWAP > PixelFormatTraits_XRGB32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_XRGB32_8888::getter_type,
+ PixelFormatTraits_XRGB32_8888::setter_type);
+
+// The following two ones were added for Android needs and for completeness
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0xFF000000,
+ 0x00FF0000,
+ 0x0000FF00,
+ BASEBMP_TRUECOLORMASK_LSB_SWAP > PixelFormatTraits_XBGR32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_XBGR32_8888::getter_type,
+ PixelFormatTraits_XBGR32_8888::setter_type);
+
+typedef PixelFormatTraitsTemplate_RGBMask<
+ sal_uInt32,
+ 0xFF000000,
+ 0x00FF0000,
+ 0x0000FF00,
+ BASEBMP_TRUECOLORMASK_MSB_SWAP > PixelFormatTraits_RGBX32_8888;
+BASEBMP_SPECIALIZE_ACCESSORTRAITS(PixelFormatTraits_RGBX32_8888::getter_type,
+ PixelFormatTraits_RGBX32_8888::setter_type);
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_RGBMASKPIXELFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/scaleimage.hxx b/include/basebmp/scaleimage.hxx
new file mode 100644
index 000000000000..fc9022357fe6
--- /dev/null
+++ b/include/basebmp/scaleimage.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_SCALEIMAGE_HXX
+#define INCLUDED_BASEBMP_SCALEIMAGE_HXX
+
+#include <osl/diagnose.h>
+
+#include <vigra/tuple.hxx>
+#include <vigra/copyimage.hxx>
+#include <vigra/basicimage.hxx>
+#include <vigra/iteratortraits.hxx>
+
+namespace basebmp
+{
+
+template< class SourceIter, class SourceAcc,
+ class DestIter, class DestAcc >
+void scaleLine( SourceIter s_begin,
+ SourceIter s_end,
+ SourceAcc s_acc,
+ DestIter d_begin,
+ DestIter d_end,
+ DestAcc d_acc )
+{
+ const int src_width = s_end - s_begin;
+ const int dest_width = d_end - d_begin;
+
+ OSL_ASSERT( src_width > 0 && dest_width > 0 );
+
+ if( src_width >= dest_width )
+ {
+ // shrink
+ int rem = 0;
+ while( s_begin != s_end )
+ {
+ if( rem >= 0 )
+ {
+ d_acc.set( s_acc(s_begin), d_begin );
+
+ rem -= src_width;
+ ++d_begin;
+ }
+
+ rem += dest_width;
+ ++s_begin;
+ }
+ }
+ else
+ {
+ // enlarge
+ int rem = -dest_width;
+ while( d_begin != d_end )
+ {
+ if( rem >= 0 )
+ {
+ rem -= dest_width;
+ ++s_begin;
+ }
+
+ d_acc.set( s_acc(s_begin), d_begin );
+
+ rem += src_width;
+ ++d_begin;
+ }
+ }
+}
+
+/** Scale an image using zero order interpolation (pixel replication)
+
+ Source and destination range must be at least one pixel wide and
+ high.
+
+ @param s_begin
+ Start iterator for source image
+
+ @param s_end
+ End iterator for source image
+
+ @param s_acc
+ Source accessor
+
+ @param d_begin
+ Start iterator for destination image
+
+ @param d_end
+ End iterator for destination image
+
+ @param d_acc
+ Destination accessor
+
+ @param bMustCopy
+ When true, scaleImage always copies source, even when doing 1:1
+ copy
+ */
+template< class SourceIter, class SourceAcc,
+ class DestIter, class DestAcc >
+void scaleImage( SourceIter s_begin,
+ SourceIter s_end,
+ SourceAcc s_acc,
+ DestIter d_begin,
+ DestIter d_end,
+ DestAcc d_acc,
+ bool bMustCopy=false )
+{
+ const int src_width ( s_end.x - s_begin.x );
+ const int src_height( s_end.y - s_begin.y );
+
+ const int dest_width ( d_end.x - d_begin.x );
+ const int dest_height( d_end.y - d_begin.y );
+
+ if( !bMustCopy &&
+ src_width == dest_width &&
+ src_height == dest_height )
+ {
+ // no scaling involved, can simply copy
+ vigra::copyImage( s_begin, s_end, s_acc,
+ d_begin, d_acc );
+ return;
+ }
+
+ typedef vigra::BasicImage<typename SourceAcc::value_type> TmpImage;
+ typedef typename TmpImage::traverser TmpImageIter;
+
+ TmpImage tmp_image(src_width,
+ dest_height);
+ TmpImageIter t_begin = tmp_image.upperLeft();
+
+ // scale in y direction
+ for( int x=0; x<src_width; ++x, ++s_begin.x, ++t_begin.x )
+ {
+ typename SourceIter::column_iterator s_cbegin = s_begin.columnIterator();
+ typename TmpImageIter::column_iterator t_cbegin = t_begin.columnIterator();
+
+ scaleLine(s_cbegin, s_cbegin+src_height, s_acc,
+ t_cbegin, t_cbegin+dest_height, tmp_image.accessor());
+ }
+
+ t_begin = tmp_image.upperLeft();
+
+ // scale in x direction
+ for( int y=0; y<dest_height; ++y, ++d_begin.y, ++t_begin.y )
+ {
+ typename DestIter::row_iterator d_rbegin = d_begin.rowIterator();
+ typename TmpImageIter::row_iterator t_rbegin = t_begin.rowIterator();
+
+ scaleLine(t_rbegin, t_rbegin+src_width, tmp_image.accessor(),
+ d_rbegin, d_rbegin+dest_width, d_acc);
+ }
+}
+
+/** Scale an image, range tuple version
+
+ @param bMustCopy
+ When true, scaleImage always copies source, even when doing 1:1
+ copy
+ */
+template< class SourceIter, class SourceAcc,
+ class DestIter, class DestAcc >
+inline void scaleImage( vigra::triple<SourceIter,SourceIter,SourceAcc> const& src,
+ vigra::triple<DestIter,DestIter,DestAcc> const& dst,
+ bool bMustCopy=false )
+{
+ scaleImage(src.first,src.second,src.third,
+ dst.first,dst.second,dst.third,
+ bMustCopy);
+}
+
+}
+
+#endif /* INCLUDED_BASEBMP_SCALEIMAGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/scanlineformats.hxx b/include/basebmp/scanlineformats.hxx
new file mode 100644
index 000000000000..a1708980b5ac
--- /dev/null
+++ b/include/basebmp/scanlineformats.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_SCANLINEFORMATS_HXX
+#define INCLUDED_BASEBMP_SCANLINEFORMATS_HXX
+
+#include <sal/types.h>
+
+/* Definition of Scanline formats */
+
+namespace basebmp { namespace Format
+{
+ static const sal_Int32 NONE = 0;
+ static const sal_Int32 ONE_BIT_MSB_GREY = (sal_Int32)0x01;
+ static const sal_Int32 ONE_BIT_LSB_GREY = (sal_Int32)0x02;
+ static const sal_Int32 ONE_BIT_MSB_PAL = (sal_Int32)0x03;
+ static const sal_Int32 ONE_BIT_LSB_PAL = (sal_Int32)0x04;
+ static const sal_Int32 FOUR_BIT_MSB_GREY = (sal_Int32)0x05;
+ static const sal_Int32 FOUR_BIT_LSB_GREY = (sal_Int32)0x06;
+ static const sal_Int32 FOUR_BIT_MSB_PAL = (sal_Int32)0x07;
+ static const sal_Int32 FOUR_BIT_LSB_PAL = (sal_Int32)0x08;
+ static const sal_Int32 EIGHT_BIT_PAL = (sal_Int32)0x09;
+ static const sal_Int32 EIGHT_BIT_GREY = (sal_Int32)0x0A;
+ static const sal_Int32 SIXTEEN_BIT_LSB_TC_MASK = (sal_Int32)0x0B;
+ static const sal_Int32 SIXTEEN_BIT_MSB_TC_MASK = (sal_Int32)0x0C;
+ static const sal_Int32 TWENTYFOUR_BIT_TC_MASK = (sal_Int32)0x0D;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK = (sal_Int32)0x0E;
+ // The order of the channels code letters indicates the order of the
+ // channel bytes in memory, I think
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_BGRA = THIRTYTWO_BIT_TC_MASK;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_ARGB = (sal_Int32)0x0F;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_ABGR = (sal_Int32)0x10;
+ static const sal_Int32 THIRTYTWO_BIT_TC_MASK_RGBA = (sal_Int32)0x11;
+ static const sal_Int32 MAX = (sal_Int32)0x11;
+
+ const char *formatName(sal_Int32 nScanlineFormat);
+} }
+
+#endif /* INCLUDED_BASEBMP_SCANLINEFORMATS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/stridedarrayiterator.hxx b/include/basebmp/stridedarrayiterator.hxx
new file mode 100644
index 000000000000..6f5772e527c6
--- /dev/null
+++ b/include/basebmp/stridedarrayiterator.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_STRIDEDARRAYITERATOR_HXX
+#define INCLUDED_BASEBMP_STRIDEDARRAYITERATOR_HXX
+
+#include <basebmp/metafunctions.hxx>
+
+namespace basebmp
+{
+
+/** Like vigra::StridedArrayIterator
+
+ Changed semantics re. DirectionSelector<StridedArrayTag>: stride
+ now counts in <em>raw</em> bytes
+
+ Adapts given ptr, in a way that iterator increments move forward
+ in strided steps. Stride can, by the way, also be negative
+ */
+template< typename T > class StridedArrayIterator
+{
+public:
+ typedef typename clone_const<T, unsigned char>::type internal_type;
+
+ /** Create iterator
+
+ @param stride
+
+ Stride in bytes. Given value should better match memory layout
+ of T, as memory gets reinterpret-casted.
+ */
+ explicit StridedArrayIterator(int stride, T* ptr = 0) :
+ stride_(stride),
+ current_(reinterpret_cast<internal_type*>(ptr))
+ {}
+
+ /** Copy from other StridedArrayIterator, plus given offset
+
+ @param offset
+ Offset in bytes
+ */
+ StridedArrayIterator( StridedArrayIterator const& rSrc,
+ int offset ) :
+ stride_(rSrc.stride_),
+ current_(reinterpret_cast<internal_type*>(
+ reinterpret_cast<T*>(rSrc.current_)+offset))
+ {}
+
+ void operator++() {current_ += stride_; }
+ void operator++(int) {current_ += stride_; }
+ void operator--() {current_ -= stride_; }
+ void operator--(int) {current_ -= stride_; }
+ void operator+=(int dy) {current_ += dy*stride_; }
+ void operator-=(int dy) {current_ -= dy*stride_; }
+
+ int operator-(StridedArrayIterator const & rhs) const
+ { return (current_ - rhs.current_) / stride_; }
+
+ bool operator==(StridedArrayIterator const & rhs) const
+ { return current_ == rhs.current_; }
+
+ bool operator!=(StridedArrayIterator const & rhs) const
+ { return current_ != rhs.current_; }
+
+ bool operator<(StridedArrayIterator const & rhs) const
+ { return *this - rhs < 0; }
+
+ bool operator<=(StridedArrayIterator const & rhs) const
+ { return *this - rhs <= 0; }
+
+ bool operator>(StridedArrayIterator const & rhs) const
+ { return *this - rhs > 0; }
+
+ bool operator>=(StridedArrayIterator const & rhs) const
+ { return *this - rhs >= 0; }
+
+ T* operator()() const
+ { return reinterpret_cast<T*>(current_); }
+
+ T* operator()(int d) const
+ { return reinterpret_cast<T*>(current_ + d*stride_); }
+
+private:
+ int stride_;
+ internal_type* current_;
+};
+
+} // namespace basebmp
+
+#endif /* INCLUDED_BASEBMP_STRIDEDARRAYITERATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basebmp/tools.hxx b/include/basebmp/tools.hxx
new file mode 100644
index 000000000000..31854a1d5e25
--- /dev/null
+++ b/include/basebmp/tools.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEBMP_TOOLS_HXX
+#define INCLUDED_BASEBMP_TOOLS_HXX
+
+#include <basegfx/range/b2ibox.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <vigra/tuple.hxx>
+#include <vigra/diff2d.hxx>
+
+namespace basebmp
+{
+ inline vigra::Diff2D topLeft( const basegfx::B2IBox& rRange )
+ { return vigra::Diff2D(rRange.getMinX(),rRange.getMinY()); }
+
+ inline vigra::Diff2D bottomRight( const basegfx::B2IBox& rRange )
+ { return vigra::Diff2D(rRange.getMaxX(),rRange.getMaxY()); }
+
+ template< class Iterator, class Accessor >
+ inline vigra::triple<Iterator,Iterator,Accessor>
+ destIterRange(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IBox& rRange)
+ {
+ return vigra::triple<Iterator,Iterator,Accessor>(
+ begin + topLeft(rRange),
+ begin + bottomRight(rRange),
+ accessor);
+ }
+
+ template< class Iterator, class Accessor >
+ inline vigra::triple<Iterator,Iterator,Accessor>
+ srcIterRange(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IBox& rRange)
+ {
+ return vigra::triple<Iterator,Iterator,Accessor>(
+ begin + topLeft(rRange),
+ begin + bottomRight(rRange),
+ accessor);
+ }
+
+ template< class Iterator, class Accessor >
+ inline vigra::pair<Iterator,Accessor>
+ srcIter(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IPoint& rPt)
+ {
+ return vigra::pair<Iterator,Accessor>(
+ begin + vigra::Diff2D(rPt.getX(),rPt.getY()),
+ accessor);
+ }
+
+ template< class Iterator, class Accessor >
+ inline vigra::pair<Iterator,Accessor>
+ destIter(Iterator const& begin,
+ Accessor const& accessor,
+ const basegfx::B2IPoint& rPt)
+ {
+ return vigra::pair<Iterator,Accessor>(
+ begin + vigra::Diff2D(rPt.getX(),rPt.getY()),
+ accessor);
+ }
+}
+
+#endif /* INCLUDED_BASEBMP_TOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/basegfxdllapi.h b/include/basegfx/basegfxdllapi.h
new file mode 100644
index 000000000000..b71f0755d277
--- /dev/null
+++ b/include/basegfx/basegfxdllapi.h
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFXDLLAPI_H
+#define INCLUDED_BASEGFXDLLAPI_H
+
+#if defined BASEGFX_STATICLIBRARY
+
+#define BASEGFX_DLLPUBLIC
+#define BASEGFX_DLLPRIVATE
+
+#else /*BASEGFX_STATICLIBRARY*/
+
+#if defined BASEGFX_DLLIMPLEMENTATION
+#define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASEGFX_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /*BASEGFX_STATICLIBRARY*/
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx
new file mode 100644
index 000000000000..9b91e212ec89
--- /dev/null
+++ b/include/basegfx/color/bcolor.hxx
@@ -0,0 +1,229 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_COLOR_BCOLOR_HXX
+#define _BGFX_COLOR_BCOLOR_HXX
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace com { namespace sun { namespace star { namespace rendering {
+ class XGraphicDevice;
+}}}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** Base Color class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for colors will be added here.
+
+ @see B3DTuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED BColor : public B3DTuple
+ {
+ public:
+ /** Create a Color with red, green and blue components from [0.0 to 1.0]
+
+ The color is initialized to (0.0, 0.0, 0.0)
+ */
+ BColor()
+ : B3DTuple()
+ {}
+
+ /** Create a 3D Color
+
+ @param fRed
+ @param fGreen
+ @param fBlue
+ These parameters are used to initialize the red, green and blue intensities of the color
+ */
+ BColor(double fRed, double fGreen, double fBlue)
+ : B3DTuple(fRed, fGreen, fBlue)
+ {}
+
+ /** Create a 3D Color
+
+ @param fLuminosity
+ The parameter is used to initialize the red, green and blue intensities of the color
+ */
+ explicit BColor(double fLuminosity)
+ : B3DTuple(fLuminosity, fLuminosity, fLuminosity)
+ {}
+
+ /** Create a copy of a Color
+
+ @param rVec
+ The Color which will be copied.
+ */
+ BColor(const BColor& rVec)
+ : B3DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ BColor(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ ~BColor()
+ {}
+
+ // data access read
+ double getRed() const { return mfX; }
+ double getGreen() const { return mfY; }
+ double getBlue() const { return mfZ; }
+
+ // data access write
+ void setRed(double fNew) { mfX = fNew; }
+ void setGreen(double fNew) { mfY = fNew; }
+ void setBlue(double fNew) { mfZ = fNew; }
+
+ /** *=operator to allow usage from BColor, too
+ */
+ BColor& operator*=( const BColor& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from BColor, too
+ */
+ BColor& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ BColor& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ // blend to another color using luminance
+ void blend(const BColor& rColor)
+ {
+ const double fLuminance(luminance());
+ mfX = rColor.getRed() * fLuminance;
+ mfY = rColor.getGreen() * fLuminance;
+ mfZ = rColor.getBlue() * fLuminance;
+ }
+
+ // luminance
+ double luminance() const
+ {
+ const double fRedWeight(77.0 / 256.0); // 0.30
+ const double fGreenWeight(151.0 / 256.0); // 0.59
+ const double fBlueWeight(28.0 / 256.0); // 0.11
+
+ return (mfX * fRedWeight + mfY * fGreenWeight + mfZ * fBlueWeight);
+ }
+
+ // distances in color space
+ double getDistanceRed(const BColor& rColor) const { return (getRed() > rColor.getRed() ? getRed() - rColor.getRed() : rColor.getRed() - getRed()); }
+ double getDistanceGreen(const BColor& rColor) const { return (getGreen() > rColor.getGreen() ? getGreen() - rColor.getGreen() : rColor.getGreen() - getGreen()); }
+ double getDistanceBlue(const BColor& rColor) const { return (getBlue() > rColor.getBlue() ? getBlue() - rColor.getBlue() : rColor.getBlue() - getBlue()); }
+
+ double getDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ return sqrt(fDistR * fDistR + fDistG * fDistG + fDistB * fDistB);
+ }
+
+ double getMinimumDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ double fRetval(fDistR < fDistG ? fDistR : fDistG);
+ return (fRetval < fDistB ? fRetval : fDistB);
+ }
+
+ double getMaximumDistance(const BColor& rColor) const
+ {
+ const double fDistR(getDistanceRed(rColor));
+ const double fDistG(getDistanceGreen(rColor));
+ const double fDistB(getDistanceBlue(rColor));
+
+ double fRetval(fDistR > fDistG ? fDistR : fDistG);
+ return (fRetval > fDistB ? fRetval : fDistB);
+ }
+
+ // clamp color to [0.0..1.0] values in all three intensity components
+ void clamp()
+ {
+ mfX = basegfx::clamp(mfX, 0.0, 1.0);
+ mfY = basegfx::clamp(mfY, 0.0, 1.0);
+ mfZ = basegfx::clamp(mfZ, 0.0, 1.0);
+ }
+
+ void invert()
+ {
+ mfX = 1.0 - mfX;
+ mfY = 1.0 - mfY;
+ mfZ = 1.0 - mfZ;
+ }
+
+ static const BColor& getEmptyBColor()
+ {
+ return (const BColor&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+
+ com::sun::star::uno::Sequence< double > colorToDoubleSequence(const com::sun::star::uno::Reference< com::sun::star::rendering::XGraphicDevice >& /*xGraphicDevice*/) const
+ {
+ com::sun::star::uno::Sequence< double > aRet(4);
+ double* pRet = aRet.getArray();
+
+ pRet[0] = mfX;
+ pRet[1] = mfY;
+ pRet[2] = mfZ;
+ pRet[3] = 1.0;
+
+ return aRet;
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_COLOR_BCOLOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolormodifier.hxx b/include/basegfx/color/bcolormodifier.hxx
new file mode 100644
index 000000000000..4b6f04efc8e9
--- /dev/null
+++ b/include/basegfx/color/bcolormodifier.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_COLOR_BCOLORMODIFIER_HXX
+#define _BGFX_COLOR_BCOLORMODIFIER_HXX
+
+#include <basegfx/color/bcolor.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** Descriptor for type of color modification
+ */
+ enum BColorModifyMode
+ {
+ BCOLORMODIFYMODE_REPLACE, // replace all color with local color
+ BCOLORMODIFYMODE_INTERPOLATE, // interpolate color between given and local with local value
+ BCOLORMODIFYMODE_GRAY, // convert color to gray
+ BCOLORMODIFYMODE_BLACKANDWHITE, // convert color to B&W, local value is treshhold
+ BCOLORMODIFYMODE_INVERT, // invert color
+ BCOLORMODIFYMODE_LUMINANCE_TO_ALPHA // convert color to alpha value (used for Svg Mask)
+ };
+
+ /** Class to hold a color, value and mode for a color modification. Color modification is
+ done calling the getModifiedColor() method
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED BColorModifier
+ {
+ protected:
+ ::basegfx::BColor maBColor;
+ double mfValue;
+ BColorModifyMode meMode;
+
+ public:
+ BColorModifier(
+ const ::basegfx::BColor& rBColor,
+ double fValue = 0.5,
+ BColorModifyMode eMode = BCOLORMODIFYMODE_REPLACE)
+ : maBColor(rBColor),
+ mfValue(fValue),
+ meMode(eMode)
+ {}
+
+ // compare operator(s)
+ bool operator==(const BColorModifier& rCompare) const
+ {
+ return (maBColor == rCompare.maBColor && mfValue == rCompare.mfValue && meMode == rCompare.meMode);
+ }
+
+ bool operator!=(const BColorModifier& rCompare) const
+ {
+ return !(operator==(rCompare));
+ }
+
+ // data access
+ const ::basegfx::BColor& getBColor() const { return maBColor; }
+ double getValue() const { return mfValue; }
+ BColorModifyMode getMode() const { return meMode; }
+
+ // compute modified color
+ ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& aSourceColor) const;
+ };
+
+ /** Class to hold a stack of BColorModifiers and to get the modified color with
+ applying all existing entry changes
+ */
+ class BASEGFX_DLLPUBLIC BColorModifierStack
+ {
+ protected:
+ ::std::vector< BColorModifier > maBColorModifiers;
+
+ public:
+ sal_uInt32 count() const
+ {
+ return maBColorModifiers.size();
+ }
+
+ const BColorModifier& getBColorModifier(sal_uInt32 nIndex) const
+ {
+ OSL_ENSURE(nIndex < count(), "BColorModifierStack: Access out of range (!)");
+ return maBColorModifiers[nIndex];
+ }
+
+ ::basegfx::BColor getModifiedColor(const ::basegfx::BColor& rSource) const
+ {
+ if(count())
+ {
+ ::basegfx::BColor aRetval(rSource);
+ ::std::vector< BColorModifier >::const_iterator aEnd(maBColorModifiers.end());
+
+ while(aEnd != maBColorModifiers.begin())
+ {
+ aRetval = (--aEnd)->getModifiedColor(aRetval);
+ }
+
+ return aRetval;
+ }
+ else
+ {
+ return rSource;
+ }
+ }
+
+ void push(const BColorModifier& rNew)
+ {
+ maBColorModifiers.push_back(rNew);
+ }
+
+ void pop()
+ {
+ maBColorModifiers.pop_back();
+ }
+ };
+} // end of namespace basegfx
+
+#endif // _BGFX_COLOR_BCOLORMODIFIER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/color/bcolortools.hxx b/include/basegfx/color/bcolortools.hxx
new file mode 100644
index 000000000000..42ac7aafb3cc
--- /dev/null
+++ b/include/basegfx/color/bcolortools.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_COLOR_BCOLORTOOLS_HXX
+#define _BGFX_COLOR_BCOLORTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BColor;
+
+ namespace tools
+ {
+ /// Transform from RGB to HSL
+ BASEGFX_DLLPUBLIC BColor rgb2hsl(const BColor& rRGBColor);
+ /// Transform from HSL to RGB
+ BASEGFX_DLLPUBLIC BColor hsl2rgb(const BColor& rHSLColor);
+
+ /// Transform from RGB to HSV
+ BASEGFX_DLLPUBLIC BColor rgb2hsv(const BColor& rRGBColor);
+ /// Transform from HSV to RGB
+ BASEGFX_DLLPUBLIC BColor hsv2rgb(const BColor& rHSVColor);
+
+ /// Transform from Rec. 709 RGB (D65 white point) into CIE XYZ
+ BASEGFX_DLLPUBLIC BColor rgb2ciexyz( const BColor& rRGBColor );
+
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_COLOR_BCOLORTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/curve/b2dbeziertools.hxx b/include/basegfx/curve/b2dbeziertools.hxx
new file mode 100644
index 000000000000..f52f00a1912f
--- /dev/null
+++ b/include/basegfx/curve/b2dbeziertools.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_CURVE_B2DBEZIERTOOLS_HXX
+#define _BGFX_CURVE_B2DBEZIERTOOLS_HXX
+
+#include <sal/types.h>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx
+{
+ class B2DCubicBezier;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DCubicBezierHelper
+ {
+ private:
+ ::std::vector< double > maLengthArray;
+ sal_uInt32 mnEdgeCount;
+
+ public:
+ explicit B2DCubicBezierHelper(const B2DCubicBezier& rBase, sal_uInt32 nDivisions = 9);
+
+ double getLength() const { if(!maLengthArray.empty()) return maLengthArray[maLengthArray.size() - 1]; else return 0.0; }
+ double distanceToRelative(double fDistance) const;
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_CURVE_B2DBEZIERTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/curve/b2dcubicbezier.hxx b/include/basegfx/curve/b2dcubicbezier.hxx
new file mode 100644
index 000000000000..003a1970bb0a
--- /dev/null
+++ b/include/basegfx/curve/b2dcubicbezier.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_CURVE_B2DCUBICBEZIER_HXX
+#define _BGFX_CURVE_B2DCUBICBEZIER_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx
+{
+ class B2DPolygon;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DCubicBezier
+ {
+ B2DPoint maStartPoint;
+ B2DPoint maEndPoint;
+ B2DPoint maControlPointA;
+ B2DPoint maControlPointB;
+
+ public:
+ B2DCubicBezier();
+ B2DCubicBezier(const B2DCubicBezier& rBezier);
+ B2DCubicBezier(const B2DPoint& rStart, const B2DPoint& rControlPointA, const B2DPoint& rControlPointB, const B2DPoint& rEnd);
+ ~B2DCubicBezier();
+
+ // assignment operator
+ B2DCubicBezier& operator=(const B2DCubicBezier& rBezier);
+
+ // compare operators
+ bool operator==(const B2DCubicBezier& rBezier) const;
+ bool operator!=(const B2DCubicBezier& rBezier) const;
+ bool equal(const B2DCubicBezier& rBezier) const;
+
+ // test if vectors are used
+ bool isBezier() const;
+
+ // test if contained bezier is trivial and reset vectors accordingly
+ void testAndSolveTrivialBezier();
+
+ /** get length of edge
+
+ This method handles beziers and simple edges. For
+ beziers, the deviation describes the maximum allowed
+ deviation from the real edge length. The default
+ allows a deviation of 1% from the correct length.
+
+ For beziers, there is no direct way to get the length,
+ thus this method may subdivide the bezier edge and may
+ not be cheap.
+
+ @param fDeviation
+ The maximal allowed deviation between correct length
+ and bezier edge length
+
+ @return
+ The length of the edge
+ */
+ double getLength(double fDeviation = 0.01) const;
+
+ // get distance between start and end point
+ double getEdgeLength() const;
+
+ // get length of control polygon
+ double getControlPolygonLength() const;
+
+ // data interface
+ B2DPoint getStartPoint() const { return maStartPoint; }
+ void setStartPoint(const B2DPoint& rValue) { maStartPoint = rValue; }
+
+ B2DPoint getEndPoint() const { return maEndPoint; }
+ void setEndPoint(const B2DPoint& rValue) { maEndPoint = rValue; }
+
+ B2DPoint getControlPointA() const { return maControlPointA; }
+ void setControlPointA(const B2DPoint& rValue) { maControlPointA = rValue; }
+
+ B2DPoint getControlPointB() const { return maControlPointB; }
+ void setControlPointB(const B2DPoint& rValue) { maControlPointB = rValue; }
+
+ /** get the tangent in point t
+
+ This method handles all the exceptions, e.g. when control point
+ A is equal to start point and/or control point B is equal to end
+ point
+
+ @param t
+ The bezier index in the range [0.0 .. 1.0]. It will be truncated.
+
+ @return
+ The tangent vector in point t
+ */
+ B2DVector getTangent(double t) const;
+
+ /** adaptive subdivide by angle criteria
+ no start point is added, but all necessary created edges
+ and the end point
+ #i37443# allow the criteria to get unsharp in recursions
+ */
+ void adaptiveSubdivideByAngle(B2DPolygon& rTarget, double fAngleBound, bool bAllowUnsharpen) const;
+
+ /** #i37443# adaptive subdivide by nCount subdivisions
+ no start point is added, but all necessary created edges
+ and the end point
+ */
+ void adaptiveSubdivideByCount(B2DPolygon& rTarget, sal_uInt32 nCount) const;
+
+ /** Subdivide cubic bezier segment.
+
+ This function adaptively subdivides the bezier
+ segment into as much straight line segments as necessary,
+ such that the maximal orthogonal distance from any of the
+ segments to the true curve is less than the given error
+ value.
+ No start point is added, but all necessary created edges
+ and the end point
+
+ @param rPoly
+ Output polygon. The subdivided bezier segment is added to
+ this polygon via B2DPolygon::append().
+
+ @param rCurve
+ The cubic bezier curve to subdivide
+
+ @param fDistanceBound
+ Bound on the maximal distance of the approximation to the
+ true curve.
+ */
+ void adaptiveSubdivideByDistance(B2DPolygon& rTarget, double fDistanceBound) const;
+
+ // get point at given relative position
+ B2DPoint interpolatePoint(double t) const;
+
+ // calculate the smallest distance from given point to this cubic bezier segment
+ // and return the value. The relative position on the segment is returned in rCut.
+ double getSmallestDistancePointToBezierSegment(const B2DPoint& rTestPoint, double& rCut) const;
+
+ // do a split at position t and fill both resulting segments
+ void split(double t, B2DCubicBezier* pBezierA, B2DCubicBezier* pBezierB) const;
+
+ // extract snippet from fStart to fEnd from this bezier
+ B2DCubicBezier snippet(double fStart, double fEnd) const;
+
+ // get range including conrol points
+ B2DRange getRange() const;
+
+ /** Get the minimum extremum position t
+
+ @param rfResult
+ Will be changed and set to a eventually found split value which should be in the
+ range [0.0 .. 1.0]. It will be the smallest current extremum; there may be more
+
+ @return
+ Returns true if there was at least one extremum found
+ */
+ bool getMinimumExtremumPosition(double& rfResult) const;
+
+ /** Get all extremum pos of this segment
+
+ This method will calculate all extremum positions of the segment
+ and add them to rResults if they are in the range ]0.0 .. 1.0[
+
+ @param rResults
+ The vector of doubles where the results will be added. Evtl.
+ existing contents will be removed since an empty vector is a
+ necessary result to express that there are no extreme positions
+ anymore. Since there is an upper maximum of 4 values, it makes
+ sense to use reserve(4) at the vector as preparation.
+ */
+ void getAllExtremumPositions(::std::vector< double >& rResults) const;
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_CURVE_B2DCUBICBEZIER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b2dhommatrix.hxx b/include/basegfx/matrix/b2dhommatrix.hxx
new file mode 100644
index 000000000000..30204b91fad5
--- /dev/null
+++ b/include/basegfx/matrix/b2dhommatrix.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_MATRIX_B2DHOMMATRIX_HXX
+#define _BGFX_MATRIX_B2DHOMMATRIX_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DTuple;
+ class Impl2DHomMatrix;
+
+ class BASEGFX_DLLPUBLIC B2DHomMatrix
+ {
+ public:
+ typedef o3tl::cow_wrapper< Impl2DHomMatrix > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ B2DHomMatrix();
+ B2DHomMatrix(const B2DHomMatrix& rMat);
+ ~B2DHomMatrix();
+
+ /** constructor to allow setting all needed values for a 3x2 matrix at once. The
+ parameter f_0x1 e.g. is the same as using set(0, 1, f)
+ */
+ B2DHomMatrix(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
+
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+
+ /** allow setting all needed values for a 3x2 matrix in one call. The
+ parameter f_0x1 e.g. is the same as using set(0, 1, f)
+ */
+ void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2);
+
+ // test if last line is default to see if last line needs to be
+ // involved in calculations
+ bool isLastLineDefault() const;
+
+ // reset to a standard matrix
+ bool isIdentity() const;
+ void identity();
+
+ bool isInvertible() const;
+ bool invert();
+
+ void rotate(double fRadiant);
+
+ void translate(double fX, double fY);
+
+ void scale(double fX, double fY);
+
+ // Shearing-Matrices
+ void shearX(double fSx);
+ void shearY(double fSy);
+
+ B2DHomMatrix& operator+=(const B2DHomMatrix& rMat);
+ B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
+
+ bool operator==(const B2DHomMatrix& rMat) const;
+ bool operator!=(const B2DHomMatrix& rMat) const;
+
+ B2DHomMatrix& operator*=(double fValue);
+ B2DHomMatrix& operator/=(double fValue);
+
+ // matrix multiplication from the left to the local
+ B2DHomMatrix& operator*=(const B2DHomMatrix& rMat);
+
+ // assignment operator
+ B2DHomMatrix& operator=(const B2DHomMatrix& rMat);
+
+ // Help routine to decompose given homogen 3x3 matrix to components. A correction of
+ // the components is done to avoid inaccuracies.
+ bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
+ };
+
+ // addition, subtraction
+ inline B2DHomMatrix operator+(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aSum(rMatA);
+ aSum += rMatB;
+ return aSum;
+ }
+
+ inline B2DHomMatrix operator-(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aDiv(rMatA);
+ aDiv -= rMatB;
+ return aDiv;
+ }
+
+ // multiplication, division by a constant
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMat, double fValue)
+ {
+ B2DHomMatrix aNew(rMat);
+ aNew *= fValue;
+ return aNew;
+ }
+
+ inline B2DHomMatrix operator/(const B2DHomMatrix& rMat, double fValue)
+ {
+ B2DHomMatrix aNew(rMat);
+ aNew *= 1.0 / fValue;
+ return aNew;
+ }
+
+ inline B2DHomMatrix operator*(const B2DHomMatrix& rMatA, const B2DHomMatrix& rMatB)
+ {
+ B2DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_MATRIX_B2DHOMMATRIX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx
new file mode 100644
index 000000000000..ed255360f831
--- /dev/null
+++ b/include/basegfx/matrix/b2dhommatrixtools.hxx
@@ -0,0 +1,225 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_MATRIX_B2DHOMMATRIXTOOLS_HXX
+#define _BGFX_MATRIX_B2DHOMMATRIXTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** If the rotation angle is an approximate multiple of pi/2,
+ force fSin/fCos to -1/0/1, to maintain orthogonality (which
+ might also be advantageous for the other cases, but: for
+ multiples of pi/2, the exact values _can_ be attained. It
+ would be largely unintuitive, if a 180 degrees rotation
+ would introduce slight roundoff errors, instead of exactly
+ mirroring the coordinate system)
+ */
+ BASEGFX_DLLPUBLIC void createSinCosOrthogonal(double& o_rSin, double& rCos, double fRadiant);
+
+ /** Tooling methods for on-the-fly matrix generation e.g. for inline
+ multiplications
+ */
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearXB2DHomMatrix(double fShearX);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearYB2DHomMatrix(double fShearY);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createRotateB2DHomMatrix(double fRadiant);
+ BASEGFX_DLLPUBLIC B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY);
+
+ /// inline versions for parameters as tuples
+ inline B2DHomMatrix createScaleB2DHomMatrix(const B2DTuple& rScale)
+ {
+ return createScaleB2DHomMatrix(rScale.getX(), rScale.getY());
+ }
+
+ inline B2DHomMatrix createTranslateB2DHomMatrix(const B2DTuple& rTranslate)
+ {
+ return createTranslateB2DHomMatrix(rTranslate.getX(), rTranslate.getY());
+ }
+
+ /** Tooling methods for faster completely combined matrix creation
+ when scale, shearX, rotation and translation needs to be done in
+ exactly that order. It's faster since it direcly calculates
+ each matrix value based on a symbolic calculation of the three
+ matrix multiplications.
+ Inline versions for parameters as tuples added, too.
+ */
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
+ double fScaleX, double fScaleY,
+ double fShearX,
+ double fRadiant,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createScaleShearXRotateTranslateB2DHomMatrix(
+ const B2DTuple& rScale,
+ double fShearX,
+ double fRadiant,
+ const B2DTuple& rTranslate)
+ {
+ return createScaleShearXRotateTranslateB2DHomMatrix(
+ rScale.getX(), rScale.getY(),
+ fShearX,
+ fRadiant,
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ BASEGFX_DLLPUBLIC B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
+ double fShearX,
+ double fRadiant,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createShearXRotateTranslateB2DHomMatrix(
+ double fShearX,
+ double fRadiant,
+ const B2DTuple& rTranslate)
+ {
+ return createShearXRotateTranslateB2DHomMatrix(
+ fShearX,
+ fRadiant,
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ BASEGFX_DLLPUBLIC B2DHomMatrix createScaleTranslateB2DHomMatrix(
+ double fScaleX, double fScaleY,
+ double fTranslateX, double fTranslateY);
+ inline B2DHomMatrix createScaleTranslateB2DHomMatrix(
+ const B2DTuple& rScale,
+ const B2DTuple& rTranslate)
+ {
+ return createScaleTranslateB2DHomMatrix(
+ rScale.getX(), rScale.getY(),
+ rTranslate.getX(), rTranslate.getY());
+ }
+
+ /// special for the often used case of rotation around a point
+ BASEGFX_DLLPUBLIC B2DHomMatrix createRotateAroundPoint(
+ double fPointX, double fPointY,
+ double fRadiant);
+ inline B2DHomMatrix createRotateAroundPoint(
+ const B2DTuple& rPoint,
+ double fRadiant)
+ {
+ return createRotateAroundPoint(
+ rPoint.getX(), rPoint.getY(),
+ fRadiant);
+ }
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedDecompose
+ {
+ private:
+ B2DVector maScale;
+ B2DVector maTranslate;
+ double mfRotate;
+ double mfShearX;
+
+ public:
+ B2DHomMatrixBufferedDecompose(const B2DHomMatrix& rB2DHomMatrix = B2DHomMatrix())
+ : maScale(),
+ maTranslate(),
+ mfRotate(0.0),
+ mfShearX(0.0)
+ {
+ rB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
+ }
+
+ // data access
+ B2DHomMatrix getB2DHomMatrix() const
+ {
+ return createScaleShearXRotateTranslateB2DHomMatrix(
+ maScale, mfShearX, mfRotate, maTranslate);
+ }
+
+ const B2DVector& getScale() const { return maScale; }
+ const B2DVector& getTranslate() const { return maTranslate; }
+ double getRotate() const { return mfRotate; }
+ double getShearX() const { return mfShearX; }
+ };
+ } // end of namespace tools
+} // end of namespace basegfx
+
+///////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ class BASEGFX_DLLPUBLIC B2DHomMatrixBufferedOnDemandDecompose
+ {
+ private:
+ B2DHomMatrix maB2DHomMatrix;
+ B2DVector maScale;
+ B2DVector maTranslate;
+ double mfRotate;
+ double mfShearX;
+
+ // bitfield
+ unsigned mbDecomposed : 1;
+
+ void impCheckDecompose()
+ {
+ if(!mbDecomposed)
+ {
+ maB2DHomMatrix.decompose(maScale, maTranslate, mfRotate, mfShearX);
+ mbDecomposed = true;
+ }
+ }
+
+ public:
+ B2DHomMatrixBufferedOnDemandDecompose(const B2DHomMatrix& rB2DHomMatrix = B2DHomMatrix())
+ : maB2DHomMatrix(rB2DHomMatrix),
+ maScale(),
+ maTranslate(),
+ mfRotate(0.0),
+ mfShearX(0.0),
+ mbDecomposed(false)
+ {
+ }
+
+ // data access
+ const B2DHomMatrix& getB2DHomMatrix() const { return maB2DHomMatrix; }
+ const B2DVector& getScale() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maScale; }
+ const B2DVector& getTranslate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return maTranslate; }
+ double getRotate() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfRotate; }
+ double getShearX() const { const_cast< B2DHomMatrixBufferedOnDemandDecompose* >(this)->impCheckDecompose(); return mfShearX; }
+ };
+ } // end of namespace tools
+
+} // end of namespace basegfx
+
+///////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_MATRIX_B2DHOMMATRIXTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/matrix/b3dhommatrix.hxx b/include/basegfx/matrix/b3dhommatrix.hxx
new file mode 100644
index 000000000000..037d400d674f
--- /dev/null
+++ b/include/basegfx/matrix/b3dhommatrix.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_MATRIX_B3DHOMMATRIX_HXX
+#define _BGFX_MATRIX_B3DHOMMATRIX_HXX
+
+#include <sal/types.h>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3DTuple;
+ class Impl3DHomMatrix;
+
+ class BASEGFX_DLLPUBLIC B3DHomMatrix
+ {
+ public:
+ typedef o3tl::cow_wrapper< Impl3DHomMatrix > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ B3DHomMatrix();
+ B3DHomMatrix(const B3DHomMatrix& rMat);
+ ~B3DHomMatrix();
+
+ double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
+ void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
+
+ // test if last line is default to see if last line needs to be
+ // involved in calculations
+ bool isLastLineDefault() const;
+
+ bool isIdentity() const;
+ /// Reset to the identity matrix
+ void identity();
+
+ /// Invert the matrix (if possible)
+ bool invert();
+
+ /// Calc the matrix determinant
+ double determinant() const;
+
+ /// Rotation
+ void rotate(double fAngleX,double fAngleY,double fAngleZ);
+
+ /// Translation
+ void translate(double fX, double fY, double fZ);
+
+ /// Scaling
+ void scale(double fX, double fY, double fZ);
+
+ // Shearing-Matrices
+ void shearXY(double fSx, double fSy);
+ void shearXZ(double fSx, double fSz);
+
+ // Projection matrices, used for converting between eye and
+ // clip coordinates
+ void frustum(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.001, double fFar = 1.0);
+
+ void ortho(double fLeft = -1.0, double fRight = 1.0,
+ double fBottom = -1.0, double fTop = 1.0,
+ double fNear = 0.0, double fFar = 1.0);
+
+ // build orientation matrix
+ void orientation(
+ B3DPoint aVRP = B3DPoint(0.0,0.0,1.0),
+ B3DVector aVPN = B3DVector(0.0,0.0,1.0),
+ B3DVector aVUV = B3DVector(0.0,1.0,0.0));
+
+ // addition, subtraction
+ B3DHomMatrix& operator+=(const B3DHomMatrix& rMat);
+ B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
+
+ // comparison
+ bool operator==(const B3DHomMatrix& rMat) const;
+ bool operator!=(const B3DHomMatrix& rMat) const;
+
+ // multiplication, division by constant value
+ B3DHomMatrix& operator*=(double fValue);
+ B3DHomMatrix& operator/=(double fValue);
+
+ // matrix multiplication (from the left)
+ B3DHomMatrix& operator*=(const B3DHomMatrix& rMat);
+
+ // assignment operator
+ B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
+
+ // decomposition
+ bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const;
+ };
+
+ // addition, subtraction
+ inline B3DHomMatrix operator+(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aSum(rMatA);
+ aSum += rMatB;
+ return aSum;
+ }
+
+ inline B3DHomMatrix operator-(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aDiv(rMatA);
+ aDiv -= rMatB;
+ return aDiv;
+ }
+
+ // multiplication, division by constant value
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMat, double fValue)
+ {
+ B3DHomMatrix aNew(rMat);
+ aNew *= fValue;
+ return aNew;
+ }
+
+ inline B3DHomMatrix operator/(const B3DHomMatrix& rMat, double fValue)
+ {
+ B3DHomMatrix aNew(rMat);
+ aNew *= 1.0 / fValue;
+ return aNew;
+ }
+
+ inline B3DHomMatrix operator*(const B3DHomMatrix& rMatA, const B3DHomMatrix& rMatB)
+ {
+ B3DHomMatrix aMul(rMatB);
+ aMul *= rMatA;
+ return aMul;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_MATRIX_B3DHOMMATRIX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
new file mode 100644
index 000000000000..70dcabe1a190
--- /dev/null
+++ b/include/basegfx/numeric/ftools.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_NUMERIC_FTOOLS_HXX
+#define _BGFX_NUMERIC_FTOOLS_HXX
+
+#include <rtl/math.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// standard PI defines from solar.h, but we do not want to link against tools
+
+#ifndef F_PI
+#define F_PI M_PI
+#endif
+#ifndef F_PI2
+#define F_PI2 M_PI_2
+#endif
+#ifndef F_PI4
+#define F_PI4 M_PI_4
+#endif
+#ifndef F_PI180
+#define F_PI180 (M_PI/180.0)
+#endif
+#ifndef F_PI1800
+#define F_PI1800 (M_PI/1800.0)
+#endif
+#ifndef F_PI18000
+#define F_PI18000 (M_PI/18000.0)
+#endif
+#ifndef F_2PI
+#define F_2PI (2.0*M_PI)
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// fTools defines
+
+namespace basegfx
+{
+ /** Round double to nearest integer
+
+ @return the nearest integer
+ */
+ inline sal_Int32 fround( double fVal )
+ {
+ return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : -static_cast<sal_Int32>( -fVal + .5 );
+ }
+
+ /** Round double to nearest integer
+
+ @return the nearest 64 bit integer
+ */
+ inline sal_Int64 fround64( double fVal )
+ {
+ return fVal > 0.0 ? static_cast<sal_Int64>( fVal + .5 ) : -static_cast<sal_Int64>( -fVal + .5 );
+ }
+
+ /** Prune a small epsilon range around zero.
+
+ Use this method e.g. for calculating scale values. There, it
+ is usually advisable not to set a scaling to 0.0, because that
+ yields singular transformation matrices.
+
+ @param fVal
+ An arbitrary, but finite and valid number
+
+ @return either fVal, or a small value slightly above (when
+ fVal>0) or below (when fVal<0) zero.
+ */
+ inline double pruneScaleValue( double fVal )
+ {
+ // old version used ::std::min/max, but this collides if min is defined as preprocessor
+ // macro which is the case e.g with windows.h headers. The simplest way to avoid this is to
+ // just use the full comparison. I keep the original here, maybe there will be a better
+ // solution some day.
+ //
+ //return fVal < 0.0 ?
+ // (::std::min(fVal,-0.00001)) :
+ // (::std::max(fVal,0.00001));
+
+ if(fVal < 0.0)
+ return (fVal < -0.00001 ? fVal : -0.00001);
+ else
+ return (fVal > 0.00001 ? fVal : 0.00001);
+ }
+
+ /** clamp given value against given minimum and maximum values
+ */
+ template <class T> inline const T& clamp(const T& value, const T& minimum, const T& maximum)
+ {
+ if(value < minimum)
+ {
+ return minimum;
+ }
+ else if(value > maximum)
+ {
+ return maximum;
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+ /** Convert value from degrees to radians
+ */
+ inline double deg2rad( double v )
+ {
+ // divide first, to get exact values for v being a multiple of
+ // 90 degrees
+ return v / 90.0 * M_PI_2;
+ }
+
+ /** Convert value radians to degrees
+ */
+ inline double rad2deg( double v )
+ {
+ // divide first, to get exact values for v being a multiple of
+ // pi/2
+ return v / M_PI_2 * 90.0;
+ }
+
+
+ class BASEGFX_DLLPUBLIC fTools
+ {
+ /// Threshold value for equalZero()
+ static double mfSmallValue;
+
+ public:
+ /// Get threshold value for equalZero and friends
+ static double getSmallValue() { return mfSmallValue; }
+ /// Set threshold value for equalZero and friends
+ static void setSmallValue(const double& rfNew) { mfSmallValue = rfNew; }
+
+ /// Compare against small value
+ static bool equalZero(const double& rfVal)
+ {
+ return (fabs(rfVal) <= getSmallValue());
+ }
+
+ /// Compare against given small value
+ static bool equalZero(const double& rfVal, const double& rfSmallValue)
+ {
+ return (fabs(rfVal) <= rfSmallValue);
+ }
+
+ static bool equal(const double& rfValA, const double& rfValB)
+ {
+ // changed to approxEqual usage for better numerical correctness
+ return rtl::math::approxEqual(rfValA, rfValB);
+ }
+
+ static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ {
+ return (fabs(rfValA - rfValB) <= rfSmallValue);
+ }
+
+ static bool less(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA < rfValB && !equal(rfValA, rfValB));
+ }
+
+ static bool lessOrEqual(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA < rfValB || equal(rfValA, rfValB));
+ }
+
+ static bool more(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA > rfValB && !equal(rfValA, rfValB));
+ }
+
+ static bool moreOrEqual(const double& rfValA, const double& rfValB)
+ {
+ return (rfValA > rfValB || equal(rfValA, rfValB));
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_NUMERIC_FTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/pixel/bpixel.hxx b/include/basegfx/pixel/bpixel.hxx
new file mode 100644
index 000000000000..a2c59101fa78
--- /dev/null
+++ b/include/basegfx/pixel/bpixel.hxx
@@ -0,0 +1,217 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_PIXEL_BPIXEL_HXX
+#define _BGFX_PIXEL_BPIXEL_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC BPixel
+ {
+ protected:
+ union
+ {
+ struct
+ {
+ // bitfield
+ unsigned mnR : 8; // red intensity
+ unsigned mnG : 8; // green intensity
+ unsigned mnB : 8; // blue intensity
+ unsigned mnO : 8; // opacity, 0 == full transparence
+ } maRGBO;
+
+ struct
+ {
+ // bitfield
+ unsigned mnValue : 32; // all values
+ } maCombinedRGBO;
+ } maPixelUnion;
+
+ public:
+ BPixel()
+ {
+ maPixelUnion.maCombinedRGBO.mnValue = 0L;
+ }
+
+ // use explicit here to make sure everyone knows what he is doing. Values range from
+ // 0..255 integer here.
+ explicit BPixel(sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nOpacity)
+ {
+ maPixelUnion.maRGBO.mnR = nRed;
+ maPixelUnion.maRGBO.mnG = nGreen;
+ maPixelUnion.maRGBO.mnB = nBlue;
+ maPixelUnion.maRGBO.mnO = nOpacity;
+ }
+
+ // constructor from BColor which uses double precision color, so change it
+ // to local integer format. It will also be clamped here.
+ BPixel(const BColor& rColor, sal_uInt8 nOpacity)
+ {
+ maPixelUnion.maRGBO.mnR = sal_uInt8((rColor.getRed() * 255.0) + 0.5);
+ maPixelUnion.maRGBO.mnG = sal_uInt8((rColor.getGreen() * 255.0) + 0.5);
+ maPixelUnion.maRGBO.mnB = sal_uInt8((rColor.getBlue() * 255.0) + 0.5);
+ maPixelUnion.maRGBO.mnO = nOpacity;
+ }
+
+ // copy constructor
+ BPixel(const BPixel& rPixel)
+ {
+ maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue;
+ }
+
+ ~BPixel()
+ {}
+
+ // assignment operator
+ BPixel& operator=( const BPixel& rPixel )
+ {
+ maPixelUnion.maCombinedRGBO.mnValue = rPixel.maPixelUnion.maCombinedRGBO.mnValue;
+ return *this;
+ }
+
+ // data access read
+ sal_uInt8 getRed() const { return maPixelUnion.maRGBO.mnR; }
+ sal_uInt8 getGreen() const { return maPixelUnion.maRGBO.mnG; }
+ sal_uInt8 getBlue() const { return maPixelUnion.maRGBO.mnB; }
+ sal_uInt8 getOpacity() const { return maPixelUnion.maRGBO.mnO; }
+ sal_uInt32 getRedGreenBlueOpacity() const { return maPixelUnion.maCombinedRGBO.mnValue; }
+
+ // data access write
+ void setRed(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnR = nNew; }
+ void setGreen(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnG = nNew; }
+ void setBlue(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnB = nNew; }
+ void setOpacity(sal_uInt8 nNew) { maPixelUnion.maRGBO.mnO = nNew; }
+ void setRedGreenBlueOpacity(sal_uInt32 nRedGreenBlueOpacity) { maPixelUnion.maCombinedRGBO.mnValue = nRedGreenBlueOpacity; }
+ void setRedGreenBlue(sal_uInt8 nR, sal_uInt8 nG, sal_uInt8 nB) { maPixelUnion.maRGBO.mnR = nR; maPixelUnion.maRGBO.mnG = nG; maPixelUnion.maRGBO.mnB = nB; }
+
+ // comparators
+ bool isInvisible() const { return (0 == maPixelUnion.maRGBO.mnO); }
+ bool isVisible() const { return (0 != maPixelUnion.maRGBO.mnO); }
+ bool isEmpty() const { return isInvisible(); }
+ bool isUsed() const { return isVisible(); }
+
+ bool operator==( const BPixel& rPixel ) const
+ {
+ return (rPixel.maPixelUnion.maCombinedRGBO.mnValue == maPixelUnion.maCombinedRGBO.mnValue);
+ }
+
+ bool operator!=( const BPixel& rPixel ) const
+ {
+ return (rPixel.maPixelUnion.maCombinedRGBO.mnValue != maPixelUnion.maCombinedRGBO.mnValue);
+ }
+
+ // empty element
+ static const BPixel& getEmptyBPixel();
+ };
+
+ //////////////////////////////////////////////////////////////////////////
+ // external operators
+
+ inline BPixel minimum(const BPixel& rTupA, const BPixel& rTupB)
+ {
+ BPixel aMin(
+ (rTupB.getRed() < rTupA.getRed()) ? rTupB.getRed() : rTupA.getRed(),
+ (rTupB.getGreen() < rTupA.getGreen()) ? rTupB.getGreen() : rTupA.getGreen(),
+ (rTupB.getBlue() < rTupA.getBlue()) ? rTupB.getBlue() : rTupA.getBlue(),
+ (rTupB.getOpacity() < rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity());
+ return aMin;
+ }
+
+ inline BPixel maximum(const BPixel& rTupA, const BPixel& rTupB)
+ {
+ BPixel aMax(
+ (rTupB.getRed() > rTupA.getRed()) ? rTupB.getRed() : rTupA.getRed(),
+ (rTupB.getGreen() > rTupA.getGreen()) ? rTupB.getGreen() : rTupA.getGreen(),
+ (rTupB.getBlue() > rTupA.getBlue()) ? rTupB.getBlue() : rTupA.getBlue(),
+ (rTupB.getOpacity() > rTupA.getOpacity()) ? rTupB.getOpacity() : rTupA.getOpacity());
+ return aMax;
+ }
+
+ inline BPixel interpolate(const BPixel& rOld1, const BPixel& rOld2, double t)
+ {
+ if(rOld1 == rOld2)
+ {
+ return rOld1;
+ }
+ else if(0.0 >= t)
+ {
+ return rOld1;
+ }
+ else if(1.0 <= t)
+ {
+ return rOld2;
+ }
+ else
+ {
+ const sal_uInt32 nFactor(fround(256.0 * t));
+ const sal_uInt32 nNegFac(256L - nFactor);
+ return BPixel(
+ (sal_uInt8)(((sal_uInt32)rOld1.getRed() * nNegFac + (sal_uInt32)rOld2.getRed() * nFactor) >> 8L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getGreen() * nNegFac + (sal_uInt32)rOld2.getGreen() * nFactor) >> 8L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getBlue() * nNegFac + (sal_uInt32)rOld2.getBlue() * nFactor) >> 8L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() * nNegFac + (sal_uInt32)rOld2.getOpacity() * nFactor) >> 8L));
+ }
+ }
+
+ inline BPixel average(const BPixel& rOld1, const BPixel& rOld2)
+ {
+ if(rOld1 == rOld2)
+ {
+ return rOld1;
+ }
+ else
+ {
+ return BPixel(
+ (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed()) >> 1L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen()) >> 1L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue()) >> 1L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity()) >> 1L));
+ }
+ }
+
+ inline BPixel average(const BPixel& rOld1, const BPixel& rOld2, const BPixel& rOld3)
+ {
+ if(rOld1 == rOld2 && rOld2 == rOld3)
+ {
+ return rOld1;
+ }
+ else
+ {
+ return BPixel(
+ (sal_uInt8)(((sal_uInt32)rOld1.getRed() + (sal_uInt32)rOld2.getRed() + (sal_uInt32)rOld3.getRed()) / 3L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getGreen() + (sal_uInt32)rOld2.getGreen() + (sal_uInt32)rOld3.getGreen()) / 3L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getBlue() + (sal_uInt32)rOld2.getBlue() + (sal_uInt32)rOld3.getBlue()) / 3L),
+ (sal_uInt8)(((sal_uInt32)rOld1.getOpacity() + (sal_uInt32)rOld2.getOpacity() + (sal_uInt32)rOld3.getOpacity()) / 3L));
+ }
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_PIXEL_BPIXEL_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b2dpoint.hxx b/include/basegfx/point/b2dpoint.hxx
new file mode 100644
index 000000000000..ef73c8ab46c9
--- /dev/null
+++ b/include/basegfx/point/b2dpoint.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B2DPOINT_HXX
+#define _BGFX_POINT_B2DPOINT_HXX
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B2DTuple
+ */
+ class SAL_WARN_UNUSED B2DPoint : public ::basegfx::B2DTuple
+ {
+ public:
+ /** Create a 2D Point
+
+ The point is initialized to (0.0, 0.0)
+ */
+ B2DPoint()
+ : B2DTuple()
+ {}
+
+ /** Create a 2D Point
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Point.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Point.
+ */
+ B2DPoint(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ B2DPoint(const B2DPoint& rPoint)
+ : B2DTuple(rPoint)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ explicit B2DPoint(const ::basegfx::B2IPoint& rPoint)
+ : B2DTuple(rPoint)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DPoint(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
+
+ ~B2DPoint()
+ {}
+
+ /** *=operator to allow usage from B2DPoint, too
+ */
+ B2DPoint& operator*=( const B2DPoint& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2DPoint, too
+ */
+ B2DPoint& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ BASEGFX_DLLPUBLIC B2DPoint& operator=( const ::basegfx::B2DTuple& rPoint );
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B2DVector, applied.
+ */
+ BASEGFX_DLLPUBLIC B2DPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+
+ static const B2DPoint& getEmptyPoint()
+ {
+ return (const B2DPoint&) ::basegfx::B2DTuple::getEmptyTuple();
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform B2DPoint by given transformation matrix.
+
+ Since this is a Point, translational components of the
+ matrix are used.
+ */
+ BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint );
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POINT_B2DPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b2ipoint.hxx b/include/basegfx/point/b2ipoint.hxx
new file mode 100644
index 000000000000..33b225a2a36d
--- /dev/null
+++ b/include/basegfx/point/b2ipoint.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B2IPOINT_HXX
+#define _BGFX_POINT_B2IPOINT_HXX
+
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2ITuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B2ITuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2IPoint : public ::basegfx::B2ITuple
+ {
+ public:
+ /** Create a 2D Point
+
+ The point is initialized to (0, 0)
+ */
+ B2IPoint()
+ : B2ITuple()
+ {}
+
+ /** Create a 2D Point
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Point.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Point.
+ */
+ B2IPoint(sal_Int32 nX, sal_Int32 nY)
+ : B2ITuple(nX, nY)
+ {}
+
+ /** Create a copy of a 2D Point
+
+ @param rPoint
+ The 2D Point which will be copied.
+ */
+ B2IPoint(const B2IPoint& rPoint)
+ : B2ITuple(rPoint)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2ITuple-based classes
+ */
+ B2IPoint(const ::basegfx::B2ITuple& rTuple)
+ : B2ITuple(rTuple)
+ {}
+
+ ~B2IPoint()
+ {}
+
+ /** *=operator to allow usage from B2IPoint, too
+ */
+ B2IPoint& operator*=( const B2IPoint& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2IPoint, too
+ */
+ B2IPoint& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2ITuple calculations
+ */
+ B2IPoint& operator=( const ::basegfx::B2ITuple& rPoint );
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B2DVector, applied.
+ */
+ B2IPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_POINT_B2IPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b3dpoint.hxx b/include/basegfx/point/b3dpoint.hxx
new file mode 100644
index 000000000000..391bc128b9fb
--- /dev/null
+++ b/include/basegfx/point/b3dpoint.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B3DPOINT_HXX
+#define _BGFX_POINT_B3DPOINT_HXX
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B3DTuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3DPoint : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Point
+
+ The point is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DPoint()
+ : B3DTuple()
+ {}
+
+ /** Create a 3D Point
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Point.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Point.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Point.
+ */
+ B3DPoint(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
+
+ /** Create a copy of a 3D Point
+
+ @param rVec
+ The 3D Point which will be copied.
+ */
+ B3DPoint(const B3DPoint& rVec)
+ : B3DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DPoint(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ ~B3DPoint()
+ {}
+
+ /** *=operator to allow usage from B3DPoint, too
+ */
+ B3DPoint& operator*=( const B3DPoint& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3DPoint, too
+ */
+ B3DPoint& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B3DVector, applied.
+ */
+ B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+
+ static const B3DPoint& getEmptyPoint()
+ {
+ return (const B3DPoint&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform B3DPoint by given transformation matrix.
+
+ Since this is a Point, translational components of the
+ matrix are used.
+ */
+ BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_POINT_B3DPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/point/b3ipoint.hxx b/include/basegfx/point/b3ipoint.hxx
new file mode 100644
index 000000000000..e80514c13de2
--- /dev/null
+++ b/include/basegfx/point/b3ipoint.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POINT_B3IPOINT_HXX
+#define _BGFX_POINT_B3IPOINT_HXX
+
+#include <basegfx/tuple/b3ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3ITuple. All necessary extensions
+ which are special for points will be added here.
+
+ @see B3ITuple
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3IPoint : public ::basegfx::B3ITuple
+ {
+ public:
+ /** Create a 3D Point
+
+ The point is initialized to (0, 0, 0)
+ */
+ B3IPoint()
+ : B3ITuple()
+ {}
+
+ /** Create a 3D Point
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Point.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Point.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Point.
+ */
+ B3IPoint(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : B3ITuple(nX, nY, nZ)
+ {}
+
+ /** Create a copy of a 3D Point
+
+ @param rVec
+ The 3D Point which will be copied.
+ */
+ B3IPoint(const B3IPoint& rVec)
+ : B3ITuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3ITuple-based classes
+ */
+ B3IPoint(const ::basegfx::B3ITuple& rTuple)
+ : B3ITuple(rTuple)
+ {}
+
+ ~B3IPoint()
+ {}
+
+ /** *=operator to allow usage from B3IPoint, too
+ */
+ B3IPoint& operator*=( const B3IPoint& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ mnZ *= rPnt.mnZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3IPoint, too
+ */
+ B3IPoint& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3ITuple calculations
+ */
+ B3IPoint& operator=( const ::basegfx::B3ITuple& rVec )
+ {
+ mnX = rVec.getX();
+ mnY = rVec.getY();
+ mnZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Transform point by given transformation matrix.
+
+ The translational components of the matrix are, in
+ contrast to B3DVector, applied.
+ */
+ B3IPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_POINT_B3IPOINT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dlinegeometry.hxx b/include/basegfx/polygon/b2dlinegeometry.hxx
new file mode 100644
index 000000000000..934158f88a2f
--- /dev/null
+++ b/include/basegfx/polygon/b2dlinegeometry.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DLINEGEOMETRY_HXX
+#define _BGFX_POLYGON_B2DLINEGEOMETRY_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Create line start/end geometry element, mostly arrows and things like that.
+
+ @param rCandidate
+ The polygon which needs to get that line ends and needs to have two points
+ at least.
+
+ @param rArrow
+ The line start/end geometry. It is assumed that the tip is pointing
+ upwards. Result will be rotated and scaled to fit.
+
+ @param bStart
+ describes if creation is for start or end of candidate.
+
+ @param fWidth
+ defines the size of the element, it's describing the target width in X
+ of the arrow.
+
+ @param fDockingPosition needs to be in [0.0 ..1.0] range, where 0.0 means
+ that the tip of the arrow will be aligned with the polygon start, 1.0 means
+ the bottom. The default of 0.5 describes a centered arrow.
+
+ @param pConsumedLength
+ Using this parameter it is possible to get back how much from the candidate
+ geometry is overlapped by the created element (consumed).
+
+ @param fCandidateLength
+ This should contain the length of rCandidate to allow work without
+ again calculating the length (which may be expensive with beziers). If 0.0 is
+ given, the length is calculated on demand.
+
+ @return
+ The Line start and end polygon, correctly rotated and scaled
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createAreaGeometryForLineStartEnd(
+ const B2DPolygon& rCandidate,
+ const B2DPolyPolygon& rArrow,
+ bool bStart,
+ double fWidth,
+ double fCandidateLength = 0.0, // 0.0 -> calculate self
+ double fDockingPosition = 0.5, // 0->top, 1->bottom
+ double* pConsumedLength = 0L);
+
+ /** create filled polygon geometry for lines with a line width
+
+ This method will create bezier based, fillable polygons which
+ will resample the curve if it was extended for the given half
+ line width. It will remove extrema positions from contained
+ bezier segments and get as close as possible and defined by
+ the given parameters to the ideal result.
+
+ It will check edges for trivial bezier to avoid unnecessary
+ bezier polygons. Care is taken to produce the in-between
+ polygon points (the ones original on the source poygon) since
+ it has showed that without those, the raster converters leave
+ non-filled gaps.
+
+ @param rCandidate
+ The source polygon defining the hairline polygon path
+
+ @param fHalfLineWidth
+ The width of the line to one side
+
+ @param eJoin
+ The LineJoin if the edges meeting in a point do not have a C1
+ or C2 continuity
+
+ @param eCap
+ The kind of cap, which is added to the line.
+
+ @param fMaxAllowedAngle
+ Allows to hand over the maximum allowed angle between an edge and
+ it's control vectors. The smaller, the more subdivisions will be
+ needed to create the filled geometry. Allowed range is cropped to
+ [F_PI2 .. 0.01 * F_PI2].
+
+ @param fMaxPartOfEdge
+ Allows to influence from with relative length of a control vector
+ compared to it's edge a split is forced. The smaller, the more
+ subdivisions will be needed to create the filled geometry. Allowed
+ range is cropped to [1.0 .. 0.01]
+
+ @praram fMiterMinimumAngle
+ The minimum wanted angle between two edges when edge rounding
+ is using miter. When an edge is smaller than this (tighter)
+ the usual fallback to bevel is used. Allowed range is cropped
+ to [F_PI .. 0.01 * F_PI].
+
+ @return
+ The PolyPolygon containing the geometry of the extended line by
+ it's line width. Contains bezier segments and edge roundings as
+ needed and defined.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createAreaGeometry(
+ const B2DPolygon& rCandidate,
+ double fHalfLineWidth,
+ B2DLineJoin eJoin = B2DLINEJOIN_ROUND,
+ com::sun::star::drawing::LineCap eCap = com::sun::star::drawing::LineCap_BUTT,
+ double fMaxAllowedAngle = (12.5 * F_PI180),
+ double fMaxPartOfEdge = 0.4,
+ double fMiterMinimumAngle = (15.0 * F_PI180));
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DLINEGEOMETRY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygon.hxx b/include/basegfx/polygon/b2dpolygon.hxx
new file mode 100644
index 000000000000..7c854fdc8a0e
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygon.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
+#define _BGFX_POLYGON_B2DPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class ImplB2DPolygon;
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPoint;
+ class B2DVector;
+ class B2DHomMatrix;
+ class B2DCubicBezier;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DPolygon > ImplType;
+
+ private:
+ // internal data.
+ ImplType mpPolygon;
+
+ public:
+ /// diverse constructors
+ B2DPolygon();
+ B2DPolygon(const B2DPolygon& rPolygon);
+ B2DPolygon(const B2DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
+ ~B2DPolygon();
+
+ /// assignment operator
+ B2DPolygon& operator=(const B2DPolygon& rPolygon);
+
+ /// unshare this polygon with all internally shared instances
+ void makeUnique();
+
+ /// compare operators
+ bool operator==(const B2DPolygon& rPolygon) const;
+ bool operator!=(const B2DPolygon& rPolygon) const;
+
+ /// member count
+ sal_uInt32 count() const;
+
+ /// Coordinate interface
+ basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
+ void setB2DPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+
+ /// Coordinate insert/append
+ void insert(sal_uInt32 nIndex, const basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
+ void append(const basegfx::B2DPoint& rPoint, sal_uInt32 nCount);
+ void append(const basegfx::B2DPoint& rPoint);
+ void reserve(sal_uInt32 nCount);
+
+ /// Basic ControlPoint interface
+ basegfx::B2DPoint getPrevControlPoint(sal_uInt32 nIndex) const;
+ basegfx::B2DPoint getNextControlPoint(sal_uInt32 nIndex) const;
+ void setPrevControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+ void setNextControlPoint(sal_uInt32 nIndex, const basegfx::B2DPoint& rValue);
+ void setControlPoints(sal_uInt32 nIndex, const basegfx::B2DPoint& rPrev, const basegfx::B2DPoint& rNext);
+
+ /// ControlPoint resets
+ void resetPrevControlPoint(sal_uInt32 nIndex);
+ void resetNextControlPoint(sal_uInt32 nIndex);
+ void resetControlPoints();
+
+ /// Bezier segment append with control points. The current last polygon point is implicitly taken as start point.
+ void appendBezierSegment(const basegfx::B2DPoint& rNextControlPoint, const basegfx::B2DPoint& rPrevControlPoint, const basegfx::B2DPoint& rPoint);
+
+ /// ControlPoint checks
+ bool areControlPointsUsed() const;
+ bool isPrevControlPointUsed(sal_uInt32 nIndex) const;
+ bool isNextControlPointUsed(sal_uInt32 nIndex) const;
+ B2VectorContinuity getContinuityInPoint(sal_uInt32 nIndex) const;
+
+ /** bezier segment access
+
+ This method also works when it is no bezier segment at all and will fill
+ the given B2DCubicBezier as needed.
+ In any case, the given B2DCubicBezier will be filled, if necessary with
+ the single start point (if no valid edge exists).
+
+ @param nIndex
+ Index of the addressed edge's start point
+
+ @param rTarget
+ The B2DCubicBezier to be filled. It's data WILL be changed.
+ */
+ void getBezierSegment(sal_uInt32 nIndex, B2DCubicBezier& rTarget) const;
+
+ /** Default adaptive subdivision access
+
+ This method will return a default adapive subdivision of the polygon.
+ If the polygon does not contain any bezier curve segments, it will
+ just return itself.
+
+ The subdivision is created on first request and buffered, so when using
+ this subdivision You have the guarantee for fast accesses for multiple
+ usages. It is intended for tooling usage for tasks which would be hard
+ to accomplish on bezier segments (e.g. isInEpsilonRange).
+
+ The current default subdivision uses adaptiveSubdivideByCount with 9
+ subdivisions which gives 10 edges and 11 points per segment and is
+ usually pretty usable for processing purposes. There is no parameter
+ passing here ATM but it may be changed on demand. If needed, a TYPE
+ and PARAMETER (both defaulted) may be added to allow for switching
+ between the different kinds of subdivisiond and passing them one
+ parameter.
+
+ The lifetime of the buffered subdivision is based on polygon changes.
+ When changing the polygon, it will be flushed. It is buffered at the
+ refcounted implementation class, so it will survive copy by value and
+ combinations in PolyPolygons.
+
+ @return
+ The default (and buffered) subdivision of this polygon. It may
+ be this polygon itself when it has no bezier segments. It is guaranteed
+ to have no more bezier segments
+ */
+ B2DPolygon getDefaultAdaptiveSubdivision() const;
+
+ /** Get the B2DRange (Rectangle dimensions) of this B2DPolygon
+
+ A polygon may have up to three ranges:
+
+ (a) the range of the polygon points
+ (b) the range of the polygon points and control points
+ (c) the outer range of the subdivided bezier curve
+
+ Ranges (a) and (c) are produced by tools::getRange(); resp. this
+ getB2DRange(). tools::getRangeWithControlPoints handles case (b).
+
+ To get range (c) a simple solution would be to subdivide the polygon
+ and use getRange() on it. Since subdivision is expensive and decreases
+ the polygon quality, i added this new method. It will use a
+ methodology suggested by HDU. First, it gets the range (a).
+ Then it iterates over the bezier segments and for each it
+ first tests if the outer range of the bezier segment is already
+ contained in the result range.
+
+ The subdivision itself uses getAllExtremumPositions() to only
+ calculate extremum points and to expand the result accordingly.
+ Thus it calculates maximal four extremum points on the bezier
+ segment, no split is used at all.
+
+ @return
+ The outer range of the bezier curve/polygon
+ */
+ B2DRange getB2DRange() const;
+
+ /** append other 2D polygons
+
+ The default (nIndex ==0 && nCount == 0) will append
+ the whole rPoly
+
+ @param rPoly
+ The source polygon
+
+ @param nIndex
+ The index to the first point of rPoly to append
+
+ @param nCount
+ The number of points to append from rPoly, starting
+ from nIndex. If zero, as much as possibel is appended
+ */
+ void append(const B2DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ /// remove points
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ /// clear all points
+ void clear();
+
+ /// closed state interface
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ /// flip polygon direction
+ void flip();
+
+ /// test if Polygon has double points
+ bool hasDoublePoints() const;
+
+ /// remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ /// apply transformation given in matrix form
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+ };
+
+ // typedef for a vector of B2DPolygons
+ typedef ::std::vector< B2DPolygon > B2DPolygonVector;
+
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POLYGON_B2DPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygonclipper.hxx b/include/basegfx/polygon/b2dpolygonclipper.hxx
new file mode 100644
index 000000000000..197958e45a00
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygonclipper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX
+#define _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B2DRange;
+
+ namespace tools
+ {
+ // This method clips the given PolyPolygon against a horizontal or vertical axis (parallell to X or Y axis). The axis is
+ // defined by bParallelToXAxis (true -> it's parallel to the X-Axis of the coordinate system, else to the Y-Axis) and the
+ // fValueOnOtherAxis (gives the translation to the coordinate system axis). For example, when You want to define
+ // a clip axis parallel to X.Axis and 100 above it, use bParallelToXAxis = true and fValueOnOtherAxis = 100.
+ // The value bAboveAxis defines on which side the return value will be (true -> above X, right of Y).
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnParallelAxis(const B2DPolyPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnParallelAxis(const B2DPolygon& rCandidate, bool bParallelToXAxis, bool bAboveAxis, double fValueOnOtherAxis, bool bStroke);
+
+ // Clip the given PolyPolygon against the given range. bInside defines if the result will contain the
+ // parts which are contained in the range or vice versa.
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnRange(const B2DPolyPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnRange(const B2DPolygon& rCandidate, const B2DRange& rRange, bool bInside, bool bStroke);
+
+ // Clip given PolyPolygon against given clipping polygon.
+ // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
+ // With stroke polygons, You get all line snippets inside rCip.
+ // With filled polygons, You get all PolyPolygon parts which were inside rClip.
+ // The switch bInside decides if the parts inside the clip polygon or outside shall be created.
+ // The clip polygon is always assumed closed, even when it's isClosed() is false.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke);
+ BASEGFX_DLLPUBLIC B2DPolyPolygon clipPolygonOnPolyPolygon(const B2DPolygon& rCandidate, const B2DPolyPolygon& rClip, bool bInside, bool bStroke);
+
+ // clip the given polygon against the given range. the resulting polygon will always contain
+ // the inside parts which will always be interpreted as areas. the incoming polygon is expected
+ // to be a simple triangle list. the result is also a simple triangle list.
+ BASEGFX_DLLPUBLIC B2DPolygon clipTriangleListOnRange( const B2DPolygon& rCandidate, const B2DRange& rRange );
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYPOLYGON_B2DPOLYGONCLIPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygoncutandtouch.hxx b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx
new file mode 100644
index 000000000000..05f8e0e0cb3a
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygoncutandtouch.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_CUTANDTOUCH_HXX
+#define _BGFX_POLYGON_CUTANDTOUCH_HXX
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ // look for self-intersections and self-touches (points on an edge) in given polygon and add
+ // extra points there. Result will have no touches or intersections on an edge, only on points
+ BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCutsAndTouches(const B2DPolygon& rCandidate);
+
+ // look for polypolygon-intersections and polypolygon-touches (point of poly A on an edge of poly B) in given PolyPolygon and add
+ // extra points there. Result will have no touches or intersections between contained polygons on an edge, only on points. For
+ // convenience, the correction for self-intersections for each member polygon will be used, too.
+ // Changed: Self intersections are searched by default, but may be switched off by 2nd parameter.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon addPointsAtCutsAndTouches(const B2DPolyPolygon& rCandidate, bool bSelfIntersections = true);
+
+ // look for intersections of rCandidate with the edge from rStart to rEnd and add extra points there.
+ // Points are only added in the range of the edge, not on the endless vector.
+ BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPoint& rStart, const B2DPoint& rEnd);
+
+ // look for intersections of rCandidate with the mask Polygon and add extra points there.
+ // The mask polygon is assumed to be closed, even when it's not explicitly.
+ BASEGFX_DLLPUBLIC B2DPolygon addPointsAtCuts(const B2DPolygon& rCandidate, const B2DPolyPolygon& rMask);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POLYGON_CUTANDTOUCH_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
new file mode 100644
index 000000000000..dce479847d65
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -0,0 +1,442 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
+#define _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B2DPolygon;
+ class B2DRange;
+
+ namespace tools
+ {
+ // B2DPolygon tools
+
+ // open/close with point add/remove and control point corrections
+ BASEGFX_DLLPUBLIC void openWithGeometryChange(B2DPolygon& rCandidate);
+ BASEGFX_DLLPUBLIC void closeWithGeometryChange(B2DPolygon& rCandidate);
+
+ /** Check if given polygon is closed.
+
+ This is kind of a 'classic' method to support old polygon
+ definitions. Those old polygon definitions define the
+ closed state of the polygon using identical start and
+ endpoints. This method corrects this (removes double
+ start/end points) and sets the Closed()-state of the
+ polygon correctly.
+ */
+ BASEGFX_DLLPUBLIC void checkClosed(B2DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate);
+
+ // Get orientation of Polygon
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation(const B2DPolygon& rCandidate);
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
+ // not true is given in bWithBorder flag.
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolygon& rCandidate, const B2DPolygon& rPolygon, bool bWithBorder = false);
+
+ /** Get the range of a polygon
+
+ This method creates the outer range of the subdivided bezier curve.
+ For detailed discussion see B2DPolygon::getB2DRange()
+
+ @param rCandidate
+ The B2DPolygon eventually containing bezier segments
+
+ @return
+ The outer range of the bezier curve
+ */
+ BASEGFX_DLLPUBLIC B2DRange getRange(const B2DPolygon& rCandidate);
+
+ // get signed area of polygon
+ BASEGFX_DLLPUBLIC double getSignedArea(const B2DPolygon& rCandidate);
+
+ // get area of polygon
+ BASEGFX_DLLPUBLIC double getArea(const B2DPolygon& rCandidate);
+
+ /** get length of polygon edge from point nIndex to nIndex + 1 */
+ BASEGFX_DLLPUBLIC double getEdgeLength(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ /** get length of polygon */
+ BASEGFX_DLLPUBLIC double getLength(const B2DPolygon& rCandidate);
+
+ // get position on polygon for absolute given distance. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get a snippet from given polygon for absolute distances. The polygon is assumed
+ // to be opened (not closed). fFrom and fTo need to be in range [0.0 .. fLength], where
+ // fTo >= fFrom. If length is given, it is assumed the correct polygon length,
+ // if 0.0 it is calculated using getLength(...)
+ BASEGFX_DLLPUBLIC B2DPolygon getSnippetAbsolute(const B2DPolygon& rCandidate, double fFrom, double fTo, double fLength = 0.0);
+
+ // Continuity check for point with given index
+ BASEGFX_DLLPUBLIC B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon& rCandidate, double fDistanceBound = 0.0);
+
+ // Subdivide all contained curves. Use angleBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon& rCandidate, double fAngleBound = 0.0);
+
+ // #i37443# Subdivide all contained curves.
+ BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByCount(const B2DPolygon& rCandidate, sal_uInt32 nCount = 0L);
+
+ // Definitions for the cut flags used from the findCut methods
+ typedef sal_uInt16 CutFlagValue;
+
+ #define CUTFLAG_NONE (0x0000)
+ #define CUTFLAG_LINE (0x0001)
+ #define CUTFLAG_START1 (0x0002)
+ #define CUTFLAG_START2 (0x0004)
+ #define CUTFLAG_END1 (0x0008)
+ #define CUTFLAG_END2 (0x0010)
+ #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
+ #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
+
+ // This version works with two points and vectors to define the
+ // edges for the cut test.
+ BASEGFX_DLLPUBLIC CutFlagValue findCut(
+ const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
+ const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
+ CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ double* pCut1 = 0L, double* pCut2 = 0L);
+
+ // test if point is on the given edge in range ]0.0..1.0[ without
+ // the start/end points. If so, return true and put the parameter
+ // value in pCut (if provided)
+ BASEGFX_DLLPUBLIC bool isPointOnEdge(
+ const B2DPoint& rPoint,
+ const B2DPoint& rEdgeStart,
+ const B2DVector& rEdgeDelta,
+ double* pCut = 0L);
+
+ /** Apply given LineDashing to given polygon
+
+ This method is used to cut down line polygons to the needed
+ pieces when a dashing needs to be applied.
+ It is now capable of keeping contained bezier segments.
+ It is also capable of delivering line and non-line portions
+ depending on what target polygons You provide. This is useful
+ e.g. for dashed lines with two colors.
+ If the last and the first snippet in one of the results have
+ a common start/end ppoint, they will be merged to achieve as
+ view as needed result line snippets. This is also relevant for
+ further processing the results.
+
+ @param rCandidate
+ The polygon based on which the snippets will be created.
+
+ @param rDotDashArray
+ The line pattern given as array of length values
+
+ @param pLineTarget
+ The target for line snippets, e.g. the first entry will be
+ a line segment with length rDotDashArray[0]. The given
+ polygon will be emptied as preparation.
+
+ @param pGapTarget
+ The target for gap snippets, e.g. the first entry will be
+ a line segment with length rDotDashArray[1]. The given
+ polygon will be emptied as preparation.
+
+ @param fFullDashDotLen
+ The sumed-up length of the rDotDashArray. If zero, it will
+ be calculated internally.
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B2DPolyPolygon* pLineTarget,
+ B2DPolyPolygon* pGapTarget = 0,
+ double fFullDashDotLen = 0.0);
+
+ // test if point is inside epsilon-range around an edge defined
+ // by the two given points. Can be used for HitTesting. The epsilon-range
+ // is defined to be the rectangle centered to the given edge, using height
+ // 2 x fDistance, and the circle around both points with radius fDistance.
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance);
+
+ // test if point is inside epsilon-range around the given Polygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the rectangle centered
+ // to the given edge, using height 2 x fDistance, and the circle around both points
+ // with radius fDistance.
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
+
+ /** Create a polygon from a rectangle.
+
+ @param rRect
+ The rectangle which describes the polygon size
+
+ @param fRadiusX
+ @param fRadiusY
+ Radius of the edge rounding, relative to the rectangle size. 0.0 means no
+ rounding, 1.0 will lead to an ellipse
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromRect( const B2DRectangle& rRect, double fRadiusX, double fRadiusY );
+
+ /** Create a polygon from a rectangle.
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromRect( const B2DRectangle& rRect );
+
+ /** Create the unit polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createUnitPolygon();
+
+ /** Create a circle polygon with given radius.
+
+ This method creates a circle approximation consisting of
+ four cubic bezier segments, which approximate the given
+ circle with an error of less than 0.5 percent.
+
+ @param rCenter
+ Center point of the circle
+
+ @param fRadius
+ Radius of the circle
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromCircle( const B2DPoint& rCenter, double fRadius );
+
+ /// create half circle centered on (0,0) from [0 .. F_PI]
+ B2DPolygon createHalfUnitCircle();
+
+ /** create a polygon which describes the unit circle and close it
+
+ @param nStartQuadrant
+ To be able to rebuild the old behaviour where the circles started at bottom,
+ this parameter is used. Default is 0 which is the first quadrant and the
+ polygon's start point will be the rightmost one. When using e.g. 1, the
+ first created quadrant will start at the YMax-position (with Y down on screens,
+ this is the lowest one). This is needed since when lines are dashed, toe old
+ geometry started at bottom point, else it would look different.
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromUnitCircle(sal_uInt32 nStartQuadrant = 0);
+
+ /** Create an ellipse polygon with given radii.
+
+ This method creates an ellipse approximation consisting of
+ four cubic bezier segments, which approximate the given
+ ellipse with an error of less than 0.5 percent.
+
+ @param rCenter
+ Center point of the circle
+
+ @param fRadiusX
+ Radius of the ellipse in X direction
+
+ @param fRadiusY
+ Radius of the ellipse in Y direction
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromEllipse( const B2DPoint& rCenter, double fRadiusX, double fRadiusY );
+
+ /** Create an unit ellipse polygon with the given angles, from start to end
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromEllipseSegment( const B2DPoint& rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd );
+
+ BASEGFX_DLLPUBLIC B2DPolygon createPolygonFromUnitEllipseSegment( double fStart, double fEnd );
+
+ /** Predicate whether a given polygon is a rectangle.
+
+ @param rPoly
+ Polygon to check
+
+ @return true, if the polygon describes a rectangle
+ (polygon is closed, and the points are either cw or ccw
+ enumerations of a rectangle's vertices). Note that
+ intermediate points and duplicate points are ignored.
+ */
+ BASEGFX_DLLPUBLIC bool isRectangle( const B2DPolygon& rPoly );
+
+ // create 3d polygon from given 2d polygon. The given fZCoordinate is used to expand the
+ // third coordinate.
+ BASEGFX_DLLPUBLIC B3DPolygon createB3DPolygonFromB2DPolygon(const B2DPolygon& rCandidate, double fZCoordinate = 0.0);
+
+ // create 2d PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
+ // matrix and the resulting x,y is used to form the new polygon.
+ BASEGFX_DLLPUBLIC B2DPolygon createB2DPolygonFromB3DPolygon(const B3DPolygon& rCandidate, const B3DHomMatrix& rMat);
+
+ // calculate the smallest distance to given edge and return. The relative position on the edge is returned in Cut.
+ // That position is in the range [0.0 .. 1.0] and the returned distance is adapted accordingly to the start or end
+ // point of the edge
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToEdge(const B2DPoint& rPointA, const B2DPoint& rPointB, const B2DPoint& rTestPoint, double& rCut);
+
+ // for each contained edge calculate the smallest distance. Return the index to the smallest
+ // edge in rEdgeIndex. The relative position on the edge is returned in rCut.
+ // If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToPolygon(const B2DPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rEdgeIndex, double& rCut);
+
+ // distort single point. rOriginal describes the original range, where the given points describe the distorted corresponding points.
+ BASEGFX_DLLPUBLIC B2DPoint distort(const B2DPoint& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // distort polygon. rOriginal describes the original range, where the given points describe the distorted corresponding points.
+ BASEGFX_DLLPUBLIC B2DPolygon distort(const B2DPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // expand all segments (which are not yet) to curve segments. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances on each segment.
+ BASEGFX_DLLPUBLIC B2DPolygon expandToCurve(const B2DPolygon& rCandidate);
+
+ // expand given segment to curve segment. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances. The return value describes if a change took place.
+ BASEGFX_DLLPUBLIC bool expandToCurveInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // set continuity for given index. If not a curve, nothing will change. Non-curve points are not changed, too.
+ // The return value describes if a change took place.
+ BASEGFX_DLLPUBLIC bool setContinuityInPoint(B2DPolygon& rCandidate, sal_uInt32 nIndex, B2VectorContinuity eContinuity);
+
+ // test if polygon contains neutral points. A neutral point is one whos orientation is neutral
+ // e.g. positioned on the edge of it's predecessor and successor
+ BASEGFX_DLLPUBLIC bool hasNeutralPoints(const B2DPolygon& rCandidate);
+
+ // remove neutral points. A neutral point is one whos orientation is neutral
+ // e.g. positioned on the edge of it's predecessor and successor
+ BASEGFX_DLLPUBLIC B2DPolygon removeNeutralPoints(const B2DPolygon& rCandidate);
+
+ // tests if polygon is convex
+ BASEGFX_DLLPUBLIC bool isConvex(const B2DPolygon& rCandidate);
+
+ // calculates the orientation at edge nIndex
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientationForIndex(const B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ BASEGFX_DLLPUBLIC bool isPointOnLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidate, bool bWithPoints = false);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithPoints = true);
+
+ // test if candidate is inside triangle
+ BASEGFX_DLLPUBLIC bool isPointInTriangle(const B2DPoint& rA, const B2DPoint& rB, const B2DPoint& rC, const B2DPoint& rCandidate, bool bWithBorder = false);
+
+ // test if candidateA and candidateB are on the same side of the given line
+ BASEGFX_DLLPUBLIC bool arePointsOnSameSideOfLine(const B2DPoint& rStart, const B2DPoint& rEnd, const B2DPoint& rCandidateA, const B2DPoint& rCandidateB, bool bWithLine = false);
+
+ // add triangles for given rCandidate to rTarget. For each triangle, 3 points will be added to rCandidate.
+ // All triangles will go from the start point of rCandidate to two consecutive points, building (rCandidate.count() - 2)
+ // triangles.
+ BASEGFX_DLLPUBLIC void addTriangleFan(const B2DPolygon& rCandidate, B2DPolygon& rTarget);
+
+ // grow for polygon. Move all geometry in each point in the direction of the normal in that point
+ // with the given amount. Value may be negative.
+ BASEGFX_DLLPUBLIC B2DPolygon growInNormalDirection(const B2DPolygon& rCandidate, double fValue);
+
+ // force all sub-polygons to a point count of nSegments
+ BASEGFX_DLLPUBLIC B2DPolygon reSegmentPolygon(const B2DPolygon& rCandidate, sal_uInt32 nSegments);
+
+ // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
+ // organisation, e.g. same amount of points
+ BASEGFX_DLLPUBLIC B2DPolygon interpolate(const B2DPolygon& rOld1, const B2DPolygon& rOld2, double t);
+
+ // #i76891# Try to remove existing curve segments if they are simply edges
+ BASEGFX_DLLPUBLIC B2DPolygon simplifyCurveSegments(const B2DPolygon& rCandidate);
+
+ // makes the given indexed point the new polygon start point. To do that, the points in the
+ // polygon will be rotated. This is only valid for closed polygons, for non-closed ones
+ // an assertion will be triggered
+ BASEGFX_DLLPUBLIC B2DPolygon makeStartPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndexOfNewStatPoint);
+
+ /** create edges of given length along given B2DPolygon
+
+ @param rCandidate
+ The polygon to move along. Points at the given polygon are created, starting
+ at position fStart and stopping at less or equal to fEnd. The closed state is
+ preserved.
+ The polygon is subdivided if curve segments are included. That subdivision is the base
+ for the newly created points.
+ If the source is closed, the indirectly existing last edge may NOT have the
+ given length.
+ If the source is open, all edges will have the given length. You may use the last
+ point of the original when You want to add the last edge Yourself.
+
+ @param fLength
+ The length of the created edges. If less or equal zero, an empty polygon is returned.
+
+ @param fStart
+ The start distance for the first to be generated point. Use 0.0 to get the
+ original start point. Negative values are truncated to 0.0.
+
+ @param fEnd
+ The maximum distance for the last point. No more points behind this distance will be created.
+ Use 0.0 to proccess the whole polygon. Negative values are truncated to 0.0. It also
+ needs to be more or equal to fStart, else it is truncated to fStart.
+
+ @return
+ The newly created polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createEdgesOfGivenLength(const B2DPolygon& rCandidate, double fLength, double fStart = 0.0, double fEnd = 0.0);
+
+ /** Create Waveline along given polygon
+ The implementation is based on createEdgesOfGivenLength and creates a curve
+ segment with the given dimensions for each created line segment. The polygon
+ is treated as if opened (closed state will be ignored) and only for whole
+ edges a curve segment will be created (no rest handling)
+
+ @param rCandidate
+ The polygon along which the waveline will be created
+
+ @param fWaveWidth
+ The length of a single waveline curve segment
+
+ @param fgWaveHeight
+ The height of the waveline (amplitude)
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon createWaveline(const B2DPolygon& rCandidate, double fWaveWidth, double fWaveHeight);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolygontriangulator.hxx b/include/basegfx/polygon/b2dpolygontriangulator.hxx
new file mode 100644
index 000000000000..5af34ae1ecd2
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolygontriangulator.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYGONTRIANGULATOR_HXX
+#define _BGFX_POLYGON_B2DPOLYGONTRIANGULATOR_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace triangulator
+ {
+ // triangulate given polygon
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon triangulate(const ::basegfx::B2DPolygon& rCandidate);
+
+ // triangulate given PolyPolygon
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon triangulate(const ::basegfx::B2DPolyPolygon& rCandidate);
+
+ } // end of namespace triangulator
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DPOLYGONTRIANGULATOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygon.hxx b/include/basegfx/polygon/b2dpolypolygon.hxx
new file mode 100644
index 000000000000..cd22644ab8ce
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygon.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+#define _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <vector>
+
+// predeclarations
+class ImplB2DPolyPolygon;
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DHomMatrix;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B2DPolyPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DPolyPolygon > ImplType;
+
+ private:
+ ImplType mpPolyPolygon;
+
+ public:
+ B2DPolyPolygon();
+ B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon);
+ explicit B2DPolyPolygon(const B2DPolygon& rPolygon);
+ ~B2DPolyPolygon();
+
+ // assignment operator
+ B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
+
+ /// unshare this poly-polygon (and all included polygons) with all internally shared instances
+ void makeUnique();
+
+ // compare operators
+ bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
+ bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
+
+ // polygon interface
+ sal_uInt32 count() const;
+
+ B2DPolygon getB2DPolygon(sal_uInt32 nIndex) const;
+ void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
+
+ // test for curve
+ bool areControlPointsUsed() const;
+
+ // insert/append single polygon
+ void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+
+ /** Default adaptive subdivision access
+
+ For details refer to B2DPolygon::getDefaultAdaptiveSubdivision()
+
+ @return
+ The default subdivision of this polygon
+ */
+ B2DPolyPolygon getDefaultAdaptiveSubdivision() const;
+
+ /** Get the B2DRange (Rectangle dimensions) of this B2DPolyPolygon
+
+ For details refer to B2DPolygon::getB2DRange()
+
+ @return
+ The outer range of the bezier curve/polygon
+ */
+ B2DRange getB2DRange() const;
+
+ // insert/append multiple polygons
+ void insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon);
+ void append(const B2DPolyPolygon& rPolyPolygon);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // reset to empty state
+ void clear();
+
+ // closed state
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if PolyPolygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const basegfx::B2DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B2DPolygon* begin() const;
+ const B2DPolygon* end() const;
+ B2DPolygon* begin();
+ B2DPolygon* end();
+ };
+
+ // typedef for a vector of B2DPolyPolygons
+ typedef ::std::vector< B2DPolyPolygon > B2DPolyPolygonVector;
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B2DPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygoncutter.hxx b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
new file mode 100644
index 000000000000..31bd8b6279f9
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygoncutter.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONCUTTER_HXX
+#define _BGFX_POLYGON_B2DPOLYPOLYGONCUTTER_HXX
+
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Solve all crossovers (aka self-intersections) in a polyPolygon.
+
+ This re-layouts all contained polygons so that the result
+ will contain only non-cutting polygons. For that reason,
+ points will be added at crossover and touch points and the
+ single Polygons may be re-combined. The orientations of
+ the contained polygons in not changed but used as
+ topological information. Self crossovers of the contained
+ sub-polygons are implicitely handled, but to not lose the
+ topological information, it may be necessary to remove
+ self-intersections of the contained sub-polygons in a
+ preparing step and to explicitly correct their
+ orientations.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolyPolygon& rCandidate);
+
+ /** Solve all crossovers (aka self-intersections) in a Polygon
+
+ Same as above, but for single polygons. Result will be
+ free of self-intersections. When result contains multiple
+ polygons, it may be necessary to rearrange their
+ orientations since holes may have been created (use
+ correctOrientations eventually).
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const B2DPolygon& rCandidate);
+
+ /** Strip neutral polygons from PolyPolygon.
+
+ Neutral polygons are ones who's orientation is neutral, so
+ normally they have no volume -> just closed paths. A
+ polygon with the same positive and negative oriented
+ volume is also neutral, so this may not be wanted. It is
+ safe to call with self-intersection-free polygons, though
+ (that's where it's mostly used).
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon stripNeutralPolygons(const B2DPolyPolygon& rCandidate);
+
+ /** Remove unnecessary/non-displayed polygons.
+
+ Works only correct with self-intersection-free
+ polygons. For each polygon, the depth for the PolyPolygon
+ is calculated. The orientation is used to identify holes.
+ Start value for holes is -1, for polygons it's zero. Ech
+ time a polygon is contained in another one, it's depth is
+ increased when inside a polygon, decreased when inside a
+ hole. The result is a depth which e.g. is -1 for holes
+ outside everything, 1 for a polygon covered by another
+ polygon and zero for e.g. holes in a polygon or polygons
+ outside everythig else. In the 2nd step, all polygons
+ with depth other than zero are removed. If bKeepAboveZero
+ is used, all polygons < 1 are removed. The bKeepAboveZero
+ mode is useful for clipping, e.g. just append one polygon
+ to another and use this mode -> only parts where two
+ polygons overlapped will be kept. In combination with
+ correct orientation of the input orientations and the
+ SolveCrossover calls this can be combined for logical
+ polygon operations or polygon clipping.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon stripDispensablePolygons(const B2DPolyPolygon& rCandidate, bool bKeepAboveZero = false);
+
+ /** Emulate nonzero winding rule filling.
+
+ Geometrically convert PolyPolygons which are proposed to
+ use nonzero fill rule to a representation where evenodd
+ paint will give the same result. To do this all
+ intersections and self-intersections get solved (the
+ polygons will be rearranged if needed). Then all polygons
+ which are inside another one with the same orientation get
+ deleted
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createNonzeroConform(const B2DPolyPolygon& rCandidate);
+
+ // For convenience: The four basic operations OR, XOR, AND and DIFF for
+ // two PolyPolygons. These are combinations of the above methods. To not be forced
+ // to do evtl. already done preparations twice, You have to do the operations Yourself.
+ //
+ // A source preparation consists of preparing it to be seen as XOR-Rule PolyPolygon,
+ // so it is freed of intersections, self-intersections and the orientations are corrected.
+ // Important is that it will define the same areas as before, but is intersection-free.
+ // As an example think about a single polygon looping in itself and having holes. To
+ // topologically correctly handle this, it is necessary to remove all intersections and
+ // to correct the orientations. The orientation of the isolated holes e.g. will be negative.
+ // Topologically it is necessary to prepare each polygon which is seen as entity. It is
+ // not sufficient just to concatenate them and prepare the result, this may be topologically
+ // different since the simple concatenation will be seen as XOR. To work correctly, You
+ // may need to OR those polygons.
+
+ /// prep for ops - solve self-intersections and intersections, remove neutral parts and check orientations.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon prepareForPolygonOperation(const B2DPolygon& rCandidate);
+ /// prep for ops - solve self-intersections and intersections, remove neutral parts and check orientations.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon prepareForPolygonOperation(const B2DPolyPolygon& rCandidate);
+
+ /// OR: Return all areas where CandidateA or CandidateB exist
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationOr(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// XOR: Return all areas where CandidateA or CandidateB exist, but not both
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationXor(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// AND: Return all areas where CandidateA and CandidateB exist
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationAnd(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /// DIFF: Return all areas where CandidateA is not covered by CandidateB (cut B out of A)
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solvePolygonOperationDiff(const B2DPolyPolygon& rCandidateA, const B2DPolyPolygon& rCandidateB);
+
+ /** merge all single PolyPolygons to a single, OR-ed PolyPolygon
+
+ @param rInput
+ The source PolyPolygons
+
+ @return A single PolyPolygon containing the Or-merged result
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon mergeToSinglePolyPolygon(const B2DPolyPolygonVector& rInput);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _BGFX_POLYGON_B2DPOLYPOLYGONCUTTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygonfillrule.hxx b/include/basegfx/polygon/b2dpolypolygonfillrule.hxx
new file mode 100644
index 000000000000..390dd9bac9f0
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygonfillrule.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGONFILLRULE_HXX
+#define _BGFX_POLYGON_B2DPOLYPOLYGONFILLRULE_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** Fill rule to use for poly-polygon filling.
+
+ The fill rule determines which areas are inside, and which are
+ outside the poly-polygon.
+ */
+ enum FillRule
+ {
+ /** Areas, for which a scanline has crossed an odd number of
+ vertices, are regarded 'inside', the remainder 'outside'
+ of the poly-polygon.
+ */
+ FillRule_EVEN_ODD,
+
+ /** For each edge a scanline crosses, a current winding number
+ is updated. Downward edges count +1, upward edges count
+ -1. If the total accumulated winding number for one area
+ is not zero, this area is regarded 'inside', otherwise,
+ 'outside'.
+ */
+ FillRule_NONZERO_WINDING_NUMBER
+ };
+}
+
+#endif /* _BGFX_POLYGON_B2DPOLYPOLYGONFILLRULE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx
new file mode 100644
index 000000000000..29ae3e042133
--- /dev/null
+++ b/include/basegfx/polygon/b2dpolypolygontools.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
+#define _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B2DPolyPolygon;
+ class B2DRange;
+
+ namespace tools
+ {
+ // B2DPolyPolygon tools
+
+ // Check and evtl. correct orientations of all contained Polygons so that
+ // the orientations of contained polygons will variate to express areas and
+ // holes
+ BASEGFX_DLLPUBLIC B2DPolyPolygon correctOrientations(const B2DPolyPolygon& rCandidate);
+
+ // make sure polygon with index 0L is not a hole. This may evtl. change the
+ // sequence of polygons, but allows to use polygon with index 0L to
+ // get the correct normal for the whole polyPolygon
+ BASEGFX_DLLPUBLIC B2DPolyPolygon correctOutmostPolygon(const B2DPolyPolygon& rCandidate);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByDistance(const B2DPolyPolygon& rCandidate, double fDistanceBound = 0.0);
+
+ // Subdivide all contained curves. Use distanceBound value if given. Else, a convenient one
+ // is created.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByAngle(const B2DPolyPolygon& rCandidate, double fAngleBound = 0.0);
+
+ // Subdivide all contained curves. Use nCount divisions if given. Else, a convenient one
+ // is created.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon adaptiveSubdivideByCount(const B2DPolyPolygon& rCandidate, sal_uInt32 nCount = 0L);
+
+ // isInside test for B2dPoint. On border is not inside as long as not true is given
+ // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
+ BASEGFX_DLLPUBLIC bool isInside(const B2DPolyPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false);
+
+ /** Get the range of a polyPolygon
+
+ For detailed description look at getRange(const B2DPolygon&).
+ This method just expands by the range of every sub-Polygon.
+
+ @param rCandidate
+ The B2DPolyPolygon eventually containing bezier segments
+
+ @return
+ The outer range of the polygon
+ */
+ BASEGFX_DLLPUBLIC B2DRange getRange(const B2DPolyPolygon& rCandidate);
+
+ /** Apply given LineDashing to given polyPolygon
+
+ For a description see applyLineDashing in b2dpolygontoos.hxx
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B2DPolyPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B2DPolyPolygon* pLineTarget,
+ B2DPolyPolygon* pGapTarget = 0,
+ double fFullDashDotLen = 0.0);
+
+ // test if point is inside epsilon-range around the given PolyPolygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the tube around the PolyPolygon
+ // with distance fDistance and rounded edges (start and end point).
+ BASEGFX_DLLPUBLIC bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
+
+ /** Read poly-polygon from SVG.
+
+ This function imports a poly-polygon from an SVG-D
+ attribute.
+
+ @param o_rPolyPoly
+ The output poly-polygon
+
+ @param rSvgDAttribute
+ A valid SVG-D attribute string
+
+ @param rWrongPositionAfterZ
+ Indicates wheter the generator interprets wrongly
+ the position in the path after Z or z elements
+ https://bugs.freedesktop.org/show_bug.cgi?id=47406
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC bool importFromSvgD( B2DPolyPolygon& o_rPolyPoly,
+ const OUString& rSvgDAttribute, bool bWrongPositionAfterZ = false );
+
+ /** Read poly-polygon from SVG.
+
+ This function imports a poly-polygon from an SVG points
+ attribute (a plain list of coordinate pairs).
+
+ @param o_rPoly
+ The output polygon. Note that svg:points can only define a
+ single polygon
+
+ @param rSvgPointsAttribute
+ A valid SVG points attribute string
+
+ @return true, if the string was successfully parsed
+ */
+ BASEGFX_DLLPUBLIC bool importFromSvgPoints( B2DPolygon& o_rPoly,
+ const OUString& rSvgPointsAttribute );
+
+
+ // grow for polyPolygon. Move all geometry in each point in the direction of the normal in that point
+ // with the given amount. Value may be negative.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon growInNormalDirection(const B2DPolyPolygon& rCandidate, double fValue);
+
+ // This method will correct a pair of polyPolygons where the goal is to keep same point count
+ // to allow direct point association and also to remove self-intersections produced by shrinks.
+ // This method will eventually change both polyPolygons to reach that goal because there are cases
+ // where it is necessary to add new cut points to the original
+ BASEGFX_DLLPUBLIC void correctGrowShrinkPolygonPair(B2DPolyPolygon& rOriginal, B2DPolyPolygon& rGrown);
+
+ // force all sub-polygons to a point count of nSegments
+ BASEGFX_DLLPUBLIC B2DPolyPolygon reSegmentPolyPolygon(const B2DPolyPolygon& rCandidate, sal_uInt32 nSegments);
+
+ // create polygon state at t from 0.0 to 1.0 between the two polygons. Both polygons must have the same
+ // organisation, e.g. same amount of polygons
+ BASEGFX_DLLPUBLIC B2DPolyPolygon interpolate(const B2DPolyPolygon& rOld1, const B2DPolyPolygon& rOld2, double t);
+
+ // create 3d PolyPolygon from given 2d PolyPolygon. The given fZCoordinate is used to expand the
+ // third coordinate.
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createB3DPolyPolygonFromB2DPolyPolygon(const B2DPolyPolygon& rCandidate, double fZCoordinate = 0.0);
+
+ // create 2d PolyPolygon from given 3d PolyPolygon. All coordinates are transformed using the given
+ // matrix and the resulting x,y is used to form the new polygon.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon createB2DPolyPolygonFromB3DPolyPolygon(const B3DPolyPolygon& rCandidate, const B3DHomMatrix& rMat);
+
+ // for each contained edge in each contained polygon calculate the smallest distance. Return the index to the smallest
+ // edge in rEdgeIndex and the index to the polygon in rPolygonIndex. The relative position on the edge is returned in rCut.
+ // If nothing was found (e.g. empty input plygon), DBL_MAX is returned.
+ BASEGFX_DLLPUBLIC double getSmallestDistancePointToPolyPolygon(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPoint, sal_uInt32& rPolygonIndex, sal_uInt32& rEdgeIndex, double& rCut);
+
+ // distort PolyPolygon. rOriginal describes the original range, where the given points describe the distorted
+ // corresponding points.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon distort(const B2DPolyPolygon& rCandidate, const B2DRange& rOriginal, const B2DPoint& rTopLeft, const B2DPoint& rTopRight, const B2DPoint& rBottomLeft, const B2DPoint& rBottomRight);
+
+ // expand all segments (which are not yet) to curve segments. This is done with setting the control
+ // vectors on the 1/3 resp. 2/3 distances on each segment.
+ BASEGFX_DLLPUBLIC B2DPolyPolygon expandToCurve(const B2DPolyPolygon& rCandidate);
+
+ /** Predicate whether a given poly-polygon is a rectangle.
+
+ @param rPoly
+ PolyPolygon to check
+
+ @return true, if the poly-polygon describes a rectangle
+ (contains exactly one polygon, polygon is closed, and the
+ points are either cw or ccw enumerations of a rectangle's
+ vertices). Note that intermediate points and duplicate
+ points are ignored.
+ */
+ BASEGFX_DLLPUBLIC bool isRectangle( const B2DPolyPolygon& rPoly );
+
+ /** Export poly-polygon to SVG.
+
+ This function exports a poly-polygon into an SVG-D
+ statement. Currently, output of relative point sequences
+ is not yet supported (might cause slightly larger output)
+
+ @param rPolyPoly
+ The poly-polygon to export
+
+ @param bUseRelativeCoordinates
+ When true, all coordinate values are exported as relative
+ to the current position. This tends to save some space,
+ since fewer digits needs to be written.
+
+ @param bDetectQuadraticBeziers
+ When true, the export tries to detect cubic bezier
+ segments in the input polygon, which can be represented by
+ quadratic bezier segments. Note that the generated string
+ causes versions prior to OOo2.0 to crash.
+
+ @return the generated SVG-D statement (the XML d attribute
+ value alone, without any "<path ...>" or "d="...")
+ */
+ BASEGFX_DLLPUBLIC OUString exportToSvgD( const B2DPolyPolygon& rPolyPoly,
+ bool bUseRelativeCoordinates=true,
+ bool bDetectQuadraticBeziers=true );
+
+ // #i76891# Try to remove existing curve segments if they are simply edges
+ BASEGFX_DLLPUBLIC B2DPolyPolygon simplifyCurveSegments(const B2DPolyPolygon& rCandidate);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b2dtrapezoid.hxx b/include/basegfx/polygon/b2dtrapezoid.hxx
new file mode 100644
index 000000000000..43ee9fb37f6c
--- /dev/null
+++ b/include/basegfx/polygon/b2dtrapezoid.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B2DTRAPEZOID_HXX
+#define _BGFX_POLYGON_B2DTRAPEZOID_HXX
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // class to hold a single trapezoid
+ class BASEGFX_DLLPUBLIC B2DTrapezoid
+ {
+ private:
+ // Geometry data. YValues are down-oriented, this means bottom should
+ // be bigger than top to be below it. The constructor implementation
+ // guarantees:
+ //
+ // - mfBottomY >= mfTopY
+ // - mfTopXRight >= mfTopXLeft
+ // - mfBottomXRight >= mfBottomXLeft
+ double mfTopXLeft;
+ double mfTopXRight;
+ double mfTopY;
+ double mfBottomXLeft;
+ double mfBottomXRight;
+ double mfBottomY;
+
+ public:
+ // constructor
+ B2DTrapezoid(
+ const double& rfTopXLeft,
+ const double& rfTopXRight,
+ const double& rfTopY,
+ const double& rfBottomXLeft,
+ const double& rfBottomXRight,
+ const double& rfBottomY);
+
+ // data read access
+ const double& getTopXLeft() const { return mfTopXLeft; }
+ const double& getTopXRight() const { return mfTopXRight; }
+ const double& getTopY() const { return mfTopY; }
+ const double& getBottomXLeft() const { return mfBottomXLeft; }
+ const double& getBottomXRight() const { return mfBottomXRight; }
+ const double& getBottomY() const { return mfBottomY; }
+
+ // convenience method to get content as Polygon
+ B2DPolygon getB2DPolygon() const;
+ };
+
+ typedef ::std::vector< B2DTrapezoid > B2DTrapezoidVector;
+
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to
+ // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves,
+ // it's default AdaptiveSubdivision will be used.
+ // CAUTION: Trapezoids are oreintation-dependent in the sense that the upper and lower
+ // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable
+ // for primitive decompositions. To use it, the shear and rotate parts of the
+ // involved transformations HAVE to be taken into account.
+ BASEGFX_DLLPUBLIC void trapezoidSubdivide(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolyPolygon& rSourcePolyPolygon);
+
+ // directly create trapezoids from given edge. Depending on the given geometry,
+ // none up to three trapezoids will be created
+ BASEGFX_DLLPUBLIC void createLineTrapezoidFromEdge(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPoint& rPointA,
+ const B2DPoint& rPointB,
+ double fLineWidth = 1.0);
+
+ // create trapezoids for all edges of the given polygon. The closed state of
+ // the polygon is taken into account. If curves are contaned, the default
+ // AdaptiveSubdivision will be used.
+ BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolygon(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolygon& rPolygon,
+ double fLineWidth = 1.0);
+
+ // create trapezoids for all edges of the given polyPolygon. The closed state of
+ // the PolyPolygon is taken into account. If curves are contaned, the default
+ // AdaptiveSubdivision will be used.
+ BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolyPolygon(
+ B2DTrapezoidVector& ro_Result,
+ const B2DPolyPolygon& rPolyPolygon,
+ double fLineWidth = 1.0);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_POLYGON_B2DTRAPEZOID_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolygon.hxx b/include/basegfx/polygon/b3dpolygon.hxx
new file mode 100644
index 000000000000..7199eea9684c
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolygon.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B3DPOLYGON_HXX
+#define _BGFX_POLYGON_B3DPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+class ImplB3DPolygon;
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DPoint;
+ class B3DHomMatrix;
+ class B3DVector;
+ class B2DPoint;
+ class B2DHomMatrix;
+ class BColor;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B3DPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB3DPolygon > ImplType;
+
+ private:
+ // internal data.
+ ImplType mpPolygon;
+
+ public:
+ B3DPolygon();
+ B3DPolygon(const B3DPolygon& rPolygon);
+ ~B3DPolygon();
+
+ // assignment operator
+ B3DPolygon& operator=(const B3DPolygon& rPolygon);
+
+ // compare operators
+ bool operator==(const B3DPolygon& rPolygon) const;
+ bool operator!=(const B3DPolygon& rPolygon) const;
+
+ // member count
+ sal_uInt32 count() const;
+
+ // Coordinate interface
+ B3DPoint getB3DPoint(sal_uInt32 nIndex) const;
+ void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
+
+ // Coordinate append
+ void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
+
+ // BColor interface
+ BColor getBColor(sal_uInt32 nIndex) const;
+ void setBColor(sal_uInt32 nIndex, const BColor& rValue);
+ bool areBColorsUsed() const;
+ void clearBColors();
+
+ // Normals interface
+ B3DVector getNormal() const; // plane normal
+ B3DVector getNormal(sal_uInt32 nIndex) const; // normal in each point
+ void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
+ void transformNormals(const B3DHomMatrix& rMatrix);
+ bool areNormalsUsed() const;
+ void clearNormals();
+
+ // TextureCoordinate interface
+ B2DPoint getTextureCoordinate(sal_uInt32 nIndex) const;
+ void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
+ void transformTextureCoordiantes(const B2DHomMatrix& rMatrix);
+ bool areTextureCoordinatesUsed() const;
+ void clearTextureCoordinates();
+
+ // append other 2D polygons
+ void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // clear all points
+ void clear();
+
+ // closed state
+ bool isClosed() const;
+ void setClosed(bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if Polygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const B3DHomMatrix& rMatrix);
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _BGFX_POLYGON_B3DPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolygontools.hxx b/include/basegfx/polygon/b3dpolygontools.hxx
new file mode 100644
index 000000000000..9ed32b42fb90
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolygontools.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX
+#define _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B3DPolygon;
+ class B3DRange;
+
+ namespace tools
+ {
+ // B3DPolygon tools
+
+ /** Check if given polygon is closed. This is kind of a
+ 'classic' method to support old polygon definitions.
+ Those old polygon definitions define the closed state
+ of the polygon using identical start and endpoints. This
+ method corrects this (removes double start/end points)
+ and sets the Closed()-state of the polygon correctly.
+ */
+ BASEGFX_DLLPUBLIC void checkClosed(B3DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ BASEGFX_DLLPUBLIC sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B3DPolygon& rCandidate);
+
+ // get size of polygon. Control vectors are included in that ranges.
+ BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolygon& rCandidate);
+
+ // get normal vector of polygon
+ BASEGFX_DLLPUBLIC B3DVector getNormal(const B3DPolygon& rCandidate);
+
+ // get area of polygon
+ BASEGFX_DLLPUBLIC double getArea(const ::basegfx::B3DPolygon& rCandidate);
+
+ // get length of polygon
+ BASEGFX_DLLPUBLIC double getLength(const B3DPolygon& rCandidate);
+
+ /** Apply given LineDashing to given polygon
+
+ For a description see applyLineDashing in b2dpolygontoos.hxx
+ */
+ BASEGFX_DLLPUBLIC void applyLineDashing(
+ const B3DPolygon& rCandidate,
+ const ::std::vector<double>& rDotDashArray,
+ B3DPolyPolygon* pLineTarget,
+ B3DPolyPolygon* pGapTarget = 0,
+ double fFullDashDotLen = 0.0);
+
+ /** Create/replace normals for given 3d geometry with default normals from given center to outside.
+ rCandidate: the 3d geometry to change
+ rCenter: the center of the 3d geometry
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon applyDefaultNormalsSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter);
+
+ /** invert normals for given 3d geometry.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon invertNormals( const B3DPolygon& rCandidate);
+
+ /** Create/replace texture coordinates for given 3d geometry with parallel projected one
+ rRange: the full range of the 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon applyDefaultTextureCoordinatesParallel( const B3DPolygon& rCandidate, const B3DRange& rRange, bool bChangeX = true, bool bChangeY = true);
+
+ /** Create/replace texture coordinates for given 3d geometry with spherical one
+ rCenter: the centre of the used 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon applyDefaultTextureCoordinatesSphere( const B3DPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+
+ // isInside tests for B3DPoint. On border is not inside as long as not true is given in bWithBorder flag.
+ BASEGFX_DLLPUBLIC bool isInside(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+
+ // calculates if given point is on given line, taking care of the numerical epsilon
+ BASEGFX_DLLPUBLIC bool isPointOnLine(const B3DPoint& rStart, const B3DPoint& rEnd, const B3DPoint& rCandidate, bool bWithPoints = false);
+
+ // calculates if given point is on given polygon, taking care of the numerical epsilon. Uses
+ // isPointOnLine internally
+ BASEGFX_DLLPUBLIC bool isPointOnPolygon(const B3DPolygon& rCandidate, const B3DPoint& rPoint, bool bWithPoints = true);
+
+ // helper to get a fCut position between a plane (given with normal and a point)
+ // and a line given by start and end point
+ BASEGFX_DLLPUBLIC bool getCutBetweenLineAndPlane(const B3DVector& rPlaneNormal, const B3DPoint& rPlanePoint, const B3DPoint& rEdgeStart, const B3DPoint& rEdgeEnd, double& fCut);
+
+ /** snap some polygon coordinates to discrete coordinates
+
+ This method allows to snap some polygon points to discrete (integer) values
+ which equals e.g. a snap to discrete coordinates. It will snap points of
+ horizontal and vertical edges
+
+ @param rCandidate
+ The source polygon
+
+ @return
+ The modified version of the source polygon
+ */
+ BASEGFX_DLLPUBLIC B3DPolygon snapPointsOfHorizontalOrVerticalEdges(const B3DPolygon& rCandidate);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolypolygon.hxx b/include/basegfx/polygon/b3dpolypolygon.hxx
new file mode 100644
index 000000000000..d67da6ad690b
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolypolygon.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
+#define _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+// predeclarations
+class ImplB3DPolyPolygon;
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DHomMatrix;
+ class B2DHomMatrix;
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC B3DPolyPolygon
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB3DPolyPolygon > ImplType;
+
+ private:
+ ImplType mpPolyPolygon;
+
+ public:
+ B3DPolyPolygon();
+ B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon);
+ explicit B3DPolyPolygon(const B3DPolygon& rPolygon);
+ ~B3DPolyPolygon();
+
+ // assignment operator
+ B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon);
+
+ // compare operators
+ bool operator==(const B3DPolyPolygon& rPolyPolygon) const;
+ bool operator!=(const B3DPolyPolygon& rPolyPolygon) const;
+
+ // polygon interface
+ sal_uInt32 count() const;
+
+ // B3DPolygon interface
+ B3DPolygon getB3DPolygon(sal_uInt32 nIndex) const;
+ void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon);
+
+ // BColor interface
+ bool areBColorsUsed() const;
+ void clearBColors();
+
+ // Normals interface
+ void transformNormals(const B3DHomMatrix& rMatrix);
+ bool areNormalsUsed() const;
+ void clearNormals();
+
+ // TextureCoordinate interface
+ void transformTextureCoordiantes(const B2DHomMatrix& rMatrix);
+ bool areTextureCoordinatesUsed() const;
+ void clearTextureCoordinates();
+
+ // append single polygon
+ void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
+
+ // append multiple polygons
+ void append(const B3DPolyPolygon& rPolyPolygon);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // reset to empty state
+ void clear();
+
+ // flip polygon direction
+ void flip();
+
+ // test if PolyPolygon has double points
+ bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const basegfx::B3DHomMatrix& rMatrix);
+
+ // polygon iterators (same iterator validity conditions as for vector)
+ const B3DPolygon* begin() const;
+ const B3DPolygon* end() const;
+ B3DPolygon* begin();
+ B3DPolygon* end();
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYGON_B3DPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/polygon/b3dpolypolygontools.hxx b/include/basegfx/polygon/b3dpolypolygontools.hxx
new file mode 100644
index 000000000000..a50167f9b4de
--- /dev/null
+++ b/include/basegfx/polygon/b3dpolypolygontools.hxx
@@ -0,0 +1,133 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
+#define _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <vector>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predefinitions
+ class B3DPolyPolygon;
+ class B3DRange;
+
+ namespace tools
+ {
+ // B3DPolyPolygon tools
+
+ // get size of PolyPolygon. Control vectors are included in that ranges.
+ BASEGFX_DLLPUBLIC B3DRange getRange(const B3DPolyPolygon& rCandidate);
+
+ /** Create a unit 3D line polyPolygon which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitCubePolyPolygon();
+
+ /** Create a unit 3D fill polyPolygon which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitCubeFillPolyPolygon();
+
+ /** Create a 3D line polyPolygon from a B3DRange which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createCubePolyPolygonFromB3DRange( const B3DRange& rRange);
+
+ /** Create a 3D fill polyPolygon from a B3DRange which defines a cube.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createCubeFillPolyPolygonFromB3DRange( const B3DRange& rRange);
+
+ /** Create a unit 3D line polyPolygon which defines a sphere with the given count of hor and ver segments.
+ Result will be centered at (0.0, 0.0, 0.0) and sized [-1.0 .. 1.0] in all dimensions.
+ If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees.
+ With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSpherePolyPolygon(
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** Create a 3D line polyPolygon from a B3DRange which defines a sphere with the given count of hor and ver segments.
+ If nHorSeg == 0 and/or nVerSeg == 0, a default will be calculated to have a step at least each 15 degrees.
+ With VerStart, VerStop and hor range in cartesian may be specified to create a partial sphere only.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createSpherePolyPolygonFromB3DRange(
+ const B3DRange& rRange,
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** same as createUnitSpherePolyPolygon, but creates filled polygons (closed and oriented)
+ There is one extra, the bool bNormals defines if normals will be set, default is false
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createUnitSphereFillPolyPolygon(
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ bool bNormals = false,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** same as createSpherePolyPolygonFromB3DRange, but creates filled polygons (closed and oriented)
+ There is one extra, the bool bNormals defines if normals will be set, default is false
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon createSphereFillPolyPolygonFromB3DRange(
+ const B3DRange& rRange,
+ sal_uInt32 nHorSeg = 0L, sal_uInt32 nVerSeg = 0L,
+ bool bNormals = false,
+ double fVerStart = F_PI2, double fVerStop = -F_PI2,
+ double fHorStart = 0.0, double fHorStop = F_2PI);
+
+ /** Create/replace normals for given 3d geometry with default normals from given center to outside.
+ rCandidate: the 3d geometry to change
+ rCenter: the center of the 3d geometry
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultNormalsSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter);
+
+ /** invert normals for given 3d geometry.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon invertNormals( const B3DPolyPolygon& rCandidate);
+
+ /** Create/replace texture coordinates for given 3d geometry with parallel projected one
+ rRange: the full range of the 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesParallel( const B3DPolyPolygon& rCandidate, const B3DRange& rRange, bool bChangeX = true, bool bChangeY = true);
+
+ /** Create/replace texture coordinates for given 3d geometry with spherical one
+ rCenter: the centre of the used 3d geometry
+ If bChangeX, x texture coordinate will be recalculated.
+ If bChangeY, y texture coordinate will be recalculated.
+ */
+ BASEGFX_DLLPUBLIC B3DPolyPolygon applyDefaultTextureCoordinatesSphere( const B3DPolyPolygon& rCandidate, const B3DPoint& rCenter, bool bChangeX = true, bool bChangeY = true);
+
+ // isInside test for B3DPoint. On border is not inside as long as not true is given
+ // in bWithBorder flag. It is assumed that the orientations of the given polygon are correct.
+ BASEGFX_DLLPUBLIC bool isInside(const B3DPolyPolygon& rCandidate, const B3DPoint& rPoint, bool bWithBorder = false);
+
+ } // end of namespace tools
+} // end of namespace basegfx
+
+#endif /* _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1drange.hxx b/include/basegfx/range/b1drange.hxx
new file mode 100644
index 000000000000..ffe704a1b845
--- /dev/null
+++ b/include/basegfx/range/b1drange.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B1DRANGE_HXX
+#define _BGFX_RANGE_B1DRANGE_HXX
+
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ class B1IRange;
+
+ /** A one-dimensional interval over doubles
+
+ This is a set of real numbers, bounded by a lower and an upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+ */
+ class B1DRange
+ {
+ ::basegfx::BasicRange< double, DoubleTraits > maRange;
+
+ public:
+ B1DRange() {}
+
+ /// Create degenerate interval consisting of a single double number
+ explicit B1DRange(double fStartValue)
+ : maRange(fStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given double values
+ B1DRange(double fStartValue1, double fStartValue2)
+ : maRange(fStartValue1)
+ {
+ expand(fStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRange.reset();
+ }
+
+ bool operator==( const B1DRange& rRange ) const
+ {
+ return (maRange == rRange.maRange);
+ }
+
+ bool operator!=( const B1DRange& rRange ) const
+ {
+ return (maRange != rRange.maRange);
+ }
+
+ bool equal(const B1DRange& rRange) const
+ {
+ return (maRange.equal(rRange.maRange));
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ double getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(double fValue) const
+ {
+ return maRange.isInside(fValue);
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B1DRange& rRange) const
+ {
+ return maRange.isInside(rRange.maRange);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1DRange& rRange) const
+ {
+ return maRange.overlaps(rRange.maRange);
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B1DRange& rRange) const
+ {
+ return maRange.overlapsMore(rRange.maRange);
+ }
+
+ /// add fValue to the set, expanding as necessary
+ void expand(double fValue)
+ {
+ maRange.expand(fValue);
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B1DRange& rRange)
+ {
+ maRange.expand(rRange.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1DRange& rRange)
+ {
+ maRange.intersect(rRange.maRange);
+ }
+
+ /// grow set by fValue on both sides
+ void grow(double fValue)
+ {
+ maRange.grow(fValue);
+ }
+ };
+
+} // end of namespace basegfx
+
+
+#endif /* _BGFX_RANGE_B1DRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1ibox.hxx b/include/basegfx/range/b1ibox.hxx
new file mode 100644
index 000000000000..7c81e37c1288
--- /dev/null
+++ b/include/basegfx/range/b1ibox.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B1IBOX_HXX
+#define _BGFX_RANGE_B1IBOX_HXX
+
+#include <basegfx/range/basicbox.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A one-dimensional interval over integers
+
+ This is most easily depicted as a set of integers, bounded by
+ a lower and an upper value - but excluding the upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is half-open, i.e. the lower bound is included, the
+ upper bound not (if you're used to the notation - we're
+ talking about [a,b) here, compared to closed [a,b] or fully
+ open intervals (a,b)).
+
+ If you don't need a half-open interval, check B1IRange.
+
+ That means, isInside(val) will return true also for values of
+ val=a, but not for val=b.
+
+ @see B1IRange
+ */
+ class B1IBox
+ {
+ ::basegfx::BasicBox maRange;
+
+ public:
+ B1IBox() {}
+
+ /// Create degenerate interval that's still empty
+ explicit B1IBox(sal_Int32 nStartValue)
+ : maRange(nStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given values
+ B1IBox(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
+ : maRange(nStartValue1)
+ {
+ expand(nStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will still return false.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRange.reset();
+ }
+
+ bool operator==( const B1IBox& rBox ) const
+ {
+ return (maRange == rBox.maRange);
+ }
+
+ bool operator!=( const B1IBox& rBox ) const
+ {
+ return (maRange != rBox.maRange);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ Int32Traits::DifferenceType getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(sal_Int32 nValue) const
+ {
+ return maRange.isInside(nValue);
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B1IBox& rBox) const
+ {
+ return maRange.isInside(rBox.maRange);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1IBox& rBox) const
+ {
+ return maRange.overlaps(rBox.maRange);
+ }
+
+ /// add nValue to the set, expanding as necessary
+ void expand(sal_Int32 nValue)
+ {
+ maRange.expand(nValue);
+ }
+
+ /// add rBox to the set, expanding as necessary
+ void expand(const B1IBox& rBox)
+ {
+ maRange.expand(rBox.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1IBox& rBox)
+ {
+ maRange.intersect(rBox.maRange);
+ }
+
+ /// grow set by nValue on both sides
+ void grow(sal_Int32 nValue)
+ {
+ maRange.grow(nValue);
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B1IBOX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b1irange.hxx b/include/basegfx/range/b1irange.hxx
new file mode 100644
index 000000000000..0ba5878fb0c8
--- /dev/null
+++ b/include/basegfx/range/b1irange.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B1IRANGE_HXX
+#define _BGFX_RANGE_B1IRANGE_HXX
+
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A one-dimensional interval over integers
+
+ This is a set of real numbers, bounded by a lower and an upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ Probably you rather want B1IBox for integers.
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B1IBox
+ */
+ class B1IRange
+ {
+ ::basegfx::BasicRange< sal_Int32, Int32Traits > maRange;
+
+ public:
+ B1IRange() {}
+
+ /// Create degenerate interval consisting of a single double number
+ explicit B1IRange(sal_Int32 nStartValue)
+ : maRange(nStartValue)
+ {
+ }
+
+ /// Create proper interval between the two given values
+ B1IRange(sal_Int32 nStartValue1, sal_Int32 nStartValue2)
+ : maRange(nStartValue1)
+ {
+ expand(nStartValue2);
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRange.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRange.reset();
+ }
+
+ bool operator==( const B1IRange& rRange ) const
+ {
+ return (maRange == rRange.maRange);
+ }
+
+ bool operator!=( const B1IRange& rRange ) const
+ {
+ return (maRange != rRange.maRange);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinimum() const
+ {
+ return maRange.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaximum() const
+ {
+ return maRange.getMaximum();
+ }
+
+ /// return difference between upper and lower value. returns 0 for empty sets.
+ Int32Traits::DifferenceType getRange() const
+ {
+ return maRange.getRange();
+ }
+
+ /// return middle of upper and lower value. returns 0 for empty sets.
+ double getCenter() const
+ {
+ return maRange.getCenter();
+ }
+
+ /// yields true if value is contained in set
+ bool isInside(sal_Int32 nValue) const
+ {
+ return maRange.isInside(nValue);
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B1IRange& rRange) const
+ {
+ return maRange.isInside(rRange.maRange);
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B1IRange& rRange) const
+ {
+ return maRange.overlaps(rRange.maRange);
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B1IRange& rRange) const
+ {
+ return maRange.overlapsMore(rRange.maRange);
+ }
+
+ /// add nValue to the set, expanding as necessary
+ void expand(sal_Int32 nValue)
+ {
+ maRange.expand(nValue);
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B1IRange& rRange)
+ {
+ maRange.expand(rRange.maRange);
+ }
+
+ /// calc set intersection
+ void intersect(const B1IRange& rRange)
+ {
+ maRange.intersect(rRange.maRange);
+ }
+
+ /// grow set by nValue on both sides
+ void grow(sal_Int32 nValue)
+ {
+ maRange.grow(nValue);
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B1IRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2dconnectedranges.hxx b/include/basegfx/range/b2dconnectedranges.hxx
new file mode 100644
index 000000000000..f1d65196bd8f
--- /dev/null
+++ b/include/basegfx/range/b2dconnectedranges.hxx
@@ -0,0 +1,257 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DCONNECTEDRANGES_HXX
+#define _BGFX_RANGE_B2DCONNECTEDRANGES_HXX
+
+#include <osl/diagnose.h>
+#include <basegfx/range/b2drange.hxx>
+#include <list>
+#include <utility>
+#include <algorithm>
+
+
+namespace basegfx
+{
+ /** Calculate connected ranges from input ranges.
+
+ This template constructs a list of connected ranges from the
+ given input ranges. That is, the output will contain a set of
+ ranges, itself containing a number of input ranges, which will
+ be mutually non-intersecting.
+
+ Example:
+ <code>
+ -------------------
+ | -------|
+ | | ||
+ | --- | ||
+ | | | -------| --------
+ | | +--------- | | |
+ | --+ | | | |
+ | | | | --------
+ | ---------- |
+ -------------------
+ </code
+
+ Here, the outer rectangles represent the output
+ ranges. Contained are the input rectangles that comprise these
+ output ranges.
+
+ @tpl UserData
+ User data to be stored along with the range, to later identify
+ which range went into which connected component. Must be
+ assignable, default- and copy-constructible.
+ */
+ template< typename UserData > class B2DConnectedRanges
+ {
+ public:
+ /// Type of the basic entity (rect + user data)
+ typedef ::std::pair< B2DRange, UserData > ComponentType;
+ typedef ::std::list< ComponentType > ComponentListType;
+
+ /// List of (intersecting) components, plus overall bounds
+ struct ConnectedComponents
+ {
+ ComponentListType maComponentList;
+ B2DRange maTotalBounds;
+ };
+
+ typedef ::std::list< ConnectedComponents > ConnectedComponentsType;
+
+
+ /// Create the range calculator
+ B2DConnectedRanges() :
+ maDisjunctAggregatesList(),
+ maTotalBounds()
+ {
+ }
+
+ /** Query total bounds of all added ranges.
+
+ @return the union bound rect over all added ranges.
+ */
+ B2DRange getBounds() const
+ {
+ return maTotalBounds;
+ }
+
+ /** Add an additional range.
+
+ This method integrates a new range into the connected
+ ranges lists. The method has a worst-case time complexity
+ of O(n^2), with n denoting the number of already added
+ ranges (typically, for well-behaved input, it is O(n)
+ though).
+ */
+ void addRange( const B2DRange& rRange,
+ const UserData& rUserData )
+ {
+ // check whether fast path is possible: if new range is
+ // outside accumulated total range, can add it as a
+ // separate component right away.
+ const bool bNotOutsideEverything(
+ maTotalBounds.overlaps( rRange ) );
+
+ // update own global bounds range
+ maTotalBounds.expand( rRange );
+
+ // assemble anything intersecting with rRange into
+ // this new connected component
+ ConnectedComponents aNewConnectedComponent;
+
+ // as at least rRange will be a member of
+ // aNewConnectedComponent (will be added below), can
+ // preset the overall bounds here.
+ aNewConnectedComponent.maTotalBounds = rRange;
+
+
+ //
+ // STAGE 1: Search for intersecting maDisjunctAggregatesList entries
+ // =================================================================
+ //
+
+ // if rRange is empty, it will intersect with no
+ // maDisjunctAggregatesList member. Thus, we can safe us
+ // the check.
+ // if rRange is outside all other rectangle, skip here,
+ // too
+ if( bNotOutsideEverything &&
+ !rRange.isEmpty() )
+ {
+ typename ConnectedComponentsType::iterator aCurrAggregate;
+ typename ConnectedComponentsType::iterator aLastAggregate;
+
+ // flag, determining whether we touched one or more of
+ // the maDisjunctAggregatesList entries. _If_ we did,
+ // we have to repeat the intersection process, because
+ // these changes might have generated new
+ // intersections.
+ bool bSomeAggregatesChanged;
+
+ // loop, until bSomeAggregatesChanged stays false
+ do
+ {
+ // only continue loop if 'intersects' branch below was hit
+ bSomeAggregatesChanged = false;
+
+ // iterate over all current members of maDisjunctAggregatesList
+ for( aCurrAggregate=maDisjunctAggregatesList.begin(),
+ aLastAggregate=maDisjunctAggregatesList.end();
+ aCurrAggregate != aLastAggregate; )
+ {
+ // first check if current component's bounds
+ // are empty. This ensures that distinct empty
+ // components are not merged into one
+ // aggregate. As a matter of fact, they have
+ // no position and size.
+
+ if( !aCurrAggregate->maTotalBounds.isEmpty() &&
+ aCurrAggregate->maTotalBounds.overlaps(
+ aNewConnectedComponent.maTotalBounds ) )
+ {
+ // union the intersecting
+ // maDisjunctAggregatesList element into
+ // aNewConnectedComponent
+
+ // calc union bounding box
+ aNewConnectedComponent.maTotalBounds.expand( aCurrAggregate->maTotalBounds );
+
+ // extract all aCurrAggregate components
+ // to aNewConnectedComponent
+ aNewConnectedComponent.maComponentList.splice(
+ aNewConnectedComponent.maComponentList.end(),
+ aCurrAggregate->maComponentList );
+
+ // remove and delete aCurrAggregate entry
+ // from list (we've gutted it's content
+ // above). list::erase() will update our
+ // iterator with the predecessor here.
+ aCurrAggregate = maDisjunctAggregatesList.erase( aCurrAggregate );
+
+ // at least one aggregate changed, need to rescan everything
+ bSomeAggregatesChanged = true;
+ }
+ else
+ {
+ aCurrAggregate++;
+ }
+ }
+ }
+ while( bSomeAggregatesChanged );
+ }
+
+ //
+ // STAGE 2: Add newly generated connected component list element
+ // =============================================================
+ //
+
+ // add new component to the end of the component list
+ aNewConnectedComponent.maComponentList.push_back(
+ ComponentType( rRange, rUserData ) );
+
+ // do some consistency checks (aka post conditions)
+ OSL_ENSURE( !aNewConnectedComponent.maComponentList.empty(),
+ "B2DConnectedRanges::addRange(): empty aggregate list" );
+ OSL_ENSURE( !aNewConnectedComponent.maTotalBounds.isEmpty() ||
+ (aNewConnectedComponent.maTotalBounds.isEmpty() &&
+ aNewConnectedComponent.maComponentList.size() == 1),
+ "B2DConnectedRanges::addRange(): empty ranges must be solitary");
+
+ // add aNewConnectedComponent as a new entry to
+ // maDisjunctAggregatesList
+ maDisjunctAggregatesList.push_back( aNewConnectedComponent );
+ }
+
+ /** Apply a functor to each of the disjunct component
+ aggregates.
+
+ @param aFunctor
+ Functor to apply. Must provide an operator( const ConnectedComponents& ).
+
+ @return a copy of the functor, as applied to all aggregates.
+ */
+ template< typename UnaryFunctor > UnaryFunctor forEachAggregate( UnaryFunctor aFunctor ) const
+ {
+ return ::std::for_each( maDisjunctAggregatesList.begin(),
+ maDisjunctAggregatesList.end(),
+ aFunctor );
+ }
+
+ private:
+ // default: disabled copy/assignment
+ B2DConnectedRanges(const B2DConnectedRanges&);
+ B2DConnectedRanges& operator=( const B2DConnectedRanges& );
+
+ /** Current list of disjunct sets of connected components
+
+ Each entry corresponds to one of the top-level rectangles
+ in the drawing above.
+ */
+ ConnectedComponentsType maDisjunctAggregatesList;
+
+ /** Global bound rect over all added ranges.
+ */
+ B2DRange maTotalBounds;
+ };
+}
+
+#endif /* _BGFX_RANGE_B2DCONNECTEDRANGES_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2dpolyrange.hxx b/include/basegfx/range/b2dpolyrange.hxx
new file mode 100644
index 000000000000..b910062d11a3
--- /dev/null
+++ b/include/basegfx/range/b2dpolyrange.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DPOLYRANGE_HXX
+#define _BGFX_RANGE_B2DPOLYRANGE_HXX
+
+#include <o3tl/cow_wrapper.hxx>
+#include <boost/tuple/tuple.hpp>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DTuple;
+ class B2DRange;
+ class B2DPolyPolygon;
+ class ImplB2DPolyRange;
+
+ /** Multiple ranges in one object.
+
+ This class combines multiple ranges in one object, providing a
+ total, enclosing range for it.
+
+ You can use this class e.g. when updating views containing
+ rectangular objects. Add each modified object to a
+ B2DMultiRange, then test each viewable object against
+ intersection with the multi range.
+
+ Similar in spirit to the poly-polygon vs. polygon relationship.
+
+ Note that comparable to polygons, a poly-range can also
+ contain 'holes' - this is encoded via polygon orientation at
+ the poly-polygon, and via explicit flags for the poly-range.
+ */
+ class BASEGFX_DLLPUBLIC B2DPolyRange
+ {
+ public:
+ typedef boost::tuple<B2DRange,B2VectorOrientation> ElementType ;
+
+ B2DPolyRange();
+ ~B2DPolyRange();
+
+ /** Create a multi range with exactly one containing range
+ */
+ B2DPolyRange( const B2DPolyRange& );
+ B2DPolyRange& operator=( const B2DPolyRange& );
+
+ bool operator==(const B2DPolyRange&) const;
+ bool operator!=(const B2DPolyRange&) const;
+
+ /// Number of included ranges
+ sal_uInt32 count() const;
+
+ ElementType getElement(sal_uInt32 nIndex) const;
+
+ // insert/append a single range
+ void appendElement(const B2DRange& rRange, B2VectorOrientation eOrient, sal_uInt32 nCount = 1);
+
+ void clear();
+
+ /** Test whether given range overlaps one or more of the
+ included ranges. Does *not* use overall range, but checks
+ individually.
+ */
+ bool overlaps( const B2DRange& rRange ) const;
+
+ /** Request a poly-polygon with solved cross-overs
+ */
+ B2DPolyPolygon solveCrossovers() const;
+
+ private:
+ o3tl::cow_wrapper< ImplB2DPolyRange > mpImpl;
+ };
+}
+
+#endif /* _BGFX_RANGE_B2DPOLYRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drange.hxx b/include/basegfx/range/b2drange.hxx
new file mode 100644
index 000000000000..1f3884c1c9ce
--- /dev/null
+++ b/include/basegfx/range/b2drange.hxx
@@ -0,0 +1,320 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DRANGE_HXX
+#define _BGFX_RANGE_B2DRANGE_HXX
+
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ // predeclarations
+ class B2IRange;
+ class B2DHomMatrix;
+
+ /** A two-dimensional interval over doubles
+
+ This is a set of real numbers, bounded by a lower and an upper
+ pair. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B1DRange
+ */
+ class B2DRange
+ {
+ public:
+ typedef double ValueType;
+ typedef DoubleTraits TraitsType;
+
+ B2DRange() {}
+
+ /// Create degenerate interval consisting of a single point
+ explicit B2DRange(const B2DTuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given double pairs
+ B2DRange(double x1,
+ double y1,
+ double x2,
+ double y2)
+ : maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2DRange(const B2DTuple& rTuple1,
+ const B2DTuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ BASEGFX_DLLPUBLIC explicit B2DRange(const B2IRange& rRange);
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single point included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return (
+ maRangeX.isEmpty()
+ || maRangeY.isEmpty()
+ );
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==( const B2DRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY);
+ }
+
+ bool operator!=( const B2DRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY);
+ }
+
+ bool equal(const B2DRange& rRange) const
+ {
+ return (maRangeX.equal(rRange.maRangeX)
+ && maRangeY.equal(rRange.maRangeY));
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ double getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ double getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ double getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ double getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2DPoint getMinimum() const
+ {
+ return B2DPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2DPoint getMaximum() const
+ {
+ return B2DPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower point. returns (0,0) for empty sets.
+ B2DVector getRange() const
+ {
+ return B2DVector(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /// return center X value of set. returns 0 for empty sets.
+ double getCenterX() const
+ {
+ return maRangeX.getCenter();
+ }
+
+ /// return center Y value of set. returns 0 for empty sets.
+ double getCenterY() const
+ {
+ return maRangeY.getCenter();
+ }
+
+ /// yields true if given point is contained in set
+ bool isInside(const B2DTuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B2DRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B2DRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B2DRange& rRange) const
+ {
+ return (
+ maRangeX.overlapsMore(rRange.maRangeX)
+ && maRangeY.overlapsMore(rRange.maRangeY)
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2DTuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B2DRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const B2DRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ }
+
+ /// grow set by fValue on all sides
+ void grow(double fValue)
+ {
+ maRangeX.grow(fValue);
+ maRangeY.grow(fValue);
+ }
+
+ BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix& rMatrix);
+
+ private:
+ typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ };
+
+ /** Round double to nearest integer for 2D range
+
+ @return the nearest integer for this range
+ */
+ BASEGFX_DLLPUBLIC B2IRange fround(const B2DRange& rRange);
+
+ /** Compute the set difference of the two given ranges
+
+ This method calculates the symmetric difference (aka XOR)
+ between the two given ranges, and returning the resulting
+ ranges. Thus, the result will contain all areas where one, but
+ not both ranges lie.
+
+ @param o_rResult
+ Result vector. The up to four difference ranges are returned
+ within this vector
+
+ @param rFirst
+ The first range
+
+ @param rSecond
+ The second range
+
+ @return the input vector
+ */
+ BASEGFX_DLLPUBLIC ::std::vector< B2DRange >& computeSetDifference( ::std::vector< B2DRange >& o_rResult,
+ const B2DRange& rFirst,
+ const B2DRange& rSecond );
+
+} // end of namespace basegfx
+
+
+#endif /* _BGFX_RANGE_B2DRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drangeclipper.hxx b/include/basegfx/range/b2drangeclipper.hxx
new file mode 100644
index 000000000000..99bc8763369d
--- /dev/null
+++ b/include/basegfx/range/b2drangeclipper.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DRANGECLIPPER_HXX
+#define _BGFX_RANGE_B2DRANGECLIPPER_HXX
+
+#include <basegfx/range/b2dpolyrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Extract poly-polygon w/o self-intersections from poly-range
+
+ Similar to the solveCrossovers(const B2DPolyPolygon&)
+ method, this one calculates a self-intersection-free
+ poly-polygon with the same topology, and encoding
+ inside/outsidedness via polygon orientation and layering.
+ */
+ BASEGFX_DLLPUBLIC B2DPolyPolygon solveCrossovers(const std::vector<B2DRange>& rRanges,
+ const std::vector<B2VectorOrientation>& rOrientations);
+ }
+}
+
+#endif /* _BGFX_RANGE_B2DRANGECLIPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2drectangle.hxx b/include/basegfx/range/b2drectangle.hxx
new file mode 100644
index 000000000000..8d4715d64410
--- /dev/null
+++ b/include/basegfx/range/b2drectangle.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2DRECTANGLE_HXX
+#define _BGFX_RANGE_B2DRECTANGLE_HXX
+
+#include <basegfx/range/b2drange.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2DRange exactly models a Rectangle, thus,
+ // for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2DRange B2DRectangle;
+}
+
+#endif /* _BGFX_RANGE_B2DRECTANGLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2ibox.hxx b/include/basegfx/range/b2ibox.hxx
new file mode 100644
index 000000000000..7c182a4ab327
--- /dev/null
+++ b/include/basegfx/range/b2ibox.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2IBOX_HXX
+#define _BGFX_RANGE_B2IBOX_HXX
+
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/tuple/b2i64tuple.hxx>
+#include <basegfx/range/basicbox.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A two-dimensional interval over integers
+
+ This is most easily depicted as a set of integers, bounded by
+ a lower and an upper value - but excluding the upper
+ value. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ The set is half-open, i.e. the lower bound is included, the
+ upper bound not (if you're used to the notation - we're
+ talking about [a,b) here, compared to closed [a,b] or fully
+ open intervals (a,b)).
+
+ If you don't need a half-open interval, check B2IRange.
+
+ That means, isInside(val) will return true also for values of
+ val=a, but not for val=b.
+
+ Alternatively, consider this a rectangle, where the rightmost
+ pixel column and the bottommost pixel row are excluded - this
+ is much like polygon filling. As a result, filling a given
+ rectangle with basebmp::BitmapDevice::fillPolyPolygon(), will
+ affect exactly the same set of pixel as isInside() would
+ return true for.
+
+ @see B2IRange
+ */
+ class B2IBox
+ {
+ public:
+ typedef sal_Int32 ValueType;
+ typedef Int32Traits TraitsType;
+
+ B2IBox() {}
+
+ /// Create degenerate interval that's still empty
+ explicit B2IBox(const B2ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given points
+ B2IBox(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 x2,
+ sal_Int32 y2) :
+ maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2IBox(const B2ITuple& rTuple1,
+ const B2ITuple& rTuple2) :
+ maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single value included will still return false.
+ */
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==( const B2IBox& rBox ) const
+ {
+ return (maRangeX == rBox.maRangeX
+ && maRangeY == rBox.maRangeY);
+ }
+
+ bool operator!=( const B2IBox& rBox ) const
+ {
+ return (maRangeX != rBox.maRangeX
+ || maRangeY != rBox.maRangeY);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMinimum() const
+ {
+ return B2IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMaximum() const
+ {
+ return B2IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower value. returns (0,0) for empty sets.
+ B2I64Tuple getRange() const
+ {
+ return B2I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /// yields true if point is contained in set
+ bool isInside(const B2ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// yields true if rBox is inside, or equal to set
+ bool isInside(const B2IBox& rBox) const
+ {
+ return (
+ maRangeX.isInside(rBox.maRangeX)
+ && maRangeY.isInside(rBox.maRangeY)
+ );
+ }
+
+ /// yields true if rBox at least partly inside set
+ bool overlaps(const B2IBox& rBox) const
+ {
+ return (
+ maRangeX.overlaps(rBox.maRangeX)
+ && maRangeY.overlaps(rBox.maRangeY)
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rBox to the set, expanding as necessary
+ void expand(const B2IBox& rBox)
+ {
+ maRangeX.expand(rBox.maRangeX);
+ maRangeY.expand(rBox.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const B2IBox& rBox)
+ {
+ maRangeX.intersect(rBox.maRangeX);
+ maRangeY.intersect(rBox.maRangeY);
+ }
+
+ /// grow set by nValue on all sides
+ void grow(sal_Int32 nValue)
+ {
+ maRangeX.grow(nValue);
+ maRangeY.grow(nValue);
+ }
+
+ private:
+ BasicBox maRangeX;
+ BasicBox maRangeY;
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B2IBOX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2irange.hxx b/include/basegfx/range/b2irange.hxx
new file mode 100644
index 000000000000..60f9fc79fa67
--- /dev/null
+++ b/include/basegfx/range/b2irange.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2IRANGE_HXX
+#define _BGFX_RANGE_B2IRANGE_HXX
+
+#include <basegfx/point/b2ipoint.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/tuple/b2i64tuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** A two-dimensional interval over integers
+
+ This is a set of real numbers, bounded by a lower and an upper
+ pair. All inbetween values are included in the set (see also
+ http://en.wikipedia.org/wiki/Interval_%28mathematics%29).
+
+ Probably you rather want B2IBox for integers.
+
+ The set is closed, i.e. the upper and the lower bound are
+ included (if you're used to the notation - we're talking about
+ [a,b] here, compared to half-open [a,b) or open intervals
+ (a,b)).
+
+ That means, isInside(val) will return true also for values of
+ val=a or val=b.
+
+ @see B2IBox
+ */
+ class B2IRange
+ {
+ public:
+ typedef sal_Int32 ValueType;
+ typedef Int32Traits TraitsType;
+
+ B2IRange() {}
+
+ /// Create degenerate interval consisting of a single point
+ explicit B2IRange(const B2ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY())
+ {
+ }
+
+ /// Create proper interval between the two given integer pairs
+ B2IRange(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 x2,
+ sal_Int32 y2)
+ : maRangeX(x1),
+ maRangeY(y1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ }
+
+ /// Create proper interval between the two given points
+ B2IRange(const B2ITuple& rTuple1,
+ const B2ITuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY())
+ {
+ expand( rTuple2 );
+ }
+
+ /** Check if the interval set is empty
+
+ @return false, if no value is in this set - having a
+ single point included will already return true.
+ */
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty();
+ }
+
+ /// reset the object to empty state again, clearing all values
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ }
+
+ bool operator==( const B2IRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY);
+ }
+
+ bool operator!=( const B2IRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY);
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ /// return difference between upper and lower X value. returns 0 for empty sets.
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ /// return difference between upper and lower Y value. returns 0 for empty sets.
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ /// get lower bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMinimum() const
+ {
+ return B2IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum()
+ );
+ }
+
+ /// get upper bound of the set. returns arbitrary values for empty sets.
+ B2IPoint getMaximum() const
+ {
+ return B2IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum()
+ );
+ }
+
+ /// return difference between upper and lower point. returns (0,0) for empty sets.
+ B2I64Tuple getRange() const
+ {
+ return B2I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange()
+ );
+ }
+
+ /// return center point of set. returns (0,0) for empty sets.
+ B2DPoint getCenter() const
+ {
+ return B2DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter()
+ );
+ }
+
+ /// yields true if given point is contained in set
+ bool isInside(const B2ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ );
+ }
+
+ /// yields true if rRange is inside, or equal to set
+ bool isInside(const B2IRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if rRange at least partly inside set
+ bool overlaps(const B2IRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ );
+ }
+
+ /// yields true if overlaps(rRange) does, and the overlap is larger than infinitesimal
+ bool overlapsMore(const B2IRange& rRange) const
+ {
+ return (
+ maRangeX.overlapsMore(rRange.maRangeX)
+ && maRangeY.overlapsMore(rRange.maRangeY)
+ );
+ }
+
+ /// add point to the set, expanding as necessary
+ void expand(const B2ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ }
+
+ /// add rRange to the set, expanding as necessary
+ void expand(const B2IRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ }
+
+ /// calc set intersection
+ void intersect(const B2IRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ }
+
+ /// grow set by nValue on all sides
+ void grow(sal_Int32 nValue)
+ {
+ maRangeX.grow(nValue);
+ maRangeY.grow(nValue);
+ }
+
+ private:
+ typedef ::basegfx::BasicRange< ValueType, TraitsType > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ };
+
+ /** Compute the set difference of the two given ranges
+
+ This method calculates the symmetric difference (aka XOR)
+ between the two given ranges, and returning the resulting
+ ranges. Thus, the result will contain all areas where one, but
+ not both ranges lie.
+
+ @param o_rResult
+ Result vector. The up to four difference ranges are returned
+ within this vector
+
+ @param rFirst
+ The first range
+
+ @param rSecond
+ The second range
+
+ @return the input vector
+ */
+ BASEGFX_DLLPUBLIC ::std::vector< B2IRange >& computeSetDifference( ::std::vector< B2IRange >& o_rResult,
+ const B2IRange& rFirst,
+ const B2IRange& rSecond );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B2IRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b2irectangle.hxx b/include/basegfx/range/b2irectangle.hxx
new file mode 100644
index 000000000000..40792732ab1d
--- /dev/null
+++ b/include/basegfx/range/b2irectangle.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B2IRECTANGLE_HXX
+#define _BGFX_RANGE_B2IRECTANGLE_HXX
+
+#include <basegfx/range/b2irange.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2IRange exactly models a Rectangle, thus,
+ // for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2IRange B2IRectangle;
+}
+
+#endif /* _BGFX_RANGE_B2IRECTANGLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b3drange.hxx b/include/basegfx/range/b3drange.hxx
new file mode 100644
index 000000000000..7b17f04e4964
--- /dev/null
+++ b/include/basegfx/range/b3drange.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B3DRANGE_HXX
+#define _BGFX_RANGE_B3DRANGE_HXX
+
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclarations
+ class B3IRange;
+ class B3DHomMatrix;
+
+ class B3DRange
+ {
+ typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ MyBasicRange maRangeZ;
+
+ public:
+ B3DRange() {}
+
+ explicit B3DRange(const B3DTuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY()),
+ maRangeZ(rTuple.getZ())
+ {
+ }
+
+ B3DRange(double x1,
+ double y1,
+ double z1,
+ double x2,
+ double y2,
+ double z2)
+ : maRangeX(x1),
+ maRangeY(y1),
+ maRangeZ(z1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ maRangeZ.expand(z2);
+ }
+
+ B3DRange(const B3DTuple& rTuple1,
+ const B3DTuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY()),
+ maRangeZ(rTuple1.getZ())
+ {
+ expand(rTuple2);
+ }
+
+ bool isEmpty() const
+ {
+ return (
+ maRangeX.isEmpty()
+ || maRangeY.isEmpty()
+ || maRangeZ.isEmpty()
+ );
+ }
+
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ maRangeZ.reset();
+ }
+
+ bool operator==( const B3DRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY
+ && maRangeZ == rRange.maRangeZ);
+ }
+
+ bool operator!=( const B3DRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY
+ || maRangeZ != rRange.maRangeZ);
+ }
+
+ bool equal(const B3DRange& rRange) const
+ {
+ return (maRangeX.equal(rRange.maRangeX)
+ && maRangeY.equal(rRange.maRangeY)
+ && maRangeZ.equal(rRange.maRangeZ));
+ }
+
+ double getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ double getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ double getMinZ() const
+ {
+ return maRangeZ.getMinimum();
+ }
+
+ double getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ double getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ double getMaxZ() const
+ {
+ return maRangeZ.getMaximum();
+ }
+
+ double getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ double getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ double getDepth() const
+ {
+ return maRangeZ.getRange();
+ }
+
+ B3DPoint getMinimum() const
+ {
+ return B3DPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum(),
+ maRangeZ.getMinimum()
+ );
+ }
+
+ B3DPoint getMaximum() const
+ {
+ return B3DPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum(),
+ maRangeZ.getMaximum()
+ );
+ }
+
+ B3DVector getRange() const
+ {
+ return B3DVector(
+ maRangeX.getRange(),
+ maRangeY.getRange(),
+ maRangeZ.getRange()
+ );
+ }
+
+ B3DPoint getCenter() const
+ {
+ return B3DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter(),
+ maRangeZ.getCenter()
+ );
+ }
+
+ double getCenterX() const
+ {
+ return maRangeX.getCenter();
+ }
+
+ double getCenterY() const
+ {
+ return maRangeY.getCenter();
+ }
+
+ double getCenterZ() const
+ {
+ return maRangeZ.getCenter();
+ }
+
+ bool isInside(const B3DTuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ && maRangeZ.isInside(rTuple.getZ())
+ );
+ }
+
+ bool isInside(const B3DRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ && maRangeZ.isInside(rRange.maRangeZ)
+ );
+ }
+
+ bool overlaps(const B3DRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ && maRangeZ.overlaps(rRange.maRangeZ)
+ );
+ }
+
+ void expand(const B3DTuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ maRangeZ.expand(rTuple.getZ());
+ }
+
+ void expand(const B3DRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ maRangeZ.expand(rRange.maRangeZ);
+ }
+
+ void intersect(const B3DRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ maRangeZ.intersect(rRange.maRangeZ);
+ }
+
+ void grow(double fValue)
+ {
+ maRangeX.grow(fValue);
+ maRangeY.grow(fValue);
+ maRangeZ.grow(fValue);
+ }
+
+ BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix& rMatrix);
+ };
+
+} // end of namespace basegfx
+
+
+#endif /* _BGFX_RANGE_B3DRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/b3irange.hxx b/include/basegfx/range/b3irange.hxx
new file mode 100644
index 000000000000..558c2abb4d62
--- /dev/null
+++ b/include/basegfx/range/b3irange.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_B3IRANGE_HXX
+#define _BGFX_RANGE_B3IRANGE_HXX
+
+#include <basegfx/point/b3ipoint.hxx>
+#include <basegfx/point/b3dpoint.hxx>
+#include <basegfx/tuple/b3ituple.hxx>
+#include <basegfx/tuple/b3i64tuple.hxx>
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B3IRange
+ {
+ typedef ::basegfx::BasicRange< sal_Int32, Int32Traits > MyBasicRange;
+
+ MyBasicRange maRangeX;
+ MyBasicRange maRangeY;
+ MyBasicRange maRangeZ;
+
+ public:
+ B3IRange() {}
+
+ explicit B3IRange(const B3ITuple& rTuple)
+ : maRangeX(rTuple.getX()),
+ maRangeY(rTuple.getY()),
+ maRangeZ(rTuple.getZ())
+ {
+ }
+
+ B3IRange(sal_Int32 x1,
+ sal_Int32 y1,
+ sal_Int32 z1,
+ sal_Int32 x2,
+ sal_Int32 y2,
+ sal_Int32 z2)
+ : maRangeX(x1),
+ maRangeY(y1),
+ maRangeZ(z1)
+ {
+ maRangeX.expand(x2);
+ maRangeY.expand(y2);
+ maRangeZ.expand(z2);
+ }
+
+ B3IRange(const B3ITuple& rTuple1,
+ const B3ITuple& rTuple2)
+ : maRangeX(rTuple1.getX()),
+ maRangeY(rTuple1.getY()),
+ maRangeZ(rTuple1.getZ())
+ {
+ expand(rTuple2);
+ }
+
+ bool isEmpty() const
+ {
+ return maRangeX.isEmpty() || maRangeY.isEmpty() || maRangeZ.isEmpty();
+ }
+
+ void reset()
+ {
+ maRangeX.reset();
+ maRangeY.reset();
+ maRangeZ.reset();
+ }
+
+ bool operator==( const B3IRange& rRange ) const
+ {
+ return (maRangeX == rRange.maRangeX
+ && maRangeY == rRange.maRangeY
+ && maRangeZ == rRange.maRangeZ);
+ }
+
+ bool operator!=( const B3IRange& rRange ) const
+ {
+ return (maRangeX != rRange.maRangeX
+ || maRangeY != rRange.maRangeY
+ || maRangeZ != rRange.maRangeZ);
+ }
+
+ sal_Int32 getMinX() const
+ {
+ return maRangeX.getMinimum();
+ }
+
+ sal_Int32 getMinY() const
+ {
+ return maRangeY.getMinimum();
+ }
+
+ sal_Int32 getMinZ() const
+ {
+ return maRangeZ.getMinimum();
+ }
+
+ sal_Int32 getMaxX() const
+ {
+ return maRangeX.getMaximum();
+ }
+
+ sal_Int32 getMaxY() const
+ {
+ return maRangeY.getMaximum();
+ }
+
+ sal_Int32 getMaxZ() const
+ {
+ return maRangeZ.getMaximum();
+ }
+
+ sal_Int64 getWidth() const
+ {
+ return maRangeX.getRange();
+ }
+
+ sal_Int64 getHeight() const
+ {
+ return maRangeY.getRange();
+ }
+
+ sal_Int64 getDepth() const
+ {
+ return maRangeZ.getRange();
+ }
+
+ B3IPoint getMinimum() const
+ {
+ return B3IPoint(
+ maRangeX.getMinimum(),
+ maRangeY.getMinimum(),
+ maRangeZ.getMinimum()
+ );
+ }
+
+ B3IPoint getMaximum() const
+ {
+ return B3IPoint(
+ maRangeX.getMaximum(),
+ maRangeY.getMaximum(),
+ maRangeZ.getMaximum()
+ );
+ }
+
+ B3I64Tuple getRange() const
+ {
+ return B3I64Tuple(
+ maRangeX.getRange(),
+ maRangeY.getRange(),
+ maRangeZ.getRange()
+ );
+ }
+
+ B3DPoint getCenter() const
+ {
+ return B3DPoint(
+ maRangeX.getCenter(),
+ maRangeY.getCenter(),
+ maRangeZ.getCenter()
+ );
+ }
+
+ bool isInside(const B3ITuple& rTuple) const
+ {
+ return (
+ maRangeX.isInside(rTuple.getX())
+ && maRangeY.isInside(rTuple.getY())
+ && maRangeZ.isInside(rTuple.getZ())
+ );
+ }
+
+ bool isInside(const B3IRange& rRange) const
+ {
+ return (
+ maRangeX.isInside(rRange.maRangeX)
+ && maRangeY.isInside(rRange.maRangeY)
+ && maRangeZ.isInside(rRange.maRangeZ)
+ );
+ }
+
+ bool overlaps(const B3IRange& rRange) const
+ {
+ return (
+ maRangeX.overlaps(rRange.maRangeX)
+ && maRangeY.overlaps(rRange.maRangeY)
+ && maRangeZ.overlaps(rRange.maRangeZ)
+ );
+ }
+
+ void expand(const B3ITuple& rTuple)
+ {
+ maRangeX.expand(rTuple.getX());
+ maRangeY.expand(rTuple.getY());
+ maRangeZ.expand(rTuple.getZ());
+ }
+
+ void expand(const B3IRange& rRange)
+ {
+ maRangeX.expand(rRange.maRangeX);
+ maRangeY.expand(rRange.maRangeY);
+ maRangeZ.expand(rRange.maRangeZ);
+ }
+
+ void intersect(const B3IRange& rRange)
+ {
+ maRangeX.intersect(rRange.maRangeX);
+ maRangeY.intersect(rRange.maRangeY);
+ maRangeZ.intersect(rRange.maRangeZ);
+ }
+
+ void grow(sal_Int32 nValue)
+ {
+ maRangeX.grow(nValue);
+ maRangeY.grow(nValue);
+ maRangeZ.grow(nValue);
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_B3IRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/basicbox.hxx b/include/basegfx/range/basicbox.hxx
new file mode 100644
index 000000000000..bab84c17f89a
--- /dev/null
+++ b/include/basegfx/range/basicbox.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_BASICBOX_HXX
+#define _BGFX_RANGE_BASICBOX_HXX
+
+#include <basegfx/range/basicrange.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** Explicitely different from BasicRange, handling the inside predicates
+ differently.
+
+ This is modelled after how polygon fill algorithms set pixel -
+ typically excluding rightmost and bottommost ones.
+ */
+ class BasicBox : public BasicRange< sal_Int32, Int32Traits >
+ {
+ typedef BasicRange< sal_Int32, Int32Traits > Base;
+ public:
+ BasicBox() {}
+
+ explicit BasicBox( sal_Int32 nValue ) :
+ Base( nValue )
+ {
+ }
+
+ bool isEmpty() const
+ {
+ return mnMinimum >= mnMaximum;
+ }
+
+ double getCenter() const
+ {
+ if(isEmpty())
+ {
+ return 0.0;
+ }
+ else
+ {
+ return ((mnMaximum + mnMinimum - 1.0) / 2.0);
+ }
+ }
+
+ using Base::isInside;
+
+ bool isInside(sal_Int32 nValue) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (nValue >= mnMinimum) && (nValue < mnMaximum);
+ }
+ }
+
+ using Base::overlaps;
+
+ bool overlaps(const BasicBox& rBox) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rBox.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return !((rBox.mnMaximum <= mnMinimum) || (rBox.mnMinimum >= mnMaximum));
+ }
+ }
+ }
+
+ void grow(sal_Int32 nValue)
+ {
+ if(!isEmpty())
+ {
+ bool bLessThanZero(nValue < 0);
+
+ if(nValue > 0 || bLessThanZero)
+ {
+ mnMinimum -= nValue;
+ mnMaximum += nValue;
+
+ if(bLessThanZero)
+ {
+ // test if range did collapse
+ if(mnMinimum > mnMaximum)
+ {
+ // if yes, collapse to center
+ mnMinimum = mnMaximum = ((mnMaximum + mnMinimum - 1) / 2);
+ }
+ }
+ }
+ }
+ }
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_BASICBOX_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/range/basicrange.hxx b/include/basegfx/range/basicrange.hxx
new file mode 100644
index 000000000000..51b5593ae61d
--- /dev/null
+++ b/include/basegfx/range/basicrange.hxx
@@ -0,0 +1,278 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RANGE_BASICRANGE_HXX
+#define _BGFX_RANGE_BASICRANGE_HXX
+
+#include <sal/types.h>
+#include <float.h>
+#include <basegfx/numeric/ftools.hxx>
+
+
+namespace basegfx
+{
+ template< typename T, typename Traits > class BasicRange
+ {
+ protected:
+ T mnMinimum;
+ T mnMaximum;
+
+ public:
+ typedef T ValueType;
+ typedef Traits TraitsType;
+
+ BasicRange() :
+ mnMinimum(Traits::maxVal()),
+ mnMaximum(Traits::minVal())
+ {
+ }
+
+ explicit BasicRange( T nValue ) :
+ mnMinimum(nValue),
+ mnMaximum(nValue)
+ {
+ }
+
+ void reset()
+ {
+ mnMinimum = Traits::maxVal();
+ mnMaximum = Traits::minVal();
+ }
+
+ bool isEmpty() const
+ {
+ return Traits::maxVal() == mnMinimum;
+ }
+
+ T getMinimum() const { return mnMinimum; }
+ T getMaximum() const { return mnMaximum; }
+
+ double getCenter() const
+ {
+ if(isEmpty())
+ {
+ return 0.0;
+ }
+ else
+ {
+ return ((mnMaximum + mnMinimum) / 2.0);
+ }
+ }
+
+ bool isInside(T nValue) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (nValue >= mnMinimum) && (nValue <= mnMaximum);
+ }
+ }
+
+ bool isInside(const BasicRange& rRange) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rRange.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return (rRange.mnMinimum >= mnMinimum) && (rRange.mnMaximum <= mnMaximum);
+ }
+ }
+ }
+
+ bool overlaps(const BasicRange& rRange) const
+ {
+ if(isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ if(rRange.isEmpty())
+ {
+ return false;
+ }
+ else
+ {
+ return !((rRange.mnMaximum < mnMinimum) || (rRange.mnMinimum > mnMaximum));
+ }
+ }
+ }
+
+ bool overlapsMore(const BasicRange& rRange) const
+ {
+ if(isEmpty() || rRange.isEmpty())
+ return false;
+ // returns true if the overlap is more than just a touching at the limits
+ return ((rRange.mnMaximum > mnMinimum) && (rRange.mnMinimum < mnMaximum));
+ }
+
+ bool operator==( const BasicRange& rRange ) const
+ {
+ return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum);
+ }
+
+ bool operator!=( const BasicRange& rRange ) const
+ {
+ return (mnMinimum != rRange.mnMinimum || mnMaximum != rRange.mnMaximum);
+ }
+
+ bool equal(const BasicRange& rRange) const
+ {
+ return (
+ fTools::equal(mnMinimum, rRange.mnMinimum) &&
+ fTools::equal(mnMaximum, rRange.mnMaximum));
+ }
+
+ void expand(T nValue)
+ {
+ if(isEmpty())
+ {
+ mnMinimum = mnMaximum = nValue;
+ }
+ else
+ {
+ if(nValue < mnMinimum)
+ {
+ mnMinimum = nValue;
+ }
+
+ if(nValue > mnMaximum)
+ {
+ mnMaximum = nValue;
+ }
+ }
+ }
+
+ void expand(const BasicRange& rRange)
+ {
+ if(isEmpty())
+ {
+ mnMinimum = rRange.mnMinimum;
+ mnMaximum = rRange.mnMaximum;
+ }
+ else
+ {
+ if(!rRange.isEmpty())
+ {
+ if(rRange.mnMinimum < mnMinimum)
+ {
+ mnMinimum = rRange.mnMinimum;
+ }
+
+ if(rRange.mnMaximum > mnMaximum)
+ {
+ mnMaximum = rRange.mnMaximum;
+ }
+ }
+ }
+ }
+
+ void intersect(const BasicRange& rRange)
+ {
+ // here, overlaps also tests all isEmpty() conditions already.
+ if( !overlaps( rRange ) )
+ {
+ reset();
+ }
+ else
+ {
+ if(rRange.mnMinimum > mnMinimum)
+ {
+ mnMinimum = rRange.mnMinimum;
+ }
+
+ if(rRange.mnMaximum < mnMaximum)
+ {
+ mnMaximum = rRange.mnMaximum;
+ }
+ }
+ }
+
+ void grow(T nValue)
+ {
+ if(!isEmpty())
+ {
+ bool bLessThanZero(nValue < 0);
+
+ if(nValue > 0 || bLessThanZero)
+ {
+ mnMinimum -= nValue;
+ mnMaximum += nValue;
+
+ if(bLessThanZero)
+ {
+ // test if range did collapse
+ if(mnMinimum > mnMaximum)
+ {
+ // if yes, collapse to center
+ mnMinimum = mnMaximum = (mnMinimum + mnMaximum) / 2;
+ }
+ }
+ }
+ }
+ }
+
+ typename Traits::DifferenceType getRange() const
+ {
+ if(isEmpty())
+ {
+ return Traits::neutral();
+ }
+ else
+ {
+ return (mnMaximum - mnMinimum);
+ }
+ }
+ };
+
+ // some pre-fabricated traits
+ struct DoubleTraits
+ {
+ static double minVal() { return DBL_MIN; };
+ static double maxVal() { return DBL_MAX; };
+ static double neutral() { return 0.0; };
+
+ typedef double DifferenceType;
+ };
+
+ struct Int32Traits
+ {
+ static sal_Int32 minVal() { return SAL_MIN_INT32; };
+ static sal_Int32 maxVal() { return SAL_MAX_INT32; };
+ static sal_Int32 neutral() { return 0L; };
+
+ typedef sal_Int64 DifferenceType;
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_RANGE_BASICRANGE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/bpixelraster.hxx b/include/basegfx/raster/bpixelraster.hxx
new file mode 100644
index 000000000000..ed7ac931d805
--- /dev/null
+++ b/include/basegfx/raster/bpixelraster.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RASTER_BPIXELRASTER_HXX
+#define _BGFX_RASTER_BPIXELRASTER_HXX
+
+#include <algorithm>
+#include <string.h>
+#include <sal/types.h>
+#include <basegfx/pixel/bpixel.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BPixelRaster
+ {
+ private:
+ // do not allow copy constructor and assignment operator
+ BPixelRaster(const BPixelRaster&);
+ BPixelRaster& operator=(const BPixelRaster&);
+
+ protected:
+ sal_uInt32 mnWidth;
+ sal_uInt32 mnHeight;
+ sal_uInt32 mnCount;
+ BPixel* mpContent;
+
+ public:
+ // reset
+ void reset()
+ {
+ memset(mpContent, 0, sizeof(BPixel) * mnCount);
+ }
+
+ // constructor/destructor
+ BPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight)
+ : mnWidth(nWidth),
+ mnHeight(nHeight),
+ mnCount(nWidth * nHeight),
+ mpContent(new BPixel[mnCount])
+ {
+ reset();
+ }
+
+ ~BPixelRaster()
+ {
+ delete [] mpContent;
+ }
+
+ // coordinate calcs between X/Y and span
+ sal_uInt32 getIndexFromXY(sal_uInt32 nX, sal_uInt32 nY) const { return (nX + (nY * mnWidth)); }
+ sal_uInt32 getXFromIndex(sal_uInt32 nIndex) const { return (nIndex % mnWidth); }
+ sal_uInt32 getYFromIndex(sal_uInt32 nIndex) const { return (nIndex / mnWidth); }
+
+ // data access read
+ sal_uInt32 getWidth() const { return mnWidth; }
+ sal_uInt32 getHeight() const { return mnHeight; }
+ sal_uInt32 getCount() const { return mnCount; }
+
+ // data access read only
+ const BPixel& getBPixel(sal_uInt32 nIndex) const
+ {
+ assert(nIndex < mnCount); //Access out of range
+ return mpContent[nIndex];
+ }
+
+ // data access read/write
+ BPixel& getBPixel(sal_uInt32 nIndex)
+ {
+ assert(nIndex < mnCount); //Access out of range
+ return mpContent[nIndex];
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RASTER_BPIXELRASTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/bzpixelraster.hxx b/include/basegfx/raster/bzpixelraster.hxx
new file mode 100644
index 000000000000..ddd4f1e56cb0
--- /dev/null
+++ b/include/basegfx/raster/bzpixelraster.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RASTER_BZPIXELRASTER_HXX
+#define _BGFX_RASTER_BZPIXELRASTER_HXX
+
+#include <basegfx/raster/bpixelraster.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BZPixelRaster : public BPixelRaster
+ {
+ protected:
+ // additionally, host a ZBuffer
+ sal_uInt16* mpZBuffer;
+
+ public:
+ // reset
+ void resetZ()
+ {
+ reset();
+ memset(mpZBuffer, 0, sizeof(sal_uInt16) * mnCount);
+ }
+
+ // constructor/destructor
+ BZPixelRaster(sal_uInt32 nWidth, sal_uInt32 nHeight)
+ : BPixelRaster(nWidth, nHeight),
+ mpZBuffer(new sal_uInt16[mnCount])
+ {
+ memset(mpZBuffer, 0, sizeof(sal_uInt16) * mnCount);
+ }
+
+ ~BZPixelRaster()
+ {
+ delete [] mpZBuffer;
+ }
+
+ // data access read only
+ const sal_uInt16& getZ(sal_uInt32 nIndex) const
+ {
+#ifdef DBG_UTIL
+ if(nIndex >= mnCount)
+ {
+ OSL_FAIL("getZ: Access out of range (!)");
+ return mpZBuffer[0L];
+ }
+#endif
+ return mpZBuffer[nIndex];
+ }
+
+ // data access read/write
+ sal_uInt16& getZ(sal_uInt32 nIndex)
+ {
+#ifdef DBG_UTIL
+ if(nIndex >= mnCount)
+ {
+ OSL_FAIL("getZ: Access out of range (!)");
+ return mpZBuffer[0L];
+ }
+#endif
+ return mpZBuffer[nIndex];
+ }
+ };
+} // end of namespace basegfx
+
+#endif /* _BGFX_RASTER_BZPIXELRASTER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/raster/rasterconvert3d.hxx b/include/basegfx/raster/rasterconvert3d.hxx
new file mode 100644
index 000000000000..1bfbe20b1cf0
--- /dev/null
+++ b/include/basegfx/raster/rasterconvert3d.hxx
@@ -0,0 +1,340 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_RASTER_RASTERCONVERT3D_HXX
+#define _BGFX_RASTER_RASTERCONVERT3D_HXX
+
+#include <sal/types.h>
+#include <vector>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/vector/b3dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx
+{
+ class B3DPolygon;
+ class B3DPolyPolygon;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// interpolators for double precision
+
+namespace basegfx
+{
+ class ip_single
+ {
+ private:
+ double mfVal;
+ double mfInc;
+
+ public:
+ ip_single()
+ : mfVal(0.0),
+ mfInc(0.0)
+ {}
+
+ ip_single(double fVal, double fInc)
+ : mfVal(fVal),
+ mfInc(fInc)
+ {}
+
+ double getVal() const { return mfVal; }
+ double getInc() const { return mfInc; }
+
+ void increment(double fStep) { mfVal += fStep * mfInc; }
+ };
+} // end of namespace basegfx
+
+namespace basegfx
+{
+ class ip_double
+ {
+ private:
+ ip_single maX;
+ ip_single maY;
+
+ public:
+ ip_double()
+ : maX(),
+ maY()
+ {}
+
+ ip_double(double fXVal, double fXInc, double fYVal, double fYInc)
+ : maX(fXVal, fXInc),
+ maY(fYVal, fYInc)
+ {}
+
+ const ip_single& getX() const { return maX; }
+ const ip_single& getY() const { return maY; }
+
+ void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); }
+ };
+} // end of namespace basegfx
+
+namespace basegfx
+{
+ class ip_triple
+ {
+ private:
+ ip_single maX;
+ ip_single maY;
+ ip_single maZ;
+
+ public:
+ ip_triple()
+ : maX(),
+ maY(),
+ maZ()
+ {}
+
+ ip_triple(double fXVal, double fXInc, double fYVal, double fYInc, double fZVal, double fZInc)
+ : maX(fXVal, fXInc),
+ maY(fYVal, fYInc),
+ maZ(fZVal, fZInc)
+ {}
+
+ const ip_single& getX() const { return maX; }
+ const ip_single& getY() const { return maY; }
+ const ip_single& getZ() const { return maZ; }
+
+ void increment(double fStep) { maX.increment(fStep); maY.increment(fStep); maZ.increment(fStep); }
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// InterpolatorProvider3D to have a common source for allocating interpolators
+// which may then be addressed using the index to the vectors
+
+namespace basegfx
+{
+ #define SCANLINE_EMPTY_INDEX (0xffffffff)
+
+ class InterpolatorProvider3D
+ {
+ private:
+ ::std::vector< ip_triple > maColorInterpolators;
+ ::std::vector< ip_triple > maNormalInterpolators;
+ ::std::vector< ip_double > maTextureInterpolators;
+ ::std::vector< ip_triple > maInverseTextureInterpolators;
+
+ protected:
+ sal_uInt32 addColorInterpolator(const BColor& rA, const BColor& rB, double fInvYDelta)
+ {
+ B3DVector aDelta(rB.getRed() - rA.getRed(), rB.getGreen() - rA.getGreen(), rB.getBlue() - rA.getBlue());
+ aDelta *= fInvYDelta;
+ maColorInterpolators.push_back(ip_triple(rA.getRed(), aDelta.getX(), rA.getGreen(), aDelta.getY(), rA.getBlue(), aDelta.getZ()));
+ return (maColorInterpolators.size() - 1L);
+ }
+
+ sal_uInt32 addNormalInterpolator(const B3DVector& rA, const B3DVector& rB, double fInvYDelta)
+ {
+ B3DVector aDelta(rB.getX() - rA.getX(), rB.getY() - rA.getY(), rB.getZ() - rA.getZ());
+ aDelta *= fInvYDelta;
+ maNormalInterpolators.push_back(ip_triple(rA.getX(), aDelta.getX(), rA.getY(), aDelta.getY(), rA.getZ(), aDelta.getZ()));
+ return (maNormalInterpolators.size() - 1L);
+ }
+
+ sal_uInt32 addTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fInvYDelta)
+ {
+ B2DVector aDelta(rB.getX() - rA.getX(), rB.getY() - rA.getY());
+ aDelta *= fInvYDelta;
+ maTextureInterpolators.push_back(ip_double(rA.getX(), aDelta.getX(), rA.getY(), aDelta.getY()));
+ return (maTextureInterpolators.size() - 1L);
+ }
+
+ sal_uInt32 addInverseTextureInterpolator(const B2DPoint& rA, const B2DPoint& rB, double fZEyeA, double fZEyeB, double fInvYDelta)
+ {
+ const double fInvZEyeA(fTools::equalZero(fZEyeA) ? fZEyeA : 1.0 / fZEyeA);
+ const double fInvZEyeB(fTools::equalZero(fZEyeB) ? fZEyeB : 1.0 / fZEyeB);
+ const B2DPoint aInvA(rA * fInvZEyeA);
+ const B2DPoint aInvB(rB * fInvZEyeB);
+ double fZDelta(fInvZEyeB - fInvZEyeA);
+ B2DVector aDelta(aInvB.getX() - aInvA.getX(), aInvB.getY() - aInvA.getY());
+
+ fZDelta *= fInvYDelta;
+ aDelta *= fInvYDelta;
+
+ maInverseTextureInterpolators.push_back(ip_triple(aInvA.getX(), aDelta.getX(), aInvA.getY(), aDelta.getY(), fInvZEyeA, fZDelta));
+ return (maInverseTextureInterpolators.size() - 1L);
+ }
+
+ void reset()
+ {
+ maColorInterpolators.clear();
+ maNormalInterpolators.clear();
+ maTextureInterpolators.clear();
+ maInverseTextureInterpolators.clear();
+ }
+
+ public:
+ InterpolatorProvider3D() {}
+
+ ::std::vector< ip_triple >& getColorInterpolators() { return maColorInterpolators; }
+ ::std::vector< ip_triple >& getNormalInterpolators() { return maNormalInterpolators; }
+ ::std::vector< ip_double >& getTextureInterpolators() { return maTextureInterpolators; }
+ ::std::vector< ip_triple >& getInverseTextureInterpolators() { return maInverseTextureInterpolators; }
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// RasterConversionLineEntry3D for Raterconversion of 3D PolyPolygons
+
+namespace basegfx
+{
+ class RasterConversionLineEntry3D
+ {
+ private:
+ ip_single maX;
+ ip_single maZ;
+ sal_Int32 mnY;
+ sal_uInt32 mnCount;
+
+ sal_uInt32 mnColorIndex;
+ sal_uInt32 mnNormalIndex;
+ sal_uInt32 mnTextureIndex;
+ sal_uInt32 mnInverseTextureIndex;
+
+ public:
+ RasterConversionLineEntry3D(const double& rfX, const double& rfDeltaX, const double& rfZ, const double& rfDeltaZ, sal_Int32 nY, sal_uInt32 nCount)
+ : maX(rfX, rfDeltaX),
+ maZ(rfZ, rfDeltaZ),
+ mnY(nY),
+ mnCount(nCount),
+ mnColorIndex(SCANLINE_EMPTY_INDEX),
+ mnNormalIndex(SCANLINE_EMPTY_INDEX),
+ mnTextureIndex(SCANLINE_EMPTY_INDEX),
+ mnInverseTextureIndex(SCANLINE_EMPTY_INDEX)
+ {}
+
+ void setColorIndex(sal_uInt32 nIndex) { mnColorIndex = nIndex; }
+ void setNormalIndex(sal_uInt32 nIndex) { mnNormalIndex = nIndex; }
+ void setTextureIndex(sal_uInt32 nIndex) { mnTextureIndex = nIndex; }
+ void setInverseTextureIndex(sal_uInt32 nIndex) { mnInverseTextureIndex = nIndex; }
+
+ bool operator<(const RasterConversionLineEntry3D& rComp) const
+ {
+ if(mnY == rComp.mnY)
+ {
+ return maX.getVal() < rComp.maX.getVal();
+ }
+
+ return mnY < rComp.mnY;
+ }
+
+ bool decrementRasterConversionLineEntry3D(sal_uInt32 nStep)
+ {
+ if(nStep >= mnCount)
+ {
+ return false;
+ }
+ else
+ {
+ mnCount -= nStep;
+ return true;
+ }
+ }
+
+ void incrementRasterConversionLineEntry3D(sal_uInt32 nStep, InterpolatorProvider3D& rProvider)
+ {
+ const double fStep((double)nStep);
+ maX.increment(fStep);
+ maZ.increment(fStep);
+ mnY += nStep;
+
+ if(SCANLINE_EMPTY_INDEX != mnColorIndex)
+ {
+ rProvider.getColorInterpolators()[mnColorIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnNormalIndex)
+ {
+ rProvider.getNormalInterpolators()[mnNormalIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnTextureIndex)
+ {
+ rProvider.getTextureInterpolators()[mnTextureIndex].increment(fStep);
+ }
+
+ if(SCANLINE_EMPTY_INDEX != mnInverseTextureIndex)
+ {
+ rProvider.getInverseTextureInterpolators()[mnInverseTextureIndex].increment(fStep);
+ }
+ }
+
+ // data read access
+ const ip_single& getX() const { return maX; }
+ sal_Int32 getY() const { return mnY; }
+ const ip_single& getZ() const { return maZ; }
+ sal_uInt32 getColorIndex() const { return mnColorIndex; }
+ sal_uInt32 getNormalIndex() const { return mnNormalIndex; }
+ sal_uInt32 getTextureIndex() const { return mnTextureIndex; }
+ sal_uInt32 getInverseTextureIndex() const { return mnInverseTextureIndex; }
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// the basic RaterConverter itself. Only one method needs to be overloaded. The
+// class itself is strictly virtual
+
+namespace basegfx
+{
+ class BASEGFX_DLLPUBLIC RasterConverter3D : public InterpolatorProvider3D
+ {
+ private:
+ // the line entries for an area conversion run
+ ::std::vector< RasterConversionLineEntry3D > maLineEntries;
+
+ struct lineComparator
+ {
+ bool operator()(const RasterConversionLineEntry3D* pA, const RasterConversionLineEntry3D* pB)
+ {
+ OSL_ENSURE(pA && pB, "lineComparator: empty pointer (!)");
+ return pA->getX().getVal() < pB->getX().getVal();
+ }
+ };
+
+ void addArea(const B3DPolygon& rFill, const B3DHomMatrix* pViewToEye);
+ void addArea(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye);
+ void addEdge(const B3DPolygon& rFill, sal_uInt32 a, sal_uInt32 b, const B3DHomMatrix* pViewToEye);
+
+ void rasterconvertB3DArea(sal_Int32 nStartLine, sal_Int32 nStopLine);
+ void rasterconvertB3DEdge(const B3DPolygon& rLine, sal_uInt32 nA, sal_uInt32 nB, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth);
+
+ virtual void processLineSpan(const RasterConversionLineEntry3D& rA, const RasterConversionLineEntry3D& rB, sal_Int32 nLine, sal_uInt32 nSpanCount) = 0;
+
+ public:
+ RasterConverter3D();
+ virtual ~RasterConverter3D();
+
+ void rasterconvertB3DPolyPolygon(const B3DPolyPolygon& rFill, const B3DHomMatrix* pViewToEye, sal_Int32 nStartLine, sal_Int32 nStopLine);
+ void rasterconvertB3DPolygon(const B3DPolygon& rLine, sal_Int32 nStartLine, sal_Int32 nStopLine, sal_uInt16 nLineWidth);
+ };
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_RASTER_RASTERCONVERT3D_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/b2dclipstate.hxx b/include/basegfx/tools/b2dclipstate.hxx
new file mode 100644
index 000000000000..f1d750ae636b
--- /dev/null
+++ b/include/basegfx/tools/b2dclipstate.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_CLIPSTATE_HXX
+#define _BGFX_TOOLS_CLIPSTATE_HXX
+
+#include <sal/types.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPolyRange;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+
+ namespace tools
+ {
+ class ImplB2DClipState;
+
+ /** This class provides an optimized, symbolic clip state for graphical output
+
+ Having a current 'clip' state is a common attribute of
+ almost all graphic output APIs, most of which internally
+ represent it via a list of rectangular bands. In contrast,
+ this implementation purely uses symbolic clips, but in a
+ quite efficient manner, deferring actual evaluation until
+ a clip representation is requested, and using faster code
+ paths for common special cases (like all-rectangle clips)
+ */
+ class BASEGFX_DLLPUBLIC B2DClipState
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType;
+
+ private:
+ ImplType mpImpl;
+
+ public:
+ /// Init clip, in 'cleared' state - everything is visible
+ B2DClipState();
+ ~B2DClipState();
+ B2DClipState( const B2DClipState& );
+ explicit B2DClipState( const B2DPolyPolygon& );
+ B2DClipState& operator=( const B2DClipState& );
+
+ /// Set clip to 'null' - nothing is visible
+ void makeNull();
+
+ /// returns true when clip is 'cleared' - everything is visible
+ bool isCleared() const;
+
+ bool operator==(const B2DClipState&) const;
+ bool operator!=(const B2DClipState&) const;
+
+ void unionRange(const B2DRange& );
+ void unionPolyPolygon(const B2DPolyPolygon& );
+
+ void intersectRange(const B2DRange& );
+ void intersectPolyPolygon(const B2DPolyPolygon& );
+
+ void subtractRange(const B2DRange& );
+ void subtractPolyPolygon(const B2DPolyPolygon& );
+
+ void xorRange(const B2DRange& );
+ void xorPolyPolygon(const B2DPolyPolygon& );
+
+ B2DPolyPolygon getClipPoly() const;
+ };
+ }
+}
+
+#endif // _BGFX_TOOLS_CLIPSTATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/canvastools.hxx b/include/basegfx/tools/canvastools.hxx
new file mode 100644
index 000000000000..819a62e47b28
--- /dev/null
+++ b/include/basegfx/tools/canvastools.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_CANVASTOOLS_HXX
+#define _BGFX_TOOLS_CANVASTOOLS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct AffineMatrix2D;
+ struct AffineMatrix3D;
+ struct Matrix2D;
+ struct RealPoint2D;
+ struct RealSize2D;
+ struct RealRectangle2D;
+ struct RealRectangle3D;
+ struct IntegerPoint2D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+ struct RealBezierSegment2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XGraphicDevice;
+ class XPolyPolygon2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace awt
+{
+ struct Point;
+ struct Size;
+ struct Rectangle;
+} } } }
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B3DHomMatrix;
+ class B2DVector;
+ class B2DPoint;
+ class B2DRange;
+ class B3DRange;
+ class B2IBox;
+ class B2IVector;
+ class B2IPoint;
+ class B2IRange;
+ class B2DPolygon;
+ class B2DPolyPolygon;
+
+ namespace unotools
+ {
+ // Polygon conversions
+ // ===================================================================
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
+ xPolyPolygonFromB2DPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice,
+ const ::basegfx::B2DPolygon& rPoly );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >
+ xPolyPolygonFromB2DPolyPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice,
+ const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealBezierSegment2D > >
+ bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealPoint2D > >
+ pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon polygonFromPoint2DSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealPoint2D >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon polygonFromBezier2DSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::geometry::RealBezierSegment2D >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& rPoints );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& rPoly );
+
+ // Matrix conversions
+ // ===================================================================
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D&
+ affineMatrixFromHomMatrix( ::com::sun::star::geometry::AffineMatrix2D& matrix,
+ const ::basegfx::B2DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
+ ::com::sun::star::geometry::AffineMatrix3D& matrix,
+ const ::basegfx::B3DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::geometry::AffineMatrix2D& matrix );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::Matrix2D&
+ matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D& matrix,
+ const ::basegfx::B2DHomMatrix& transform);
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ homMatrixFromMatrix( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::geometry::Matrix2D& matrix );
+
+ // Geometry conversions
+ // ===================================================================
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& );
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& );
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& );
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2DPoint b2DPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const ::com::sun::star::geometry::RealRectangle3D& );
+
+ BASEGFX_DLLPUBLIC ::com::sun::star::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& );
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& );
+
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const ::com::sun::star::awt::Rectangle& );
+
+ // Geometry comparisons
+ // ===================================================================
+
+ /** Return smalltest integer range, which completely contains
+ given floating point range.
+
+ @param rRange
+ Input range. Values must be within the representable
+ bounds of sal_Int32
+
+ @return the closest integer range, which completely
+ contains rRange.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Return smalltest integer box, which completely contains
+ given floating point range.
+
+ @param rRange
+ Input range. Values must be within the representable
+ bounds of sal_Int32
+
+ @return the closest integer box, which completely contains
+ rRange. Note that this box will contain all pixel affected
+ by a polygon fill operation over the input range.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2IBox b2ISurroundingBoxFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Return smalltest B2DRange with integer values, which
+ completely contains given floating point range.
+
+ @param rRange
+ Input range.
+
+ @return the closest B2DRange with integer coordinates,
+ which completely contains rRange.
+ */
+ BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ }
+}
+
+#endif /* _BGFX_TOOLS_CANVASTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/gradienttools.hxx b/include/basegfx/tools/gradienttools.hxx
new file mode 100644
index 000000000000..aa7479d2c369
--- /dev/null
+++ b/include/basegfx/tools/gradienttools.hxx
@@ -0,0 +1,405 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_GRADIENTTOOLS_HXX
+#define _BGFX_TOOLS_GRADIENTTOOLS_HXX
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+#include <vector>
+#include <algorithm>
+
+namespace basegfx
+{
+ /** Gradient definition as used in ODF 1.2
+
+ This struct collects all data necessary for rendering ODF
+ 1.2-compatible gradients. Use the createXXXODFGradientInfo()
+ methods below for initializing from ODF attributes.
+ */
+ struct BASEGFX_DLLPUBLIC ODFGradientInfo
+ {
+ /** transformation mapping from [0,1]^2 texture coordinate
+ space to [0,1]^2 shape coordinate space
+ */
+ B2DHomMatrix maTextureTransform;
+
+ /** transformation mapping from [0,1]^2 shape coordinate space
+ to [0,1]^2 texture coordinate space. This is the
+ transformation commonly used to create gradients from a
+ scanline rasterizer (put shape u/v coordinates into it, get
+ texture s/t coordinates out of it)
+ */
+ B2DHomMatrix maBackTextureTransform;
+
+ /** Aspect ratio of the gradient. Only used in drawinglayer
+ for generating nested gradient polygons currently. Already
+ catered for in the transformations above.
+ */
+ double mfAspectRatio;
+
+ /** Requested gradient steps to render. See the
+ implementations of the getXXXGradientAlpha() methods below,
+ the semantic differs slightly for the different gradient
+ types.
+ */
+ sal_uInt32 mnSteps;
+ };
+
+ namespace tools
+ {
+ /** Create matrix for ODF's linear gradient definition
+
+ Note that odf linear gradients are varying in y direction.
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate linear gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped. Assumes gradient color varies along the y axis.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getLinearGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double t(clamp(aCoor.getY(), 0.0, 1.0));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(t * nSteps) / double(nSteps + 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's axial gradient definition
+
+ Note that odf axial gradients are varying in y
+ direction. Note further that you can map the axial
+ gradient to a linear gradient (in case you want or need to
+ avoid an extra gradient renderer), by using
+ createLinearODFGradientInfo() instead, shifting the
+ resulting texture transformation by 0.5 to the top and
+ appending the same stop colors again, but mirrored.
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate axial gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped. Assumes gradient color varies along the y axis.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getAxialGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double t(clamp(fabs(aCoor.getY()), 0.0, 1.0));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+ const double fInternalSteps((nSteps * 2L) - 1L);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(((t * fInternalSteps) + 1.0) / 2.0) / double(nSteps - 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's radial gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder);
+
+ /** Calculate radial gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getRadialGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double fDist(
+ clamp(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY(),
+ 0.0,
+ 1.0));
+
+ const double t(1.0 - sqrt(fDist));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(t * nSteps) / double(nSteps - 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's elliptical gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate elliptical gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getEllipticalGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ return getRadialGradientAlpha(rUV,rGradInfo); // only matrix setup differs
+ }
+
+ /** Create matrix for ODF's square gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate square gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getSquareGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV);
+ const double fAbsX(fabs(aCoor.getX()));
+ const double fAbsY(fabs(aCoor.getY()));
+
+ if(fTools::moreOrEqual(fAbsX, 1.0) || fTools::moreOrEqual(fAbsY, 1.0))
+ return 0.0;
+
+ const double t(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY));
+ const sal_uInt32 nSteps(rGradInfo.mnSteps);
+
+ if(nSteps > 2L && nSteps < 128L)
+ return floor(t * nSteps) / double(nSteps - 1L);
+
+ return t;
+ }
+
+ /** Create matrix for ODF's rectangular gradient definition
+
+ @param o_rGradientInfo
+ Receives the calculated texture transformation matrix (for
+ use with standard [0,1]x[0,1] texture coordinates)
+
+ @param rTargetArea
+ Output area, needed for aspect ratio calculations and
+ texture transformation
+
+ @param rOffset
+ Gradient offset value (from ODF)
+
+ @param nSteps
+ Number of gradient steps (from ODF)
+
+ @param fBorder
+ Width of gradient border (from ODF)
+
+ @param fAngle
+ Gradient angle (from ODF)
+ */
+ BASEGFX_DLLPUBLIC ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo,
+ const B2DRange& rTargetArea,
+ const B2DVector& rOffset,
+ sal_uInt32 nSteps,
+ double fBorder,
+ double fAngle);
+
+ /** Calculate rectangular gradient blend value
+
+ This method generates you the lerp alpha value for
+ blending linearly between gradient start and end color,
+ according to the formula (startCol*(1.0-alpha) + endCol*alpha)
+
+ @param rUV
+ Current uv coordinate. Values outside [0,1] will be
+ clamped.
+
+ @param rGradInfo
+ Gradient info, for transformation and number of steps
+ */
+ inline double getRectangularGradientAlpha(const B2DPoint& rUV,
+ const ODFGradientInfo& rGradInfo )
+ {
+ return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs
+ }
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/keystoplerp.hxx b/include/basegfx/tools/keystoplerp.hxx
new file mode 100644
index 000000000000..8d6d41af63d9
--- /dev/null
+++ b/include/basegfx/tools/keystoplerp.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_KEYSTOPLERP_HXX
+#define _BGFX_TOOLS_KEYSTOPLERP_HXX
+
+#include <basegfx/numeric/ftools.hxx>
+#include <vector>
+#include <basegfx/basegfxdllapi.h>
+
+namespace com{ namespace sun{ namespace star{ namespace uno {
+ template<typename T> class Sequence;
+}}}}
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Lerp in a vector of key stops
+
+ This class holds a key stop vector and provides the
+ functionality to lerp inside it. Useful e.g. for
+ multi-stop gradients, or the SMIL key time activity.
+
+ For those, given a global [0,1] lerp alpha, one need to
+ find the suitable bucket index from key stop vector, and
+ then calculate the relative alpha between the two buckets
+ found.
+ */
+ class BASEGFX_DLLPUBLIC KeyStopLerp
+ {
+ public:
+ typedef std::pair<std::ptrdiff_t,double> ResultType;
+
+ /** Create lerper with given vector of stops
+
+ @param rKeyStops
+
+ Vector of stops, must contain at least two elements
+ (though preferrably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const std::vector<double>& rKeyStops );
+
+ /** Create lerper with given sequence of stops
+
+ @param rKeyStops
+
+ Sequence of stops, must contain at least two elements
+ (though preferrably more, otherwise you probably don't
+ need key stop lerping in the first place). All
+ elements must be of monotonically increasing value.
+ */
+ explicit KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops );
+
+ /** Find two nearest bucket index & interpolate
+
+ @param fAlpha
+ Find bucket index i, with keyStops[i] < fAlpha <=
+ keyStops[i+1]. Return new alpha value in [0,1),
+ proportional to fAlpha's position between keyStops[i]
+ and keyStops[i+1]
+ */
+ ResultType lerp(double fAlpha) const;
+
+ private:
+ std::vector<double> maKeyStops;
+ mutable std::ptrdiff_t mnLastIndex;
+ };
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/lerp.hxx b/include/basegfx/tools/lerp.hxx
new file mode 100644
index 000000000000..a0c0d714a295
--- /dev/null
+++ b/include/basegfx/tools/lerp.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_LERP_HXX
+#define _BGFX_TOOLS_LERP_HXX
+
+#include <sal/types.h>
+
+namespace basegfx
+{
+ namespace tools
+ {
+ /** Generic linear interpolator
+
+ @tpl ValueType
+ Must have operator+ and operator* defined, and should
+ have value semantics.
+
+ @param t
+ As usual, t must be in the [0,1] range
+ */
+ template< typename ValueType > ValueType lerp( const ValueType& rFrom,
+ const ValueType& rTo,
+ double t )
+ {
+ // This is only to suppress a double->int warning. All other
+ // types should be okay here.
+ return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo );
+ }
+ }
+}
+
+#endif /* _BGFX_TOOLS_LERP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/rectcliptools.hxx b/include/basegfx/tools/rectcliptools.hxx
new file mode 100644
index 000000000000..3d5f77e18e0e
--- /dev/null
+++ b/include/basegfx/tools/rectcliptools.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_RECTCLIPTOOLS_HXX
+#define _BGFX_TOOLS_RECTCLIPTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/range/b2ibox.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ namespace tools
+ {
+ namespace RectClipFlags
+ {
+ static const sal_uInt32 LEFT = (sal_Int32)0x01;
+ static const sal_uInt32 RIGHT = (sal_Int32)0x02;
+ static const sal_uInt32 TOP = (sal_Int32)0x04;
+ static const sal_uInt32 BOTTOM = (sal_Int32)0x08;
+ }
+
+ /** Calc clip mask for Cohen-Sutherland rectangle clip
+
+ This function returns a clip mask used for the
+ Cohen-Sutherland rectangle clip method, where one or more
+ of the lower four bits are set, if the given point is
+ outside one or more of the four half planes defining the
+ rectangle (see RectClipFlags for possible values)
+ */
+ template< class Point, class Rect > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const Rect& rR )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip = (rP.getX() < rR.getMinX()) << 0;
+ clip |= (rP.getX() > rR.getMaxX()) << 1;
+ clip |= (rP.getY() < rR.getMinY()) << 2;
+ clip |= (rP.getY() > rR.getMaxY()) << 3;
+ return clip;
+ }
+
+ /// Cohen-Sutherland mask calculation - overload for boxes.
+ template< class Point > inline
+ sal_uInt32 getCohenSutherlandClipFlags( const Point& rP,
+ const B2IBox& rB )
+ {
+ // maxY | minY | maxX | minX
+ sal_uInt32 clip = (rP.getX() < rB.getMinX()) << 0;
+ clip |= (rP.getX() >= rB.getMaxX()) << 1;
+ clip |= (rP.getY() < rB.getMinY()) << 2;
+ clip |= (rP.getY() >= rB.getMaxY()) << 3;
+ return clip;
+ }
+
+ /** Determine number of clip planes hit by given clip mask
+
+ This method returns the number of one bits in the four
+ least significant bits of the argument, which amounts to
+ the number of clip planes hit within the
+ getCohenSutherlandClipFlags() method.
+ */
+ inline sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags )
+ {
+ // classic bit count algo, see e.g. Reingold, Nievergelt,
+ // Deo: Combinatorial Algorithms, Theory and Practice,
+ // Prentice-Hall 1977
+ nFlags = (nFlags & 0x05) + ((nFlags >> 1) & 0x05);
+ nFlags = (nFlags & 0x03) + (nFlags >> 2); // no need for &
+ // 0x03, can't
+ // overflow
+ return nFlags;
+ }
+ }
+}
+
+#endif // _BGFX_TOOLS_RECTCLIPTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/tools.hxx b/include/basegfx/tools/tools.hxx
new file mode 100644
index 000000000000..c1fa0940ae35
--- /dev/null
+++ b/include/basegfx/tools/tools.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TOOLS_TOOLS_HXX
+#define _BGFX_TOOLS_TOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DRange;
+
+ namespace tools
+ {
+ /** Expand given parallelogram, such that it extends beyond
+ bound rect in a given direction.
+
+ This method is useful when e.g. generating one-dimensional
+ gradients, such as linear or axial gradients: those
+ gradients vary only in one direction, the other has
+ constant color. Most of the time, those gradients extends
+ infinitely in the direction with the constant color, but
+ practically, one always has a limiting bound rect into
+ which the gradient is painted. The method at hand now
+ extends a given parallelogram (e.g. the transformed
+ bounding box of a gradient) virtually into infinity to the
+ top and to the bottom (i.e. normal to the line io_rLeftTop
+ io_rRightTop), such that the given rectangle is guaranteed
+ to be covered in that direction.
+
+ @attention There might be some peculiarities with this
+ method, that might limit its usage to the described
+ gradients. One of them is the fact that when determining
+ how far the parallelogram has to be extended to the top or
+ the bottom, the upper and lower border are assumed to be
+ infinite lines.
+
+ @param io_rLeftTop
+ Left, top edge of the parallelogramm. Note that this need
+ not be the left, top edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rLeftBottom
+ Left, bottom edge of the parallelogramm. Note that this need
+ not be the left, bottom edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rRightTop
+ Right, top edge of the parallelogramm. Note that this need
+ not be the right, top edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param io_rRightBottom
+ Right, bottom edge of the parallelogramm. Note that this need
+ not be the right, bottom edge geometrically, it's just used
+ when determining the extension direction. Thus, it's
+ perfectly legal to affine-transform a rectangle, and given
+ the transformed point here. On method return, this
+ parameter will contain the adapted output.
+
+ @param rFitTarget
+ The rectangle to fit the parallelogram into.
+ */
+ BASEGFX_DLLPUBLIC void infiniteLineFromParallelogram( ::basegfx::B2DPoint& io_rLeftTop,
+ ::basegfx::B2DPoint& io_rLeftBottom,
+ ::basegfx::B2DPoint& io_rRightTop,
+ ::basegfx::B2DPoint& io_rRightBottom,
+ const ::basegfx::B2DRange& rFitTarget );
+
+ }
+}
+
+#endif /* _BGFX_TOOLS_TOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/unopolypolygon.hxx b/include/basegfx/tools/unopolypolygon.hxx
new file mode 100644
index 000000000000..72ed9418663a
--- /dev/null
+++ b/include/basegfx/tools/unopolypolygon.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX
+#define INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/FillRule.hpp>
+#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/basegfxdllapi.h>
+#include <boost/utility.hpp>
+
+
+namespace basegfx
+{
+namespace unotools
+{
+ typedef ::cppu::WeakComponentImplHelper3<
+ ::com::sun::star::rendering::XLinePolyPolygon2D,
+ ::com::sun::star::rendering::XBezierPolyPolygon2D,
+ ::com::sun::star::lang::XServiceInfo > UnoPolyPolygonBase;
+
+ class BASEGFX_DLLPUBLIC UnoPolyPolygon
+ : private cppu::BaseMutex
+ , private boost::noncopyable
+ , public UnoPolyPolygonBase
+ {
+ public:
+ explicit UnoPolyPolygon( const B2DPolyPolygon& );
+
+ // XPolyPolygon2D
+ virtual void SAL_CALL addPolyPolygon( const ::com::sun::star::geometry::RealPoint2D& position, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& polyPolygon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberOfPolygons( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::rendering::FillRule SAL_CALL getFillRule( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFillRule( ::com::sun::star::rendering::FillRule fillRule ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setClosed( ::sal_Int32 index, ::sal_Bool closedState ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XLinePolyPolygon2D
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > > SAL_CALL getPoints( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPoints( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::geometry::RealPoint2D SAL_CALL getPoint( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPoint( const ::com::sun::star::geometry::RealPoint2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XBezierPolyPolygon2D
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > > SAL_CALL getBezierSegments( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBezierSegments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::geometry::RealBezierSegment2D SAL_CALL getBezierSegment( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setBezierSegment( const ::com::sun::star::geometry::RealBezierSegment2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ B2DPolyPolygon getPolyPolygon() const;
+
+ protected:
+ /// Check whether index is a valid polygon index
+ void checkIndex( sal_Int32 nIndex ) const // throw (::com::sun::star::lang::IndexOutOfBoundsException);
+ {
+ if( nIndex < 0 || nIndex >= static_cast<sal_Int32>(maPolyPoly.count()) )
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+
+ B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex,
+ sal_Int32 nNumberOfPolygons,
+ sal_Int32 nPointIndex,
+ sal_Int32 nNumberOfPoints ) const;
+
+ /// Get cow copy of internal polygon. not thread-safe outside this object.
+ B2DPolyPolygon getPolyPolygonUnsafe() const
+ {
+ return maPolyPoly;
+ }
+
+ /// Called whenever internal polypolygon gets modified
+ virtual void modifying() const {}
+
+ private:
+ B2DPolyPolygon maPolyPoly;
+ ::com::sun::star::rendering::FillRule meFillRule;
+ };
+}
+}
+
+#endif /* INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/unotools.hxx b/include/basegfx/tools/unotools.hxx
new file mode 100644
index 000000000000..c95eb5361f5c
--- /dev/null
+++ b/include/basegfx/tools/unotools.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_BASEGFX_UNOTOOLS_HXX
+#define INCLUDED_BASEGFX_UNOTOOLS_HXX
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/FillRule.hpp>
+#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+
+namespace basegfx
+{
+class B2DPolyPolygon;
+
+namespace unotools
+{
+
+ BASEGFX_DLLPUBLIC B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const ::com::sun::star::drawing::PolyPolygonBezierCoords& rSourcePolyPolygon)
+ throw( ::com::sun::star::lang::IllegalArgumentException );
+
+ BASEGFX_DLLPUBLIC void b2DPolyPolygonToPolyPolygonBezier( const B2DPolyPolygon& rPolyPoly,
+ ::com::sun::star::drawing::PolyPolygonBezierCoords& rRetval );
+}
+}
+
+#endif /* INCLUDED_BASEGFX_UNOTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tools/zoomtools.hxx b/include/basegfx/tools/zoomtools.hxx
new file mode 100644
index 000000000000..44d9052a2552
--- /dev/null
+++ b/include/basegfx/tools/zoomtools.hxx
@@ -0,0 +1,50 @@
+/* -*- 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.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Tim Hardeck <thardeck@suse.com>
+ *
+ * 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 _BGFX_TOOLS_ZOOMTOOLS_HXX
+#define _BGFX_TOOLS_ZOOMTOOLS_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ /** This namespace provides functions for optimized geometric zooming
+ */
+ namespace zoomtools
+ {
+ BASEGFX_DLLPUBLIC long zoomOut(long nCurrent);
+ BASEGFX_DLLPUBLIC long zoomIn(long nCurrent);
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2dtuple.hxx b/include/basegfx/tuple/b2dtuple.hxx
new file mode 100644
index 000000000000..380ba8adf493
--- /dev/null
+++ b/include/basegfx/tuple/b2dtuple.hxx
@@ -0,0 +1,352 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B2DTUPLE_HXX
+#define _BGFX_TUPLE_B2DTUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclarations
+ class B2ITuple;
+
+ /** Base class for all Points/Vectors with two double values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two double values
+ */
+ class SAL_WARN_UNUSED B2DTuple
+ {
+ protected:
+ double mfX;
+ double mfY;
+
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0.0, 0.0)
+ */
+ B2DTuple()
+ : mfX(0.0),
+ mfY(0.0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2DTuple(double fX, double fY)
+ : mfX( fX ),
+ mfY( fY )
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2DTuple(const B2DTuple& rTup)
+ : mfX( rTup.mfX ),
+ mfY( rTup.mfY )
+ {}
+
+ /** Create a copy of a 2D integer Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ BASEGFX_DLLPUBLIC explicit B2DTuple(const B2ITuple& rTup);
+
+ ~B2DTuple()
+ {}
+
+ /// Get X-Coordinate of 2D Tuple
+ double getX() const
+ {
+ return mfX;
+ }
+
+ /// Get Y-Coordinate of 2D Tuple
+ double getY() const
+ {
+ return mfY;
+ }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(double fX)
+ {
+ mfX = fX;
+ }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(double fY)
+ {
+ mfY = fY;
+ }
+
+ /// Array-access to 2D Tuple
+ const double& operator[] (int nPos) const
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; return mfY;
+ return *((&mfX) + nPos);
+ }
+
+ /// Array-access to 2D Tuple
+ double& operator[] (int nPos)
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; return mfY;
+ return *((&mfX) + nPos);
+ }
+
+ // comparators with tolerance
+ //////////////////////////////////////////////////////////////////////
+
+ bool equalZero() const
+ {
+ return (this == &getEmptyTuple() ||
+ (fTools::equalZero(mfX) && fTools::equalZero(mfY)));
+ }
+
+ bool equalZero(const double& rfSmallValue) const
+ {
+ return (this == &getEmptyTuple() ||
+ (fTools::equalZero(mfX, rfSmallValue) && fTools::equalZero(mfY, rfSmallValue)));
+ }
+
+ bool equal(const B2DTuple& rTup) const
+ {
+ return (
+ this == &rTup ||
+ (fTools::equal(mfX, rTup.mfX) &&
+ fTools::equal(mfY, rTup.mfY)));
+ }
+
+ bool equal(const B2DTuple& rTup, const double& rfSmallValue) const
+ {
+ return (
+ this == &rTup ||
+ (fTools::equal(mfX, rTup.mfX, rfSmallValue) &&
+ fTools::equal(mfY, rTup.mfY, rfSmallValue)));
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B2DTuple& operator+=( const B2DTuple& rTup )
+ {
+ mfX += rTup.mfX;
+ mfY += rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator-=( const B2DTuple& rTup )
+ {
+ mfX -= rTup.mfX;
+ mfY -= rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator/=( const B2DTuple& rTup )
+ {
+ mfX /= rTup.mfX;
+ mfY /= rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator*=( const B2DTuple& rTup )
+ {
+ mfX *= rTup.mfX;
+ mfY *= rTup.mfY;
+ return *this;
+ }
+
+ B2DTuple& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ B2DTuple& operator/=(double t)
+ {
+ const double fVal(1.0 / t);
+ mfX *= fVal;
+ mfY *= fVal;
+ return *this;
+ }
+
+ B2DTuple operator-(void) const
+ {
+ return B2DTuple(-mfX, -mfY);
+ }
+
+ bool operator==( const B2DTuple& rTup ) const
+ {
+ return equal(rTup);
+ }
+
+ bool operator!=( const B2DTuple& rTup ) const
+ {
+ return !equal(rTup);
+ }
+
+ B2DTuple& operator=( const B2DTuple& rTup )
+ {
+ mfX = rTup.mfX;
+ mfY = rTup.mfY;
+ return *this;
+ }
+
+ BASEGFX_DLLPUBLIC static const B2DTuple& getEmptyTuple();
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B2DTuple minimum(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMin;
+ }
+
+ inline B2DTuple maximum(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMax;
+ }
+
+ inline B2DTuple absolute(const B2DTuple& rTup)
+ {
+ B2DTuple aAbs(
+ (0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY());
+ return aAbs;
+ }
+
+ inline B2DTuple interpolate(const B2DTuple& rOld1, const B2DTuple& rOld2, double t)
+ {
+ B2DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
+ return aInt;
+ }
+
+ inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5);
+ return aAvg;
+ }
+
+ inline B2DTuple average(const B2DTuple& rOld1, const B2DTuple& rOld2, const B2DTuple& rOld3)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B2DTuple operator+(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B2DTuple operator-(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B2DTuple operator/(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B2DTuple operator*(const B2DTuple& rTupA, const B2DTuple& rTupB)
+ {
+ B2DTuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B2DTuple operator*(const B2DTuple& rTup, double t)
+ {
+ B2DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator*(double t, const B2DTuple& rTup)
+ {
+ B2DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator/(const B2DTuple& rTup, double t)
+ {
+ B2DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B2DTuple operator/(double t, const B2DTuple& rTup)
+ {
+ B2DTuple aNew(t, t);
+ B2DTuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+
+ /** Round double to nearest integer for 2D tuple
+
+ @return the nearest integer for this tuple
+ */
+ BASEGFX_DLLPUBLIC B2ITuple fround(const B2DTuple& rTup);
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B2DTUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2i64tuple.hxx b/include/basegfx/tuple/b2i64tuple.hxx
new file mode 100644
index 000000000000..debb4cabe578
--- /dev/null
+++ b/include/basegfx/tuple/b2i64tuple.hxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B2I64TUPLE_HXX
+#define _BGFX_TUPLE_B2I64TUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with two sal_Int64 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two sal_Int64 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2I64Tuple
+ {
+ protected:
+ sal_Int64 mnX;
+ sal_Int64 mnY;
+
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0, 0)
+ */
+ B2I64Tuple()
+ : mnX(0),
+ mnY(0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2I64Tuple(sal_Int64 fX, sal_Int64 fY)
+ : mnX( fX ),
+ mnY( fY )
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2I64Tuple(const B2I64Tuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY )
+ {}
+
+ ~B2I64Tuple()
+ {}
+
+ /// Get X-Coordinate of 2D Tuple
+ sal_Int64 getX() const
+ {
+ return mnX;
+ }
+
+ /// Get Y-Coordinate of 2D Tuple
+ sal_Int64 getY() const
+ {
+ return mnY;
+ }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(sal_Int64 fX)
+ {
+ mnX = fX;
+ }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(sal_Int64 fY)
+ {
+ mnY = fY;
+ }
+
+ /// Array-access to 2D Tuple
+ const sal_Int64& operator[] (int nPos) const
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 2D Tuple
+ sal_Int64& operator[] (int nPos)
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B2I64Tuple& operator+=( const B2I64Tuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator-=( const B2I64Tuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator/=( const B2I64Tuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator*=( const B2I64Tuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ return *this;
+ }
+
+ B2I64Tuple& operator*=(sal_Int64 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ B2I64Tuple& operator/=(sal_Int64 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ return *this;
+ }
+
+ B2I64Tuple operator-(void) const
+ {
+ return B2I64Tuple(-mnX, -mnY);
+ }
+
+ bool equalZero() const { return mnX == 0 && mnY == 0; }
+
+ bool operator==( const B2I64Tuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY);
+ }
+
+ bool operator!=( const B2I64Tuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B2I64Tuple& operator=( const B2I64Tuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B2I64Tuple minimum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMin;
+ }
+
+ inline B2I64Tuple maximum(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY());
+ return aMax;
+ }
+
+ inline B2I64Tuple absolute(const B2I64Tuple& rTup)
+ {
+ B2I64Tuple aAbs(
+ (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0 > rTup.getY()) ? -rTup.getY() : rTup.getY());
+ return aAbs;
+ }
+
+ inline B2DTuple interpolate(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, double t)
+ {
+ B2DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY());
+ return aInt;
+ }
+
+ inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5);
+ return aAvg;
+ }
+
+ inline B2DTuple average(const B2I64Tuple& rOld1, const B2I64Tuple& rOld2, const B2I64Tuple& rOld3)
+ {
+ B2DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B2I64Tuple operator+(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B2I64Tuple operator-(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B2I64Tuple operator/(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B2I64Tuple operator*(const B2I64Tuple& rTupA, const B2I64Tuple& rTupB)
+ {
+ B2I64Tuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B2I64Tuple operator*(const B2I64Tuple& rTup, sal_Int64 t)
+ {
+ B2I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2I64Tuple operator*(sal_Int64 t, const B2I64Tuple& rTup)
+ {
+ B2I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B2I64Tuple operator/(const B2I64Tuple& rTup, sal_Int64 t)
+ {
+ B2I64Tuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B2I64Tuple operator/(sal_Int64 t, const B2I64Tuple& rTup)
+ {
+ B2I64Tuple aNew(t, t);
+ B2I64Tuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B2I64TUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b2ituple.hxx b/include/basegfx/tuple/b2ituple.hxx
new file mode 100644
index 000000000000..41203a0c58c4
--- /dev/null
+++ b/include/basegfx/tuple/b2ituple.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B2ITUPLE_HXX
+#define _BGFX_TUPLE_B2ITUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with two sal_Int32 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on two sal_Int32 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2ITuple
+ {
+ protected:
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+
+ public:
+ /** Create a 2D Tuple
+
+ The tuple is initialized to (0, 0)
+ */
+ B2ITuple()
+ : mnX(0),
+ mnY(0)
+ {}
+
+ /** Create a 2D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Tuple.
+ */
+ B2ITuple(sal_Int32 fX, sal_Int32 fY)
+ : mnX( fX ),
+ mnY( fY )
+ {}
+
+ /** Create a copy of a 2D Tuple
+
+ @param rTup
+ The 2D Tuple which will be copied.
+ */
+ B2ITuple(const B2ITuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY )
+ {}
+
+ ~B2ITuple()
+ {}
+
+ /// Get X-Coordinate of 2D Tuple
+ sal_Int32 getX() const
+ {
+ return mnX;
+ }
+
+ /// Get Y-Coordinate of 2D Tuple
+ sal_Int32 getY() const
+ {
+ return mnY;
+ }
+
+ /// Set X-Coordinate of 2D Tuple
+ void setX(sal_Int32 fX)
+ {
+ mnX = fX;
+ }
+
+ /// Set Y-Coordinate of 2D Tuple
+ void setY(sal_Int32 fY)
+ {
+ mnY = fY;
+ }
+
+ /// Array-access to 2D Tuple
+ const sal_Int32& operator[] (int nPos) const
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 2D Tuple
+ sal_Int32& operator[] (int nPos)
+ {
+ // Here, normally one if(...) should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; return mnY;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B2ITuple& operator+=( const B2ITuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator-=( const B2ITuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator/=( const B2ITuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator*=( const B2ITuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ return *this;
+ }
+
+ B2ITuple& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ B2ITuple& operator/=(sal_Int32 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ return *this;
+ }
+
+ B2ITuple operator-(void) const
+ {
+ return B2ITuple(-mnX, -mnY);
+ }
+
+ bool equalZero() const { return mnX == 0 && mnY == 0; }
+
+ bool operator==( const B2ITuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY);
+ }
+
+ bool operator!=( const B2ITuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B2ITuple& operator=( const B2ITuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+ class B2DTuple;
+
+ BASEGFX_DLLPUBLIC B2ITuple operator+(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator-(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator/(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator*(const B2ITuple& rTupA, const B2ITuple& rTupB);
+ BASEGFX_DLLPUBLIC B2ITuple operator*(const B2ITuple& rTup, sal_Int32 t);
+ BASEGFX_DLLPUBLIC B2ITuple operator*(sal_Int32 t, const B2ITuple& rTup);
+ BASEGFX_DLLPUBLIC B2ITuple operator/(const B2ITuple& rTup, sal_Int32 t);
+ BASEGFX_DLLPUBLIC B2ITuple operator/(sal_Int32 t, const B2ITuple& rTup);
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B2ITUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3dtuple.hxx b/include/basegfx/tuple/b3dtuple.hxx
new file mode 100644
index 000000000000..1eb4dd38de09
--- /dev/null
+++ b/include/basegfx/tuple/b3dtuple.hxx
@@ -0,0 +1,421 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B3DTUPLE_HXX
+#define _BGFX_TUPLE_B3DTUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclarations
+ class B3ITuple;
+
+ /** Base class for all Points/Vectors with three double values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three double values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3DTuple
+ {
+ protected:
+ double mfX;
+ double mfY;
+ double mfZ;
+
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DTuple()
+ : mfX(0.0),
+ mfY(0.0),
+ mfZ(0.0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3DTuple(double fX, double fY, double fZ)
+ : mfX(fX),
+ mfY(fY),
+ mfZ(fZ)
+ {}
+
+ /** Create a copy of a 3D Tuple
+
+ @param rTup
+ The 3D Tuple which will be copied.
+ */
+ B3DTuple(const B3DTuple& rTup)
+ : mfX( rTup.mfX ),
+ mfY( rTup.mfY ),
+ mfZ( rTup.mfZ )
+ {}
+
+ ~B3DTuple()
+ {}
+
+ /// get X-Coordinate of 3D Tuple
+ double getX() const
+ {
+ return mfX;
+ }
+
+ /// get Y-Coordinate of 3D Tuple
+ double getY() const
+ {
+ return mfY;
+ }
+
+ /// get Z-Coordinate of 3D Tuple
+ double getZ() const
+ {
+ return mfZ;
+ }
+
+ /// set X-Coordinate of 3D Tuple
+ void setX(double fX)
+ {
+ mfX = fX;
+ }
+
+ /// set Y-Coordinate of 3D Tuple
+ void setY(double fY)
+ {
+ mfY = fY;
+ }
+
+ /// set Z-Coordinate of 3D Tuple
+ void setZ(double fZ)
+ {
+ mfZ = fZ;
+ }
+
+ /// Array-access to 3D Tuple
+ const double& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ;
+ return *((&mfX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ double& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both double members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mfX; if(1 == nPos) return mfY; return mfZ;
+ return *((&mfX) + nPos);
+ }
+
+ // comparators with tolerance
+ //////////////////////////////////////////////////////////////////////
+
+ bool equalZero() const
+ {
+ return (this == &getEmptyTuple() ||
+ (::basegfx::fTools::equalZero(mfX)
+ && ::basegfx::fTools::equalZero(mfY)
+ && ::basegfx::fTools::equalZero(mfZ)));
+ }
+
+ bool equalZero(const double& rfSmallValue) const
+ {
+ return (this == &getEmptyTuple() ||
+ (::basegfx::fTools::equalZero(mfX, rfSmallValue)
+ && ::basegfx::fTools::equalZero(mfY, rfSmallValue)
+ && ::basegfx::fTools::equalZero(mfZ, rfSmallValue)));
+ }
+
+ bool equal(const B3DTuple& rTup) const
+ {
+ return (
+ this == &rTup ||
+ (::basegfx::fTools::equal(mfX, rTup.mfX) &&
+ ::basegfx::fTools::equal(mfY, rTup.mfY) &&
+ ::basegfx::fTools::equal(mfZ, rTup.mfZ)));
+ }
+
+ bool equal(const B3DTuple& rTup, const double& rfSmallValue) const
+ {
+ return (
+ this == &rTup ||
+ (::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) &&
+ ::basegfx::fTools::equal(mfY, rTup.mfY, rfSmallValue) &&
+ ::basegfx::fTools::equal(mfZ, rTup.mfZ, rfSmallValue)));
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B3DTuple& operator+=( const B3DTuple& rTup )
+ {
+ mfX += rTup.mfX;
+ mfY += rTup.mfY;
+ mfZ += rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator-=( const B3DTuple& rTup )
+ {
+ mfX -= rTup.mfX;
+ mfY -= rTup.mfY;
+ mfZ -= rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator/=( const B3DTuple& rTup )
+ {
+ mfX /= rTup.mfX;
+ mfY /= rTup.mfY;
+ mfZ /= rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator*=( const B3DTuple& rTup )
+ {
+ mfX *= rTup.mfX;
+ mfY *= rTup.mfY;
+ mfZ *= rTup.mfZ;
+ return *this;
+ }
+
+ B3DTuple& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ B3DTuple& operator/=(double t)
+ {
+ const double fVal(1.0 / t);
+ mfX *= fVal;
+ mfY *= fVal;
+ mfZ *= fVal;
+ return *this;
+ }
+
+ B3DTuple operator-(void) const
+ {
+ return B3DTuple(-mfX, -mfY, -mfZ);
+ }
+
+ bool operator==( const B3DTuple& rTup ) const
+ {
+ return equal(rTup);
+ }
+
+ bool operator!=( const B3DTuple& rTup ) const
+ {
+ return !equal(rTup);
+ }
+
+ B3DTuple& operator=( const B3DTuple& rTup )
+ {
+ mfX = rTup.mfX;
+ mfY = rTup.mfY;
+ mfZ = rTup.mfZ;
+ return *this;
+ }
+
+ void correctValues(const double fCompareValue = 0.0)
+ {
+ if(0.0 == fCompareValue)
+ {
+ if(::basegfx::fTools::equalZero(mfX))
+ {
+ mfX = 0.0;
+ }
+
+ if(::basegfx::fTools::equalZero(mfY))
+ {
+ mfY = 0.0;
+ }
+
+ if(::basegfx::fTools::equalZero(mfZ))
+ {
+ mfZ = 0.0;
+ }
+ }
+ else
+ {
+ if(::basegfx::fTools::equal(mfX, fCompareValue))
+ {
+ mfX = fCompareValue;
+ }
+
+ if(::basegfx::fTools::equal(mfY, fCompareValue))
+ {
+ mfY = fCompareValue;
+ }
+
+ if(::basegfx::fTools::equal(mfZ, fCompareValue))
+ {
+ mfZ = fCompareValue;
+ }
+ }
+ }
+
+ static const B3DTuple& getEmptyTuple();
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B3DTuple minimum(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMin;
+ }
+
+ inline B3DTuple maximum(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMax;
+ }
+
+ inline B3DTuple absolute(const B3DTuple& rTup)
+ {
+ B3DTuple aAbs(
+ (0.0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0.0 > rTup.getY()) ? -rTup.getY() : rTup.getY(),
+ (0.0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ());
+ return aAbs;
+ }
+
+ inline B3DTuple interpolate(const B3DTuple& rOld1, const B3DTuple& rOld2, double t)
+ {
+ B3DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ return aInt;
+ }
+
+ inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5,
+ (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ return aAvg;
+ }
+
+ inline B3DTuple average(const B3DTuple& rOld1, const B3DTuple& rOld2, const B3DTuple& rOld3)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+ (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B3DTuple operator+(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3DTuple operator-(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3DTuple operator/(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B3DTuple operator*(const B3DTuple& rTupA, const B3DTuple& rTupB)
+ {
+ B3DTuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3DTuple operator*(const B3DTuple& rTup, double t)
+ {
+ B3DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator*(double t, const B3DTuple& rTup)
+ {
+ B3DTuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator/(const B3DTuple& rTup, double t)
+ {
+ B3DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B3DTuple operator/(double t, const B3DTuple& rTup)
+ {
+ B3DTuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ /** Round double to nearest integer for 3D tuple
+
+ @return the nearest integer for this tuple
+ */
+ BASEGFX_DLLPUBLIC B3ITuple fround(const B3DTuple& rTup);
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B3DTUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3i64tuple.hxx b/include/basegfx/tuple/b3i64tuple.hxx
new file mode 100644
index 000000000000..bcc1acaee6b1
--- /dev/null
+++ b/include/basegfx/tuple/b3i64tuple.hxx
@@ -0,0 +1,336 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B3I64TUPLE_HXX
+#define _BGFX_TUPLE_B3I64TUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with three sal_Int64 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three sal_Int64 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3I64Tuple
+ {
+ protected:
+ sal_Int64 mnX;
+ sal_Int64 mnY;
+ sal_Int64 mnZ;
+
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0, 0, 0)
+ */
+ B3I64Tuple()
+ : mnX(0),
+ mnY(0),
+ mnZ(0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3I64Tuple(sal_Int64 nX, sal_Int64 nY, sal_Int64 nZ)
+ : mnX(nX),
+ mnY(nY),
+ mnZ(nZ)
+ {}
+
+ /** Create a copy of a 3D Tuple
+
+ @param rTup
+ The 3D Tuple which will be copied.
+ */
+ B3I64Tuple(const B3I64Tuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY ),
+ mnZ( rTup.mnZ )
+ {}
+
+ ~B3I64Tuple()
+ {}
+
+ /// get X-Coordinate of 3D Tuple
+ sal_Int64 getX() const
+ {
+ return mnX;
+ }
+
+ /// get Y-Coordinate of 3D Tuple
+ sal_Int64 getY() const
+ {
+ return mnY;
+ }
+
+ /// get Z-Coordinate of 3D Tuple
+ sal_Int64 getZ() const
+ {
+ return mnZ;
+ }
+
+ /// set X-Coordinate of 3D Tuple
+ void setX(sal_Int64 nX)
+ {
+ mnX = nX;
+ }
+
+ /// set Y-Coordinate of 3D Tuple
+ void setY(sal_Int64 nY)
+ {
+ mnY = nY;
+ }
+
+ /// set Z-Coordinate of 3D Tuple
+ void setZ(sal_Int64 nZ)
+ {
+ mnZ = nZ;
+ }
+
+ /// Array-access to 3D Tuple
+ const sal_Int64& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ sal_Int64& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int64 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B3I64Tuple& operator+=( const B3I64Tuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ mnZ += rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator-=( const B3I64Tuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ mnZ -= rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator/=( const B3I64Tuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ mnZ /= rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator*=( const B3I64Tuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ mnZ *= rTup.mnZ;
+ return *this;
+ }
+
+ B3I64Tuple& operator*=(sal_Int64 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ B3I64Tuple& operator/=(sal_Int64 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ mnZ /= t;
+ return *this;
+ }
+
+ B3I64Tuple operator-(void) const
+ {
+ return B3I64Tuple(-mnX, -mnY, -mnZ);
+ }
+
+ bool operator==( const B3I64Tuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ);
+ }
+
+ bool operator!=( const B3I64Tuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B3I64Tuple& operator=( const B3I64Tuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ mnZ = rTup.mnZ;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B3I64Tuple minimum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMin;
+ }
+
+ inline B3I64Tuple maximum(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMax;
+ }
+
+ inline B3I64Tuple absolute(const B3I64Tuple& rTup)
+ {
+ B3I64Tuple aAbs(
+ (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(),
+ (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ());
+ return aAbs;
+ }
+
+ inline B3DTuple interpolate(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, double t)
+ {
+ B3DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ return aInt;
+ }
+
+ inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5,
+ (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ return aAvg;
+ }
+
+ inline B3DTuple average(const B3I64Tuple& rOld1, const B3I64Tuple& rOld2, const B3I64Tuple& rOld3)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+ (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B3I64Tuple operator+(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3I64Tuple operator-(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3I64Tuple operator/(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B3I64Tuple operator*(const B3I64Tuple& rTupA, const B3I64Tuple& rTupB)
+ {
+ B3I64Tuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3I64Tuple operator*(const B3I64Tuple& rTup, sal_Int64 t)
+ {
+ B3I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3I64Tuple operator*(sal_Int64 t, const B3I64Tuple& rTup)
+ {
+ B3I64Tuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3I64Tuple operator/(const B3I64Tuple& rTup, sal_Int64 t)
+ {
+ B3I64Tuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B3I64Tuple operator/(sal_Int64 t, const B3I64Tuple& rTup)
+ {
+ B3I64Tuple aNew(t, t, t);
+ B3I64Tuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B3I64TUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/tuple/b3ituple.hxx b/include/basegfx/tuple/b3ituple.hxx
new file mode 100644
index 000000000000..49fb24634ed4
--- /dev/null
+++ b/include/basegfx/tuple/b3ituple.hxx
@@ -0,0 +1,335 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_TUPLE_B3ITUPLE_HXX
+#define _BGFX_TUPLE_B3ITUPLE_HXX
+
+#include <sal/types.h>
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ /** Base class for all Points/Vectors with three sal_Int32 values
+
+ This class provides all methods common to Point
+ avd Vector classes which are derived from here.
+
+ @derive Use this class to implement Points or Vectors
+ which are based on three sal_Int32 values
+ */
+ class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B3ITuple
+ {
+ protected:
+ sal_Int32 mnX;
+ sal_Int32 mnY;
+ sal_Int32 mnZ;
+
+ public:
+ /** Create a 3D Tuple
+
+ The tuple is initialized to (0, 0, 0)
+ */
+ B3ITuple()
+ : mnX(0),
+ mnY(0),
+ mnZ(0)
+ {}
+
+ /** Create a 3D Tuple
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Tuple.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Tuple.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Tuple.
+ */
+ B3ITuple(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : mnX(nX),
+ mnY(nY),
+ mnZ(nZ)
+ {}
+
+ /** Create a copy of a 3D Tuple
+
+ @param rTup
+ The 3D Tuple which will be copied.
+ */
+ B3ITuple(const B3ITuple& rTup)
+ : mnX( rTup.mnX ),
+ mnY( rTup.mnY ),
+ mnZ( rTup.mnZ )
+ {}
+
+ ~B3ITuple()
+ {}
+
+ /// get X-Coordinate of 3D Tuple
+ sal_Int32 getX() const
+ {
+ return mnX;
+ }
+
+ /// get Y-Coordinate of 3D Tuple
+ sal_Int32 getY() const
+ {
+ return mnY;
+ }
+
+ /// get Z-Coordinate of 3D Tuple
+ sal_Int32 getZ() const
+ {
+ return mnZ;
+ }
+
+ /// set X-Coordinate of 3D Tuple
+ void setX(sal_Int32 nX)
+ {
+ mnX = nX;
+ }
+
+ /// set Y-Coordinate of 3D Tuple
+ void setY(sal_Int32 nY)
+ {
+ mnY = nY;
+ }
+
+ /// set Z-Coordinate of 3D Tuple
+ void setZ(sal_Int32 nZ)
+ {
+ mnZ = nZ;
+ }
+
+ /// Array-access to 3D Tuple
+ const sal_Int32& operator[] (int nPos) const
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ /// Array-access to 3D Tuple
+ sal_Int32& operator[] (int nPos)
+ {
+ // Here, normally two if(...)'s should be used. In the assumption that
+ // both sal_Int32 members can be accessed as an array a shortcut is used here.
+ // if(0 == nPos) return mnX; if(1 == nPos) return mnY; return mnZ;
+ return *((&mnX) + nPos);
+ }
+
+ // operators
+ //////////////////////////////////////////////////////////////////////
+
+ B3ITuple& operator+=( const B3ITuple& rTup )
+ {
+ mnX += rTup.mnX;
+ mnY += rTup.mnY;
+ mnZ += rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator-=( const B3ITuple& rTup )
+ {
+ mnX -= rTup.mnX;
+ mnY -= rTup.mnY;
+ mnZ -= rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator/=( const B3ITuple& rTup )
+ {
+ mnX /= rTup.mnX;
+ mnY /= rTup.mnY;
+ mnZ /= rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator*=( const B3ITuple& rTup )
+ {
+ mnX *= rTup.mnX;
+ mnY *= rTup.mnY;
+ mnZ *= rTup.mnZ;
+ return *this;
+ }
+
+ B3ITuple& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ B3ITuple& operator/=(sal_Int32 t)
+ {
+ mnX /= t;
+ mnY /= t;
+ mnZ /= t;
+ return *this;
+ }
+
+ B3ITuple operator-(void) const
+ {
+ return B3ITuple(-mnX, -mnY, -mnZ);
+ }
+
+ bool operator==( const B3ITuple& rTup ) const
+ {
+ return this == &rTup || (rTup.mnX == mnX && rTup.mnY == mnY && rTup.mnZ == mnZ);
+ }
+
+ bool operator!=( const B3ITuple& rTup ) const
+ {
+ return !(*this == rTup);
+ }
+
+ B3ITuple& operator=( const B3ITuple& rTup )
+ {
+ mnX = rTup.mnX;
+ mnY = rTup.mnY;
+ mnZ = rTup.mnZ;
+ return *this;
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ inline B3ITuple minimum(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aMin(
+ (rTupB.getX() < rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() < rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() < rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMin;
+ }
+
+ inline B3ITuple maximum(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aMax(
+ (rTupB.getX() > rTupA.getX()) ? rTupB.getX() : rTupA.getX(),
+ (rTupB.getY() > rTupA.getY()) ? rTupB.getY() : rTupA.getY(),
+ (rTupB.getZ() > rTupA.getZ()) ? rTupB.getZ() : rTupA.getZ());
+ return aMax;
+ }
+
+ inline B3ITuple absolute(const B3ITuple& rTup)
+ {
+ B3ITuple aAbs(
+ (0 > rTup.getX()) ? -rTup.getX() : rTup.getX(),
+ (0 > rTup.getY()) ? -rTup.getY() : rTup.getY(),
+ (0 > rTup.getZ()) ? -rTup.getZ() : rTup.getZ());
+ return aAbs;
+ }
+
+ inline B3DTuple interpolate(const B3ITuple& rOld1, const B3ITuple& rOld2, double t)
+ {
+ B3DTuple aInt(
+ ((rOld2.getX() - rOld1.getX()) * t) + rOld1.getX(),
+ ((rOld2.getY() - rOld1.getY()) * t) + rOld1.getY(),
+ ((rOld2.getZ() - rOld1.getZ()) * t) + rOld1.getZ());
+ return aInt;
+ }
+
+ inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX()) * 0.5,
+ (rOld1.getY() + rOld2.getY()) * 0.5,
+ (rOld1.getZ() + rOld2.getZ()) * 0.5);
+ return aAvg;
+ }
+
+ inline B3DTuple average(const B3ITuple& rOld1, const B3ITuple& rOld2, const B3ITuple& rOld3)
+ {
+ B3DTuple aAvg(
+ (rOld1.getX() + rOld2.getX() + rOld3.getX()) * (1.0 / 3.0),
+ (rOld1.getY() + rOld2.getY() + rOld3.getY()) * (1.0 / 3.0),
+ (rOld1.getZ() + rOld2.getZ() + rOld3.getZ()) * (1.0 / 3.0));
+ return aAvg;
+ }
+
+ inline B3ITuple operator+(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aSum(rTupA);
+ aSum += rTupB;
+ return aSum;
+ }
+
+ inline B3ITuple operator-(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aSub(rTupA);
+ aSub -= rTupB;
+ return aSub;
+ }
+
+ inline B3ITuple operator/(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aDiv(rTupA);
+ aDiv /= rTupB;
+ return aDiv;
+ }
+
+ inline B3ITuple operator*(const B3ITuple& rTupA, const B3ITuple& rTupB)
+ {
+ B3ITuple aMul(rTupA);
+ aMul *= rTupB;
+ return aMul;
+ }
+
+ inline B3ITuple operator*(const B3ITuple& rTup, sal_Int32 t)
+ {
+ B3ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3ITuple operator*(sal_Int32 t, const B3ITuple& rTup)
+ {
+ B3ITuple aNew(rTup);
+ aNew *= t;
+ return aNew;
+ }
+
+ inline B3ITuple operator/(const B3ITuple& rTup, sal_Int32 t)
+ {
+ B3ITuple aNew(rTup);
+ aNew /= t;
+ return aNew;
+ }
+
+ inline B3ITuple operator/(sal_Int32 t, const B3ITuple& rTup)
+ {
+ B3ITuple aNew(t, t, t);
+ B3ITuple aTmp(rTup);
+ aNew /= aTmp;
+ return aNew;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_TUPLE_B3ITUPLE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2dsize.hxx b/include/basegfx/vector/b2dsize.hxx
new file mode 100644
index 000000000000..bde343b46685
--- /dev/null
+++ b/include/basegfx/vector/b2dsize.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2DSIZE_HXX
+#define _BGFX_VECTOR_B2DSIZE_HXX
+
+#include <basegfx/vector/b2dvector.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2DVector exactly models a Size object,
+ // thus, for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2DVector B2DSize;
+}
+
+#endif /* _BGFX_VECTOR_B2DSIZE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2dvector.hxx b/include/basegfx/vector/b2dvector.hxx
new file mode 100644
index 000000000000..99489eb7169c
--- /dev/null
+++ b/include/basegfx/vector/b2dvector.hxx
@@ -0,0 +1,254 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2DVECTOR_HXX
+#define _BGFX_VECTOR_B2DVECTOR_HXX
+
+#include <basegfx/tuple/b2dtuple.hxx>
+#include <basegfx/vector/b2ivector.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two double values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2DTuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2DTuple
+ */
+ class BASEGFX_DLLPUBLIC B2DVector : public ::basegfx::B2DTuple
+ {
+ public:
+ /** Create a 2D Vector
+
+ The vector is initialized to (0.0, 0.0)
+ */
+ B2DVector()
+ : B2DTuple()
+ {}
+
+ /** Create a 2D Vector
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
+ */
+ B2DVector(double fX, double fY)
+ : B2DTuple(fX, fY)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ B2DVector(const B2DVector& rVec)
+ : B2DTuple(rVec)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ explicit B2DVector(const ::basegfx::B2IVector& rVec)
+ : B2DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2DTuple-based classes
+ */
+ B2DVector(const ::basegfx::B2DTuple& rTuple)
+ : B2DTuple(rTuple)
+ {}
+
+ ~B2DVector()
+ {}
+
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=( const B2DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2DVector, too
+ */
+ B2DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2DTuple calculations
+ */
+ B2DVector& operator=( const ::basegfx::B2DTuple& rVec );
+
+ /** Calculate the length of this 2D Vector
+
+ @return The Length of the 2D Vector
+ */
+ double getLength() const;
+
+ /** Set the length of this 2D Vector
+
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2DVector& setLength(double fLen);
+
+ /** Normalize this 2D Vector
+
+ The length of the 2D Vector is set to 1.0
+ */
+ B2DVector& normalize();
+
+ /** Calculate the Scalar with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Scalar value of the two involved 2D Vectors
+ */
+ double scalar( const B2DVector& rVec ) const;
+
+ /** Calculate the length of the cross product with another 2D Vector
+
+ In 2D, returning an actual vector does not make much
+ sense here. The magnitude, although, can be readily
+ used for tasks such as angle calculations, since for
+ the returned value, the following equation holds:
+ retVal = getLength(this)*getLength(rVec)*sin(theta),
+ with theta being the angle between the two vectors.
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The length of the cross product of the two involved 2D Vectors
+ */
+ double cross( const B2DVector& rVec ) const;
+
+ /** Calculate the Angle with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Angle value of the two involved 2D Vectors in -pi/2 < return < pi/2
+ */
+ double angle( const B2DVector& rVec ) const;
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2DVector& operator*=( const B2DHomMatrix& rMat );
+
+ static const B2DVector& getEmptyVector();
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Calculate the orientation to another 2D Vector
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ The mathematical Orientation of the two involved 2D Vectors
+ */
+ BASEGFX_DLLPUBLIC B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Calculate a perpendicular 2D Vector to the given one
+
+ @param rVec
+ The source 2D Vector
+
+ @attention This only works if the given 2D Vector is normalized.
+
+ @return
+ A 2D Vector perpendicular to the one given in parameter rVec
+ */
+ BASEGFX_DLLPUBLIC B2DVector getPerpendicular( const B2DVector& rNormalizedVec );
+
+ /** Calculate a perpendicular 2D Vector to the given one,
+ normalize the given one as preparation
+
+ @param rVec
+ The source 2D Vector
+
+ @return
+ A normalized 2D Vector perpendicular to the one given in parameter rVec
+ */
+ BASEGFX_DLLPUBLIC B2DVector getNormalizedPerpendicular( const B2DVector& rVec );
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 2D Vector
+
+ @param rVecB
+ The second 2D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ BASEGFX_DLLPUBLIC bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec );
+
+ /** Test continuity between given vectors.
+
+ The two given vectors are assumed to describe control points on a
+ common point. Calculate if there is a continuity between them.
+ */
+ BASEGFX_DLLPUBLIC B2VectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B2DVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2enums.hxx b/include/basegfx/vector/b2enums.hxx
new file mode 100644
index 000000000000..abbf4cfaf546
--- /dev/null
+++ b/include/basegfx/vector/b2enums.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2ENUMS_HXX
+#define _BGFX_VECTOR_B2ENUMS_HXX
+
+#include <sal/types.h>
+
+namespace basegfx
+{
+ /** Descriptor for the mathematical orientations of two 2D Vectors
+ */
+ enum B2VectorOrientation
+ {
+ /// mathematically positive oriented
+ ORIENTATION_POSITIVE = 0,
+
+ /// mathematically negative oriented
+ ORIENTATION_NEGATIVE,
+
+ /// mathematically neutral, thus parallel
+ ORIENTATION_NEUTRAL
+ };
+
+ /** Descriptor for the mathematical continuity of two 2D Vectors
+ */
+ enum B2VectorContinuity
+ {
+ /// none
+ CONTINUITY_NONE = 0,
+
+ /// mathematically negative oriented
+ CONTINUITY_C1,
+
+ /// mathematically neutral, thus parallel
+ CONTINUITY_C2
+ };
+
+ /** Descriptor for possible line joins between two line segments
+ */
+ enum B2DLineJoin
+ {
+ B2DLINEJOIN_NONE, // no rounding
+ B2DLINEJOIN_MIDDLE, // calc middle value between joints
+ B2DLINEJOIN_BEVEL, // join edges with line
+ B2DLINEJOIN_MITER, // extend till cut
+ B2DLINEJOIN_ROUND // create arc
+ };
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B2ENUMS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2isize.hxx b/include/basegfx/vector/b2isize.hxx
new file mode 100644
index 000000000000..4a2fe2228661
--- /dev/null
+++ b/include/basegfx/vector/b2isize.hxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2ISIZE_HXX
+#define _BGFX_VECTOR_B2ISIZE_HXX
+
+#include <basegfx/vector/b2ivector.hxx>
+
+namespace basegfx
+{
+ // syntactic sugar: a B2IVector exactly models a Size object,
+ // thus, for interface clarity, we provide an alias name
+
+ /// Alias name for interface clarity (not everybody is aware of the identity)
+ typedef B2IVector B2ISize;
+}
+
+#endif /* _BGFX_VECTOR_B2ISIZE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b2ivector.hxx b/include/basegfx/vector/b2ivector.hxx
new file mode 100644
index 000000000000..63ce2ae28fba
--- /dev/null
+++ b/include/basegfx/vector/b2ivector.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B2IVECTOR_HXX
+#define _BGFX_VECTOR_B2IVECTOR_HXX
+
+#include <basegfx/tuple/b2ituple.hxx>
+#include <basegfx/vector/b2enums.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B2DHomMatrix;
+
+ /** Base Point class with two sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 2D data class from B2ITuple. All necessary extensions
+ which are special for 2D Vectors are added here.
+
+ @see B2ITuple
+ */
+ class BASEGFX_DLLPUBLIC B2IVector : public ::basegfx::B2ITuple
+ {
+ public:
+ /** Create a 2D Vector
+
+ The vector is initialized to (0, 0)
+ */
+ B2IVector()
+ : B2ITuple()
+ {}
+
+ /** Create a 2D Vector
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 2D Vector.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 2D Vector.
+ */
+ B2IVector(sal_Int32 nX, sal_Int32 nY)
+ : B2ITuple(nX, nY)
+ {}
+
+ /** Create a copy of a 2D Vector
+
+ @param rVec
+ The 2D Vector which will be copied.
+ */
+ B2IVector(const B2IVector& rVec)
+ : B2ITuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B2ITuple-based classes
+ */
+ B2IVector(const ::basegfx::B2ITuple& rTuple)
+ : B2ITuple(rTuple)
+ {}
+
+ ~B2IVector()
+ {}
+
+ /** *=operator to allow usage from B2IVector, too
+ */
+ B2IVector& operator*=( const B2IVector& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B2IVector, too
+ */
+ B2IVector& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B2ITuple calculations
+ */
+ B2IVector& operator=( const ::basegfx::B2ITuple& rVec );
+
+ /** Set the length of this 2D Vector
+
+ @param fLen
+ The to be achieved length of the 2D Vector
+ */
+ B2IVector& setLength(double fLen);
+
+ /** Calculate the Scalar with another 2D Vector
+
+ @param rVec
+ The second 2D Vector
+
+ @return
+ The Scalar value of the two involved 2D Vectors
+ */
+ double scalar( const B2IVector& rVec ) const;
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B2IVector& operator*=( const B2DHomMatrix& rMat );
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec );
+
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B2IVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b3dvector.hxx b/include/basegfx/vector/b3dvector.hxx
new file mode 100644
index 000000000000..99f23bc7b6d3
--- /dev/null
+++ b/include/basegfx/vector/b3dvector.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B3DVECTOR_HXX
+#define _BGFX_VECTOR_B3DVECTOR_HXX
+
+#include <basegfx/tuple/b3dtuple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three double values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3DTuple. All necessary extensions
+ which are special for 3D Vectors are added here.
+
+ @see B3DTuple
+ */
+ class BASEGFX_DLLPUBLIC B3DVector : public ::basegfx::B3DTuple
+ {
+ public:
+ /** Create a 3D Vector
+
+ The vector is initialized to (0.0, 0.0, 0.0)
+ */
+ B3DVector()
+ : B3DTuple()
+ {}
+
+ /** Create a 3D Vector
+
+ @param fX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Vector.
+
+ @param fY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Vector.
+
+ @param fZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Vector.
+ */
+ B3DVector(double fX, double fY, double fZ)
+ : B3DTuple(fX, fY, fZ)
+ {}
+
+ /** Create a copy of a 3D Vector
+
+ @param rVec
+ The 3D Vector which will be copied.
+ */
+ B3DVector(const B3DVector& rVec)
+ : B3DTuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3DTuple-based classes
+ */
+ B3DVector(const ::basegfx::B3DTuple& rTuple)
+ : B3DTuple(rTuple)
+ {}
+
+ ~B3DVector()
+ {}
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=( const B3DVector& rPnt )
+ {
+ mfX *= rPnt.mfX;
+ mfY *= rPnt.mfY;
+ mfZ *= rPnt.mfZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3DVector, too
+ */
+ B3DVector& operator*=(double t)
+ {
+ mfX *= t;
+ mfY *= t;
+ mfZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3DTuple calculations
+ */
+ B3DVector& operator=( const ::basegfx::B3DTuple& rVec )
+ {
+ mfX = rVec.getX();
+ mfY = rVec.getY();
+ mfZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Calculate the length of this 3D Vector
+
+ @return The Length of the 3D Vector
+ */
+ double getLength(void) const
+ {
+ double fLen(scalar(*this));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XY-Plane for this 3D Vector
+
+ @return The XY-Plane Length of the 3D Vector
+ */
+ double getXYLength(void) const
+ {
+ double fLen((mfX * mfX) + (mfY * mfY));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XZ-Plane for this 3D Vector
+
+ @return The XZ-Plane Length of the 3D Vector
+ */
+ double getXZLength(void) const
+ {
+ double fLen((mfX * mfX) + (mfZ * mfZ)); // #i73040#
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the YZ-Plane for this 3D Vector
+
+ @return The YZ-Plane Length of the 3D Vector
+ */
+ double getYZLength(void) const
+ {
+ double fLen((mfY * mfY) + (mfZ * mfZ));
+ if((0.0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Set the length of this 3D Vector
+
+ @param fLen
+ The to be achieved length of the 3D Vector
+ */
+ B3DVector& setLength(double fLen)
+ {
+ double fLenNow(scalar(*this));
+
+ if(!::basegfx::fTools::equalZero(fLenNow))
+ {
+ const double fOne(1.0);
+
+ if(!::basegfx::fTools::equal(fOne, fLenNow))
+ {
+ fLen /= sqrt(fLenNow);
+ }
+
+ mfX *= fLen;
+ mfY *= fLen;
+ mfZ *= fLen;
+ }
+
+ return *this;
+ }
+
+ /** Normalize this 3D Vector
+
+ The length of the 3D Vector is set to 1.0
+ */
+ B3DVector& normalize();
+
+ /** Test if this 3D Vector is normalized
+
+ @return
+ true if lenth of vector is equal to 1.0
+ false else
+ */
+ bool isNormalized() const
+ {
+ const double fOne(1.0);
+ const double fScalar(scalar(*this));
+
+ return (::basegfx::fTools::equal(fOne, fScalar));
+ }
+
+ /** get a 3D Vector which is perpendicular to this and a given 3D Vector
+
+ @attention This only works if this and the given 3D Vector are
+ both normalized.
+
+ @param rNormalizedVec
+ A normalized 3D Vector.
+
+ @return
+ A 3D Vector perpendicular to this and the given one
+ */
+ B3DVector getPerpendicular(const B3DVector& rNormalizedVec) const;
+
+ /** Calculate the Scalar product
+
+ This method calculates the Scalar product between this
+ and the given 3D Vector.
+
+ @param rVec
+ A second 3D Vector.
+
+ @return
+ The Scalar Product of two 3D Vectors
+ */
+ double scalar(const B3DVector& rVec) const
+ {
+ return ((mfX * rVec.mfX) + (mfY * rVec.mfY) + (mfZ * rVec.mfZ));
+ }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B3DVector& operator*=( const B3DHomMatrix& rMat );
+
+ static const B3DVector& getEmptyVector()
+ {
+ return (const B3DVector&) ::basegfx::B3DTuple::getEmptyTuple();
+ }
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** get a 3D Vector which is in 2D (ignoring
+ the Z-Coordinate) perpendicular to a given 3D Vector
+
+ @attention This only works if the given 3D Vector is normalized.
+
+ @param rNormalizedVec
+ A normalized 3D Vector.
+
+ @return
+ A 3D Vector perpendicular to the given one in X,Y (2D).
+ */
+ inline B3DVector getPerpendicular2D( const B3DVector& rNormalizedVec )
+ {
+ B3DVector aPerpendicular(-rNormalizedVec.getY(), rNormalizedVec.getX(), rNormalizedVec.getZ());
+ return aPerpendicular;
+ }
+
+ /** Test two vectors which need not to be normalized for parallelism
+
+ @param rVecA
+ The first 3D Vector
+
+ @param rVecB
+ The second 3D Vector
+
+ @return
+ bool if the two values are parallel. Also true if
+ one of the vectors is empty.
+ */
+ BASEGFX_DLLPUBLIC bool areParallel( const B3DVector& rVecA, const B3DVector& rVecB );
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B3DVector operator*( const B3DHomMatrix& rMat, const B3DVector& rVec );
+
+ /** Calculate the Cross Product of two 3D Vectors
+
+ @param rVecA
+ A first 3D Vector.
+
+ @param rVecB
+ A second 3D Vector.
+
+ @return
+ The Cross Product of both 3D Vectors
+ */
+ inline B3DVector cross(const B3DVector& rVecA, const B3DVector& rVecB)
+ {
+ B3DVector aVec(
+ rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
+ rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
+ rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
+ return aVec;
+ }
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif /* _BGFX_VECTOR_B3DVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basegfx/vector/b3ivector.hxx b/include/basegfx/vector/b3ivector.hxx
new file mode 100644
index 000000000000..8248ade15cb0
--- /dev/null
+++ b/include/basegfx/vector/b3ivector.hxx
@@ -0,0 +1,249 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BGFX_VECTOR_B3IVECTOR_HXX
+#define _BGFX_VECTOR_B3IVECTOR_HXX
+
+#include <basegfx/tuple/b3ituple.hxx>
+#include <basegfx/basegfxdllapi.h>
+
+namespace basegfx
+{
+ // predeclaration
+ class B3DHomMatrix;
+
+ /** Base Point class with three sal_Int32 values
+
+ This class derives all operators and common handling for
+ a 3D data class from B3ITuple. All necessary extensions
+ which are special for 3D Vectors are added here.
+
+ @see B3ITuple
+ */
+ class BASEGFX_DLLPUBLIC B3IVector : public ::basegfx::B3ITuple
+ {
+ public:
+ /** Create a 3D Vector
+
+ The vector is initialized to (0, 0, 0)
+ */
+ B3IVector()
+ : B3ITuple()
+ {}
+
+ /** Create a 3D Vector
+
+ @param nX
+ This parameter is used to initialize the X-coordinate
+ of the 3D Vector.
+
+ @param nY
+ This parameter is used to initialize the Y-coordinate
+ of the 3D Vector.
+
+ @param nZ
+ This parameter is used to initialize the Z-coordinate
+ of the 3D Vector.
+ */
+ B3IVector(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ)
+ : B3ITuple(nX, nY, nZ)
+ {}
+
+ /** Create a copy of a 3D Vector
+
+ @param rVec
+ The 3D Vector which will be copied.
+ */
+ B3IVector(const B3IVector& rVec)
+ : B3ITuple(rVec)
+ {}
+
+ /** constructor with tuple to allow copy-constructing
+ from B3ITuple-based classes
+ */
+ B3IVector(const ::basegfx::B3ITuple& rTuple)
+ : B3ITuple(rTuple)
+ {}
+
+ ~B3IVector()
+ {}
+
+ /** *=operator to allow usage from B3IVector, too
+ */
+ B3IVector& operator*=( const B3IVector& rPnt )
+ {
+ mnX *= rPnt.mnX;
+ mnY *= rPnt.mnY;
+ mnZ *= rPnt.mnZ;
+ return *this;
+ }
+
+ /** *=operator to allow usage from B3IVector, too
+ */
+ B3IVector& operator*=(sal_Int32 t)
+ {
+ mnX *= t;
+ mnY *= t;
+ mnZ *= t;
+ return *this;
+ }
+
+ /** assignment operator to allow assigning the results
+ of B3ITuple calculations
+ */
+ B3IVector& operator=( const ::basegfx::B3ITuple& rVec )
+ {
+ mnX = rVec.getX();
+ mnY = rVec.getY();
+ mnZ = rVec.getZ();
+ return *this;
+ }
+
+ /** Calculate the length of this 3D Vector
+
+ @return The Length of the 3D Vector
+ */
+ double getLength(void) const
+ {
+ double fLen(scalar(*this));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XY-Plane for this 3D Vector
+
+ @return The XY-Plane Length of the 3D Vector
+ */
+ double getXYLength(void) const
+ {
+ double fLen((mnX * mnX) + (mnY * mnY));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the XZ-Plane for this 3D Vector
+
+ @return The XZ-Plane Length of the 3D Vector
+ */
+ double getXZLength(void) const
+ {
+ double fLen((mnX * mnZ) + (mnY * mnZ));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Calculate the length in the YZ-Plane for this 3D Vector
+
+ @return The YZ-Plane Length of the 3D Vector
+ */
+ double getYZLength(void) const
+ {
+ double fLen((mnY * mnY) + (mnZ * mnZ));
+ if((0 == fLen) || (1.0 == fLen))
+ return fLen;
+ return sqrt(fLen);
+ }
+
+ /** Set the length of this 3D Vector
+
+ @param fLen
+ The to be achieved length of the 3D Vector
+ */
+ B3IVector& setLength(double fLen)
+ {
+ double fLenNow(scalar(*this));
+
+ if(!::basegfx::fTools::equalZero(fLenNow))
+ {
+ const double fOne(1.0);
+
+ if(!::basegfx::fTools::equal(fOne, fLenNow))
+ {
+ fLen /= sqrt(fLenNow);
+ }
+
+ mnX = fround(mnX*fLen);
+ mnY = fround(mnY*fLen);
+ mnZ = fround(mnZ*fLen);
+ }
+
+ return *this;
+ }
+
+ /** Calculate the Scalar product
+
+ This method calculates the Scalar product between this
+ and the given 3D Vector.
+
+ @param rVec
+ A second 3D Vector.
+
+ @return
+ The Scalar Product of two 3D Vectors
+ */
+ double scalar(const B3IVector& rVec) const
+ {
+ return ((mnX * rVec.mnX) + (mnY * rVec.mnY) + (mnZ * rVec.mnZ));
+ }
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ B3IVector& operator*=( const B3DHomMatrix& rMat );
+ };
+
+ // external operators
+ //////////////////////////////////////////////////////////////////////////
+
+ /** Transform vector by given transformation matrix.
+
+ Since this is a vector, translational components of the
+ matrix are disregarded.
+ */
+ BASEGFX_DLLPUBLIC B3IVector operator*( const B3DHomMatrix& rMat, const B3IVector& rVec );
+
+ /** Calculate the Cross Product of two 3D Vectors
+
+ @param rVecA
+ A first 3D Vector.
+
+ @param rVecB
+ A second 3D Vector.
+
+ @return
+ The Cross Product of both 3D Vectors
+ */
+ inline B3IVector cross(const B3IVector& rVecA, const B3IVector& rVecB)
+ {
+ B3IVector aVec(
+ rVecA.getY() * rVecB.getZ() - rVecA.getZ() * rVecB.getY(),
+ rVecA.getZ() * rVecB.getX() - rVecA.getX() * rVecB.getZ(),
+ rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX());
+ return aVec;
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_VECTOR_B3DVECTOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basicdllapi.h b/include/basic/basicdllapi.h
new file mode 100644
index 000000000000..5c5c4647cd4c
--- /dev/null
+++ b/include/basic/basicdllapi.h
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#ifndef INCLUDED_BASICDLLAPI_H
+#define INCLUDED_BASICDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(BASIC_DLLIMPLEMENTATION)
+#define BASIC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define BASIC_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define BASIC_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_BASICDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basicmanagerrepository.hxx b/include/basic/basicmanagerrepository.hxx
new file mode 100644
index 000000000000..411aeadb8545
--- /dev/null
+++ b/include/basic/basicmanagerrepository.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef BASICMANAGERREPOSITORY_HXX
+#define BASICMANAGERREPOSITORY_HXX
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include "basicdllapi.h"
+
+class BasicManager;
+
+//........................................................................
+namespace basic
+{
+//........................................................................
+
+ //====================================================================
+ //= BasicManagerRepository
+ //====================================================================
+ /** specifies a callback for instances which are interested in BasicManagers
+ created by the BasicManagerRepository.
+ */
+ class BASIC_DLLPUBLIC SAL_NO_VTABLE BasicManagerCreationListener
+ {
+ public:
+ /** is called when a BasicManager has been created
+
+ @param _rxForDocument
+ denotes the document for which the BasicManager has been created. If this is <NULL/>,
+ then the BasicManager is the application-wide BasicManager.
+
+ @param _pBasicManager
+ denotes the BasicManager which has been created. The listener might for instance
+ decide to add global variables to it, or otherwise initialize it.
+ */
+ virtual void onBasicManagerCreated(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxForDocument,
+ BasicManager& _rBasicManager
+ ) = 0;
+
+ protected:
+ ~BasicManagerCreationListener() {}
+ };
+
+ //====================================================================
+ //= BasicManagerRepository
+ //====================================================================
+ class BASIC_DLLPUBLIC BasicManagerRepository
+ {
+ public:
+ /** returns the BasicManager belonging to the given document
+
+ If the BasicManager does not yet exist, it is created. In this case, if the application's
+ BasicManager does not yet exist, it is also created. This is necessary since
+ the application's BasicManager acts as parent for all document's BasicManagers.
+
+ If you're interested in this case - the implicit creation of the application's BasicManager -,
+ then you need to register as BasicManagerCreationListener.
+
+ @param _rxDocumentModel
+ denotes the document model whose BasicManager is to be retrieved. Must not be <NULL/>.
+ The document should support the XDocumentPropertiesSupplier
+ interface, for retrieving
+ its title, which is needed in some error conditions.
+ Also it <em>must</em> support the XStorageBasedDocument interface, since we
+ must be able to retrieve the document's storage. If this interface is <em>not</em>
+ supported, creating a new BasicManager will certainly fail.
+
+ @return
+ the BasicManager for this model.
+
+ @attention
+ The returned BasicManager instances is owned by the repository. In particular,
+ you are not allowed to delete it. Instead, the given model is observed: As soon
+ as it's closed, the associated BasicManager is deleted.
+ */
+ static BasicManager* getDocumentBasicManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocumentModel
+ );
+
+ /** returns the application-wide BasicManager
+
+ @param _bCreate
+ determines whether the BasicManager should be created (<TRUE/>) if it
+ does not yet exist.
+
+ @attention
+ If the BasicManager is newly created, then it is still owned by the repository.
+ In particular, you are not allowed to delete it. Instead, call resetApplicationBasicManager
+ to release the BasicManager.
+ */
+ static BasicManager* getApplicationBasicManager( bool _bCreate );
+
+ /** resets the application-wide BasicManager to <NULL/>
+ */
+ static void resetApplicationBasicManager();
+
+ /** registers a BasicManagerCreationListener instance which is notified whenever
+ the repository creates a BasicManager instance.
+
+ Note that this listener is <em>not</em> called when somebody else
+ creates BasicManager instances.
+
+ If the same listener is registered multiple times, it is also notified
+ multiple times, and needs to be revoked once for each registration.
+ */
+ static void registerCreationListener(
+ BasicManagerCreationListener& _rListener
+ );
+
+ /** reveokes a BasicManagerCreationListener instance which has previously
+ been registered to be notified about created BasicManager instances.
+ */
+ static void revokeCreationListener(
+ BasicManagerCreationListener& _rListener
+ );
+ };
+
+//........................................................................
+} // namespace basic
+//........................................................................
+
+#endif // BASICMANAGERREPOSITORY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basmgr.hxx b/include/basic/basmgr.hxx
new file mode 100644
index 000000000000..12bca4779565
--- /dev/null
+++ b/include/basic/basmgr.hxx
@@ -0,0 +1,238 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _BASMGR_HXX
+#define _BASMGR_HXX
+
+#include <svl/brdcst.hxx>
+#include <basic/sbstar.hxx>
+#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
+#include <com/sun/star/script/XStarBasicAccess.hpp>
+#include "basicdllapi.h"
+#include <vector>
+
+// Basic XML Import/Export
+BASIC_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::script::XStarBasicAccess >
+ getStarBasicAccess( BasicManager* pMgr );
+
+class SotStorage;
+
+#define BASERR_REASON_OPENSTORAGE 0x0001
+#define BASERR_REASON_OPENLIBSTORAGE 0x0002
+#define BASERR_REASON_OPENMGRSTREAM 0x0004
+#define BASERR_REASON_OPENLIBSTREAM 0x0008
+#define BASERR_REASON_LIBNOTFOUND 0x0010
+#define BASERR_REASON_STORAGENOTFOUND 0x0020
+#define BASERR_REASON_BASICLOADERROR 0x0040
+#define BASERR_REASON_NOSTORAGENAME 0x0080
+
+#define BASERR_REASON_STDLIB 0x0100
+
+class BASIC_DLLPUBLIC BasicError
+{
+private:
+ sal_uIntPtr nErrorId;
+ sal_uInt16 nReason;
+ OUString aErrStr;
+
+public:
+ BasicError( const BasicError& rErr );
+ BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr );
+
+ sal_uIntPtr GetErrorId() const { return nErrorId; }
+ sal_uInt16 GetReason() const { return nReason; }
+ OUString GetErrorStr() { return aErrStr; }
+
+ void SetErrorId( sal_uIntPtr n ) { nErrorId = n; }
+ void SetReason( sal_uInt16 n ) { nReason = n; }
+ void SetErrorStr( const OUString& rStr) { aErrStr = rStr; }
+};
+
+class BasicLibs;
+class ErrorManager;
+class BasicLibInfo;
+
+namespace basic { class BasicManagerCleaner; }
+
+// Library password handling for 5.0 documents
+class BASIC_DLLPUBLIC OldBasicPassword
+{
+public:
+ virtual void setLibraryPassword( const OUString& rLibraryName, const OUString& rPassword ) = 0;
+ virtual OUString getLibraryPassword( const OUString& rLibraryName ) = 0;
+ virtual void clearLibraryPassword( const OUString& rLibraryName ) = 0;
+ virtual sal_Bool hasLibraryPassword( const OUString& rLibraryName ) = 0;
+
+protected:
+ ~OldBasicPassword() {}
+};
+
+struct LibraryContainerInfo
+{
+ ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxScriptCont;
+ ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > mxDialogCont;
+ OldBasicPassword* mpOldBasicPassword;
+
+ LibraryContainerInfo()
+ :mpOldBasicPassword( NULL )
+ {
+ }
+
+ LibraryContainerInfo
+ (
+ com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > xScriptCont,
+ com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer > xDialogCont,
+ OldBasicPassword* pOldBasicPassword
+ )
+ : mxScriptCont( xScriptCont )
+ , mxDialogCont( xDialogCont )
+ , mpOldBasicPassword( pOldBasicPassword )
+ {}
+};
+
+struct BasicManagerImpl;
+
+
+#define LIB_NOTFOUND 0xFFFF
+
+class BASIC_DLLPUBLIC BasicManager : public SfxBroadcaster
+{
+ friend class LibraryContainer_Impl;
+ friend class StarBasicAccess_Impl;
+ friend class BasMgrContainerListenerImpl;
+ friend class ::basic::BasicManagerCleaner;
+
+private:
+ BasicLibs* pLibs;
+ std::vector<BasicError> aErrors;
+
+ OUString aName;
+ OUString maStorageName;
+ bool mbDocMgr;
+
+ BasicManagerImpl* mpImpl;
+
+ BASIC_DLLPRIVATE void Init();
+
+protected:
+ sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo ) const;
+ sal_Bool ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly = sal_False );
+ void ImpCreateStdLib( StarBASIC* pParentFromStdLib );
+ void ImpMgrNotLoaded( const OUString& rStorageName );
+ BasicLibInfo* CreateLibInfo();
+ void LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL, sal_Bool bLoadBasics = sal_True );
+ void LoadOldBasicManager( SotStorage& rStorage );
+ sal_Bool ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const;
+ sal_Bool ImplEncryptStream( SvStream& rStream ) const;
+ BasicLibInfo* FindLibInfo( StarBASIC* pBasic ) const;
+ void CheckModules( StarBASIC* pBasic, sal_Bool bReference ) const;
+ ~BasicManager();
+
+public:
+ TYPEINFO();
+ BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib = NULL, OUString* pLibPath = NULL, bool bDocMgr = false );
+ BasicManager( StarBASIC* pStdLib, OUString* pLibPath = NULL, bool bDocMgr = false );
+
+ /** deletes the given BasicManager instance
+
+ This method is necessary since normally, BasicManager instances are owned by the BasicManagerRepository,
+ and expected to be deleted by the repository only. However, there exists quite some legacy code,
+ which needs to explicitly delete a BasicManager itself. This code must not use the (protected)
+ destructor, but LegacyDeleteBasicManager.
+ */
+ static void LegacyDeleteBasicManager( BasicManager*& _rpManager );
+
+ void SetStorageName( const OUString& rName ) { maStorageName = rName; }
+ OUString GetStorageName() const { return maStorageName; }
+ void SetName( const OUString& rName ) { aName = rName; }
+ OUString GetName() const { return aName; }
+
+
+ sal_uInt16 GetLibCount() const;
+ StarBASIC* GetLib( sal_uInt16 nLib ) const;
+ StarBASIC* GetLib( const OUString& rName ) const;
+ sal_uInt16 GetLibId( const OUString& rName ) const;
+
+ OUString GetLibName( sal_uInt16 nLib );
+
+ /** announces the library containers which belong to this BasicManager
+
+ The method will automatically add two global constants, BasicLibraries and DialogLibraries,
+ to the BasicManager.
+ */
+ void SetLibraryContainerInfo( const LibraryContainerInfo& rInfo );
+
+ const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >&
+ GetDialogLibraryContainer() const;
+ const ::com::sun::star::uno::Reference< com::sun::star::script::XPersistentLibraryContainer >&
+ GetScriptLibraryContainer() const;
+
+ sal_Bool LoadLib( sal_uInt16 nLib );
+ sal_Bool RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage );
+
+ // Modify-Flag will be reset only during save.
+ sal_Bool IsBasicModified() const;
+
+ std::vector<BasicError>& GetErrors();
+
+ /** sets a global constant in the basic library, referring to some UNO object, to a new value.
+
+ If a constant with this name already existed before, its value is changed, and the old constant is
+ returned. If it does not yet exist, it is newly created, and inserted into the basic library.
+ */
+ ::com::sun::star::uno::Any
+ SetGlobalUNOConstant( const sal_Char* _pAsciiName, const ::com::sun::star::uno::Any& _rValue );
+
+ /** retrieves a global constant in the basic library, referring to some UNO object, returns true if a value is found ( value is in aOut ) false otherwise. */
+ bool GetGlobalUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
+ /** determines whether there are password-protected modules whose size exceedes the
+ legacy module size
+ @param _out_rModuleNames
+ takes the names of modules whose size exceeds the legacy limit
+ */
+ bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< OUString >& _out_rModuleNames );
+ bool HasExeCode( const OUString& );
+ /// determines whether the Basic Manager has a given macro, given by fully qualified name
+ bool HasMacro( OUString const& i_fullyQualifiedName ) const;
+ /// executes a given macro
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue );
+ /// executes a given macro
+ ErrCode ExecuteMacro( OUString const& i_fullyQualifiedName, OUString const& i_commaSeparatedArgs, SbxValue* i_retValue );
+
+private:
+ BASIC_DLLPRIVATE sal_Bool IsReference( sal_uInt16 nLib );
+
+ BASIC_DLLPRIVATE sal_Bool SetLibName( sal_uInt16 nLib, const OUString& rName );
+
+ BASIC_DLLPRIVATE StarBASIC* GetStdLib() const;
+ BASIC_DLLPRIVATE StarBASIC* AddLib( SotStorage& rStorage, const OUString& rLibName, sal_Bool bReference );
+ BASIC_DLLPRIVATE sal_Bool RemoveLib( sal_uInt16 nLib );
+ BASIC_DLLPRIVATE sal_Bool HasLib( const OUString& rName ) const;
+
+ BASIC_DLLPRIVATE StarBASIC* CreateLibForLibContainer( const OUString& rLibName,
+ const com::sun::star::uno::Reference< com::sun::star::script::XLibraryContainer >&
+ xScriptCont );
+ // For XML import/export:
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName );
+ BASIC_DLLPRIVATE StarBASIC* CreateLib( const OUString& rLibName, const OUString& Password,
+ const OUString& LinkTargetURL );
+};
+
+#endif //_BASMGR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/basrdll.hxx b/include/basic/basrdll.hxx
new file mode 100644
index 000000000000..20edde65b9cd
--- /dev/null
+++ b/include/basic/basrdll.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BASRDLL_HXX
+#define _BASRDLL_HXX
+
+class ResMgr;
+
+#include <vcl/accel.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC BasicDLL
+{
+private:
+ ResMgr* pBasResMgr;
+
+ bool bDebugMode;
+ bool bBreakEnabled;
+
+public:
+ BasicDLL();
+ ~BasicDLL();
+
+ ResMgr* GetBasResMgr() const { return pBasResMgr; }
+
+ static void BasicBreak();
+
+ static void EnableBreak( bool bEnable );
+ static void SetDebugMode( bool bDebugMode );
+};
+
+#define BASIC_DLL() (*(BasicDLL**)GetAppData( SHL_BASIC ) )
+
+#endif //_BASRDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/global.hxx b/include/basic/global.hxx
new file mode 100644
index 000000000000..e63029da5785
--- /dev/null
+++ b/include/basic/global.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+
+#ifndef BASIC_SBGLOBAL_HXX
+#define BASIC_SBGLOBAL_HXX
+
+namespace utl {
+ class TransliterationWrapper;
+}
+
+class SbGlobal
+{
+public:
+ static utl::TransliterationWrapper& GetTransliteration();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/modsizeexceeded.hxx b/include/basic/modsizeexceeded.hxx
new file mode 100644
index 000000000000..05dd70b4b66d
--- /dev/null
+++ b/include/basic/modsizeexceeded.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _BASIC_MODSIZEEXCEEDED_HXX
+#define _BASIC_MODSIZEEXCEEDED_HXX
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC ModuleSizeExceeded : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
+{
+ // C++ interface
+ public:
+ ModuleSizeExceeded( const com::sun::star::uno::Sequence<OUString>& sModules );
+
+ sal_Bool isAbort() const;
+ sal_Bool isApprove() const;
+
+ // UNO interface
+ public:
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException ) { return m_lContinuations; }
+ com::sun::star::uno::Any SAL_CALL getRequest() throw( com::sun::star::uno::RuntimeException )
+ {
+ return m_aRequest;
+ }
+
+ // member
+ private:
+ OUString m_sMods;
+ com::sun::star::uno::Any m_aRequest;
+ com::sun::star::uno::Sequence< com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > > m_lContinuations;
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation > m_xAbort;
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionContinuation> m_xApprove;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbdef.hxx b/include/basic/sbdef.hxx
new file mode 100644
index 000000000000..2bc29cbb08c3
--- /dev/null
+++ b/include/basic/sbdef.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBDEF_HXX
+#define _SB_SBDEF_HXX
+
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include "basicdllapi.h"
+
+// Returns type name for Basic type, array flag is ignored
+// implementation: basic/source/runtime/methods.cxx
+BASIC_DLLPUBLIC OUString getBasicTypeName( SbxDataType eType );
+
+// Returns type name for Basic objects, especially
+// important for SbUnoObj instances
+// implementation: basic/source/classes/sbunoobj.cxx
+class SbxObject;
+BASIC_DLLPUBLIC OUString getBasicObjectTypeName( SbxObject* pObj );
+
+// Allows Basic IDE to set watch mode to suppress errors
+// implementation: basic/source/runtime/runtime.cxx
+BASIC_DLLPUBLIC void setBasicWatchMode( bool bOn );
+
+// Debug Flags:
+#define SbDEBUG_BREAK 0x0001 // Break-Callback
+#define SbDEBUG_STEPINTO 0x0002 // Single Step-Callback
+#define SbDEBUG_STEPOVER 0x0004 // Additional flag Step Over
+#define SbDEBUG_CONTINUE 0x0008 // Do not change flags
+#define SbDEBUG_STEPOUT 0x0010 // Leave Sub
+
+#define SBXID_BASIC 0x6273 // sb: StarBASIC
+#define SBXID_BASICMOD 0x6d62 // bm: StarBASIC Module
+#define SBXID_BASICPROP 0x7262 // pr: StarBASIC Property
+#define SBXID_BASICMETHOD 0x6d65 // me: StarBASIC Method
+#define SBXID_JSCRIPTMOD 0x6a62 // jm: JavaScript Module
+#define SBXID_JSCRIPTMETH 0x6a64 // jm: JavaScript Module
+
+#define SBX_HINT_BASICSTART SFX_HINT_USER04
+#define SBX_HINT_BASICSTOP SFX_HINT_USER05
+
+enum PropertyMode
+{
+ PROPERTY_MODE_NONE,
+ PROPERTY_MODE_GET,
+ PROPERTY_MODE_LET,
+ PROPERTY_MODE_SET
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sberrors.hxx b/include/basic/sberrors.hxx
new file mode 100644
index 000000000000..f287f3afca88
--- /dev/null
+++ b/include/basic/sberrors.hxx
@@ -0,0 +1,418 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBERRORS_HXX
+#define _SB_SBERRORS_HXX
+
+#include <basic/sbxdef.hxx>
+
+#ifndef __RSC
+typedef sal_uIntPtr SbError;
+#endif
+
+// Mapping to SbxError
+#define ERRCODE_BASIC_SYNTAX ERRCODE_SBX_SYNTAX // unspecified syntax error
+#define ERRCODE_BASIC_BAD_ARGUMENT ERRCODE_SBX_NOTIMP // Invalid procedure call
+#define ERRCODE_BASIC_MATH_OVERFLOW ERRCODE_SBX_OVERFLOW // Overflow
+#define ERRCODE_BASIC_OUT_OF_RANGE ERRCODE_SBX_BOUNDS // Subscript out of range
+#define ERRCODE_BASIC_ZERODIV ERRCODE_SBX_ZERODIV // Division by zero
+#define ERRCODE_BASIC_CONVERSION ERRCODE_SBX_CONVERSION // Type mismatch
+#define ERRCODE_BASIC_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER // Invalid Parameter
+#define ERRCODE_BASIC_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED // Sub or Function not defined
+#define ERRCODE_BASIC_INTERNAL_ERROR ERRCODE_SBX_ERROR // internal error
+#define ERRCODE_BASIC_NO_OBJECT ERRCODE_SBX_NO_OBJECT // Object variable not set
+#define ERRCODE_BASIC_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD // Can't load module
+#define ERRCODE_BASIC_BAD_INDEX ERRCODE_SBX_BAD_INDEX // Invalid object index
+#define ERRCODE_BASIC_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT // No active view or document
+#define ERRCODE_BASIC_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE // Bad property value
+#define ERRCODE_BASIC_PROP_READONLY ERRCODE_SBX_PROP_READONLY // Property is read only
+#define ERRCODE_BASIC_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY // Property is write only
+#define ERRCODE_BASIC_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT // Invalid object reference
+#define ERRCODE_BASIC_NO_METHOD ERRCODE_SBX_NO_METHOD // Property or method not found
+#define ERRCODE_BASIC_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT // Invalid usee of object
+#define ERRCODE_BASIC_NO_OLE ERRCODE_SBX_NO_OLE // Class does not support OLE
+#define ERRCODE_BASIC_BAD_METHOD ERRCODE_SBX_BAD_METHOD // Object doesn't support method
+#define ERRCODE_BASIC_OLE_ERROR ERRCODE_SBX_OLE_ERROR // OLE Automation error
+#define ERRCODE_BASIC_BAD_ACTION ERRCODE_SBX_BAD_ACTION // Object doesn't support this action
+#define ERRCODE_BASIC_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS // Object doesn't support named args
+#define ERRCODE_BASIC_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE // Object doesn't support current locale setting
+#define ERRCODE_BASIC_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND // Named argument not found
+#define ERRCODE_BASIC_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL // Argument not optional
+#define ERRCODE_BASIC_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS // Wrong number of arguments
+#define ERRCODE_BASIC_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL // Object not a collection
+
+// Append Basic specific error messages to ERRCODE_AREA_SBX
+#define ERRCODE_BASIC_NO_GOSUB ((LAST_SBX_ERROR_ID+1UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Return without Gosub
+#define ERRCODE_BASIC_REDO_FROM_START ((LAST_SBX_ERROR_ID+2UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Redo form start (SB internal)
+#define ERRCODE_BASIC_NO_MEMORY ((LAST_SBX_ERROR_ID+3UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Out of memory
+#define ERRCODE_BASIC_ALREADY_DIM ((LAST_SBX_ERROR_ID+4UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Array already dimensioned
+#define ERRCODE_BASIC_DUPLICATE_DEF ((LAST_SBX_ERROR_ID+5UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Duplicate definition
+#define ERRCODE_BASIC_VAR_UNDEFINED ((LAST_SBX_ERROR_ID+6UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Variable undefined (SB)
+#define ERRCODE_BASIC_USER_ABORT ((LAST_SBX_ERROR_ID+7UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // User interrupt occurred
+#define ERRCODE_BASIC_BAD_RESUME ((LAST_SBX_ERROR_ID+8UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Resume without error
+#define ERRCODE_BASIC_STACK_OVERFLOW ((LAST_SBX_ERROR_ID+9UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Out of stack space
+#define ERRCODE_BASIC_BAD_DLL_LOAD ((LAST_SBX_ERROR_ID+10UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Error in loading DLL
+#define ERRCODE_BASIC_BAD_DLL_CALL ((LAST_SBX_ERROR_ID+11UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad DLL calling convention
+#define ERRCODE_BASIC_BAD_CHANNEL ((LAST_SBX_ERROR_ID+12UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad file name or number
+#define ERRCODE_BASIC_FILE_NOT_FOUND ((LAST_SBX_ERROR_ID+13UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // File not found
+#define ERRCODE_BASIC_BAD_FILE_MODE ((LAST_SBX_ERROR_ID+14UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad file mode
+#define ERRCODE_BASIC_FILE_ALREADY_OPEN ((LAST_SBX_ERROR_ID+15UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // File already open
+#define ERRCODE_BASIC_IO_ERROR ((LAST_SBX_ERROR_ID+16UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Device I/O error
+#define ERRCODE_BASIC_FILE_EXISTS ((LAST_SBX_ERROR_ID+17UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // File already exists
+#define ERRCODE_BASIC_BAD_RECORD_LENGTH ((LAST_SBX_ERROR_ID+18UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // bad record length
+#define ERRCODE_BASIC_DISK_FULL ((LAST_SBX_ERROR_ID+19UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // disk full
+#define ERRCODE_BASIC_READ_PAST_EOF ((LAST_SBX_ERROR_ID+20UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Input past end of file
+#define ERRCODE_BASIC_BAD_RECORD_NUMBER ((LAST_SBX_ERROR_ID+21UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad record number
+#define ERRCODE_BASIC_TOO_MANY_FILES ((LAST_SBX_ERROR_ID+22UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Too many files
+#define ERRCODE_BASIC_NO_DEVICE ((LAST_SBX_ERROR_ID+23UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Device not available
+#define ERRCODE_BASIC_ACCESS_DENIED ((LAST_SBX_ERROR_ID+24UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Permission denied
+#define ERRCODE_BASIC_NOT_READY ((LAST_SBX_ERROR_ID+25UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Disk not ready
+#define ERRCODE_BASIC_NOT_IMPLEMENTED ((LAST_SBX_ERROR_ID+26UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Feature not implemented
+#define ERRCODE_BASIC_DIFFERENT_DRIVE ((LAST_SBX_ERROR_ID+27UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // No rename with different drive
+#define ERRCODE_BASIC_ACCESS_ERROR ((LAST_SBX_ERROR_ID+28UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Path/File access error
+#define ERRCODE_BASIC_PATH_NOT_FOUND ((LAST_SBX_ERROR_ID+29UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Path not found
+#define ERRCODE_BASIC_BAD_PATTERN ((LAST_SBX_ERROR_ID+30UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid pattern string
+#define ERRCODE_BASIC_IS_NULL ((LAST_SBX_ERROR_ID+31UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid use of Null
+
+// DDE messages from 250-299
+#define ERRCODE_BASIC_DDE_ERROR ((LAST_SBX_ERROR_ID+32UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_WAITINGACK ((LAST_SBX_ERROR_ID+33UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_OUTOFCHANNELS ((LAST_SBX_ERROR_ID+34UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NO_RESPONSE ((LAST_SBX_ERROR_ID+35UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_MULT_RESPONSES ((LAST_SBX_ERROR_ID+36UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_CHANNEL_LOCKED ((LAST_SBX_ERROR_ID+37UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NOTPROCESSED ((LAST_SBX_ERROR_ID+38UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_TIMEOUT ((LAST_SBX_ERROR_ID+39UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_USER_INTERRUPT ((LAST_SBX_ERROR_ID+40UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_BUSY ((LAST_SBX_ERROR_ID+41UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NO_DATA ((LAST_SBX_ERROR_ID+42UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT ((LAST_SBX_ERROR_ID+43UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_PARTNER_QUIT ((LAST_SBX_ERROR_ID+44UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_CONV_CLOSED ((LAST_SBX_ERROR_ID+45UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_NO_CHANNEL ((LAST_SBX_ERROR_ID+46UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_INVALID_LINK ((LAST_SBX_ERROR_ID+47UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_QUEUE_OVERFLOW ((LAST_SBX_ERROR_ID+48UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_LINK_ALREADY_EST ((LAST_SBX_ERROR_ID+49UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_LINK_INV_TOPIC ((LAST_SBX_ERROR_ID+50UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+#define ERRCODE_BASIC_DDE_DLL_NOT_FOUND ((LAST_SBX_ERROR_ID+51UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+
+#define ERRCODE_BASIC_NEEDS_OBJECT ((LAST_SBX_ERROR_ID+52UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Object required
+#define ERRCODE_BASIC_BAD_ORDINAL ((LAST_SBX_ERROR_ID+53UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid ordinal
+#define ERRCODE_BASIC_DLLPROC_NOT_FOUND ((LAST_SBX_ERROR_ID+54UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Specified DLL function not found
+#define ERRCODE_BASIC_BAD_CLIPBD_FORMAT ((LAST_SBX_ERROR_ID+55UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Invalid clipboard format
+
+// Debugger messages from 700-799
+
+#define ERRCODE_BASIC_PROPERTY_NOT_FOUND ((LAST_SBX_ERROR_ID+56UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Class not have property
+#define ERRCODE_BASIC_METHOD_NOT_FOUND ((LAST_SBX_ERROR_ID+57UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Class does not have method
+#define ERRCODE_BASIC_ARG_MISSING ((LAST_SBX_ERROR_ID+58UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Missing required argument
+#define ERRCODE_BASIC_BAD_NUMBER_OF_ARGS ((LAST_SBX_ERROR_ID+59UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Bad number of arguments
+#define ERRCODE_BASIC_METHOD_FAILED ((LAST_SBX_ERROR_ID+60UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Method failed
+#define ERRCODE_BASIC_SETPROP_FAILED ((LAST_SBX_ERROR_ID+61UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Unable to set property
+#define ERRCODE_BASIC_GETPROP_FAILED ((LAST_SBX_ERROR_ID+62UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME) // Unable to get property
+
+// Compiler Errors (do not occure at runtime)
+// These IDs can shift at any time
+
+#define ERRCODE_BASIC_UNEXPECTED ((LAST_SBX_ERROR_ID+63UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unexpected symbol: xx
+#define ERRCODE_BASIC_EXPECTED ((LAST_SBX_ERROR_ID+64UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Expected: xx
+#define ERRCODE_BASIC_SYMBOL_EXPECTED ((LAST_SBX_ERROR_ID+65UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Symbol expected
+#define ERRCODE_BASIC_VAR_EXPECTED ((LAST_SBX_ERROR_ID+66UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Variable expected
+#define ERRCODE_BASIC_LABEL_EXPECTED ((LAST_SBX_ERROR_ID+67UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Label expected
+#define ERRCODE_BASIC_LVALUE_EXPECTED ((LAST_SBX_ERROR_ID+68UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Lvalue expected
+#define ERRCODE_BASIC_VAR_DEFINED ((LAST_SBX_ERROR_ID+69UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Variable xxx already defined
+#define ERRCODE_BASIC_PROC_DEFINED ((LAST_SBX_ERROR_ID+70UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Procedure xx already defined
+#define ERRCODE_BASIC_LABEL_DEFINED ((LAST_SBX_ERROR_ID+71UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Label xxx already defined
+#define ERRCODE_BASIC_UNDEF_VAR ((LAST_SBX_ERROR_ID+72UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Variable xx undefined
+#define ERRCODE_BASIC_UNDEF_ARRAY ((LAST_SBX_ERROR_ID+73UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Array or function xx undefined
+#define ERRCODE_BASIC_UNDEF_PROC ((LAST_SBX_ERROR_ID+74UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Procedure xxx undefined
+#define ERRCODE_BASIC_UNDEF_LABEL ((LAST_SBX_ERROR_ID+75UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Label xxx undefined
+#define ERRCODE_BASIC_UNDEF_TYPE ((LAST_SBX_ERROR_ID+76UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unknown user defined type xxx
+#define ERRCODE_BASIC_BAD_EXIT ((LAST_SBX_ERROR_ID+77UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Exit XXX expected
+#define ERRCODE_BASIC_BAD_BLOCK ((LAST_SBX_ERROR_ID+78UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unterminated statement block: missing XX
+#define ERRCODE_BASIC_BAD_BRACKETS ((LAST_SBX_ERROR_ID+79UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Parentheses do not match
+#define ERRCODE_BASIC_BAD_DECLARATION ((LAST_SBX_ERROR_ID+80UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Symbol xx defined differently
+#define ERRCODE_BASIC_BAD_PARAMETERS ((LAST_SBX_ERROR_ID+81UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Parameters do not match
+#define ERRCODE_BASIC_BAD_CHAR_IN_NUMBER ((LAST_SBX_ERROR_ID+82UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Bad character in number
+#define ERRCODE_BASIC_MUST_HAVE_DIMS ((LAST_SBX_ERROR_ID+83UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Array needs dimensioning
+#define ERRCODE_BASIC_NO_IF ((LAST_SBX_ERROR_ID+84UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Else/Endif without If
+#define ERRCODE_BASIC_NOT_IN_SUBR ((LAST_SBX_ERROR_ID+85UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // xxx not allowed within a sub
+#define ERRCODE_BASIC_NOT_IN_MAIN ((LAST_SBX_ERROR_ID+86UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // xxx not allowed outside a sub
+#define ERRCODE_BASIC_WRONG_DIMS ((LAST_SBX_ERROR_ID+87UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Dimensions do not match
+#define ERRCODE_BASIC_BAD_OPTION ((LAST_SBX_ERROR_ID+88UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Unknown option: xxx
+#define ERRCODE_BASIC_CONSTANT_REDECLARED ((LAST_SBX_ERROR_ID+89UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Constant xx redeclared
+#define ERRCODE_BASIC_PROG_TOO_LARGE ((LAST_SBX_ERROR_ID+90UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Program is too large
+#define ERRCODE_BASIC_NO_STRINGS_ARRAYS ((LAST_SBX_ERROR_ID+91UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER)
+
+#define ERRCODE_BASIC_EXCEPTION ((LAST_SBX_ERROR_ID+92UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_RUNTIME)
+
+#define ERRCODE_BASMGR_STDLIBOPEN (LAST_SBX_ERROR_ID+93UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_STDLIBSAVE (LAST_SBX_ERROR_ID+94UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBLOAD (LAST_SBX_ERROR_ID+95UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBCREATE (LAST_SBX_ERROR_ID+96UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBSAVE (LAST_SBX_ERROR_ID+97UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_LIBDEL (LAST_SBX_ERROR_ID+98UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_MGROPEN (LAST_SBX_ERROR_ID+99UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_MGRSAVE (LAST_SBX_ERROR_ID+100UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_REMOVELIB (LAST_SBX_ERROR_ID+101UL) | ERRCODE_AREA_SBX
+#define ERRCODE_BASMGR_UNLOADLIB (LAST_SBX_ERROR_ID+102UL) | ERRCODE_AREA_SBX
+
+#define ERRCODE_BASIC_ARRAY_FIX ((LAST_SBX_ERROR_ID+104UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // This array is fixed
+#define ERRCODE_BASIC_STRING_OVERFLOW ((LAST_SBX_ERROR_ID+105UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Out of string space
+#define ERRCODE_BASIC_EXPR_TOO_COMPLEX ((LAST_SBX_ERROR_ID+106UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Expression too complex
+#define ERRCODE_BASIC_OPER_NOT_PERFORM ((LAST_SBX_ERROR_ID+107UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Can't perform requested operation
+#define ERRCODE_BASIC_TOO_MANY_DLL ((LAST_SBX_ERROR_ID+108UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // Too many dll application clients
+#define ERRCODE_BASIC_LOOP_NOT_INIT ((LAST_SBX_ERROR_ID+109UL) | ERRCODE_AREA_SBX | \
+ ERRCODE_CLASS_COMPILER) // For loop not initialized
+
+#define ERRCODE_BASIC_COMPAT ((LAST_SBX_ERROR_ID+103UL)| ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME)
+
+// Map old codes to new codes
+#define SbERR_SYNTAX ERRCODE_BASIC_SYNTAX
+#define SbERR_NO_GOSUB ERRCODE_BASIC_NO_GOSUB
+#define SbERR_REDO_FROM_START ERRCODE_BASIC_REDO_FROM_START
+#define SbERR_BAD_ARGUMENT ERRCODE_BASIC_BAD_ARGUMENT
+#define SbERR_MATH_OVERFLOW ERRCODE_BASIC_MATH_OVERFLOW
+#define SbERR_NO_MEMORY ERRCODE_BASIC_NO_MEMORY
+#define SbERR_ALREADY_DIM ERRCODE_BASIC_ALREADY_DIM
+#define SbERR_OUT_OF_RANGE ERRCODE_BASIC_OUT_OF_RANGE
+#define SbERR_DUPLICATE_DEF ERRCODE_BASIC_DUPLICATE_DEF
+#define SbERR_ZERODIV ERRCODE_BASIC_ZERODIV
+#define SbERR_VAR_UNDEFINED ERRCODE_BASIC_VAR_UNDEFINED
+#define SbERR_CONVERSION ERRCODE_BASIC_CONVERSION
+#define SbERR_BAD_PARAMETER ERRCODE_BASIC_BAD_PARAMETER
+#define SbERR_USER_ABORT ERRCODE_BASIC_USER_ABORT
+#define SbERR_BAD_RESUME ERRCODE_BASIC_BAD_RESUME
+#define SbERR_STACK_OVERFLOW ERRCODE_BASIC_STACK_OVERFLOW
+#define SbERR_PROC_UNDEFINED ERRCODE_BASIC_PROC_UNDEFINED
+#define SbERR_BAD_DLL_LOAD ERRCODE_BASIC_BAD_DLL_LOAD
+#define SbERR_BAD_DLL_CALL ERRCODE_BASIC_BAD_DLL_CALL
+#define SbERR_INTERNAL_ERROR ERRCODE_BASIC_INTERNAL_ERROR
+#define SbERR_BAD_CHANNEL ERRCODE_BASIC_BAD_CHANNEL
+#define SbERR_FILE_NOT_FOUND ERRCODE_BASIC_FILE_NOT_FOUND
+#define SbERR_BAD_FILE_MODE ERRCODE_BASIC_BAD_FILE_MODE
+#define SbERR_FILE_ALREADY_OPEN ERRCODE_BASIC_FILE_ALREADY_OPEN
+#define SbERR_IO_ERROR ERRCODE_BASIC_IO_ERROR
+#define SbERR_FILE_EXISTS ERRCODE_BASIC_FILE_EXISTS
+#define SbERR_BAD_RECORD_LENGTH ERRCODE_BASIC_BAD_RECORD_LENGTH
+#define SbERR_DISK_FULL ERRCODE_BASIC_DISK_FULL
+#define SbERR_READ_PAST_EOF ERRCODE_BASIC_READ_PAST_EOF
+#define SbERR_BAD_RECORD_NUMBER ERRCODE_BASIC_BAD_RECORD_NUMBER
+#define SbERR_TOO_MANY_FILES ERRCODE_BASIC_TOO_MANY_FILES
+#define SbERR_NO_DEVICE ERRCODE_BASIC_NO_DEVICE
+#define SbERR_ACCESS_DENIED ERRCODE_BASIC_ACCESS_DENIED
+#define SbERR_NOT_READY ERRCODE_BASIC_NOT_READY
+#define SbERR_NOT_IMPLEMENTED ERRCODE_BASIC_NOT_IMPLEMENTED
+#define SbERR_DIFFERENT_DRIVE ERRCODE_BASIC_DIFFERENT_DRIVE
+#define SbERR_ACCESS_ERROR ERRCODE_BASIC_ACCESS_ERROR
+#define SbERR_PATH_NOT_FOUND ERRCODE_BASIC_PATH_NOT_FOUND
+#define SbERR_NO_OBJECT ERRCODE_BASIC_NO_OBJECT
+#define SbERR_BAD_PATTERN ERRCODE_BASIC_BAD_PATTERN
+#define SBERR_IS_NULL ERRCODE_BASIC_IS_NULL
+#define SbERR_DDE_ERROR ERRCODE_BASIC_DDE_ERROR
+#define SbERR_DDE_WAITINGACK ERRCODE_BASIC_DDE_WAITINGACK
+#define SbERR_DDE_OUTOFCHANNELS ERRCODE_BASIC_DDE_OUTOFCHANNELS
+#define SbERR_DDE_NO_RESPONSE ERRCODE_BASIC_DDE_NO_RESPONSE
+#define SbERR_DDE_MULT_RESPONSES ERRCODE_BASIC_DDE_MULT_RESPONSES
+#define SbERR_DDE_CHANNEL_LOCKED ERRCODE_BASIC_DDE_CHANNEL_LOCKED
+#define SbERR_DDE_NOTPROCESSED ERRCODE_BASIC_DDE_NOTPROCESSED
+#define SbERR_DDE_TIMEOUT ERRCODE_BASIC_DDE_TIMEOUT
+#define SbERR_DDE_USER_INTERRUPT ERRCODE_BASIC_DDE_USER_INTERRUPT
+#define SbERR_DDE_BUSY ERRCODE_BASIC_DDE_BUSY
+#define SbERR_DDE_NO_DATA ERRCODE_BASIC_DDE_NO_DATA
+#define SbERR_DDE_WRONG_DATA_FORMAT ERRCODE_BASIC_DDE_WRONG_DATA_FORMAT
+#define SbERR_DDE_PARTNER_QUIT ERRCODE_BASIC_DDE_PARTNER_QUIT
+#define SbERR_DDE_CONV_CLOSED ERRCODE_BASIC_DDE_CONV_CLOSED
+#define SbERR_DDE_NO_CHANNEL ERRCODE_BASIC_DDE_NO_CHANNEL
+#define SbERR_DDE_INVALID_LINK ERRCODE_BASIC_DDE_INVALID_LINK
+#define SbERR_DDE_QUEUE_OVERFLOW ERRCODE_BASIC_DDE_QUEUE_OVERFLOW
+#define SbERR_DDE_LINK_ALREADY_EST ERRCODE_BASIC_DDE_LINK_ALREADY_EST
+#define SbERR_DDE_LINK_INV_TOPIC ERRCODE_BASIC_DDE_LINK_INV_TOPIC
+#define SbERR_DDE_DLL_NOT_FOUND ERRCODE_BASIC_DDE_DLL_NOT_FOUND
+#define SbERR_CANNOT_LOAD ERRCODE_BASIC_CANNOT_LOAD
+#define SbERR_BAD_INDEX ERRCODE_BASIC_BAD_INDEX
+#define SbERR_NO_ACTIVE_OBJECT ERRCODE_BASIC_NO_ACTIVE_OBJECT
+#define SbERR_BAD_PROP_VALUE ERRCODE_BASIC_BAD_PROP_VALUE
+#define SbERR_PROP_READONLY ERRCODE_BASIC_PROP_READONLY
+#define SbERR_PROP_WRITEONLY ERRCODE_BASIC_PROP_WRITEONLY
+#define SbERR_INVALID_OBJECT ERRCODE_BASIC_INVALID_OBJECT
+#define SbERR_NO_METHOD ERRCODE_BASIC_NO_METHOD
+#define SbERR_NEEDS_OBJECT ERRCODE_BASIC_NEEDS_OBJECT
+#define SbERR_INVALID_USAGE_OBJECT ERRCODE_BASIC_INVALID_USAGE_OBJECT
+#define SbERR_NO_OLE ERRCODE_BASIC_NO_OLE
+#define SbERR_BAD_METHOD ERRCODE_BASIC_BAD_METHOD
+#define SbERR_OLE_ERROR ERRCODE_BASIC_OLE_ERROR
+#define SbERR_BAD_ACTION ERRCODE_BASIC_BAD_ACTION
+#define SbERR_NO_NAMED_ARGS ERRCODE_BASIC_NO_NAMED_ARGS
+#define SbERR_BAD_LOCALE ERRCODE_BASIC_BAD_LOCALE
+#define SbERR_NAMED_NOT_FOUND ERRCODE_BASIC_NAMED_NOT_FOUND
+#define SbERR_NOT_OPTIONAL ERRCODE_BASIC_NOT_OPTIONAL
+#define SbERR_WRONG_ARGS ERRCODE_BASIC_WRONG_ARGS
+#define SbERR_NOT_A_COLL ERRCODE_BASIC_NOT_A_COLL
+#define SbERR_BAD_ORDINAL ERRCODE_BASIC_BAD_ORDINAL
+#define SbERR_DLLPROC_NOT_FOUND ERRCODE_BASIC_DLLPROC_NOT_FOUND
+#define SbERR_BAD_CLIPBD_FORMAT ERRCODE_BASIC_BAD_CLIPBD_FORMAT
+#define SbERR_PROPERTY_NOT_FOUND ERRCODE_BASIC_PROPERTY_NOT_FOUND
+#define SbERR_METHOD_NOT_FOUND ERRCODE_BASIC_METHOD_NOT_FOUND
+#define SbERR_ARG_MISSING ERRCODE_BASIC_ARG_MISSING
+#define SbERR_BAD_NUMBER_OF_ARGS ERRCODE_BASIC_BAD_NUMBER_OF_ARGS
+#define SbERR_METHOD_FAILED ERRCODE_BASIC_METHOD_FAILED
+#define SbERR_SETPROP_FAILED ERRCODE_BASIC_SETPROP_FAILED
+#define SbERR_GETPROP_FAILED ERRCODE_BASIC_GETPROP_FAILED
+#define SbERR_UNEXPECTED ERRCODE_BASIC_UNEXPECTED
+#define SbERR_EXPECTED ERRCODE_BASIC_EXPECTED
+#define SbERR_SYMBOL_EXPECTED ERRCODE_BASIC_SYMBOL_EXPECTED
+#define SbERR_VAR_EXPECTED ERRCODE_BASIC_VAR_EXPECTED
+#define SbERR_LABEL_EXPECTED ERRCODE_BASIC_LABEL_EXPECTED
+#define SbERR_LVALUE_EXPECTED ERRCODE_BASIC_LVALUE_EXPECTED
+#define SbERR_VAR_DEFINED ERRCODE_BASIC_VAR_DEFINED
+#define SbERR_PROC_DEFINED ERRCODE_BASIC_PROC_DEFINED
+#define SbERR_LABEL_DEFINED ERRCODE_BASIC_LABEL_DEFINED
+#define SbERR_UNDEF_VAR ERRCODE_BASIC_UNDEF_VAR
+#define SbERR_UNDEF_ARRAY ERRCODE_BASIC_UNDEF_ARRAY
+#define SbERR_UNDEF_PROC ERRCODE_BASIC_UNDEF_PROC
+#define SbERR_UNDEF_LABEL ERRCODE_BASIC_UNDEF_LABEL
+#define SbERR_UNDEF_TYPE ERRCODE_BASIC_UNDEF_TYPE
+#define SbERR_BAD_EXIT ERRCODE_BASIC_BAD_EXIT
+#define SbERR_BAD_BLOCK ERRCODE_BASIC_BAD_BLOCK
+#define SbERR_BAD_BRACKETS ERRCODE_BASIC_BAD_BRACKETS
+#define SbERR_BAD_DECLARATION ERRCODE_BASIC_BAD_DECLARATION
+#define SbERR_BAD_PARAMETERS ERRCODE_BASIC_BAD_PARAMETERS
+#define SbERR_BAD_CHAR_IN_NUMBER ERRCODE_BASIC_BAD_CHAR_IN_NUMBER
+#define SbERR_MUST_HAVE_DIMS ERRCODE_BASIC_MUST_HAVE_DIMS
+#define SbERR_NO_IF ERRCODE_BASIC_NO_IF
+#define SbERR_NOT_IN_SUBR ERRCODE_BASIC_NOT_IN_SUBR
+#define SbERR_NOT_IN_MAIN ERRCODE_BASIC_NOT_IN_MAIN
+#define SbERR_WRONG_DIMS ERRCODE_BASIC_WRONG_DIMS
+#define SbERR_BAD_OPTION ERRCODE_BASIC_BAD_OPTION
+#define SbERR_CONSTANT_REDECLARED ERRCODE_BASIC_CONSTANT_REDECLARED
+#define SbERR_PROG_TOO_LARGE ERRCODE_BASIC_PROG_TOO_LARGE
+#define SbERR_NO_STRINGS_ARRAYS ERRCODE_BASIC_NO_STRINGS_ARRAYS
+#define SbERR_BASIC_EXCEPTION ERRCODE_BASIC_EXCEPTION
+#define SbERR_BASIC_COMPAT ERRCODE_BASIC_COMPAT
+#define SbERR_BASIC_ARRAY_FIX ERRCODE_BASIC_ARRAY_FIX
+#define SbERR_BASIC_STRING_OVERFLOW ERRCODE_BASIC_STRING_OVERFLOW
+#define SbERR_BASIC_EXPR_TOO_COMPLEX ERRCODE_BASIC_EXPR_TOO_COMPLEX
+#define SbERR_BASIC_OPER_NOT_PERFORM ERRCODE_BASIC_OPER_NOT_PERFORM
+#define SbERR_BASIC_TOO_MANY_DLL ERRCODE_BASIC_TOO_MANY_DLL
+#define SbERR_BASIC_LOOP_NOT_INIT ERRCODE_BASIC_LOOP_NOT_INIT
+
+// Grid messages from 30000-30999
+// OLE messages from 31000-31999
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbmeth.hxx b/include/basic/sbmeth.hxx
new file mode 100644
index 000000000000..9d4afbc37a24
--- /dev/null
+++ b/include/basic/sbmeth.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBMETH_HXX
+#define _SB_SBMETH_HXX
+
+#include <tools/errcode.hxx>
+#include <basic/sbxmeth.hxx>
+#include <basic/sbdef.hxx>
+#include "basicdllapi.h"
+
+class SbModule;
+
+class BASIC_DLLPUBLIC SbMethod : public SbxMethod
+{
+ friend class SbiRuntime;
+ friend class SbiFactory;
+ friend class SbModule;
+ friend class SbClassModuleObject;
+ friend class SbiCodeGen;
+ friend class SbJScriptMethod;
+ friend class SbIfaceMapperMethod;
+
+ SbxVariable* mCaller; // caller
+ SbModule* pMod;
+ sal_uInt16 nDebugFlags;
+ sal_uInt16 nLine1, nLine2;
+ sal_uInt32 nStart;
+ sal_Bool bInvalid;
+ SbxArrayRef refStatics;
+ BASIC_DLLPRIVATE SbMethod( const OUString&, SbxDataType, SbModule* );
+ BASIC_DLLPRIVATE SbMethod( const SbMethod& );
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbMethod();
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMETHOD,2);
+ TYPEINFO();
+ virtual SbxInfo* GetInfo();
+ SbxArray* GetStatics();
+ void ClearStatics();
+ SbModule* GetModule() { return pMod; }
+ sal_uInt32 GetId() const { return nStart; }
+ sal_uInt16 GetDebugFlags() { return nDebugFlags; }
+ void SetDebugFlags( sal_uInt16 n ) { nDebugFlags = n; }
+ void GetLineRange( sal_uInt16&, sal_uInt16& );
+
+ // Interface to execute a method from the applications
+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
+ virtual void Broadcast( sal_uIntPtr nHintId );
+};
+
+SV_DECL_IMPL_REF(SbMethod)
+
+class BASIC_DLLPUBLIC SbIfaceMapperMethod : public SbMethod
+{
+ friend class SbiRuntime;
+
+ SbMethodRef mxImplMeth;
+
+public:
+ TYPEINFO();
+ SbIfaceMapperMethod( const OUString& rName, SbMethod* pImplMeth )
+ : SbMethod( rName, pImplMeth->GetType(), NULL )
+ , mxImplMeth( pImplMeth )
+ {}
+ virtual ~SbIfaceMapperMethod();
+ SbMethod* getImplMethod( void )
+ { return mxImplMeth; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbmod.hxx b/include/basic/sbmod.hxx
new file mode 100644
index 000000000000..f94e2c9e8a36
--- /dev/null
+++ b/include/basic/sbmod.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBMOD_HXX
+#define _SB_SBMOD_HXX
+
+#include <com/sun/star/script/XInvocation.hpp>
+#include <basic/sbdef.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include <vector>
+#include <deque>
+#include <boost/utility.hpp>
+#include "basicdllapi.h"
+
+class SbMethod;
+class SbProperty;
+class SbiRuntime;
+typedef std::deque< sal_uInt16 > SbiBreakpoints;
+class SbiImage;
+class SbProcedureProperty;
+class SbIfaceMapperMethod;
+class SbClassModuleObject;
+
+class ModuleInitDependencyMap;
+struct ClassModuleRunInitItem;
+struct SbClassData;
+
+class BASIC_DLLPUBLIC SbModule : public SbxObject, private ::boost::noncopyable
+{
+ friend class SbiCodeGen;
+ friend class SbMethod;
+ friend class SbiRuntime;
+ friend class StarBASIC;
+ friend class SbClassModuleObject;
+
+ std::vector< OUString > mModuleVariableNames;
+
+ BASIC_DLLPRIVATE void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
+
+protected:
+ com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
+ OUString aOUSource;
+ OUString aComment;
+ SbiImage* pImage; // the Image
+ SbiBreakpoints* pBreaks; // Breakpoints
+ SbClassData* pClassData;
+ bool mbVBACompat;
+ sal_Int32 mnType;
+ SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
+ bool bIsProxyModule;
+
+ static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem );
+ void StartDefinitions();
+ SbMethod* GetMethod( const OUString&, SbxDataType );
+ SbProperty* GetProperty( const OUString&, SbxDataType );
+ SbProcedureProperty* GetProcedureProperty( const OUString&, SbxDataType );
+ SbIfaceMapperMethod* GetIfaceMapperMethod( const OUString&, SbMethod* );
+ void EndDefinitions( sal_Bool=sal_False );
+ sal_uInt16 Run( SbMethod* );
+ void RunInit();
+ void ClearPrivateVars();
+ void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic );
+ void GlobalRunInit( bool bBasicStart ); // for all modules
+ void GlobalRunDeInit( void );
+ const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16& ) const;
+ const sal_uInt8* FindNextStmnt( const sal_uInt8*, sal_uInt16&, sal_uInt16&,
+ sal_Bool bFollowJumps, const SbiImage* pImg=NULL ) const;
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual sal_Bool LoadCompleted();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+ void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint );
+ virtual ~SbModule();
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);
+ TYPEINFO();
+ SbModule( const OUString&, sal_Bool bCompat = sal_False );
+ virtual void SetParent( SbxObject* );
+ virtual void Clear();
+
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ virtual const OUString& GetSource() const;
+ const OUString& GetSource32() const;
+ const OUString& GetComment() const { return aComment; }
+ virtual void SetSource( const OUString& r );
+ void SetSource32( const OUString& r );
+
+ virtual sal_Bool Compile();
+ virtual sal_Bool IsCompiled() const;
+ const SbxObject* FindType( OUString aTypeName ) const;
+
+ virtual sal_Bool IsBreakable( sal_uInt16 nLine ) const;
+ virtual sal_Bool IsBP( sal_uInt16 nLine ) const;
+ virtual sal_Bool SetBP( sal_uInt16 nLine );
+ virtual sal_Bool ClearBP( sal_uInt16 nLine );
+ virtual void ClearAllBP();
+
+ // Store only image, no source (needed for new password protection)
+ sal_Bool StoreBinaryData( SvStream& );
+ sal_Bool StoreBinaryData( SvStream&, sal_uInt16 nVer );
+ sal_Bool LoadBinaryData( SvStream&, sal_uInt16 nVer );
+ sal_Bool LoadBinaryData( SvStream& );
+ sal_Bool ExceedsLegacyModuleSize();
+ void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+ bool HasExeCode();
+ bool IsVBACompat() const;
+ void SetVBACompat( bool bCompat );
+ sal_Int32 GetModuleType() { return mnType; }
+ void SetModuleType( sal_Int32 nType ) { mnType = nType; }
+ bool isProxyModule() { return bIsProxyModule; }
+ void AddVarName( const OUString& aName );
+ void RemoveVars();
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
+ bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
+};
+
+SV_DECL_IMPL_REF(SbModule)
+
+// Object class for instances of class modules
+class BASIC_DLLPUBLIC SbClassModuleObject : public SbModule
+{
+ SbModule* mpClassModule;
+ bool mbInitializeEventDone;
+
+public:
+ TYPEINFO();
+ SbClassModuleObject( SbModule* pClassModule );
+ ~SbClassModuleObject();
+
+ // Overridden to support NameAccess etc.
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ virtual void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
+
+ SbModule* getClassModule( void )
+ { return mpClassModule; }
+
+ void triggerInitializeEvent( void );
+ void triggerTerminateEvent( void );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbobjmod.hxx b/include/basic/sbobjmod.hxx
new file mode 100644
index 000000000000..14ca48681688
--- /dev/null
+++ b/include/basic/sbobjmod.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_OBJMOD_HXX
+#define _SB_OBJMOD_HXX
+
+#include <rtl/ref.hxx>
+#include <basic/sbmod.hxx>
+#include <basic/sbstar.hxx>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/awt/XDialog.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "basicdllapi.h"
+
+// Basic-Module for excel object.
+
+class BASIC_DLLPUBLIC SbObjModule : public SbModule
+{
+protected:
+ virtual ~SbObjModule();
+
+public:
+ TYPEINFO();
+ SbObjModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
+
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ using SbxValue::GetObject;
+ SbxVariable* GetObject();
+ void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
+};
+
+class FormObjEventListenerImpl;
+
+class BASIC_DLLPUBLIC SbUserFormModule : public SbObjModule
+{
+ com::sun::star::script::ModuleInfo m_mInfo;
+ ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener;
+ css::uno::Reference<css::awt::XDialog> m_xDialog;
+ css::uno::Reference<css::frame::XModel> m_xModel;
+ OUString sFormName;
+ bool mbInit;
+
+//protected:
+ virtual void InitObject();
+public:
+ TYPEINFO();
+ SbUserFormModule( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+ virtual ~SbUserFormModule();
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
+ void ResetApiObj( bool bTriggerTerminateEvent = true );
+ void Unload();
+ void Load();
+ void triggerMethod( const OUString& );
+ void triggerMethod( const OUString&, css::uno::Sequence< css::uno::Any >& );
+ void triggerActivateEvent();
+ void triggerDeactivateEvent();
+ void triggerInitializeEvent();
+ void triggerTerminateEvent();
+ void triggerLayoutEvent();
+ void triggerResizeEvent();
+
+ bool getInitState( void )
+ { return mbInit; }
+ void setInitState( bool bInit )
+ { mbInit = bInit; }
+
+ class SbUserFormModuleInstance* CreateInstance();
+};
+
+class BASIC_DLLPUBLIC SbUserFormModuleInstance : public SbUserFormModule
+{
+ SbUserFormModule* m_pParentModule;
+
+public:
+ SbUserFormModuleInstance( SbUserFormModule* pParentModule, const OUString& rName,
+ const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+
+ virtual sal_Bool IsClass( const OUString& ) const;
+ virtual SbxVariable* Find( const OUString& rName, SbxClassType t );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbprop.hxx b/include/basic/sbprop.hxx
new file mode 100644
index 000000000000..463fd5d41c73
--- /dev/null
+++ b/include/basic/sbprop.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBPROPERTY_HXX
+#define _SB_SBPROPERTY_HXX
+
+#include <basic/sbxprop.hxx>
+#include <basic/sbdef.hxx>
+#include "basicdllapi.h"
+
+class SbModule;
+
+class BASIC_DLLPUBLIC SbProperty : public SbxProperty
+{
+ friend class SbiFactory;
+ friend class SbModule;
+ friend class SbProcedureProperty;
+ SbModule* pMod;
+ sal_Bool bInvalid;
+ BASIC_DLLPRIVATE SbProperty( const OUString&, SbxDataType, SbModule* );
+ virtual ~SbProperty();
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICPROP,1);
+ TYPEINFO();
+ SbModule* GetModule() { return pMod; }
+};
+
+SV_DECL_IMPL_REF(SbProperty)
+
+class BASIC_DLLPUBLIC SbProcedureProperty : public SbxProperty
+{
+ bool mbSet; // Flag for set command
+
+ virtual ~SbProcedureProperty();
+
+public:
+ SbProcedureProperty( const OUString& r, SbxDataType t )
+ : SbxProperty( r, t ) // , pMod( p )
+ , mbSet( false )
+ {}
+ TYPEINFO();
+
+ bool isSet( void )
+ { return mbSet; }
+ void setSet( bool bSet )
+ { mbSet = bSet; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbstar.hxx b/include/basic/sbstar.hxx
new file mode 100644
index 000000000000..c84b62494169
--- /dev/null
+++ b/include/basic/sbstar.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBSTAR_HXX
+#define _SB_SBSTAR_HXX
+
+#include <basic/sbx.hxx>
+#include <basic/sbxobj.hxx>
+#include <rtl/ustring.hxx>
+#include <osl/mutex.hxx>
+#include <tools/link.hxx>
+
+#include <basic/sbdef.hxx>
+#include <basic/sberrors.hxx>
+#include <com/sun/star/script/ModuleInfo.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "basicdllapi.h"
+
+class SbModule; // completed module
+class SbiInstance; // runtime instance
+class SbiRuntime; // currently running procedure
+class SbiImage; // compiled image
+class BasicLibInfo; // info block for basic manager
+class SbMethod;
+class BasicManager;
+class DocBasicItem;
+
+class BASIC_DLLPUBLIC StarBASIC : public SbxObject
+{
+ friend class SbiScanner;
+ friend class SbiExpression; // Access to RTL
+ friend class SbiInstance;
+ friend class SbiRuntime;
+ friend class DocBasicItem;
+
+ SbxArrayRef pModules; // List of all modules
+ SbxObjectRef pRtl; // Runtime Library
+ SbxArrayRef xUnoListeners; // Listener handled by CreateUnoListener
+
+ // Handler-Support:
+ Link aErrorHdl; // Error handler
+ Link aBreakHdl; // Breakpoint handler
+ bool bNoRtl; // if true: do not search RTL
+ bool bBreak; // if true: Break, otherwise Step
+ bool bDocBasic;
+ bool bVBAEnabled;
+ BasicLibInfo* pLibInfo; // Info block for basic manager
+ bool bQuit;
+
+ SbxObjectRef pVBAGlobals;
+ BASIC_DLLPRIVATE SbxObject* getVBAGlobals( );
+
+ BASIC_DLLPRIVATE void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
+
+protected:
+ sal_Bool CError( SbError, const OUString&, sal_Int32, sal_Int32, sal_Int32 );
+private:
+ BASIC_DLLPRIVATE sal_Bool RTError( SbError, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE sal_Bool RTError( SbError, const OUString& rMsg, sal_Int32, sal_Int32, sal_Int32 );
+ BASIC_DLLPRIVATE sal_uInt16 BreakPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ BASIC_DLLPRIVATE sal_uInt16 StepPoint( sal_Int32 nLine, sal_Int32 nCol1, sal_Int32 nCol2 );
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+
+protected:
+ virtual sal_Bool ErrorHdl();
+ virtual sal_uInt16 BreakHdl();
+ virtual ~StarBASIC();
+
+public:
+
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASIC,1);
+ TYPEINFO();
+
+ StarBASIC( StarBASIC* pParent = NULL, bool bIsDocBasic = false );
+
+ // #51727 SetModified overridden so that the Modfied-State is
+ // not delivered to Parent.
+ virtual void SetModified( sal_Bool );
+
+ void* operator new( size_t );
+ void operator delete( void* );
+
+ virtual void Insert( SbxVariable* );
+ using SbxObject::Remove;
+ virtual void Remove( SbxVariable* );
+ virtual void Clear();
+
+ BasicLibInfo* GetLibInfo() { return pLibInfo; }
+ void SetLibInfo( BasicLibInfo* p ) { pLibInfo = p; }
+
+ // Compiler-Interface
+ SbModule* MakeModule( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule32( const OUString& rName, const OUString& rSrc );
+ SbModule* MakeModule32( const OUString& rName, const com::sun::star::script::ModuleInfo& mInfo, const OUString& rSrc );
+ sal_Bool Compile( SbModule* );
+ static void Stop();
+ static void Error( SbError );
+ static void Error( SbError, const OUString& rMsg );
+ static void FatalError( SbError );
+ static void FatalError( SbError, const OUString& rMsg );
+ static bool IsRunning();
+ static SbError GetErrBasic();
+ // #66536 make additional message accessible by RTL function Error
+ static OUString GetErrorMsg();
+ static sal_Int32 GetErl();
+
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ virtual sal_Bool Call( const OUString&, SbxArray* = NULL );
+
+ SbxArray* GetModules() { return pModules; }
+ SbxObject* GetRtl() { return pRtl; }
+ SbModule* FindModule( const OUString& );
+ // Run init code of all modules (including the inserted Doc-Basics)
+ void InitAllModules( StarBASIC* pBasicNotToInit = NULL );
+ void DeInitAllModules( void );
+ void ClearAllModuleVars( void );
+
+ // Calls for error and break handler
+ static sal_uInt16 GetLine();
+ static sal_uInt16 GetCol1();
+ static sal_uInt16 GetCol2();
+ static void SetErrorData( SbError nCode, sal_uInt16 nLine,
+ sal_uInt16 nCol1, sal_uInt16 nCol2 );
+
+ // Specific to error handler
+ static void MakeErrorText( SbError, const OUString& aMsg );
+ static const OUString& GetErrorText();
+ static SbError GetErrorCode();
+ static bool IsCompilerError();
+ static sal_uInt16 GetVBErrorCode( SbError nError );
+ static SbError GetSfxFromVBError( sal_uInt16 nError );
+ bool IsBreak() const { return bBreak; }
+
+ static Link GetGlobalErrorHdl();
+ static void SetGlobalErrorHdl( const Link& rNewHdl );
+ Link GetErrorHdl() const { return aErrorHdl; }
+ void SetErrorHdl( const Link& r ) { aErrorHdl = r; }
+
+ static void SetGlobalBreakHdl( const Link& rNewHdl );
+ Link GetBreakHdl() const { return aBreakHdl; }
+ void SetBreakHdl( const Link& r ) { aBreakHdl = r; }
+
+ SbxArrayRef getUnoListeners( void );
+
+ static SbxBase* FindSBXInCurrentScope( const OUString& rName );
+ static SbMethod* GetActiveMethod( sal_uInt16 nLevel = 0 );
+ static SbModule* GetActiveModule();
+ void SetVBAEnabled( bool bEnabled );
+ bool isVBAEnabled();
+
+ SbxObjectRef getRTL( void ) { return pRtl; }
+ bool IsDocBasic() { return bDocBasic; }
+ SbxVariable* VBAFind( const OUString& rName, SbxClassType t );
+ bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
+ void QuitAndExitApplication();
+ bool IsQuitApplication() { return bQuit; };
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
+ GetModelFromBasic( SbxObject* pBasic );
+};
+
+SV_DECL_IMPL_REF(StarBASIC)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbstdobj.hxx b/include/basic/sbstdobj.hxx
new file mode 100644
index 000000000000..75a5a6ecb452
--- /dev/null
+++ b/include/basic/sbstdobj.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBSTDOBJ1_HXX
+#define _SBSTDOBJ1_HXX
+
+#include <basic/sbxobj.hxx>
+#include <vcl/graph.hxx>
+#include <basic/sbxfac.hxx>
+#include "basicdllapi.h"
+
+//--------------------
+// class SbStdFactory
+//--------------------
+class BASIC_DLLPUBLIC SbStdFactory : public SbxFactory
+{
+public:
+ SbStdFactory();
+
+ virtual SbxObject* CreateObject( const OUString& rClassName );
+};
+
+//--------------------
+// class SbStdPicture
+//--------------------
+class BASIC_DLLPUBLIC SbStdPicture : public SbxObject
+{
+protected:
+ Graphic aGraphic;
+
+ ~SbStdPicture();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ void PropType( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropWidth( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropHeight( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+
+public:
+ TYPEINFO();
+
+ SbStdPicture();
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ Graphic GetGraphic() const { return aGraphic; }
+ void SetGraphic( const Graphic& rGrf ) { aGraphic = rGrf; }
+};
+
+//-----------------
+// class SbStdFont
+//-----------------
+class BASIC_DLLPUBLIC SbStdFont : public SbxObject
+{
+protected:
+ sal_Bool bBold;
+ sal_Bool bItalic;
+ sal_Bool bStrikeThrough;
+ sal_Bool bUnderline;
+ sal_uInt16 nSize;
+ OUString aName;
+
+ ~SbStdFont();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ void PropBold( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropItalic( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropStrikeThrough( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropUnderline( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropSize( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+ void PropName( SbxVariable* pVar, SbxArray* pPar, sal_Bool bWrite );
+
+public:
+ TYPEINFO();
+
+ SbStdFont();
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ void SetBold( sal_Bool bB ) { bBold = bB; }
+ sal_Bool IsBold() const { return bBold; }
+ void SetItalic( sal_Bool bI ) { bItalic = bI; }
+ sal_Bool IsItalic() const { return bItalic; }
+ void SetStrikeThrough( sal_Bool bS ) { bStrikeThrough = bS; }
+ sal_Bool IsStrikeThrough() const { return bStrikeThrough; }
+ void SetUnderline( sal_Bool bU ) { bUnderline = bU; }
+ sal_Bool IsUnderline() const { return bUnderline; }
+ void SetSize( sal_uInt16 nS ) { nSize = nS; }
+ sal_uInt16 GetSize() const { return nSize; }
+ void SetFontName( const OUString& rName ) { aName = rName; }
+ OUString GetFontName() const { return aName; }
+};
+
+//----------------------
+// class SbStdClipboard
+//----------------------
+class BASIC_DLLPUBLIC SbStdClipboard : public SbxObject
+{
+protected:
+
+ ~SbStdClipboard();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+
+ void MethClear( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethGetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethGetFormat( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethGetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethSetData( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+ void MethSetText( SbxVariable* pVar, SbxArray* pPar_, sal_Bool bWrite );
+
+public:
+ TYPEINFO();
+
+ SbStdClipboard();
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbuno.hxx b/include/basic/sbuno.hxx
new file mode 100644
index 000000000000..55d487a48b75
--- /dev/null
+++ b/include/basic/sbuno.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SB_SBUNO_HXX
+#define _SB_SBUNO_HXX
+
+#include <basic/sbxobj.hxx>
+#include "basicdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace uno { class Any; }}}}
+
+// Returns a SbxObject that wrapps an Uno Interface
+// Implementation in basic/source/classes/sbunoobj.cxx
+BASIC_DLLPUBLIC SbxObjectRef GetSbUnoObject( const OUString& aName, const com::sun::star::uno::Any& aUnoObj_ );
+
+// Force creation of all properties for debugging
+BASIC_DLLPUBLIC void createAllObjectProperties( SbxObject* pObj );
+BASIC_DLLPUBLIC void SetSbUnoObjectDfltPropName( SbxObject* pObj );
+
+BASIC_DLLPUBLIC ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+
+BASIC_DLLPUBLIC void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbx.hxx b/include/basic/sbx.hxx
new file mode 100644
index 000000000000..d5fba159e510
--- /dev/null
+++ b/include/basic/sbx.hxx
@@ -0,0 +1,280 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXCLASS_HXX
+#define _SBXCLASS_HXX
+
+#include "tools/ref.hxx"
+#include "svl/smplhint.hxx"
+#include "svl/lstner.hxx"
+
+#include <basic/sbxdef.hxx>
+#include <basic/sbxform.hxx>
+#include <basic/sbxobj.hxx>
+#include <basic/sbxprop.hxx>
+#include <basic/sbxmeth.hxx>
+#include "basicdllapi.h"
+
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SvStream;
+class SbxBase;
+class SbxVariable;
+class SbxProperty;
+class SbxMethod;
+class SbxObject;
+class SbxArray;
+class SbxDimArray;
+class SbxFactory;
+
+class SfxBroadcaster;
+
+// Parameter information
+struct SbxParamInfo
+{
+ const OUString aName; // Name of the parameter
+ SbxBaseRef aTypeRef; // Object, if object type
+ SbxDataType eType; // Data type
+ sal_uInt16 nFlags; // Flag-Bits
+ sal_uInt32 nUserData; // IDs etc.
+ SbxParamInfo( const OUString& s, SbxDataType t, sal_uInt16 n, SbxBase* b = NULL )
+ : aName( s ), aTypeRef( b ), eType( t ), nFlags( n ), nUserData( 0 ) {}
+ ~SbxParamInfo() {}
+};
+
+typedef boost::ptr_vector<SbxParamInfo> SbxParams;
+
+class BASIC_DLLPUBLIC SbxInfo : public SvRefBase
+{
+ friend class SbxVariable;
+ friend class SbMethod;
+
+ OUString aComment;
+ OUString aHelpFile;
+ sal_uInt32 nHelpId;
+ SbxParams aParams;
+
+protected:
+ sal_Bool LoadData( SvStream&, sal_uInt16 );
+ sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbxInfo();
+public:
+ SbxInfo();
+ SbxInfo( const OUString&, sal_uInt32 );
+
+ void AddParam( const OUString&, SbxDataType, sal_uInt16=SBX_READ );
+ const SbxParamInfo* GetParam( sal_uInt16 n ) const; // index starts with 1!
+ const OUString& GetComment() const { return aComment; }
+ const OUString& GetHelpFile() const { return aHelpFile; }
+ sal_uInt32 GetHelpId() const { return nHelpId; }
+
+ void SetComment( const OUString& r ) { aComment = r; }
+ void SetHelpFile( const OUString& r ) { aHelpFile = r; }
+ void SetHelpId( sal_uInt32 nId ) { nHelpId = nId; }
+};
+
+class BASIC_DLLPUBLIC SbxHint : public SfxSimpleHint
+{
+ SbxVariable* pVar;
+public:
+ TYPEINFO();
+ SbxHint( sal_uIntPtr n, SbxVariable* v ) : SfxSimpleHint( n ), pVar( v ) {}
+ SbxVariable* GetVar() const { return pVar; }
+};
+
+// SbxAlias is an alias for a var or object
+class BASIC_DLLPUBLIC SbxAlias : public SbxVariable, public SfxListener
+{
+ SbxVariableRef xAlias;
+ virtual ~SbxAlias();
+ virtual void Broadcast( sal_uIntPtr );
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SbxAlias( const SbxAlias& );
+ SbxAlias& operator=( const SbxAlias& );
+};
+
+// SbxArray is an unidimensional, dynamic Array
+// The variables convert from SbxVariablen. Put()/Insert() into the
+// declared datatype, if they are not SbxVARIANT.
+
+class SbxVarRefs;
+class SbxVariableRef;
+
+class BASIC_DLLPUBLIC SbxArray : public SbxBase
+{
+// #100883 Method to set method directly to parameter array
+ friend class SbMethod;
+ friend class SbClassModuleObject;
+ friend SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
+ BASIC_DLLPRIVATE void PutDirect( SbxVariable* pVar, sal_uInt32 nIdx );
+
+ SbxVarRefs* pData; // The variables
+
+protected:
+ SbxDataType eType; // Data type of the array
+ virtual ~SbxArray();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_ARRAY,1);
+ TYPEINFO();
+ SbxArray( SbxDataType=SbxVARIANT );
+ SbxArray( const SbxArray& );
+ SbxArray& operator=( const SbxArray& );
+ virtual void Clear();
+ sal_uInt16 Count() const;
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+ SbxVariableRef& GetRef( sal_uInt16 );
+ SbxVariable* Get( sal_uInt16 );
+ void Put( SbxVariable*, sal_uInt16 );
+ void Insert( SbxVariable*, sal_uInt16 );
+ void Remove( sal_uInt16 );
+ void Remove( SbxVariable* );
+ void Merge( SbxArray* );
+ const OUString& GetAlias( sal_uInt16 );
+ void PutAlias( const OUString&, sal_uInt16 );
+ SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+
+ // Additional methods for 32-bit indices
+ sal_uInt32 Count32() const;
+ SbxVariableRef& GetRef32( sal_uInt32 );
+ SbxVariable* Get32( sal_uInt32 );
+ void Put32( SbxVariable*, sal_uInt32 );
+ void Insert32( SbxVariable*, sal_uInt32 );
+ void Remove32( sal_uInt32 );
+};
+
+// SbxDimArray is an array that can dimensioned using BASIC conventions.
+struct SbxDim;
+
+class BASIC_DLLPUBLIC SbxDimArray : public SbxArray
+{
+ SbxDim* pFirst, *pLast; // Links to Dimension table
+ short nDim; // Number of dimensions
+ BASIC_DLLPRIVATE void AddDimImpl32( sal_Int32, sal_Int32, sal_Bool bAllowSize0 );
+ bool mbHasFixedSize;
+protected:
+ sal_uInt16 Offset( const short* );
+ sal_uInt32 Offset32( const sal_Int32* );
+ sal_uInt32 Offset32( SbxArray* );
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbxDimArray();
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_DIMARRAY,1);
+ TYPEINFO();
+ SbxDimArray( SbxDataType=SbxVARIANT );
+ SbxDimArray( const SbxDimArray& );
+ SbxDimArray& operator=( const SbxDimArray& );
+ virtual void Clear();
+ using SbxArray::GetRef;
+ using SbxArray::Get;
+ SbxVariable* Get( const short* );
+ using SbxArray::Put;
+ void Put( SbxVariable*, const short* );
+ SbxVariable* Get( SbxArray* );
+
+ short GetDims() const;
+ void AddDim( short, short );
+ void unoAddDim( short, short );
+ sal_Bool GetDim( short, short&, short& ) const;
+
+ using SbxArray::GetRef32;
+ using SbxArray::Get32;
+ SbxVariable* Get32( const sal_Int32* );
+ using SbxArray::Put32;
+ void Put32( SbxVariable*, const sal_Int32* );
+ void AddDim32( sal_Int32, sal_Int32 );
+ void unoAddDim32( sal_Int32, sal_Int32 );
+ sal_Bool GetDim32( sal_Int32, sal_Int32&, sal_Int32& ) const;
+ bool hasFixedSize() { return mbHasFixedSize; };
+ void setHasFixedSize( bool bHasFixedSize ) {mbHasFixedSize = bHasFixedSize; };
+};
+
+class BASIC_DLLPUBLIC SbxCollection : public SbxObject
+{
+ BASIC_DLLPRIVATE void Initialize();
+protected:
+ virtual ~SbxCollection();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+ // Overridable methods (why not pure virtual?):
+ virtual void CollAdd( SbxArray* pPar );
+ virtual void CollItem( SbxArray* pPar );
+ virtual void CollRemove( SbxArray* pPar );
+
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_COLLECTION,1);
+ TYPEINFO();
+ SbxCollection( const OUString& rClassname );
+ SbxCollection( const SbxCollection& );
+ SbxCollection& operator=( const SbxCollection& );
+ virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ virtual void Clear();
+};
+
+class BASIC_DLLPUBLIC SbxStdCollection : public SbxCollection
+{
+protected:
+ OUString aElemClass;
+ sal_Bool bAddRemoveOk;
+ virtual ~SbxStdCollection();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual void CollAdd( SbxArray* pPar );
+ virtual void CollRemove( SbxArray* pPar );
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_FIXCOLLECTION,1);
+ TYPEINFO();
+ SbxStdCollection( const OUString& rClassname, const OUString& rElemClass, sal_Bool=sal_True );
+ SbxStdCollection( const SbxStdCollection& );
+ SbxStdCollection& operator=( const SbxStdCollection& );
+ virtual void Insert( SbxVariable* );
+ const OUString& GetElementClass() const { return aElemClass; }
+};
+
+SV_IMPL_REF(SbxBase)
+
+SV_IMPL_REF(SbxVariable)
+
+#ifndef SBX_ARRAY_DECL_DEFINED
+#define SBX_ARRAY_DECL_DEFINED
+SV_DECL_REF(SbxArray)
+#endif
+SV_IMPL_REF(SbxArray)
+
+#ifndef SBX_INFO_DECL_DEFINED
+#define SBX_INFO_DECL_DEFINED
+SV_DECL_REF(SbxInfo)
+#endif
+SV_IMPL_REF(SbxInfo)
+
+SV_DECL_REF(SbxDimArray)
+SV_IMPL_REF(SbxDimArray)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxbase.hxx b/include/basic/sbxbase.hxx
new file mode 100644
index 000000000000..16484ee929d8
--- /dev/null
+++ b/include/basic/sbxbase.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXBASE_HXX
+#define _SBXBASE_HXX
+
+#include <i18nlangtag/lang.h>
+#include <basic/sbxdef.hxx>
+#include "basicdllapi.h"
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SbxFactory;
+class SbxVariable;
+class SbxBasicFormater;
+
+typedef boost::ptr_vector<SbxFactory> SbxFacs;
+
+// AppData structure for SBX:
+struct SbxAppData
+{
+ SbxError eSbxError; // Error code
+ SbxFacs aFacs; // Factories
+ SbxBasicFormater *pBasicFormater; // Pointer to Format()-Command helper class
+
+ LanguageType eBasicFormaterLangType;
+ // It might be useful to store this class 'global' because some string reosurces are saved here
+
+ SbxAppData() : eSbxError( SbxERR_OK ), aFacs(), pBasicFormater( NULL ) {}
+ ~SbxAppData();
+};
+
+BASIC_DLLPUBLIC SbxAppData& GetSbxData_Impl();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
new file mode 100644
index 000000000000..4c71d1a5b977
--- /dev/null
+++ b/include/basic/sbxcore.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXCORE_HXX
+#define _SBXCORE_HXX
+
+#include <tools/rtti.hxx>
+#include <tools/ref.hxx>
+#include <tools/debug.hxx>
+
+#include <basic/sbxdef.hxx>
+#include "basicdllapi.h"
+
+class SvStream;
+
+// The following Macro defines four (five) necessary methods within a
+// SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
+// They are necessary for loading/storing the data of derived classes.
+// Load() and Store() must not be overridden.
+
+// This version of the Macros does not define Load/StorePrivateData()-methods
+#define SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer ) \
+ virtual sal_uInt32 GetCreator() const { return nCre; } \
+ virtual sal_uInt16 GetVersion() const { return nVer; } \
+ virtual sal_uInt16 GetSbxId() const { return nSbxId; }
+
+// This version of the macro defines Load/StorePrivateData()-methods
+#define SBX_DECL_PERSIST( nCre, nSbxId, nVer ) \
+ virtual sal_Bool LoadPrivateData( SvStream&, sal_uInt16 ); \
+ virtual sal_Bool StorePrivateData( SvStream& ) const; \
+ SBX_DECL_PERSIST_NODATA( nCre, nSbxId, nVer )
+
+class SbxBase;
+class SbxFactory;
+class SbxObject;
+
+DBG_NAMEEX_VISIBILITY(SbxBase, BASIC_DLLPUBLIC)
+
+class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
+{
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+protected:
+ sal_uInt16 nFlags; // Flag-Bits
+
+ SbxBase();
+ SbxBase( const SbxBase& );
+ SbxBase& operator=( const SbxBase& );
+ virtual ~SbxBase();
+ SBX_DECL_PERSIST(0,0,0);
+public:
+ TYPEINFO();
+ inline void SetFlags( sal_uInt16 n );
+ inline sal_uInt16 GetFlags() const;
+ inline void SetFlag( sal_uInt16 n );
+ inline void ResetFlag( sal_uInt16 n );
+ inline sal_Bool IsSet( sal_uInt16 n ) const;
+ inline sal_Bool IsReset( sal_uInt16 n ) const;
+ inline sal_Bool CanRead() const;
+ inline sal_Bool CanWrite() const;
+ inline sal_Bool IsModified() const;
+ inline sal_Bool IsConst() const;
+ inline sal_Bool IsHidden() const;
+ inline sal_Bool IsVisible() const;
+
+ virtual sal_Bool IsFixed() const;
+ virtual void SetModified( sal_Bool );
+
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+
+ virtual void Clear();
+
+ static SbxBase* Load( SvStream& );
+ static void Skip( SvStream& );
+ sal_Bool Store( SvStream& );
+ virtual sal_Bool LoadCompleted();
+ virtual sal_Bool StoreCompleted();
+
+ static SbxError GetError();
+ static void SetError( SbxError );
+ static sal_Bool IsError();
+ static void ResetError();
+
+ // Set the factory for Load/Store/Create
+ static void AddFactory( SbxFactory* );
+ static void RemoveFactory( SbxFactory* );
+
+ static SbxBase* Create( sal_uInt16, sal_uInt32=SBXCR_SBX );
+ static SbxObject* CreateObject( const OUString& );
+};
+
+SV_DECL_REF(SbxBase)
+
+inline void SbxBase::SetFlags( sal_uInt16 n )
+{ //DBG_CHKTHIS( SbxBase, 0 );
+ nFlags = n; }
+
+inline sal_uInt16 SbxBase::GetFlags() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return nFlags; }
+
+inline void SbxBase::SetFlag( sal_uInt16 n )
+{ //DBG_CHKTHIS( SbxBase, 0 );
+ nFlags |= n; }
+
+inline void SbxBase::ResetFlag( sal_uInt16 n )
+{ //DBG_CHKTHIS( SbxBase, 0 );
+ nFlags &= ~n; }
+
+inline sal_Bool SbxBase::IsSet( sal_uInt16 n ) const
+{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) != 0 ); }
+
+inline sal_Bool SbxBase::IsReset( sal_uInt16 n ) const
+{ DBG_CHKTHIS( SbxBase, 0 ); return sal_Bool( ( nFlags & n ) == 0 ); }
+
+inline sal_Bool SbxBase::CanRead() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_READ ); }
+
+inline sal_Bool SbxBase::CanWrite() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_WRITE ); }
+
+inline sal_Bool SbxBase::IsModified() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_MODIFIED ); }
+
+inline sal_Bool SbxBase::IsConst() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_CONST ); }
+
+inline sal_Bool SbxBase::IsHidden() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsSet( SBX_HIDDEN ); }
+
+inline sal_Bool SbxBase::IsVisible() const
+{ DBG_CHKTHIS( SbxBase, 0 ); return IsReset( SBX_INVISIBLE ); }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxdef.hxx b/include/basic/sbxdef.hxx
new file mode 100644
index 000000000000..781a71b3b430
--- /dev/null
+++ b/include/basic/sbxdef.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SBXDEF_HXX
+#define _SBXDEF_HXX
+
+
+#ifndef __RSC
+#include <tools/solar.h>
+#include "tools/errcode.hxx"
+
+enum SbxClassType { // SBX-class-IDs (order is important!)
+ SbxCLASS_DONTCARE = 1, // don't care (search, not 0 due to StarBASIC)
+ SbxCLASS_ARRAY, // Array of SbxVariables
+ SbxCLASS_VALUE, // simple value
+ SbxCLASS_VARIABLE, // Variable (from here there is Broadcaster)
+ SbxCLASS_METHOD, // Method (Function or Sub)
+ SbxCLASS_PROPERTY, // Property
+ SbxCLASS_OBJECT // Object
+};
+
+enum SbxDataType {
+ SbxEMPTY = 0, // * Uninitialized
+ SbxNULL = 1, // * Contains no valid data
+ SbxINTEGER = 2, // * Integer (sal_Int16)
+ SbxLONG = 3, // * Long integer (sal_Int32)
+ SbxSINGLE = 4, // * Single-precision floating point number (float)
+ SbxDOUBLE = 5, // * Double-precision floating point number (double)
+ SbxCURRENCY = 6, // Currency (sal_Int64)
+ SbxDATE = 7, // * Date (double)
+ SbxSTRING = 8, // * String (StarView)
+ SbxOBJECT = 9, // * SbxBase object pointer
+ SbxERROR = 10, // * Error (sal_uInt16)
+ SbxBOOL = 11, // * Boolean (0 or -1)
+
+ SbxVARIANT = 12, // * Display for variant datatype
+ SbxDATAOBJECT = 13, // * Common data object w/o ref count
+
+ SbxCHAR = 16, // * signed char
+ SbxBYTE = 17, // * unsigned char
+ SbxUSHORT = 18, // * unsigned short (sal_uInt16)
+ SbxULONG = 19, // * unsigned long (sal_uInt32)
+
+//deprecated: // old 64bit types kept for backward compatibility in file I/O
+ SbxLONG64 = 20, // moved to SbxSALINT64 as 64bit int
+ SbxULONG64 = 21, // moved to SbxSALUINT64 as 64bit int
+
+ SbxINT = 22, // * signed machine-dependent int
+ SbxUINT = 23, // * unsigned machine-dependent int
+
+ SbxVOID = 24, // * no value (= SbxEMPTY)
+ SbxHRESULT = 25, // HRESULT
+ SbxPOINTER = 26, // generic pointer
+ SbxDIMARRAY = 27, // dimensioned array
+ SbxCARRAY = 28, // C style array
+ SbxUSERDEF = 29, // user defined
+ SbxLPSTR = 30, // * null terminated string
+
+ SbxLPWSTR = 31, // wide null terminated string
+ SbxCoreSTRING = 32, // from 1997-4-10 for GetCoreString(), only for converting<
+
+ SbxWSTRING = 33, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxWCHAR = 34, // from 2000-10-4 Reimplemented for backwards compatibility (#78919)
+ SbxSALINT64 = 35, // for currency internal, signed 64-bit int and UNO hyper
+ SbxSALUINT64= 36, // for currency internal, unsigned 64-bit int and UNO unsigned hyper
+ SbxDECIMAL = 37, // for UNO/automation Decimal
+
+ SbxVECTOR = 0x1000, // simple counted array
+ SbxARRAY = 0x2000, // array
+ SbxBYREF = 0x4000, // access by reference
+
+ SbxSV1 = 128, // first defined data type for StarView
+ SbxMEMORYSTREAM, // SvMemoryStream
+ SbxSTORAGE, // SvStorage
+
+ SbxUSER1 = 256, // first user defined data type
+ SbxUSERn = 2047 // last user defined data type
+};
+
+const sal_uInt32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
+const sal_uInt32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
+const sal_uInt32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
+const sal_uInt32 SBX_TYPE_VAR_TO_DIM_FLAG = 0x40000;
+
+enum SbxOperator {
+ // Arithmetical:
+ SbxEXP, // this ^ var
+ SbxMUL, // this * var
+ SbxDIV, // this / var
+ SbxMOD, // this MOD var (max INT32!)
+ SbxPLUS, // this + var
+ SbxMINUS, // this - var
+ SbxNEG, // -this (var is ignored)
+ SbxIDIV, // this / var (both operands max. sal_Int32!)
+ // Boolean operators (max sal_Int32!):
+ // Boolean operators (TODO deprecate this limit: max INT32!)
+ SbxAND, // this & var
+ SbxOR, // this | var
+ SbxXOR, // this ^ var
+ SbxEQV, // ~this ^ var
+ SbxIMP, // ~this | var
+ SbxNOT, // ~this (var is ignored)
+
+ // String concatenation:
+ SbxCAT, // this & var (VBA: this + var)
+
+ // Comparisons:
+ SbxEQ, // this = var
+ SbxNE, // this <> var
+ SbxLT, // this < var
+ SbxGT, // this > var
+ SbxLE, // this <= var
+ SbxGE // this >= var
+};
+
+enum SbxNameType { // Type of the questioned name of a variable
+ SbxNAME_NONE, // plain name
+ SbxNAME_SHORT, // Name(A,B)
+ SbxNAME_SHORT_TYPES, // Name%(A%,B$)
+ SbxNAME_LONG_TYPES // Name(A As Integer, B As String) As Integer
+};
+
+// from 1996/3/20: New error messages
+typedef sal_uIntPtr SbxError; // Preserve old type
+
+#endif
+
+
+// New error codes per define
+#define ERRCODE_SBX_OK ERRCODE_NONE // processed
+
+#define ERRCODE_SBX_SYNTAX (1UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_COMPILER)
+#define ERRCODE_SBX_NOTIMP (2UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED)
+#define ERRCODE_SBX_OVERFLOW (3UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // overflow
+#define ERRCODE_SBX_BOUNDS (4UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid array index
+#define ERRCODE_SBX_ZERODIV (5UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Division by zero
+#define ERRCODE_SBX_CONVERSION (6UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // wrong data type
+#define ERRCODE_SBX_BAD_PARAMETER (7UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // invalid Parameter
+#define ERRCODE_SBX_PROC_UNDEFINED (8UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Sub or Func not def
+#define ERRCODE_SBX_ERROR (9UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_UNKNOWN) // generic object error
+#define ERRCODE_SBX_NO_OBJECT (10UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object var not object
+#define ERRCODE_SBX_CANNOT_LOAD (11UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_CREATE) // Object init/load fail
+#define ERRCODE_SBX_BAD_INDEX (12UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid object index
+#define ERRCODE_SBX_NO_ACTIVE_OBJECT (13UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Object not active
+#define ERRCODE_SBX_BAD_PROP_VALUE (14UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Bad property value
+#define ERRCODE_SBX_PROP_READONLY (15UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_READ) // Property is read only
+#define ERRCODE_SBX_PROP_WRITEONLY (16UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_WRITE) // Property is write only
+#define ERRCODE_SBX_INVALID_OBJECT (17UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object reference
+#define ERRCODE_SBX_NO_METHOD (18UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Property oder Methode unbekannt
+#define ERRCODE_SBX_INVALID_USAGE_OBJECT (19UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // Invalid object usage
+#define ERRCODE_SBX_NO_OLE (20UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_ACCESS) // No OLE-Object
+#define ERRCODE_SBX_BAD_METHOD (21UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Method not supported
+#define ERRCODE_SBX_OLE_ERROR (22UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // OLE Automation Error
+#define ERRCODE_SBX_BAD_ACTION (23UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Action not supported
+#define ERRCODE_SBX_NO_NAMED_ARGS (24UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // No named arguments
+#define ERRCODE_SBX_BAD_LOCALE (25UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_NOTSUPPORTED) // Locale not supported
+#define ERRCODE_SBX_NAMED_NOT_FOUND (26UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Unknown named argument
+#define ERRCODE_SBX_NOT_OPTIONAL (27UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Argument not optional
+#define ERRCODE_SBX_WRONG_ARGS (28UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_SBX) // Invalid number of arguments
+#define ERRCODE_SBX_NOT_A_COLL (29UL | ERRCODE_AREA_SBX | ERRCODE_CLASS_RUNTIME) // Object contains no elements
+#define LAST_SBX_ERROR_ID 29UL
+
+#ifndef __RSC
+
+// Map old codes to new ones
+#define SbxERR_OK ERRCODE_SBX_OK
+#define SbxERR_SYNTAX ERRCODE_SBX_SYNTAX
+#define SbxERR_NOTIMP ERRCODE_SBX_NOTIMP
+#define SbxERR_OVERFLOW ERRCODE_SBX_OVERFLOW
+#define SbxERR_BOUNDS ERRCODE_SBX_BOUNDS
+#define SbxERR_ZERODIV ERRCODE_SBX_ZERODIV
+#define SbxERR_CONVERSION ERRCODE_SBX_CONVERSION
+#define SbxERR_BAD_PARAMETER ERRCODE_SBX_BAD_PARAMETER
+#define SbxERR_PROC_UNDEFINED ERRCODE_SBX_PROC_UNDEFINED
+#define SbxERR_ERROR ERRCODE_SBX_ERROR
+#define SbxERR_NO_OBJECT ERRCODE_SBX_NO_OBJECT
+#define SbxERR_CANNOT_LOAD ERRCODE_SBX_CANNOT_LOAD
+#define SbxERR_BAD_INDEX ERRCODE_SBX_BAD_INDEX
+#define SbxERR_NO_ACTIVE_OBJECT ERRCODE_SBX_NO_ACTIVE_OBJECT
+#define SbxERR_BAD_PROP_VALUE ERRCODE_SBX_BAD_PROP_VALUE
+#define SbxERR_PROP_READONLY ERRCODE_SBX_PROP_READONLY
+#define SbxERR_PROP_WRITEONLY ERRCODE_SBX_PROP_WRITEONLY
+#define SbxERR_INVALID_OBJECT ERRCODE_SBX_INVALID_OBJECT
+#define SbxERR_NO_METHOD ERRCODE_SBX_NO_METHOD
+#define SbxERR_INVALID_USAGE_OBJECT ERRCODE_SBX_INVALID_USAGE_OBJECT
+#define SbxERR_NO_OLE ERRCODE_SBX_NO_OLE
+#define SbxERR_BAD_METHOD ERRCODE_SBX_BAD_METHOD
+#define SbxERR_OLE_ERROR ERRCODE_SBX_OLE_ERROR
+#define SbxERR_BAD_ACTION ERRCODE_SBX_BAD_ACTION
+#define SbxERR_NO_NAMED_ARGS ERRCODE_SBX_NO_NAMED_ARGS
+#define SbxERR_BAD_LOCALE ERRCODE_SBX_BAD_LOCALE
+#define SbxERR_NAMED_NOT_FOUND ERRCODE_SBX_NAMED_NOT_FOUND
+#define SbxERR_NOT_OPTIONAL ERRCODE_SBX_NOT_OPTIONAL
+#define SbxERR_WRONG_ARGS ERRCODE_SBX_WRONG_ARGS
+#define SbxERR_NOT_A_COLL ERRCODE_SBX_NOT_A_COLL
+
+
+// Flag-Bits:
+#define SBX_READ 0x0001 // Read permission
+#define SBX_WRITE 0x0002 // Write permission
+#define SBX_READWRITE 0x0003 // Read/Write permission
+#define SBX_DONTSTORE 0x0004 // Don't store object
+#define SBX_MODIFIED 0x0008 // Object was changed
+#define SBX_FIXED 0x0010 // Fixed data type (SbxVariable)
+#define SBX_CONST 0x0020 // Definition of const value
+#define SBX_OPTIONAL 0x0040 // Parameter is optional
+#define SBX_HIDDEN 0x0080 // Element is invisible
+#define SBX_INVISIBLE 0x0100 // Element is not found by Find()
+#define SBX_EXTSEARCH 0x0200 // Object is searched completely
+#define SBX_EXTFOUND 0x0400 // Variable was found through extended search
+#define SBX_GBLSEARCH 0x0800 // Global search via Parents
+#define SBX_RESERVED 0x1000 // reserved
+#define SBX_PRIVATE 0x1000 // #110004, #112015, cannot conflict with SBX_RESERVED
+#define SBX_NO_BROADCAST 0x2000 // No broadcast on Get/Put
+#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
+#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
+#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
+#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
+ // is used for objects, the other for variables only
+#define SBX_VAR_TO_DIM 0x2000 // Same value as SBX_NO_BROADCAST, cannot conflict as
+ // used for variables without broadcaster only
+
+// Broadcaster-IDs:
+#define SBX_HINT_DYING SFX_HINT_DYING
+#define SBX_HINT_DATAWANTED SFX_HINT_USER00
+#define SBX_HINT_DATACHANGED SFX_HINT_DATACHANGED
+#define SBX_HINT_CONVERTED SFX_HINT_USER01
+#define SBX_HINT_INFOWANTED SFX_HINT_USER02
+#define SBX_HINT_OBJECTCHANGED SFX_HINT_USER03
+
+// List of all creators for Load/Store
+
+#define SBXCR_SBX 0x20584253 // SBX(blank)
+
+// List of predefined SBX-IDs. New SBX-IDs must be precisly defined so that
+// they are unique within the Stream and appropriate Factory.
+
+#define SBXID_VALUE 0x4E4E // NN: SbxValue
+#define SBXID_VARIABLE 0x4156 // VA: SbxVariable
+#define SBXID_ARRAY 0x5241 // AR: SbxArray
+#define SBXID_DIMARRAY 0x4944 // DI: SbxDimArray
+#define SBXID_OBJECT 0x424F // OB: SbxObject
+#define SBXID_COLLECTION 0x4F43 // CO: SbxCollection
+#define SBXID_FIXCOLLECTION 0x4346 // FC: SbxStdCollection
+#define SBXID_METHOD 0x454D // ME: SbxMethod
+#define SBXID_PROPERTY 0x5250 // PR: SbxProperty
+
+// StarBASIC restricts the base data type to different intervals.
+// These intervals are fixed to create 'portability and independent
+// of the implementation. Only type double is greedy and takes
+// what it gets.
+
+#define SbxMAXCHAR ((sal_Unicode)65535)
+#define SbxMINCHAR (0)
+#define SbxMAXBYTE ( 255)
+#define SbxMAXINT ( 32767)
+#define SbxMININT (-32768)
+#define SbxMAXUINT ((sal_uInt16) 65535)
+#define SbxMAXLNG ( 2147483647)
+#define SbxMINLNG ((sal_Int32)(-2147483647-1))
+#define SbxMAXULNG ((sal_uInt32) 0xffffffff)
+
+#define SbxMAXSALUINT64 SAL_MAX_UINT64
+#define SbxMAXSALINT64 SAL_MAX_INT64
+#define SbxMINSALINT64 SAL_MIN_INT64
+
+ // Currency stored as SbxSALINT64 == sal_Int64
+ // value range limits are ~(2^63 - 1)/10000
+ // fixed precision has 4 digits right of decimal pt
+#define CURRENCY_FACTOR (10000)
+#define CURRENCY_FACTOR_SQUARE (100000000)
+
+// TODO effective MAX/MINCURR limits:
+// true value ( 922337203685477.5807) is too precise for correct comparison to 64bit double
+#define SbxMAXCURR ( 922337203685477.5807)
+#define SbxMINCURR (-922337203685477.5808)
+
+#define SbxMAXSNG ( 3.402823e+38)
+#define SbxMINSNG (-3.402823e+38)
+#define SbxMAXSNG2 ( 1.175494351e-38)
+#define SbxMINSNG2 (-1.175494351e-38)
+
+// Max valid offset index of a Sbx-Array (due to 64K limit)
+#define SBX_MAXINDEX 0x3FF0
+#define SBX_MAXINDEX32 SbxMAXLNG
+
+// The numeric values of sal_True and FALSE
+enum SbxBOOL { SbxFALSE = 0, SbxTRUE = -1 };
+
+#endif //ifndef __RSC
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxfac.hxx b/include/basic/sbxfac.hxx
new file mode 100644
index 000000000000..33035cf45c9b
--- /dev/null
+++ b/include/basic/sbxfac.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SBX_SBX_FACTORY_HXX
+#define __SBX_SBX_FACTORY_HXX
+
+#include <basic/sbxdef.hxx>
+#include <rtl/ustring.hxx>
+#include "basicdllapi.h"
+
+class SbxBase;
+class SbxObject;
+
+class BASIC_DLLPUBLIC SbxFactory
+{
+ bool bHandleLast; // true: Factory is asked at last because of its expensiveness
+public:
+ virtual ~SbxFactory();
+ SbxFactory( bool bLast=false ) { bHandleLast = bLast; }
+ bool IsHandleLast( void ) { return bHandleLast; }
+ virtual SbxBase* Create( sal_uInt16 nSbxId, sal_uInt32 = SBXCR_SBX );
+ virtual SbxObject* CreateObject( const OUString& );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxform.hxx b/include/basic/sbxform.hxx
new file mode 100644
index 000000000000..589f3ec24fd0
--- /dev/null
+++ b/include/basic/sbxform.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBXFORM_HXX
+#define _SBXFORM_HXX
+
+//====================================================================
+// Implementation class for Basic command: Format$( d,formatStr )
+//====================================================================
+/*
+ Grammar of format string (a try):
+ -----------------------------------------------
+
+ format_string := {\special_char} general_format | scientific_format {\special_char} {;format_string}
+ general_format := {#[,]}{0[,]}[.{0}{#}]
+ scientific_format := {0}[.{0}{#}](e | E)(+ | -){#}{0}
+
+ percent_char := '%'
+ special_char := \char | + | - | ( | ) | $ | space_char
+ char := all_ascii_chars
+ space_char := ' '
+
+ {} repeated multiple times (incl. zero times)
+ [] exactly one or zero times
+ () parenthesis, e.g. (e | E) means e or E times
+
+ Additional predefined formats for the format string:
+ "General Number"
+ "Currency"
+ "Fixed"
+ "Standard"
+ "Percent"
+ "Scientific"
+ "Yes/No"
+ "True/False"
+ "On/Off"
+
+ Note: invalid format string are ignored just as in VisualBasic, the output is
+ probably 'undefined'. ASCII letters are outputted directly.
+
+ Constraints in VisualBasic:
+ - the exponent (scientific syntax) has a maximum of three digits!
+
+ Constraints of new implementation:
+ - the '+' sign is not allowed as wildcard in the mantissa
+
+ TODO:
+ - Date formatting
+ Wildcards are: 'h', 'm', 's', 'y'
+ predefined String-Constants/Commands:
+ "AMPM", "Long Date", "Long Time"
+*/
+
+/*
+ There are two possibilities to get the number of digits of a number:
+
+ a) use sprintf()
+ b) use log10() and pow() digit
+*/
+#define _with_sprintf // use a)
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC SbxBasicFormater {
+ public:
+ // Constructor takes signs for decimal point, thousand separation sign
+ // and necessary resource strings.
+ SbxBasicFormater( sal_Unicode _cDecPoint, sal_Unicode _cThousandSep,
+ OUString _sOnStrg,
+ OUString _sOffStrg,
+ OUString _sYesStrg,
+ OUString _sNoStrg,
+ OUString _sTrueStrg,
+ OUString _sFalseStrg,
+ OUString _sCurrencyStrg,
+ OUString _sCurrencyFormatStrg );
+
+ /* Basic command: Format$( number,format-string )
+
+ Parameter:
+ dNumber : number to be formated
+ sFormatStrg : the Format-String, e.g. ###0.0###
+
+ Return value:
+ String containing the formatted output
+ */
+ OUString BasicFormat( double dNumber, OUString sFormatStrg );
+ OUString BasicFormatNull( OUString sFormatStrg );
+
+ static sal_Bool isBasicFormat( OUString sFormatStrg );
+
+ private:
+ BASIC_DLLPRIVATE inline void ShiftString( OUStringBuffer& sStrg, sal_uInt16 nStartPos );
+ BASIC_DLLPRIVATE void AppendDigit( OUStringBuffer& sStrg, short nDigit );
+ BASIC_DLLPRIVATE void LeftShiftDecimalPoint( OUStringBuffer& sStrg );
+ BASIC_DLLPRIVATE void StrRoundDigit( OUStringBuffer& sStrg, short nPos, sal_Bool& bOverflow );
+ BASIC_DLLPRIVATE void StrRoundDigit( OUStringBuffer& sStrg, short nPos );
+ BASIC_DLLPRIVATE void ParseBack( OUStringBuffer& sStrg, const OUString& sFormatStrg,
+ short nFormatPos );
+#ifdef _with_sprintf
+ // Methods for string conversion with sprintf():
+ BASIC_DLLPRIVATE void InitScan( double _dNum );
+ BASIC_DLLPRIVATE void InitExp( double _dNewExp );
+ BASIC_DLLPRIVATE short GetDigitAtPosScan( short nPos, sal_Bool& bFoundFirstDigit );
+ BASIC_DLLPRIVATE short GetDigitAtPosExpScan( double dNewExponent, short nPos,
+ sal_Bool& bFoundFirstDigit );
+ BASIC_DLLPRIVATE short GetDigitAtPosExpScan( short nPos, sal_Bool& bFoundFirstDigit );
+#else
+ // Methods for direct 'calculation' with log10() and pow():
+ BASIC_DLLPRIVATE short GetDigitAtPos( double dNumber, short nPos, double& dNextNumber,
+ sal_Bool& bFoundFirstDigit );
+ BASIC_DLLPRIVATE short RoundDigit( double dNumber );
+#endif
+ BASIC_DLLPRIVATE OUString GetPosFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString GetNegFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString Get0FormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE OUString GetNullFormatString( const OUString& sFormatStrg, sal_Bool & bFound );
+ BASIC_DLLPRIVATE short AnalyseFormatString( const OUString& sFormatStrg,
+ short& nNoOfDigitsLeft, short& nNoOfDigitsRight,
+ short& nNoOfOptionalDigitsLeft,
+ short& nNoOfExponentDigits,
+ short& nNoOfOptionalExponentDigits,
+ sal_Bool& bPercent, sal_Bool& bCurrency, sal_Bool& bScientific,
+ sal_Bool& bGenerateThousandSeparator,
+ short& nMultipleThousandSeparators );
+ BASIC_DLLPRIVATE void ScanFormatString( double dNumber, const OUString& sFormatStrg,
+ OUString& sReturnStrg, sal_Bool bCreateSign );
+
+ //*** Data ***
+ sal_Unicode cDecPoint; // sign for the decimal point
+ sal_Unicode cThousandSep; // sign for thousand delimiter
+ // Text for output:
+ OUString sOnStrg;
+ OUString sOffStrg;
+ OUString sYesStrg;
+ OUString sNoStrg;
+ OUString sTrueStrg;
+ OUString sFalseStrg;
+ OUString sCurrencyStrg;
+ OUString sCurrencyFormatStrg;
+
+ //*** temporary data for scan loop ***
+ //-----------------------------------------------
+ // String containing the number in scientific format
+ OUString sSciNumStrg;
+ // String containing the exponent of the number
+ OUString sNumExpStrg;
+ double dNum; // the number that is scanned
+ short nNumExp; // the exponent of the number
+ short nExpExp; // the number of digits in the exponent
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxmeth.hxx b/include/basic/sbxmeth.hxx
new file mode 100644
index 000000000000..227c00cbad88
--- /dev/null
+++ b/include/basic/sbxmeth.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SBX_SBXMETHOD_HXX
+#define __SBX_SBXMETHOD_HXX
+
+#include <basic/sbxvar.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC SbxMethod : public SbxVariable
+{
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_METHOD,1);
+ TYPEINFO();
+ SbxMethod( const OUString& r, SbxDataType t );
+ SbxMethod( const SbxMethod& r );
+ ~SbxMethod();
+ SbxMethod& operator=( const SbxMethod& r ) { SbxVariable::operator=( r ); return *this; }
+ virtual SbxClassType GetClass() const;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxobj.hxx b/include/basic/sbxobj.hxx
new file mode 100644
index 000000000000..2dc4aa735513
--- /dev/null
+++ b/include/basic/sbxobj.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SBX_SBXOBJECT_HXX
+#define _SBX_SBXOBJECT_HXX
+
+#include <svl/lstner.hxx>
+#include <basic/sbxvar.hxx>
+#include "basicdllapi.h"
+
+
+class SbxProperty;
+
+class BASIC_DLLPUBLIC SbxObject : public SbxVariable, public SfxListener
+{
+ BASIC_DLLPRIVATE SbxArray* FindVar( SbxVariable*, sal_uInt16& );
+protected:
+ SbxArrayRef pMethods; // Methods
+ SbxArrayRef pProps; // Properties
+ SbxArrayRef pObjs; // Objects
+ SbxProperty* pDfltProp; // Default-Property
+ OUString aClassName; // Classname
+ OUString aDfltPropName;
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+ virtual ~SbxObject();
+ virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
+ const SfxHint& rHint, const TypeId& rHintType );
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_OBJECT,1);
+ TYPEINFO();
+ SbxObject( const OUString& rClassname );
+ SbxObject( const SbxObject& );
+ SbxObject& operator=( const SbxObject& );
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+ virtual void Clear();
+
+ virtual sal_Bool IsClass( const OUString& ) const;
+ const OUString& GetClassName() const { return aClassName; }
+ void SetClassName( const OUString &rNew ) { aClassName = rNew; }
+ // Default-Property
+ SbxProperty* GetDfltProperty();
+ void SetDfltProperty( const OUString& r );
+ // Search for an element
+ virtual SbxVariable* FindUserData( sal_uInt32 nUserData );
+ virtual SbxVariable* Find( const OUString&, SbxClassType );
+ SbxVariable* FindQualified( const OUString&, SbxClassType );
+ // Quick-Call-Interface for Methods
+ virtual sal_Bool Call( const OUString&, SbxArray* = NULL );
+ // Execution of DDE-Commands
+ SbxVariable* Execute( const OUString& );
+ // Manage elements
+ virtual sal_Bool GetAll( SbxClassType ) { return sal_True; }
+ SbxVariable* Make( const OUString&, SbxClassType, SbxDataType );
+ virtual SbxObject* MakeObject( const OUString&, const OUString& );
+ virtual void Insert( SbxVariable* );
+ // AB 23.4.1997, Optimization, Insertion without check for duplicate Entries and
+ // without Broadcasts, only used in SO2/auto.cxx
+ void QuickInsert( SbxVariable* );
+ virtual void Remove( const OUString&, SbxClassType );
+ virtual void Remove( SbxVariable* );
+
+ // Macro-Recording
+ virtual OUString GenerateSource( const OUString &rLinePrefix,
+ const SbxObject *pRelativeTo );
+ // Direct access on arrays
+ SbxArray* GetMethods() { return pMethods; }
+ SbxArray* GetProperties() { return pProps; }
+ SbxArray* GetObjects() { return pObjs; }
+ // Debugging
+ void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
+};
+
+SV_DECL_REF(SbxObject)
+SV_IMPL_REF(SbxObject)
+
+#endif /* _SBX_SBXOBJECT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxprop.hxx b/include/basic/sbxprop.hxx
new file mode 100644
index 000000000000..89d774d4967f
--- /dev/null
+++ b/include/basic/sbxprop.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __SBX_SBXPROPERTY_HXX
+#define __SBX_SBXPROPERTY_HXX
+
+#include <basic/sbxvar.hxx>
+#include "basicdllapi.h"
+
+class BASIC_DLLPUBLIC SbxProperty : public SbxVariable
+{
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_PROPERTY,1);
+ TYPEINFO();
+ SbxProperty( const OUString& r, SbxDataType t );
+ SbxProperty( const SbxProperty& r ) : SvRefBase( r ), SbxVariable( r ) {}
+ virtual ~SbxProperty();
+ SbxProperty& operator=( const SbxProperty& r )
+ { SbxVariable::operator=( r ); return *this; }
+ virtual SbxClassType GetClass() const;
+};
+
+SV_DECL_REF(SbxProperty)
+SV_IMPL_REF(SbxProperty)
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/sbxvar.hxx b/include/basic/sbxvar.hxx
new file mode 100644
index 000000000000..4d4a8b625bc3
--- /dev/null
+++ b/include/basic/sbxvar.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SBXVAR_HXX
+#define SBXVAR_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
+#include <basic/sbxcore.hxx>
+#include "basicdllapi.h"
+
+
+class SbxDecimal;
+
+struct SbxValues
+{
+ union {
+ sal_uInt8 nByte;
+ sal_uInt16 nUShort;
+ sal_Unicode nChar;
+ sal_Int16 nInteger;
+ sal_uInt32 nULong;
+ sal_Int32 nLong;
+ unsigned int nUInt;
+ int nInt;
+ sal_uInt64 uInt64;
+ sal_Int64 nInt64;
+
+ float nSingle;
+ double nDouble;
+
+ OUString* pOUString;
+ SbxDecimal* pDecimal;
+
+ SbxBase* pObj;
+
+ sal_uInt8* pByte;
+ sal_uInt16* pUShort;
+ sal_Unicode* pChar;
+ sal_Int16* pInteger;
+ sal_uInt32* pULong;
+ sal_Int32* pLong;
+ unsigned int* pUInt;
+ int* pInt;
+ sal_uInt64* puInt64;
+ sal_Int64* pnInt64;
+
+ float* pSingle;
+ double* pDouble;
+
+ void* pData;
+ };
+ SbxDataType eType;
+
+ SbxValues(): pData( NULL ), eType(SbxEMPTY) {}
+ SbxValues( SbxDataType e ): eType(e) {}
+ SbxValues( char _nChar ): nChar( _nChar ), eType(SbxCHAR) {}
+ SbxValues( sal_uInt8 _nByte ): nByte( _nByte ), eType(SbxBYTE) {}
+ SbxValues( short _nInteger ): nInteger( _nInteger ), eType(SbxINTEGER ) {}
+ SbxValues( long _nLong ): nLong( _nLong ), eType(SbxLONG) {}
+ SbxValues( sal_uInt16 _nUShort ): nUShort( _nUShort ), eType(SbxUSHORT) {}
+ SbxValues( sal_uIntPtr _nULong ): nULong( _nULong ), eType(SbxULONG) {}
+ SbxValues( int _nInt ): nInt( _nInt ), eType(SbxINT) {}
+ SbxValues( unsigned int _nUInt ): nUInt( _nUInt ), eType(SbxUINT) {}
+ SbxValues( float _nSingle ): nSingle( _nSingle ), eType(SbxSINGLE) {}
+ SbxValues( double _nDouble ): nDouble( _nDouble ), eType(SbxDOUBLE) {}
+ SbxValues( const OUString* _pString ): pOUString( (OUString*)_pString ), eType(SbxSTRING) {}
+ SbxValues( SbxBase* _pObj ): pObj( _pObj ), eType(SbxOBJECT) {}
+ SbxValues( sal_Unicode* _pChar ): pChar( _pChar ), eType(SbxLPSTR) {}
+ SbxValues( void* _pData ): pData( _pData ), eType(SbxPOINTER) {}
+
+};
+
+class BASIC_DLLPUBLIC SbxValue : public SbxBase
+{
+ // #55226 Transport additional infos
+ BASIC_DLLPRIVATE SbxValue* TheRealValue( sal_Bool bObjInObjError ) const;
+ BASIC_DLLPRIVATE SbxValue* TheRealValue() const;
+protected:
+ SbxValues aData; // Data
+ OUString aPic; // Picture-String
+ OUString aToolString; // tool string copy
+
+ virtual void Broadcast( sal_uIntPtr ); // Broadcast-Call
+ virtual ~SbxValue();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VALUE,1);
+ TYPEINFO();
+ SbxValue();
+ SbxValue( SbxDataType, void* = NULL );
+ SbxValue( const SbxValue& );
+ SbxValue& operator=( const SbxValue& );
+ virtual void Clear();
+ virtual sal_Bool IsFixed() const;
+
+ sal_Bool IsInteger() const { return sal_Bool( GetType() == SbxINTEGER ); }
+ sal_Bool IsLong() const { return sal_Bool( GetType() == SbxLONG ); }
+ sal_Bool IsSingle() const { return sal_Bool( GetType() == SbxSINGLE ); }
+ sal_Bool IsDouble() const { return sal_Bool( GetType() == SbxDOUBLE ); }
+ sal_Bool IsString() const { return sal_Bool( GetType() == SbxSTRING ); }
+ sal_Bool IsDate() const { return sal_Bool( GetType() == SbxDATE ); }
+ sal_Bool IsCurrency()const { return sal_Bool( GetType() == SbxCURRENCY ); }
+ sal_Bool IsObject() const { return sal_Bool( GetType() == SbxOBJECT ); }
+ sal_Bool IsDataObject()const{return sal_Bool( GetType() == SbxDATAOBJECT);}
+ sal_Bool IsBool() const { return sal_Bool( GetType() == SbxBOOL ); }
+ sal_Bool IsErr() const { return sal_Bool( GetType() == SbxERROR ); }
+ sal_Bool IsEmpty() const { return sal_Bool( GetType() == SbxEMPTY ); }
+ sal_Bool IsNull() const { return sal_Bool( GetType() == SbxNULL ); }
+ sal_Bool IsChar() const { return sal_Bool( GetType() == SbxCHAR ); }
+ sal_Bool IsByte() const { return sal_Bool( GetType() == SbxBYTE ); }
+ sal_Bool IsUShort() const { return sal_Bool( GetType() == SbxUSHORT ); }
+ sal_Bool IsULong() const { return sal_Bool( GetType() == SbxULONG ); }
+ sal_Bool IsInt() const { return sal_Bool( GetType() == SbxINT ); }
+ sal_Bool IsUInt() const { return sal_Bool( GetType() == SbxUINT ); }
+ sal_Bool IspChar() const { return sal_Bool( GetType() == SbxLPSTR ); }
+ sal_Bool IsNumeric() const;
+ sal_Bool IsNumericRTL() const; // #41692 Interface for Basic
+ sal_Bool ImpIsNumeric( bool bOnlyIntntl ) const; // Implementation
+
+ virtual SbxClassType GetClass() const;
+ virtual SbxDataType GetType() const;
+ SbxDataType GetFullType() const;
+ sal_Bool SetType( SbxDataType );
+
+ virtual sal_Bool Get( SbxValues& ) const;
+ const SbxValues& GetValues_Impl() const { return aData; }
+ virtual sal_Bool Put( const SbxValues& );
+
+ inline SbxValues * data() { return &aData; }
+
+ sal_Unicode GetChar() const;
+ sal_Int16 GetInteger() const;
+ sal_Int32 GetLong() const;
+ sal_Int64 GetInt64() const;
+ sal_uInt64 GetUInt64() const;
+
+ sal_Int64 GetCurrency() const;
+ SbxDecimal* GetDecimal() const;
+
+ float GetSingle() const;
+ double GetDouble() const;
+ double GetDate() const;
+
+ sal_Bool GetBool() const;
+ const OUString& GetCoreString() const;
+ OUString GetOUString() const;
+
+ SbxBase* GetObject() const;
+ sal_uInt8 GetByte() const;
+ sal_uInt16 GetUShort() const;
+ sal_uInt32 GetULong() const;
+
+ sal_Bool PutInteger( sal_Int16 );
+ sal_Bool PutLong( sal_Int32 );
+ sal_Bool PutSingle( float );
+ sal_Bool PutDouble( double );
+ sal_Bool PutDate( double );
+ sal_Bool PutBool( sal_Bool );
+ sal_Bool PutErr( sal_uInt16 );
+ sal_Bool PutStringExt( const OUString& ); // with extended analysis (International, "sal_True"/"sal_False")
+ sal_Bool PutInt64( sal_Int64 );
+ sal_Bool PutUInt64( sal_uInt64 );
+ sal_Bool PutString( const OUString& );
+ sal_Bool PutChar( sal_Unicode );
+ sal_Bool PutByte( sal_uInt8 );
+ sal_Bool PutUShort( sal_uInt16 );
+ sal_Bool PutULong( sal_uInt32 );
+ sal_Bool PutEmpty();
+ sal_Bool PutNull();
+
+ // Special methods
+ sal_Bool PutDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
+ sal_Bool PutDecimal( SbxDecimal* pDecimal ); // This function is needed for Windows build, don't remove
+ sal_Bool fillAutomationDecimal( com::sun::star::bridge::oleautomation::Decimal& rAutomationDec );
+ sal_Bool PutCurrency( const sal_Int64& );
+ // Interface for CDbl in Basic
+ static SbxError ScanNumIntnl( const OUString& rSrc, double& nVal, bool bSingle = false );
+
+ sal_Bool PutObject( SbxBase* );
+
+ virtual sal_Bool Convert( SbxDataType );
+ virtual sal_Bool Compute( SbxOperator, const SbxValue& );
+ virtual sal_Bool Compare( SbxOperator, const SbxValue& ) const;
+ sal_Bool Scan( const OUString&, sal_uInt16* = NULL );
+ void Format( OUString&, const OUString* = NULL ) const;
+
+ // The following operators are definied for easier handling.
+ // TODO: Ensure error conditions (overflow, conversions)
+ // are taken into consideration in Compute and Compare
+
+ inline int operator ==( const SbxValue& ) const;
+ inline int operator !=( const SbxValue& ) const;
+ inline int operator <( const SbxValue& ) const;
+ inline int operator >( const SbxValue& ) const;
+ inline int operator <=( const SbxValue& ) const;
+ inline int operator >=( const SbxValue& ) const;
+
+ inline SbxValue& operator *=( const SbxValue& );
+ inline SbxValue& operator /=( const SbxValue& );
+ inline SbxValue& operator %=( const SbxValue& );
+ inline SbxValue& operator +=( const SbxValue& );
+ inline SbxValue& operator -=( const SbxValue& );
+ inline SbxValue& operator &=( const SbxValue& );
+ inline SbxValue& operator |=( const SbxValue& );
+ inline SbxValue& operator ^=( const SbxValue& );
+};
+
+inline int SbxValue::operator==( const SbxValue& r ) const
+{ return Compare( SbxEQ, r ); }
+
+inline int SbxValue::operator!=( const SbxValue& r ) const
+{ return Compare( SbxNE, r ); }
+
+inline int SbxValue::operator<( const SbxValue& r ) const
+{ return Compare( SbxLT, r ); }
+
+inline int SbxValue::operator>( const SbxValue& r ) const
+{ return Compare( SbxGT, r ); }
+
+inline int SbxValue::operator<=( const SbxValue& r ) const
+{ return Compare( SbxLE, r ); }
+
+inline int SbxValue::operator>=( const SbxValue& r ) const
+{ return Compare( SbxGE, r ); }
+
+inline SbxValue& SbxValue::operator*=( const SbxValue& r )
+{ Compute( SbxMUL, r ); return *this; }
+
+inline SbxValue& SbxValue::operator/=( const SbxValue& r )
+{ Compute( SbxDIV, r ); return *this; }
+
+inline SbxValue& SbxValue::operator%=( const SbxValue& r )
+{ Compute( SbxMOD, r ); return *this; }
+
+inline SbxValue& SbxValue::operator+=( const SbxValue& r )
+{ Compute( SbxPLUS, r ); return *this; }
+
+inline SbxValue& SbxValue::operator-=( const SbxValue& r )
+{ Compute( SbxMINUS, r ); return *this; }
+
+inline SbxValue& SbxValue::operator&=( const SbxValue& r )
+{ Compute( SbxAND, r ); return *this; }
+
+inline SbxValue& SbxValue::operator|=( const SbxValue& r )
+{ Compute( SbxOR, r ); return *this; }
+
+inline SbxValue& SbxValue::operator^=( const SbxValue& r )
+{ Compute( SbxXOR, r ); return *this; }
+
+class SbxArray;
+class SbxInfo;
+
+#ifndef SBX_ARRAY_DECL_DEFINED
+#define SBX_ARRAY_DECL_DEFINED
+SV_DECL_REF(SbxArray)
+#endif
+
+#ifndef SBX_INFO_DECL_DEFINED
+#define SBX_INFO_DECL_DEFINED
+SV_DECL_REF(SbxInfo)
+#endif
+
+class SfxBroadcaster;
+
+class SbxVariableImpl;
+class StarBASIC;
+
+class BASIC_DLLPUBLIC SbxVariable : public SbxValue
+{
+ friend class SbMethod;
+
+ SbxVariableImpl* mpSbxVariableImpl; // Impl data
+ SfxBroadcaster* pCst; // Broadcaster, if needed
+ OUString maName; // Name, if available
+ SbxArrayRef mpPar; // Parameter-Array, if set
+ sal_uInt16 nHash; // Hash-ID for search
+
+ BASIC_DLLPRIVATE SbxVariableImpl* getImpl( void );
+
+protected:
+ SbxInfoRef pInfo; // Probably called information
+ sal_uIntPtr nUserData; // User data for Call()
+ SbxObject* pParent; // Currently attached object
+ virtual ~SbxVariable();
+ virtual sal_Bool LoadData( SvStream&, sal_uInt16 );
+ virtual sal_Bool StoreData( SvStream& ) const;
+public:
+ SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_VARIABLE,2);
+ TYPEINFO();
+ SbxVariable();
+ SbxVariable( SbxDataType, void* = NULL );
+ SbxVariable( const SbxVariable& );
+ SbxVariable& operator=( const SbxVariable& );
+
+ void Dump( SvStream&, sal_Bool bDumpAll=sal_False );
+
+ virtual void SetName( const OUString& );
+ virtual const OUString& GetName( SbxNameType = SbxNAME_NONE ) const;
+ sal_uInt16 GetHashCode() const { return nHash; }
+
+ virtual void SetModified( sal_Bool );
+
+ sal_uIntPtr GetUserData() const { return nUserData; }
+ void SetUserData( sal_uIntPtr n ) { nUserData = n; }
+
+ virtual SbxDataType GetType() const;
+ virtual SbxClassType GetClass() const;
+
+ // Parameter-Interface
+ virtual SbxInfo* GetInfo();
+ void SetInfo( SbxInfo* p );
+ void SetParameters( SbxArray* p );
+ SbxArray* GetParameters() const;
+
+ // Sfx-Broadcasting-Support:
+ // Due to data reduction and better DLL-hierarchie currently via casting
+ SfxBroadcaster& GetBroadcaster();
+ sal_Bool IsBroadcaster() const { return sal_Bool( pCst != NULL ); }
+ virtual void Broadcast( sal_uIntPtr nHintId );
+
+ inline const SbxObject* GetParent() const { return pParent; }
+ SbxObject* GetParent();
+ virtual void SetParent( SbxObject* );
+
+ const OUString& GetDeclareClassName( void );
+ void SetDeclareClassName( const OUString& );
+ void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
+ StarBASIC* pParentBasic );
+ void ClearComListener( void );
+
+ static sal_uInt16 MakeHashCode( const OUString& rName );
+};
+
+SV_DECL_REF(SbxVariable)
+
+#endif // SBXVAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/basic/vbahelper.hxx b/include/basic/vbahelper.hxx
new file mode 100644
index 000000000000..c18b67b63cd1
--- /dev/null
+++ b/include/basic/vbahelper.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef BASIC_VBAHELPR_HXX
+#define BASIC_VBAHELPR_HXX
+
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <rtl/ustring.hxx>
+#include "basicdllapi.h"
+
+namespace basic {
+namespace vba {
+
+/* This header contains public helper functions for VBA used from this module
+ and from other VBA implementation modules such as vbahelper.
+ */
+
+// ============================================================================
+
+/** Locks or unlocks the controllers of all documents that have the same type
+ as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and all open documents with the
+ same type will be locked or unlocked.
+
+ @param rxModel
+ A document model determining the type of the documents to be locked or
+ unlocked.
+
+ @param bLockControllers
+ Passing true will lock all controllers, passing false will unlock them.
+ */
+BASIC_DLLPUBLIC void lockControllersOfAllDocuments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ sal_Bool bLockControllers );
+
+// ============================================================================
+
+/** Enables or disables the container windows of all controllers of all
+ documents that have the same type as the specified document.
+
+ First, the global module manager (com.sun.star.frame.ModuleManager) is
+ asked for the type of the passed model, and the container windows of all
+ open documents with the same type will be enabled or disabled.
+
+ @param rxModel
+ A document model determining the type of the documents to be enabled or
+ disabled.
+
+ @param bEnableWindows
+ Passing true will enable all container windows of all controllers,
+ passing false will disable them.
+ */
+BASIC_DLLPUBLIC void enableContainerWindowsOfAllDocuments(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ sal_Bool bEnableWindows );
+
+// ============================================================================
+
+/** Registers the passed path as working directory for the application the
+ passed document belongs to.
+
+ @param rxModel
+ A document model determining the type of the application whose working
+ directory has been changed.
+
+ @param rPath
+ The new working directory.
+ */
+BASIC_DLLPUBLIC void registerCurrentDirectory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
+ const OUString& rPath );
+
+// ============================================================================
+
+} // namespace vba
+} // namespace basic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/bitmapcanvasbase.hxx b/include/canvas/base/bitmapcanvasbase.hxx
new file mode 100644
index 000000000000..5c1376b0632b
--- /dev/null
+++ b/include/canvas/base/bitmapcanvasbase.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BITMAPCANVASBASE_HXX
+#define INCLUDED_CANVAS_BITMAPCANVASBASE_HXX
+
+#include <canvas/base/canvasbase.hxx>
+#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+
+namespace canvas
+{
+ /** Helper template to handle XBitmapCanvas method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XBitmapCanvas part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XBitmapCanvas should be among them (why
+ else would you use this template, then?). Base class must have
+ an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class BitmapCanvasBase :
+ public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+
+ // XBitmapCanvas
+ virtual void SAL_CALL copyRect( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
+ const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
+ const ::com::sun::star::rendering::ViewState& sourceViewState,
+ const ::com::sun::star::rendering::RenderState& sourceRenderState,
+ const ::com::sun::star::geometry::RealRectangle2D& destRect,
+ const ::com::sun::star::rendering::ViewState& destViewState,
+ const ::com::sun::star::rendering::RenderState& destRenderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
+ destRect, destViewState, destRenderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::mbSurfaceDirty = true;
+ BaseType::maCanvasHelper.modifying();
+
+ BaseType::maCanvasHelper.copyRect( this,
+ sourceCanvas,
+ sourceRect,
+ sourceViewState,
+ sourceRenderState,
+ destRect,
+ destViewState,
+ destRenderState );
+ }
+
+ // XBitmap
+ virtual ::com::sun::star::geometry::IntegerSize2D SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getSize();
+ }
+
+ virtual ::sal_Bool SAL_CALL hasAlpha( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.hasAlpha();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
+ sal_Bool beFast ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
+ }
+
+ };
+}
+
+#endif /* INCLUDED_CANVAS_BITMAPCANVASBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/bufferedgraphicdevicebase.hxx b/include/canvas/base/bufferedgraphicdevicebase.hxx
new file mode 100644
index 000000000000..2713e0ea11bb
--- /dev/null
+++ b/include/canvas/base/bufferedgraphicdevicebase.hxx
@@ -0,0 +1,276 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX
+#define INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX
+
+#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XWindowListener.hpp>
+
+#include <canvas/canvastools.hxx>
+#include <canvas/base/graphicdevicebase.hxx>
+
+
+/* Definition of BufferedGraphicDeviceBase class */
+
+namespace canvas
+{
+ /** Helper template base class for XGraphicDevice implementations
+ on windows.
+
+ Use this base class if your target device is a
+ window. Additionally to GraphicDeviceBase, this template
+ provides an implementation of the awt::XWindowListener
+ interface, to receive notifications about state changes of the
+ associated window.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XGraphicDevice should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl DeviceHelper
+ Device helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XGraphicDevice API calls that
+ could not be handled generically.
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class DeviceHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class BufferedGraphicDeviceBase :
+ public GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase > BaseType;
+ typedef BufferedGraphicDeviceBase OurType;
+ typedef Mutex MutexType;
+
+ BufferedGraphicDeviceBase() :
+ mxWindow(),
+ maBounds(),
+ mbIsVisible( false ),
+ mbIsTopLevel( false )
+ {
+ BaseType::maPropHelper.addProperties( PropertySetHelper::MakeMap
+ ("Window",
+ boost::bind(&OurType::getXWindow,
+ this)));
+ }
+
+ // XGraphicDevice
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return this;
+ }
+
+ // XBufferController
+ virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyRange( nBuffers, (sal_Int32)1 );
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.createBuffers( nBuffers );
+ }
+
+ virtual void SAL_CALL destroyBuffers( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::maDeviceHelper.destroyBuffers();
+ }
+
+ virtual ::sal_Bool SAL_CALL showBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.showBuffer( mbIsVisible, bUpdateAll );
+ }
+
+ virtual ::sal_Bool SAL_CALL switchBuffer( ::sal_Bool bUpdateAll ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.switchBuffer( mbIsVisible, bUpdateAll );
+ }
+
+
+ /** Set corresponding canvas window
+
+ Use this method to set the window this canvas displays
+ on. Comes in handy when the canvas needs to adapt size or
+ output position to the changing window.
+
+ Whenever the bounds of the window change, <code>void
+ notifySizeUpdate( const awt::Rectangle& rBounds )</code>
+ is called, with rBounds the window bound rect relative to
+ the frame window.
+ */
+ void setWindow( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XWindow2 >& rWindow )
+ {
+ if( mxWindow.is() )
+ mxWindow->removeWindowListener( this );
+
+ mxWindow = rWindow;
+
+ if( mxWindow.is() )
+ {
+ mbIsVisible = mxWindow->isVisible();
+ mbIsTopLevel =
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTopWindow >(
+ mxWindow,
+ ::com::sun::star::uno::UNO_QUERY ).is();
+
+ maBounds = transformBounds( mxWindow->getPosSize() );
+ mxWindow->addWindowListener( this );
+ }
+ }
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 > getWindow() const
+ {
+ return mxWindow;
+ }
+
+ ::com::sun::star::uno::Any getXWindow() const
+ {
+ return ::com::sun::star::uno::makeAny(mxWindow);
+ }
+
+ virtual void disposeThis()
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ if( mxWindow.is() )
+ {
+ mxWindow->removeWindowListener(this);
+ mxWindow.clear();
+ }
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ ::com::sun::star::awt::Rectangle transformBounds( const ::com::sun::star::awt::Rectangle& rBounds )
+ {
+ // notifySizeUpdate's bounds are relative to the toplevel
+ // window
+ if( !mbIsTopLevel )
+ return tools::getAbsoluteWindowRect(
+ rBounds,
+ mxWindow );
+ else
+ return ::com::sun::star::awt::Rectangle( 0,0,rBounds.Width,rBounds.Height );
+ }
+
+ void boundsChanged( const ::com::sun::star::awt::WindowEvent& e )
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ const ::com::sun::star::awt::Rectangle& rNewBounds(
+ transformBounds(
+ ::com::sun::star::awt::Rectangle( e.X,
+ e.Y,
+ e.Width,
+ e.Height )));
+
+ if( rNewBounds.X != maBounds.X ||
+ rNewBounds.Y != maBounds.Y ||
+ rNewBounds.Width != maBounds.Width ||
+ rNewBounds.Height != maBounds.Height )
+ {
+ maBounds = rNewBounds;
+ BaseType::maDeviceHelper.notifySizeUpdate( maBounds );
+ }
+ }
+
+ // XWindowListener
+ virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ if( Source.Source == mxWindow )
+ mxWindow.clear();
+
+ BaseType::disposeEventSource(Source);
+ }
+
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ boundsChanged( e );
+ }
+
+ virtual void SAL_CALL windowMoved( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ boundsChanged( e );
+ }
+
+ virtual void SAL_CALL windowShown( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ mbIsVisible = true;
+ }
+
+ virtual void SAL_CALL windowHidden( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ mbIsVisible = false;
+ }
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 > mxWindow;
+
+ /// Current bounds of the owning Window
+ ::com::sun::star::awt::Rectangle maBounds;
+
+ /// True, if the window this canvas is contained in, is visible
+ bool mbIsVisible;
+
+ private:
+ /// True, if the window this canvas is contained in, is a toplevel window
+ bool mbIsTopLevel;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_BUFFEREDGRAPHICDEVICEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/cachedprimitivebase.hxx b/include/canvas/base/cachedprimitivebase.hxx
new file mode 100644
index 000000000000..8c7e1579f1e2
--- /dev/null
+++ b/include/canvas/base/cachedprimitivebase.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX
+#define INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/XCachedPrimitive.hpp>
+#include <com/sun/star/rendering/ViewState.hpp>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/broadcasthelper.hxx>
+
+#include <canvas/canvastoolsdllapi.h>
+
+/* Definition of CachedPrimitiveBase class */
+
+namespace canvas
+{
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCachedPrimitive,
+ ::com::sun::star::lang::XServiceInfo > CachedPrimitiveBase_Base;
+
+ /** Base class, providing common functionality for implementers of
+ the XCachedPrimitive interface.
+ */
+ class CANVASTOOLS_DLLPUBLIC CachedPrimitiveBase : public CachedPrimitiveBase_Base,
+ public ::comphelper::OBaseMutex
+ {
+ public:
+
+ /** Create an XCachedPrimitive for given target canvas
+
+ @param rUsedViewState
+ The viewstate the original object was rendered with
+
+ @param rTarget
+ The target canvas the repaint should happen on.
+
+ @param bFailForChangedViewTransform
+ When true, derived classes will never receive doRedraw()
+ calls with dissimilar view transformations and
+ bSameViewTransform set to false. This is useful for cached
+ objects where re-transforming the generated output is not
+ desirable, e.g. for hinted font output.
+ */
+ CachedPrimitiveBase( const ::com::sun::star::rendering::ViewState& rUsedViewState,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvas >& rTarget,
+ bool bFailForChangedViewTransform );
+
+ /// Dispose all internal references
+ virtual void SAL_CALL disposing();
+
+ // XCachedPrimitive
+ virtual ::sal_Int8 SAL_CALL redraw( const ::com::sun::star::rendering::ViewState& aState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ ~CachedPrimitiveBase(); // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ private:
+ CachedPrimitiveBase( const CachedPrimitiveBase& );
+ CachedPrimitiveBase& operator=( const CachedPrimitiveBase& );
+
+ /** Actually perform the requested redraw.
+
+ Clients must override this method, instead of the public
+ redraw() one.
+
+ @param rNewState
+ The viewstate to redraw with
+
+ @param rOldState
+ The viewstate this cache object was created with.
+
+ @param rTargetCanvas
+ Target canvas to render to.
+
+ @param bSameViewTransform
+ When true, rNewState and rOldState have the same transformation.
+ */
+ virtual ::sal_Int8 doRedraw( const ::com::sun::star::rendering::ViewState& rNewState,
+ const ::com::sun::star::rendering::ViewState& rOldState,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvas >& rTargetCanvas,
+ bool bSameViewTransform ) = 0;
+
+ ::com::sun::star::rendering::ViewState maUsedViewState;
+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > mxTarget;
+ const bool mbFailForChangedViewTransform;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CACHEDPRIMITIVEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/canvasbase.hxx b/include/canvas/base/canvasbase.hxx
new file mode 100644
index 000000000000..f7844fd219de
--- /dev/null
+++ b/include/canvas/base/canvasbase.hxx
@@ -0,0 +1,474 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASBASE_HXX
+#define INCLUDED_CANVAS_CANVASBASE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/TextDirection.hpp>
+#include <osl/mutex.hxx>
+#include <canvas/verifyinput.hxx>
+
+
+namespace canvas
+{
+ /** Helper template to handle XCanvas method forwarding to CanvasHelper
+
+ Use this helper to handle the XCanvas part of your
+ implementation. In theory, we could have provided CanvasHelper
+ and CanvasBase as a single template, but that would duplicate
+ a lot of code now residing in CanvasHelper only.
+
+ This template basically interposes itself between the full
+ interface you implement (i.e. not restricted to XCanvas. The
+ problem with UNO partial interface implementation actually is,
+ that you cannot do it the plain way, since deriving from a
+ common base subclass always introduces the whole set of pure
+ virtuals, that your baseclass helper just overrided) and your
+ implementation class. You then only have to implement the
+ functionality <em>besides</em> XCanvas.
+
+ <pre>
+ Example:
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::rendering::XSpriteCanvas,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName > CanvasBase_Base;
+ typedef ::canvas::internal::CanvasBase< CanvasBase_Base, CanvasHelper > ExampleCanvas_Base;
+
+ class ExampleCanvas : public ExampleCanvas_Base,
+ public SpriteSurface,
+ public RepaintTarget
+ {
+ };
+ </pre>
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XCanvas should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XCanvas API calls. Furthermore,
+ everytime the canvas API semantically changes the content of
+ the canvas, CanvasHelper::modifying() will get called
+ (<em>before</em> the actual modification takes place).
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasBase :
+ public Base
+ {
+ public:
+ typedef Base BaseType;
+ typedef CanvasHelper HelperType;
+ typedef Mutex MutexType;
+ typedef UnambiguousBase UnambiguousBaseType;
+
+ /** Create CanvasBase
+ */
+ CanvasBase() :
+ maCanvasHelper(),
+ mbSurfaceDirty( true )
+ {
+ }
+
+ virtual void disposeThis()
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ maCanvasHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XCanvas
+ virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.clear();
+ }
+
+ virtual void SAL_CALL drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aPoint, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.drawPoint( this, aPoint, viewState, renderState );
+ }
+
+ virtual void SAL_CALL drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aStartPoint, aEndPoint, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.drawLine( this, aStartPoint, aEndPoint, viewState, renderState );
+ }
+
+ virtual void SAL_CALL drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aBezierSegment, aEndPoint, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ maCanvasHelper.drawBezier( this, aBezierSegment, aEndPoint, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawPolyPolygon( this, xPolyPolygon, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ strokePolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.strokePolyPolygon( this, xPolyPolygon, viewState, renderState, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ strokeTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.strokeTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ strokeTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.strokeTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL
+ queryStrokeShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.queryStrokeShapes( this, xPolyPolygon, viewState, renderState, strokeAttributes );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ fillPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.fillPolyPolygon( this, xPolyPolygon, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ fillTexturedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.fillTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ fillTextureMappedPolyPolygon( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::Texture >& textures,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::geometry::XMapping2D >& xMapping ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.fillTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont > SAL_CALL
+ createFont( const ::com::sun::star::rendering::FontRequest& fontRequest,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties,
+ const ::com::sun::star::geometry::Matrix2D& fontMatrix ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(fontRequest,
+ // dummy, to keep argPos in sync
+ fontRequest,
+ fontMatrix,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.createFont( this, fontRequest, extraFontProperties, fontMatrix );
+ }
+
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::rendering::FontInfo > SAL_CALL
+ queryAvailableFonts( const ::com::sun::star::rendering::FontInfo& aFilter,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aFontProperties ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aFilter,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.queryAvailableFonts( this, aFilter, aFontProperties );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawText( const ::com::sun::star::rendering::StringContext& text,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvasFont >& xFont,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ sal_Int8 textDirection ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xFont, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+ tools::verifyRange( textDirection,
+ ::com::sun::star::rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
+ ::com::sun::star::rendering::TextDirection::STRONG_RIGHT_TO_LEFT );
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawText( this, text, xFont, viewState, renderState, textDirection );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawTextLayout( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout >& layoutetText,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(layoutetText, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawTextLayout( this, layoutetText, viewState, renderState );
+ }
+
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawBitmap( this, xBitmap, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmapModulated( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ maCanvasHelper.modifying();
+
+ return maCanvasHelper.drawBitmapModulated( this, xBitmap, viewState, renderState );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice > SAL_CALL
+ getDevice() throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.getDevice();
+ }
+
+ protected:
+ ~CanvasBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ HelperType maCanvasHelper;
+ mutable bool mbSurfaceDirty;
+
+ private:
+ CanvasBase( const CanvasBase& );
+ CanvasBase& operator=( const CanvasBase& );
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CANVASBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/canvascustomspritebase.hxx b/include/canvas/base/canvascustomspritebase.hxx
new file mode 100644
index 000000000000..7c1b5508bb4e
--- /dev/null
+++ b/include/canvas/base/canvascustomspritebase.hxx
@@ -0,0 +1,271 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX
+#define INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XCustomSprite.hpp>
+#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <canvas/base/integerbitmapbase.hxx>
+#include <canvas/base/sprite.hxx>
+
+#include <boost/utility.hpp>
+
+
+namespace canvas
+{
+ /** Helper template to handle XCustomSprite method forwarding to
+ CanvasCustomSpriteHelper
+
+ Use this helper to handle the XCustomSprite part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XCustomSprite and Sprite should be among
+ them (why else would you use this template, then?). Base class
+ must have an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl SpriteHelper
+ Sprite helper implementation for the backend in question
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasCustomSpriteHelper for further contractual
+ requirements towards the SpriteHelper type, and some examples.
+ */
+ template< class Base,
+ class SpriteHelper,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class CanvasCustomSpriteBase :
+ public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+ typedef SpriteHelper SpriteHelperType;
+
+ CanvasCustomSpriteBase() :
+ maSpriteHelper()
+ {
+ }
+
+ /** Object is being disposed.
+
+ Called from the cppu helper base, to notify disposal of
+ this object. Already releases all internal references.
+
+ @derive when overriding this method in derived classes,
+ <em>always</em> call the base class' method!
+ */
+ virtual void disposeThis()
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XCanvas: selectively override base's methods here, for opacity tracking
+ virtual void SAL_CALL clear() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.clearingContent( this );
+
+ // and forward to base class, which handles the actual rendering
+ return BaseType::clear();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmap( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.checkDrawBitmap( this, xBitmap, viewState, renderState );
+
+ // and forward to base class, which handles the actual rendering
+ return BaseType::drawBitmap( xBitmap,
+ viewState,
+ renderState );
+ }
+
+ // TODO(F3): If somebody uses the XIntegerBitmap methods to
+ // clear pixel (setting alpha != 1.0 there), or a compositing
+ // mode results in similar alpha, maSpriteHelper might
+ // errorneously report fully opaque sprites. Effectively, all
+ // render methods must be overridden here; or better,
+ // functionality provided at the baseclass.
+
+ // XSprite
+ virtual void SAL_CALL setAlpha( double alpha ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyRange( alpha, 0.0, 1.0 );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.setAlpha( this, alpha );
+ }
+
+ virtual void SAL_CALL move( const ::com::sun::star::geometry::RealPoint2D& aNewPos,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aNewPos, viewState, renderState,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.move( this, aNewPos, viewState, renderState );
+ }
+
+ virtual void SAL_CALL transform( const ::com::sun::star::geometry::AffineMatrix2D& aTransformation ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(aTransformation,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.transform( this, aTransformation );
+ }
+
+ virtual void SAL_CALL clip( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ // NULL xClip explicitly allowed here (to clear clipping)
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.clip( this, aClip );
+ }
+
+ virtual void SAL_CALL setPriority( double nPriority ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.setPriority( this, nPriority );
+ }
+
+ virtual void SAL_CALL show() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.show( this );
+ }
+
+ virtual void SAL_CALL hide() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.hide( this );
+ }
+
+ // XCustomSprite
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL
+ getContentCanvas() throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return this;
+ }
+
+ // Sprite
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.isAreaUpdateOpaque( rUpdateArea );
+ }
+
+ virtual bool isContentChanged() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::mbSurfaceDirty;
+ }
+
+ virtual ::basegfx::B2DPoint getPosPixel() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getPosPixel();
+ }
+
+ virtual ::basegfx::B2DVector getSizePixel() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getSizePixel();
+ }
+
+ virtual ::basegfx::B2DRange getUpdateArea() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getUpdateArea();
+ }
+
+ virtual double getPriority() const
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getPriority();
+ }
+
+ protected:
+ SpriteHelperType maSpriteHelper;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CANVASCUSTOMSPRITEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/canvascustomspritehelper.hxx b/include/canvas/base/canvascustomspritehelper.hxx
new file mode 100644
index 000000000000..2b2fd2d774d8
--- /dev/null
+++ b/include/canvas/base/canvascustomspritehelper.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX
+#define INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX
+
+#include <com/sun/star/rendering/XCustomSprite.hpp>
+#include <com/sun/star/rendering/XPolyPolygon2D.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <canvas/base/spritesurface.hxx>
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ /* Definition of CanvasCustomSpriteHelper class */
+
+ /** Base class for an XSprite helper implementation - to be used
+ in concert with CanvasCustomSpriteBase
+ */
+ class CANVASTOOLS_DLLPUBLIC CanvasCustomSpriteHelper
+ {
+ public:
+ CanvasCustomSpriteHelper();
+ virtual ~CanvasCustomSpriteHelper() {}
+
+ /** Init helper
+
+ @param rSpriteSize
+ Requested size of the sprite, as passed to the
+ XSpriteCanvas::createCustomSprite() method
+
+ @param rOwningSpriteCanvas
+ The XSpriteCanvas this sprite is displayed on
+ */
+ void init( const ::com::sun::star::geometry::RealSize2D& rSpriteSize,
+ const SpriteSurface::Reference& rOwningSpriteCanvas );
+
+ /** Object is being disposed, release all internal references
+
+ @derive when overriding this method in derived classes,
+ <em>always</em> call the base class' method!
+ */
+ void disposing();
+
+ // XCanvas
+ /// need to call this method for XCanvas::clear(), for opacity tracking
+ void clearingContent( const Sprite::Reference& rSprite );
+
+ /// need to call this method for XCanvas::drawBitmap(), for opacity tracking
+ void checkDrawBitmap( const Sprite::Reference& rSprite,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ // XSprite
+ void setAlpha( const Sprite::Reference& rSprite,
+ double alpha );
+ void move( const Sprite::Reference& rSprite,
+ const ::com::sun::star::geometry::RealPoint2D& aNewPos,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ void transform( const Sprite::Reference& rSprite,
+ const ::com::sun::star::geometry::AffineMatrix2D& aTransformation );
+ void clip( const Sprite::Reference& rSprite,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& aClip );
+ void setPriority( const Sprite::Reference& rSprite,
+ double nPriority );
+ void show( const Sprite::Reference& rSprite );
+ void hide( const Sprite::Reference& rSprite );
+
+ // Sprite
+ bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const;
+ ::basegfx::B2DPoint getPosPixel() const;
+ ::basegfx::B2DVector getSizePixel() const;
+ ::basegfx::B2DRange getUpdateArea() const;
+ double getPriority() const;
+
+ // redraw must be implemented by derived - non sensible default implementation
+ // void redraw( const Sprite::Reference& rSprite,
+ // const ::basegfx::B2DPoint& rPos ) const;
+
+
+ // Helper methods for derived classes
+ // ----------------------------------
+
+ /// Calc sprite update area from given raw sprite bounds
+ ::basegfx::B2DRange getUpdateArea( const ::basegfx::B2DRange& rUntransformedSpriteBounds ) const;
+
+ /// Calc update area for unclipped sprite content
+ ::basegfx::B2DRange getFullSpriteRect() const;
+
+ /** Returns true, if sprite content bitmap is fully opaque.
+
+ This does not take clipping or transformation into
+ account, but only denotes that the sprite bitmap's alpha
+ channel is all 1.0
+ */
+ bool isContentFullyOpaque() const { return mbIsContentFullyOpaque; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasAlphaChanged() const { return mbAlphaDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasPositionChanged() const { return mbPositionDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasTransformChanged() const { return mbTransformDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasClipChanged() const { return mbClipDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasPrioChanged() const { return mbPrioDirty; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasVisibilityChanged() const { return mbVisibilityDirty; }
+
+ /// Retrieve current alpha value
+ double getAlpha() const { return mfAlpha; }
+
+ /// Retrieve current clip
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& getClip() const { return mxClipPoly; }
+
+ const ::basegfx::B2DHomMatrix& getTransformation() const { return maTransform; }
+
+ /// Retrieve current activation state
+ bool isActive() const { return mbActive; }
+
+ protected:
+ /** Notifies that caller is again in sync with current alph
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void alphaUpdated() const { mbAlphaDirty=false; }
+
+ /** Notifies that caller is again in sync with current position
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void positionUpdated() const { mbPositionDirty=false; }
+
+ /** Notifies that caller is again in sync with current transformation
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void transformUpdated() const { mbTransformDirty=false; }
+
+ /** Notifies that caller is again in sync with current clip
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void clipUpdated() const { mbClipDirty=false; }
+
+ /** Notifies that caller is again in sync with current priority
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void prioUpdated() const { mbPrioDirty=false; }
+
+ /** Notifies that caller is again in sync with current visibility
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void visibilityUpdated() const { mbVisibilityDirty=false; }
+
+ private:
+ CanvasCustomSpriteHelper( const CanvasCustomSpriteHelper& );
+ CanvasCustomSpriteHelper& operator=( const CanvasCustomSpriteHelper& );
+
+ /** Called to convert an API polygon to a basegfx polygon
+
+ @derive Needs to be provided by backend-specific code
+ */
+ virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
+ ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& xPoly ) const = 0;
+
+ /** Update clip information from current state
+
+ This method recomputes the maCurrClipBounds and
+ mbIsCurrClipRectangle members from the current clip and
+ transformation. IFF the clip changed from rectangular to
+ rectangular again, this method issues a sequence of
+ optimized SpriteSurface::updateSprite() calls.
+
+ @return true, if SpriteSurface::updateSprite() was already
+ called within this method.
+ */
+ bool updateClipState( const Sprite::Reference& rSprite );
+
+ // --------------------------------------------------------------------
+
+ /// Owning sprite canvas
+ SpriteSurface::Reference mpSpriteCanvas;
+
+ /** Currently active clip area.
+
+ This member is either empty, denoting that the current
+ clip shows the full sprite content, or contains a
+ rectangular subarea of the sprite, outside of which
+ the sprite content is fully clipped.
+
+ @see mbIsCurrClipRectangle
+ */
+ ::basegfx::B2DRange maCurrClipBounds;
+
+ // sprite state
+ ::basegfx::B2DPoint maPosition;
+ ::basegfx::B2DVector maSize;
+ ::basegfx::B2DHomMatrix maTransform;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D > mxClipPoly;
+ double mfPriority;
+ double mfAlpha;
+ bool mbActive; // true, if not hidden
+
+ /** If true, denotes that the current sprite clip is a true
+ rectangle, i.e. maCurrClipBounds <em>exactly</em>
+ describes the visible area of the sprite.
+
+ @see maCurrClipBounds
+ */
+ bool mbIsCurrClipRectangle;
+
+ /** Redraw speedup.
+
+ When true, this flag denotes that the current sprite
+ content is fully opaque, thus, that blits to the screen do
+ neither have to take alpha into account, nor prepare any
+ background for the sprite area.
+ */
+ mutable bool mbIsContentFullyOpaque;
+
+ /// True, iff mfAlpha has changed
+ mutable bool mbAlphaDirty;
+
+ /// True, iff maPosition has changed
+ mutable bool mbPositionDirty;
+
+ /// True, iff maTransform has changed
+ mutable bool mbTransformDirty;
+
+ /// True, iff mxClipPoly has changed
+ mutable bool mbClipDirty;
+
+ /// True, iff mnPriority has changed
+ mutable bool mbPrioDirty;
+
+ /// True, iff mbActive has changed
+ mutable bool mbVisibilityDirty;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_CANVASCUSTOMSPRITEHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/disambiguationhelper.hxx b/include/canvas/base/disambiguationhelper.hxx
new file mode 100644
index 000000000000..f12a61472cd4
--- /dev/null
+++ b/include/canvas/base/disambiguationhelper.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX
+#define INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX
+
+#include <osl/mutex.hxx>
+
+
+/* Definition of the DisambiguationHelper class */
+
+namespace canvas
+{
+ /** Base class, initializing its own baseclass with m_aMutex.
+
+ This is necessary to make the CanvasBase, GraphicDeviceBase,
+ etc. classes freely combinable - letting them perform this
+ initialization would prohibit deriving e.g. CanvasBase from
+ GraphicDeviceBase.
+
+ On top of that, disambiguates XEventListener::disposing and
+ WeakComponentImplHelper::disposing.
+
+ Having two virtual methods with the same name, and not
+ overriding them in every derived class, will hide one of
+ them. Later trying to override the same method, will generate
+ a new vtable slot, and lead to very hard to spot errors.
+ */
+ template< class Base > class DisambiguationHelper : public Base
+ {
+ public:
+ typedef Base BaseType;
+
+ /** Construct DisambiguationHelper
+
+ This method is the whole purpose of this template:
+ initializing a base class with the provided m_aMutex
+ member (the WeakComponentImplHelper templates need that,
+ as they require the lifetime of the mutex to extend
+ theirs).
+ */
+ DisambiguationHelper() :
+ BaseType( m_aMutex )
+ {
+ }
+
+ virtual void SAL_CALL disposing()
+ { disposeThis(); }
+
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException)
+ { disposeEventSource(Source); }
+
+ virtual void disposeThis()
+ {}
+ virtual void disposeEventSource( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)
+ {}
+
+protected:
+ mutable ::osl::Mutex m_aMutex;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_DISAMBIGUATIONHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/graphicdevicebase.hxx b/include/canvas/base/graphicdevicebase.hxx
new file mode 100644
index 000000000000..5c3372e3f76a
--- /dev/null
+++ b/include/canvas/base/graphicdevicebase.hxx
@@ -0,0 +1,382 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX
+#define INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+#include <com/sun/star/rendering/XColorSpace.hpp>
+
+#include <canvas/parametricpolypolygon.hxx>
+#include <canvas/propertysethelper.hxx>
+
+
+/* Definition of GraphicDeviceBase class */
+
+namespace canvas
+{
+ /** Helper template base class for XGraphicDevice implementations.
+
+ This base class provides partial implementations of the
+ XGraphicDevice-related interface, such as XColorSpace.
+
+ This template basically interposes itself between the full
+ interface you implement (i.e. not restricted to XGraphicDevice
+ etc.). The problem with UNO partial interface implementation
+ actually is, that you cannot do it the plain way, since
+ deriving from a common base subclass always introduces the
+ whole set of pure virtuals, that your baseclass helper just
+ overrided) and your implementation class. You then only have
+ to implement the functionality <em>besides</em>
+ XGraphicDevice. If you want to support the optional debug
+ XUpdatable interface, also add that to the base classes
+ (client code will call the corresponding update() method,
+ whenever a burst of animations is over).
+
+ <pre>
+ Example:
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::rendering::XGraphicDevice,
+ ::com::sun::star::rendering::XColorSpace,
+ ::com::sun::star::rendering::XPropertySet,
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XServiceName > GraphicDeviceBase_Base;
+ typedef ::canvas::internal::GraphicDeviceBase< GraphicDeviceBase, DeviceHelper > ExampleDevice_Base;
+
+ class ExampleDevice : public ExampleDevice_Base
+ {
+ };
+ </pre>
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XGraphicDevice should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl DeviceHelper
+ Device helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XGraphicDevice API calls that
+ could not be handled generically.
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ DisambiguationHelper-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class DeviceHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class GraphicDeviceBase :
+ public Base
+ {
+ public:
+ typedef Base BaseType;
+ typedef DeviceHelper DeviceHelperType;
+ typedef Mutex MutexType;
+ typedef UnambiguousBase UnambiguousBaseType;
+ typedef GraphicDeviceBase ThisType;
+
+ typedef ::rtl::Reference< GraphicDeviceBase > Reference;
+
+ GraphicDeviceBase() :
+ maDeviceHelper(),
+ maPropHelper(),
+ mbDumpScreenContent(false)
+ {
+ maPropHelper.initProperties( PropertySetHelper::MakeMap
+ ("HardwareAcceleration",
+ boost::bind(&DeviceHelper::isAccelerated,
+ boost::ref(maDeviceHelper)))
+ ("DeviceHandle",
+ boost::bind(&DeviceHelper::getDeviceHandle,
+ boost::ref(maDeviceHelper)))
+ ("SurfaceHandle",
+ boost::bind(&DeviceHelper::getSurfaceHandle,
+ boost::ref(maDeviceHelper)))
+ ("DumpScreenContent",
+ boost::bind(&ThisType::getDumpScreenContent,
+ this),
+ boost::bind(&ThisType::setDumpScreenContent,
+ this,
+ _1)));
+ }
+
+ virtual void disposeThis()
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ maDeviceHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XGraphicDevice
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController > SAL_CALL getBufferController( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBufferController >();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getDeviceColorSpace( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getColorSpace();
+ }
+
+ virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalResolution( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getPhysicalResolution();
+ }
+
+ virtual ::com::sun::star::geometry::RealSize2D SAL_CALL getPhysicalSize( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getPhysicalSize();
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XLinePolyPolygon2D > SAL_CALL createCompatibleLinePolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleLinePolyPolygon( this, points );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBezierPolyPolygon2D > SAL_CALL createCompatibleBezierPolyPolygon( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleBezierPolyPolygon( this, points );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createVolatileBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > SAL_CALL createCompatibleAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleAlphaBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XVolatileBitmap > SAL_CALL createVolatileAlphaBitmap( const ::com::sun::star::geometry::IntegerSize2D& size ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyBitmapSize(size,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createVolatileAlphaBitmap( this, size );
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return this;
+ }
+
+ virtual ::sal_Bool SAL_CALL hasFullScreenMode( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.hasFullScreenMode();
+ }
+
+ virtual ::sal_Bool SAL_CALL enterFullScreenMode( ::sal_Bool bEnter ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.enterFullScreenMode( bEnter );
+ }
+
+ // XMultiServiceFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >()));
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& aServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
+ {
+ return ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XParametricPolyPolygon2D >(
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ Arguments));
+ }
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ParametricPolyPolygon::getAvailableServiceNames();
+ }
+
+
+ // XUpdatable
+ virtual void SAL_CALL update() throw (com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ if( mbDumpScreenContent )
+ maDeviceHelper.dumpScreenContent();
+ }
+
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ return maPropHelper.getPropertySetInfo();
+ }
+
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.setPropertyValue( aPropertyName, aValue );
+ }
+
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ return maPropHelper.getPropertyValue( aPropertyName );
+ }
+
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.addPropertyChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.removePropertyChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.addVetoableChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener ) throw (::com::sun::star::beans::UnknownPropertyException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.removeVetoableChangeListener( aPropertyName,
+ xListener );
+ }
+
+ protected:
+ ~GraphicDeviceBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ ::com::sun::star::uno::Any getDumpScreenContent() const
+ {
+ return ::com::sun::star::uno::makeAny( mbDumpScreenContent );
+ }
+
+ void setDumpScreenContent( const ::com::sun::star::uno::Any& rAny )
+ {
+ // TODO(Q1): this was mbDumpScreenContent =
+ // rAny.get<bool>(), only that gcc3.3 wouldn't eat it
+ rAny >>= mbDumpScreenContent;
+ }
+
+ DeviceHelperType maDeviceHelper;
+ PropertySetHelper maPropHelper;
+ bool mbDumpScreenContent;
+
+ private:
+ GraphicDeviceBase( const GraphicDeviceBase& );
+ GraphicDeviceBase& operator=( const GraphicDeviceBase& );
+ };
+}
+
+#endif /* INCLUDED_CANVAS_GRAPHICDEVICEBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/integerbitmapbase.hxx b/include/canvas/base/integerbitmapbase.hxx
new file mode 100644
index 000000000000..602e18a09eb0
--- /dev/null
+++ b/include/canvas/base/integerbitmapbase.hxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX
+#define INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX
+
+#include <com/sun/star/rendering/XIntegerBitmap.hpp>
+#include <canvas/base/bitmapcanvasbase.hxx>
+
+
+namespace canvas
+{
+ /** Helper template to handle XIntegerBitmap method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XIntegerBitmap part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XIntegerBitmap should be among them (why
+ else would you use this template, then?). Base class must have
+ an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class IntegerBitmapBase :
+ public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+
+ // XIntegerBitmap
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(rect,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(rect, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getData( bitmapLayout,
+ rect );
+ }
+
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(bitmapLayout, rect,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(rect, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::mbSurfaceDirty = true;
+ BaseType::maCanvasHelper.modifying();
+
+ BaseType::maCanvasHelper.setData( data, bitmapLayout, rect );
+ }
+
+ virtual void SAL_CALL setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(bitmapLayout, pos,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(pos, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::mbSurfaceDirty = true;
+ BaseType::maCanvasHelper.modifying();
+
+ BaseType::maCanvasHelper.setPixel( color, bitmapLayout, pos );
+ }
+
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::rendering::VolatileContentDestroyedException, ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(pos,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(pos, BaseType::getSize() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getPixel( bitmapLayout,
+ pos );
+ }
+
+ virtual ::com::sun::star::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getMemoryLayout();
+ }
+ };
+}
+
+#endif /* INCLUDED_CANVAS_INTEGERBITMAPBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/sprite.hxx b/include/canvas/base/sprite.hxx
new file mode 100644
index 000000000000..4ebafd57f998
--- /dev/null
+++ b/include/canvas/base/sprite.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITE_HXX
+#define INCLUDED_CANVAS_SPRITE_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dsize.hxx>
+
+namespace basegfx
+{
+ class B2DPoint;
+ class B2DVector;
+ class B2DRange;
+}
+
+namespace canvas
+{
+ /* Definition of Sprite interface (as we mix with UNO here, has to
+ be XInterface - reference holders to a Sprite must be able to
+ control lifetime of reference target)
+ */
+
+ /** Helper interface to connect SpriteCanvas with various
+ sprite implementations.
+
+ This interface should be implemented from every sprite class,
+ as it provides essential repaint and update area facilitates.
+
+ @derive typically, each canvas implementation will derive
+ another interface from this one, that adds rendering
+ functionality (which, of course, is impossible here in a
+ generic way)
+ */
+ class Sprite : public ::com::sun::star::lang::XComponent
+ {
+ public:
+ typedef ::rtl::Reference< Sprite > Reference;
+
+ /** Query whether sprite update will fully cover the given area.
+
+ Use this method to determine whether any background
+ content (regardless of static or sprite) needs an update
+ before rendering this sprite.
+
+ @return true, if sprite redraw will fully overwrite given
+ area (and thus, the background need not be redrawn
+ beforehand).
+ */
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0;
+
+ /** Query whether content has changed
+ */
+ virtual bool isContentChanged() const = 0;
+
+ /** Query position of the left, top pixel of the sprite
+ */
+ virtual ::basegfx::B2DPoint getPosPixel() const = 0;
+
+ /** Query size of the sprite in pixel.
+ */
+ virtual ::basegfx::B2DVector getSizePixel() const = 0;
+
+ /** Get area that is currently covered by the sprite
+
+ This area is already adapted to clipping, alpha and
+ transformation state of this sprite.
+ */
+ virtual ::basegfx::B2DRange getUpdateArea() const = 0;
+
+ /** Query sprite priority
+ */
+ virtual double getPriority() const = 0;
+
+ protected:
+ ~Sprite() {}
+ };
+
+ /** Functor providing a StrictWeakOrdering for sprite references
+ */
+ struct SpriteWeakOrder
+ {
+ bool operator()( const Sprite::Reference& rLHS,
+ const Sprite::Reference& rRHS )
+ {
+ const double nPrioL( rLHS->getPriority() );
+ const double nPrioR( rRHS->getPriority() );
+
+ // if prios are equal, tie-break on ptr value
+ return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
+ }
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/spritecanvasbase.hxx b/include/canvas/base/spritecanvasbase.hxx
new file mode 100644
index 000000000000..f892bf4170a7
--- /dev/null
+++ b/include/canvas/base/spritecanvasbase.hxx
@@ -0,0 +1,193 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITECANVASBASE_HXX
+#define INCLUDED_CANVAS_SPRITECANVASBASE_HXX
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/rendering/XSpriteCanvas.hpp>
+#include <com/sun/star/rendering/InterpolationMode.hpp>
+#include <canvas/base/integerbitmapbase.hxx>
+#include <canvas/spriteredrawmanager.hxx>
+
+
+namespace canvas
+{
+ /** Helper template to handle XIntegerBitmap method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XIntegerBitmap part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XSpriteCanvas and SpriteSurface should be
+ among them (why else would you use this template, then?). Base
+ class must have an Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ OBaseMutex-provided lock. Everytime one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=::com::sun::star::uno::XInterface > class SpriteCanvasBase :
+ public IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef IntegerBitmapBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+ typedef ::rtl::Reference< SpriteCanvasBase > Reference;
+
+ SpriteCanvasBase() :
+ maRedrawManager()
+ {
+ }
+
+ virtual void disposeThis()
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XSpriteCanvas
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimation >& animation ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(animation,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createSpriteFromAnimation(animation);
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap > >& animationBitmaps,
+ sal_Int8 interpolationMode ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::rendering::VolatileContentDestroyedException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(animationBitmaps,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyRange( interpolationMode,
+ ::com::sun::star::rendering::InterpolationMode::NEAREST_NEIGHBOR,
+ ::com::sun::star::rendering::InterpolationMode::BEZIERSPLINE4 );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createSpriteFromBitmaps(animationBitmaps, interpolationMode);
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCustomSprite > SAL_CALL createCustomSprite( const ::com::sun::star::geometry::RealSize2D& spriteSize ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifySpriteSize(spriteSize,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createCustomSprite(spriteSize);
+ }
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite > SAL_CALL createClonedSprite( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& original ) throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ tools::verifyArgs(original,
+ BOOST_CURRENT_FUNCTION,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createClonedSprite(original);
+ }
+
+ // SpriteSurface
+ virtual void showSprite( const Sprite::Reference& rSprite )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.showSprite( rSprite );
+ }
+
+ virtual void hideSprite( const Sprite::Reference& rSprite )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.hideSprite( rSprite );
+ }
+
+ virtual void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.moveSprite( rSprite, rOldPos, rNewPos, rSpriteSize );
+ }
+
+ virtual void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea )
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.updateSprite( rSprite, rPos, rUpdateArea );
+ }
+
+ protected:
+ SpriteRedrawManager maRedrawManager;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITECANVASBASE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/base/spritesurface.hxx b/include/canvas/base/spritesurface.hxx
new file mode 100644
index 000000000000..47a0fb24a67d
--- /dev/null
+++ b/include/canvas/base/spritesurface.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITESURFACE_HXX
+#define INCLUDED_CANVAS_SPRITESURFACE_HXX
+
+#include <canvas/base/sprite.hxx>
+
+namespace canvas
+{
+ /* Definition of the SpriteSurface interface */
+
+ /** Canvas surface containing sprites
+
+ Every canvas surface that contains sprites must implement this
+ interface, when employing the canvas base framework. The
+ methods provided here are used from the individual sprites to
+ notify the canvas about necessary screen updates.
+ */
+ class SpriteSurface : public ::com::sun::star::uno::XInterface
+ {
+ public:
+ typedef ::rtl::Reference< SpriteSurface > Reference;
+
+ /// Sprites should call this from XSprite::show()
+ virtual void showSprite( const Sprite::Reference& rSprite ) = 0;
+
+ /// Sprites should call this from XSprite::hide()
+ virtual void hideSprite( const Sprite::Reference& rSprite ) = 0;
+
+ /// Sprites should call this from XSprite::move()
+ virtual void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) = 0;
+
+ /** Sprites should call this when some part of the content has
+ changed.
+
+ That includes show/hide, i.e. for show, both showSprite()
+ and updateSprite() must be called.
+ */
+ virtual void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) = 0;
+
+ protected:
+ ~SpriteSurface() {}
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITESURFACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/canvastools.hxx b/include/canvas/canvastools.hxx
new file mode 100644
index 000000000000..fd6dadd0a791
--- /dev/null
+++ b/include/canvas/canvastools.hxx
@@ -0,0 +1,587 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_CANVASTOOLS_HXX
+#define INCLUDED_CANVAS_CANVASTOOLS_HXX
+
+#include <rtl/math.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <osl/diagnose.h>
+#include <rtl/ustring.hxx>
+
+#include <string.h> // for strcmp
+#include <vector>
+#include <limits>
+#include <algorithm>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DRange;
+ class B2IRange;
+ class B2IPoint;
+ class B2DPolyPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct RealSize2D;
+ struct IntegerSize2D;
+ struct AffineMatrix2D;
+ struct Matrix2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ struct RenderState;
+ struct ViewState;
+ struct IntegerBitmapLayout;
+ class XCanvas;
+ struct Texture;
+ class XIntegerBitmapColorSpace;
+ class XPolyPolygon2D;
+
+ bool operator==( const RenderState& rLHS,
+ const RenderState& rRHS );
+
+ bool operator==( const ViewState& rLHS,
+ const ViewState& rRHS );
+} } } }
+
+namespace com { namespace sun { namespace star { namespace awt
+{
+ struct Rectangle;
+ class XWindow2;
+} } } }
+
+class Color;
+
+namespace canvas
+{
+ namespace tools
+ {
+ /** Compute the next highest power of 2 of a 32-bit value
+
+ Code devised by Sean Anderson, in good ole HAKMEM
+ tradition.
+
+ @return 1 << (lg(x - 1) + 1)
+ */
+ inline sal_uInt32 nextPow2( sal_uInt32 x )
+ {
+ --x;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+
+ return ++x;
+ }
+
+ /**
+ *
+ * Count the number of 1-bits of an n-bit value
+ *
+ */
+
+ // mickey's math tricks...
+ inline unsigned int pow2( unsigned int c ) { return 0x1 << c; }
+ inline unsigned int mask( unsigned int c ) { return ((unsigned int)(-1)) / (pow2(pow2(c)) + 1); }
+ inline unsigned int count( unsigned int x, unsigned int c ) { return ((x) & mask(c)) + (((x) >> (pow2(c))) & mask(c)); }
+ template<typename T>
+ inline unsigned int bitcount( T c ) {
+ unsigned int nByteIndex = 0;
+ unsigned int nNumBytes = sizeof(T)<<2;
+ do {
+ c=count(c,nByteIndex++);
+ nNumBytes >>= 1;
+ } while(nNumBytes);
+ return c;
+ }
+ inline sal_uInt32 bitcount32( sal_uInt32 c ) {
+ c=count(c,0);
+ c=count(c,1);
+ c=count(c,2);
+ c=count(c,3);
+ c=count(c,4);
+ return c;
+ }
+
+ /** Round given floating point value down to next integer
+ */
+ inline sal_Int32 roundDown( const double& rVal )
+ {
+ return static_cast< sal_Int32 >( floor( rVal ) );
+ }
+
+ /** Round given floating point value up to next integer
+ */
+ inline sal_Int32 roundUp( const double& rVal )
+ {
+ return static_cast< sal_Int32 >( ceil( rVal ) );
+ }
+
+ /** Create a RealSize2D with both coordinate values set to +infinity
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::RealSize2D createInfiniteSize2D();
+
+
+ // View- and RenderState utilities
+ // ===================================================================
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ initRenderState( ::com::sun::star::rendering::RenderState& renderState );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::ViewState&
+ initViewState( ::com::sun::star::rendering::ViewState& viewState );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ getViewStateTransform( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::rendering::ViewState& viewState );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::ViewState&
+ setViewStateTransform( ::com::sun::star::rendering::ViewState& viewState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ getRenderStateTransform( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ setRenderStateTransform( ::com::sun::star::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ appendToRenderState( ::com::sun::star::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::RenderState&
+ prependToRenderState( ::com::sun::star::rendering::RenderState& renderState,
+ const ::basegfx::B2DHomMatrix& transform );
+
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix&
+ mergeViewAndRenderTransform( ::basegfx::B2DHomMatrix& transform,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+
+ // Matrix utilities
+ // ===================================================================
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D&
+ setIdentityAffineMatrix2D( ::com::sun::star::geometry::AffineMatrix2D& matrix );
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::geometry::Matrix2D&
+ setIdentityMatrix2D( ::com::sun::star::geometry::Matrix2D& matrix );
+
+
+ // Special utilities
+ // ===================================================================
+
+ /** Calc the bounding rectangle of a transformed rectangle.
+
+ The method applies the given transformation to the
+ specified input rectangle, and returns the bounding box of
+ the resulting output area.
+
+ @param o_Rect
+ Output rectangle
+
+ @param i_Rect
+ Input rectangle
+
+ @param i_Transformation
+ Transformation to apply to the input rectangle
+
+ @return a reference to the resulting rectangle
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DRange& calcTransformedRectBounds( ::basegfx::B2DRange& o_Rect,
+ const ::basegfx::B2DRange& i_Rect,
+ const ::basegfx::B2DHomMatrix& i_Transformation );
+
+ /** Calc a transform that maps the upper, left corner of a
+ rectangle to the origin.
+
+ The method is a specialized version of
+ calcRectToRectTransform() (Removed now), mapping the input rectangle's
+ the upper, left corner to the origin, and leaving the size
+ untouched.
+
+ @param o_transform
+ Output parameter, to receive the resulting transformation
+ matrix.
+
+ @param i_srcRect
+ Input parameter, specifies the original source
+ rectangle. The resulting transformation will exactly map
+ the source rectangle's upper, left corner to the origin.
+
+ @param i_transformation
+ The original transformation matrix. This is changed with
+ translations (if necessary), to exactly map the source
+ rectangle to the origin.
+
+ @return a reference to the resulting transformation matrix
+
+ @see calcRectToRectTransform()
+ @see calcTransformedRectBounds()
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DHomMatrix& calcRectToOriginTransform( ::basegfx::B2DHomMatrix& o_transform,
+ const ::basegfx::B2DRange& i_srcRect,
+ const ::basegfx::B2DHomMatrix& i_transformation );
+
+ /** Check whether a given rectangle is within another
+ transformed rectangle.
+
+ This method checks for polygonal containedness, i.e. the
+ transformed rectangle is not represented as an axis-alignd
+ rectangle anymore (like calcTransformedRectBounds()), but
+ polygonal. Thus, the insideness test is based on tight
+ bounds.
+
+ @param rContainedRect
+ This rectangle is checked, whether it is fully within the
+ transformed rTransformRect.
+
+ @param rTransformRect
+ This rectangle is transformed, and then checked whether it
+ fully contains rContainedRect.
+
+ @param rTransformation
+ This transformation is applied to rTransformRect
+ */
+ CANVASTOOLS_DLLPUBLIC bool isInside( const ::basegfx::B2DRange& rContainedRect,
+ const ::basegfx::B2DRange& rTransformRect,
+ const ::basegfx::B2DHomMatrix& rTransformation );
+
+ /** Clip a scroll to the given bound rect
+
+ @param io_rSourceArea
+ Source area to scroll. The resulting clipped source area
+ is returned therein.
+
+ @param io_rDestPoint
+ Destination point of the scroll (upper, left corner of
+ rSourceArea after the scroll). The new, resulting
+ destination point is returned therein.q
+
+ @param o_ClippedAreas
+ Vector of rectangles in the <em>destination</em> area
+ coordinate system, which are clipped away from the source
+ area, and thus need extra updates (i.e. they are not
+ correctly copy from the scroll operation, since there was
+ no information about them in the source).
+
+ @param rBounds
+ Bounds to clip against.
+
+ @return false, if the resulting scroll area is empty
+ */
+ CANVASTOOLS_DLLPUBLIC bool clipScrollArea( ::basegfx::B2IRange& io_rSourceArea,
+ ::basegfx::B2IPoint& io_rDestPoint,
+ ::std::vector< ::basegfx::B2IRange >& o_ClippedAreas,
+ const ::basegfx::B2IRange& rBounds );
+
+ /** Clip a blit between two differently surfaces.
+
+ This method clips source and dest rect for a clip between
+ two differently clipped surfaces, such that the resulting
+ blit rects are fully within both clip areas.
+
+ @param io_rSourceArea
+ Source area of the blit. Returned therein is the computed
+ clipped source area.
+
+ @param io_rDestPoint
+ Dest area of the blit. Returned therein is the computed
+ clipped dest area.
+
+ @param rSourceBounds
+ Clip bounds of the source surface
+
+ @param rDestBounds
+ Clip bounds of the dest surface
+
+ @return false, if the resulting blit is empty, i.e. fully
+ clipped away.
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2IRange spritePixelAreaFromB2DRange( const ::basegfx::B2DRange& rRange );
+
+ /** Retrieve various internal properties of the actual canvas implementation.
+
+ This method retrieves a bunch of internal, implementation-
+ and platform-dependent values from the canvas
+ implementation. Among them are for example operating
+ system window handles. The actual layout and content of
+ the returned sequence is dependent on the component
+ implementation, undocumented and subject to change.
+
+ @param i_rxCanvas
+ Input parameter, the canvas representation for which the device information
+ is to be retrieveds
+
+ @param o_rxParams
+ Output parameter, the sequence of Anys that hold the device parameters. Layout is as described above
+
+ @return A reference to the resulting sequence of parameters
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& getDeviceInfo(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas >& i_rxCanvas,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& o_rxParams );
+
+ /** Return a color space for a default RGBA integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGBA color.
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpace();
+
+ /** Return a color space for a default RGB integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGB color (the last byte
+ is unused).
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XIntegerBitmapColorSpace> getStdColorSpaceWithoutAlpha();
+
+ /** Return a memory layout for a default RGBA integer format
+
+ Use this method for dead-simple bitmap implementations,
+ that map all their formats to 8888 RGBA color.
+ */
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::rendering::IntegerBitmapLayout getStdMemoryLayout(
+ const ::com::sun::star::geometry::IntegerSize2D& rBitmapSize );
+
+ /// Convert standard 8888 RGBA color to vcl color
+ CANVASTOOLS_DLLPUBLIC ::Color stdIntSequenceToColor( const ::com::sun::star::uno::Sequence<sal_Int8>& rColor );
+
+ /// Convert standard 8888 RGBA color to vcl color
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::uno::Sequence<sal_Int8> colorToStdIntSequence( const ::Color& rColor );
+
+ // Modeled closely after boost::numeric_cast, only that we
+ // issue some trace output here and throw a RuntimeException
+
+ /** Cast numeric value into another (numeric) data type
+
+ Apart from converting the numeric value, this template
+ also checks if any overflow, underflow, or sign
+ information is lost (if yes, it throws an
+ uno::RuntimeException.
+ */
+ template< typename Target, typename Source > inline Target numeric_cast( Source arg )
+ {
+ // typedefs abbreviating respective trait classes
+ typedef ::std::numeric_limits< Source > SourceLimits;
+ typedef ::std::numeric_limits< Target > TargetLimits;
+
+#undef min
+#undef max
+
+ if( ( arg<0 && !TargetLimits::is_signed) || // loosing the sign here
+ ( SourceLimits::is_signed && arg<TargetLimits::min()) || // underflow will happen
+ ( arg>TargetLimits::max() ) ) // overflow will happen
+ {
+# if OSL_DEBUG_LEVEL > 2
+ OSL_TRACE("numeric_cast detected data loss");
+#endif
+ throw ::com::sun::star::uno::RuntimeException(
+ "numeric_cast detected data loss",
+ NULL );
+ }
+
+ return static_cast<Target>(arg);
+ }
+
+ CANVASTOOLS_DLLPUBLIC ::com::sun::star::awt::Rectangle getAbsoluteWindowRect(
+ const ::com::sun::star::awt::Rectangle& rRect,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow2 >& xWin );
+
+ /** Retrieve for small bound marks around each corner of the given rectangle
+ */
+ CANVASTOOLS_DLLPUBLIC ::basegfx::B2DPolyPolygon getBoundMarksPolyPolygon( const ::basegfx::B2DRange& rRange );
+
+ /** Calculate number of gradient "strips" to generate (takes
+ into account device resolution)
+
+ @param nColorSteps
+ Maximal integer difference between all color stops, needed
+ for smooth gradient color differences
+ */
+ CANVASTOOLS_DLLPUBLIC int calcGradientStepCount( ::basegfx::B2DHomMatrix& rTotalTransform,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::Texture& texture,
+ int nColorSteps );
+
+ /** A very simplistic map for ASCII strings and arbitrary value
+ types.
+
+ This class internally references a constant, static array of
+ sorted MapEntries, and performs a binary search to look up
+ values for a given query string. Note that this map is static,
+ i.e. not meant to be extented at runtime.
+
+ @tpl ValueType
+ The value type this map should store, associated with an ASCII
+ string.
+ */
+ template< typename ValueType > class ValueMap
+ {
+ public:
+ struct MapEntry
+ {
+ const char* maKey;
+ ValueType maValue;
+ };
+
+ /** Create a ValueMap for the given array of MapEntries.
+
+ @param pMap
+ Pointer to a <em>static</em> array of MapEntries. Must
+ live longer than this object! Make absolutely sure that
+ the string entries passed via pMap are ASCII-only -
+ everything else might not yield correct string
+ comparisons, and thus will result in undefined behaviour.
+
+ @param nEntries
+ Number of entries for pMap
+
+ @param bCaseSensitive
+ Whether the map query should be performed case sensitive
+ or not. When bCaseSensitive is false, all MapEntry strings
+ must be lowercase!
+ */
+ ValueMap( const MapEntry* pMap,
+ ::std::size_t nEntries,
+ bool bCaseSensitive ) :
+ mpMap( pMap ),
+ mnEntries( nEntries ),
+ mbCaseSensitive( bCaseSensitive )
+ {
+#ifdef DBG_UTIL
+ // Ensure that map entries are sorted (and all lowercase, if this
+ // map is case insensitive)
+ const OString aStr( pMap->maKey );
+ if( !mbCaseSensitive &&
+ aStr != aStr.toAsciiLowerCase() )
+ {
+ OSL_TRACE("ValueMap::ValueMap(): Key %s is not lowercase",
+ pMap->maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Key is not lowercase" );
+ }
+
+ if( mnEntries > 1 )
+ {
+ for( ::std::size_t i=0; i<mnEntries-1; ++i, ++pMap )
+ {
+ if( !mapComparator(pMap[0], pMap[1]) &&
+ mapComparator(pMap[1], pMap[0]) )
+ {
+ OSL_TRACE("ValueMap::ValueMap(): Map is not sorted, keys %s and %s are wrong",
+ pMap[0].maKey,
+ pMap[1].maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Map is not sorted" );
+ }
+
+ const OString aStr2( pMap[1].maKey );
+ if( !mbCaseSensitive &&
+ aStr2 != aStr2.toAsciiLowerCase() )
+ {
+ OSL_TRACE("ValueMap::ValueMap(): Key %s is not lowercase",
+ pMap[1].maKey);
+ OSL_FAIL( "ValueMap::ValueMap(): Key is not lowercase" );
+ }
+ }
+ }
+#endif
+ }
+
+ /** Lookup a value for the given query string
+
+ @param rName
+ The string to lookup. If the map was created with the case
+ insensitive flag, the lookup is performed
+ case-insensitive, otherwise, case-sensitive.
+
+ @param o_rResult
+ Output parameter, which receives the value associated with
+ the query string. If no value was found, the referenced
+ object is kept unmodified.
+
+ @return true, if a matching entry was found.
+ */
+ bool lookup( const OUString& rName,
+ ValueType& o_rResult ) const
+ {
+ // rName is required to contain only ASCII characters.
+ // TODO(Q1): Enforce this at upper layers
+ OString aKey( OUStringToOString( mbCaseSensitive ? rName : rName.toAsciiLowerCase(),
+ RTL_TEXTENCODING_ASCII_US ) );
+ MapEntry aSearchKey =
+ {
+ aKey.getStr(),
+ ValueType()
+ };
+
+ const MapEntry* pRes;
+ const MapEntry* pEnd = mpMap+mnEntries;
+ if( (pRes=::std::lower_bound( mpMap,
+ pEnd,
+ aSearchKey,
+ &mapComparator )) != pEnd )
+ {
+ // place to _insert before_ found - is it equal to
+ // the search key?
+ if( strcmp( pRes->maKey, aSearchKey.maKey ) == 0 )
+ {
+ // yep, correct entry found
+ o_rResult = pRes->maValue;
+ return true;
+ }
+ }
+
+ // not found
+ return false;
+ }
+
+ private:
+ static bool mapComparator( const MapEntry& rLHS,
+ const MapEntry& rRHS )
+ {
+ return strcmp( rLHS.maKey,
+ rRHS.maKey ) < 0;
+ }
+
+ const MapEntry* mpMap;
+ ::std::size_t mnEntries;
+ bool mbCaseSensitive;
+ };
+ }
+}
+
+#endif /* INCLUDED_CANVAS_CANVASTOOLS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/canvastoolsdllapi.h b/include/canvas/canvastoolsdllapi.h
new file mode 100644
index 000000000000..ad96dec3ea7c
--- /dev/null
+++ b/include/canvas/canvastoolsdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CANVAS_DLLAPI_H
+#define _CANVAS_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined(CANVASTOOLS_DLLIMPLEMENTATION)
+#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CANVASTOOLS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CANVASTOOLS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/debug.hxx b/include/canvas/debug.hxx
new file mode 100644
index 000000000000..9fc5ad31711f
--- /dev/null
+++ b/include/canvas/debug.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_DEBUG_HXX
+#define INCLUDED_CANVAS_DEBUG_HXX
+
+// shared_ptr debugging
+// --------------------
+
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+
+# include <sal/config.h>
+# include <boost/shared_ptr.hpp>
+
+::std::size_t find_unreachable_objects( bool );
+
+# if OSL_DEBUG_LEVEL > 2
+# include <osl/diagnose.h>
+# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \
+ BOOST_CURRENT_FUNCTION, a, \
+ find_unreachable_objects(true) )
+# else
+/** This macro shows how much memory is still used by shared_ptrs
+
+ Use this macro at places in the code where normally all shared_ptr
+ objects should have been deleted. You'll get the number of bytes
+ still contained in those objects, which quite possibly are prevented
+ from deletion by circular references.
+ */
+# define SHARED_PTR_LEFTOVERS(a) OSL_TRACE("%s\n%s: Unreachable objects still use %d bytes\n", \
+ BOOST_CURRENT_FUNCTION, a, \
+ find_unreachable_objects(false) )
+# endif
+
+#else
+
+# define SHARED_PTR_LEFTOVERS(a) ((void)0)
+
+#endif
+
+#endif // ! defined(INCLUDED_CANVAS_DEBUG_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/elapsedtime.hxx b/include/canvas/elapsedtime.hxx
new file mode 100644
index 000000000000..8248e3408785
--- /dev/null
+++ b/include/canvas/elapsedtime.hxx
@@ -0,0 +1,173 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ELAPSEDTIME_HXX
+#define INCLUDED_CANVAS_ELAPSEDTIME_HXX
+
+#include <sal/types.h>
+
+#include "boost/shared_ptr.hpp"
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ namespace tools
+ {
+ /** Calculate elapsed time.
+
+ This class provides several time-measurement and
+ -management functions. In its simplest use-case, it
+ measures the time from its creation.
+ */
+ class CANVASTOOLS_DLLPUBLIC ElapsedTime
+ {
+ public:
+ /** Create a new ElapsedTime object
+
+ The moment of construction starts the time
+ measurement. That means, a subsequent getElapsedTime()
+ call will return the time difference between object
+ creation and getElapsedTime() call.
+ */
+ ElapsedTime();
+
+ /** Creates a new ElapsedTime object based on another
+ timer.
+
+ The moment of construction starts the time
+ measurement. That means, a subsequent getElapsedTime()
+ call will return the time difference between object
+ creation and getElapsedTime() call. All time values
+ are not taken from the system's time base, but from
+ the provided timer.
+ */
+ ElapsedTime( ::boost::shared_ptr<ElapsedTime> const & pTimeBase );
+
+ /** Reset the time
+
+ The instance of the reset() call starts the time
+ measurement from scratch. That means, a subsequent
+ getElapsedTime() call will return the time difference
+ between reset() and getElapsedTime() call.
+ */
+ void reset();
+
+ /** Query the elapsed time
+
+ This method returns the elapsed time in seconds
+ between either the construction of this object, or the
+ last reset() call, if any (but see the time modulation
+ methods below, for means to modify the otherwise
+ continuous flow of time).
+
+ @return the elapsed time in seconds.
+ */
+ double getElapsedTime() const;
+
+ /** Pauses the running timer.
+
+ This method stops the time, as returned by this
+ object, until continueTimer() is called. During this
+ period, getElapsedTime() will always return the same
+ time value (i.e. the instant when pauseTimer() was
+ called).
+ */
+ void pauseTimer();
+
+ /** Continues the paused timer.
+
+ This method re-enables the time flow, that is, time
+ starts running again for clients calling
+ getElapsedTime(). The (subtle) difference to the
+ holdTimer/releaseTimer() methods below is, that there
+ is no perceived time 'jump' between the pauseTimer()
+ call and the continueTimer() call, i.e. the time
+ starts over with the same value it has stopped on
+ pauseTimer().
+ */
+ void continueTimer();
+
+ /** Adjusts the timer, hold and pause times.
+
+ This method modifies the time as returned by this
+ object by the specified amount. This affects the time
+ as returned by getElapsedTime(), regardless of the
+ mode (e.g. paused, or on hold).
+
+ @param fOffset
+ This value will be added to the current time, i.e. the
+ next call to getElapsedTime() (when performed
+ immediately) will be adjusted by fOffset.
+
+ @param bLimitToLastQueriedTime
+ Limits the given offset to the time that has been
+ taken via getElapsedTime()
+ */
+ void adjustTimer( double fOffset,
+ bool bLimitToLastQueriedTime = true );
+
+ /** Holds the current time.
+
+ This call makes the timer hold the current time
+ (e.g. getElapsedTime() will return the time when
+ holdTimer() was called), while the underlying time is
+ running on. When releaseTimer() is called, the time
+ will 'jump' to the then-current, underlying time. This
+ is equivalent to pressing the "interim time" button on
+ a stop watch, which shows this stopped time, while the
+ clock keeps running internally.
+ */
+ void holdTimer();
+
+ /** Releases a held timer.
+
+ After this call, the timer again returns the running
+ time on getElapsedTime().
+ */
+ void releaseTimer();
+
+ private:
+ static double getSystemTime();
+ double getCurrentTime() const;
+ double getElapsedTimeImpl() const; // does not set m_fLastQueriedTime
+
+ const ::boost::shared_ptr<ElapsedTime> m_pTimeBase;
+
+ /// To validate adjustTimer() calls with bLimitToLastQueriedTime=true
+ mutable double m_fLastQueriedTime;
+
+ /// Start time, from which the difference to the time base is returned
+ double m_fStartTime;
+
+ /// Instant, when last pause or hold started, relative to m_fStartTime
+ double m_fFrozenTime;
+
+ /// True, when in pause mode
+ bool m_bInPauseMode;
+
+ /// True, when in hold mode
+ bool m_bInHoldMode;
+ };
+
+ }
+}
+
+#endif /* INCLUDED_CANVAS_ELAPSEDTIME_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/parametricpolypolygon.hxx b/include/canvas/parametricpolypolygon.hxx
new file mode 100644
index 000000000000..2e8cb7af45fb
--- /dev/null
+++ b/include/canvas/parametricpolypolygon.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX
+#define INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+#include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp>
+#include <cppuhelper/compbase2.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include <boost/utility.hpp>
+#include <canvas/canvastoolsdllapi.h>
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DHomMatrix;
+}
+
+
+/* Definition of ParametricPolyPolygon class */
+
+namespace canvas
+{
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XParametricPolyPolygon2D,
+ ::com::sun::star::lang::XServiceInfo > ParametricPolyPolygon_Base;
+
+ class CANVASTOOLS_DLLPUBLIC ParametricPolyPolygon : public ::comphelper::OBaseMutex,
+ public ParametricPolyPolygon_Base,
+ private ::boost::noncopyable
+ {
+ public:
+ enum GradientType
+ {
+ GRADIENT_LINEAR,
+ GRADIENT_ELLIPTICAL,
+ GRADIENT_RECTANGULAR
+ };
+
+ /** Structure of defining values for the ParametricPolyPolygon
+
+ This is used to copy the state of the
+ ParametricPolyPolygon atomically.
+ */
+ struct Values
+ {
+ Values( const ::basegfx::B2DPolygon& rGradientPoly,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& rColors,
+ const ::com::sun::star::uno::Sequence< double >& rStops,
+ double nAspectRatio,
+ GradientType eType ) :
+ maGradientPoly( rGradientPoly ),
+ mnAspectRatio( nAspectRatio ),
+ maColors( rColors ),
+ maStops( rStops ),
+ meType( eType )
+ {
+ }
+
+ /// Polygonal gradient shape (ignored for linear and axial gradient)
+ const ::basegfx::B2DPolygon maGradientPoly;
+
+ /// Aspect ratio of gradient, affects scaling of innermost gradient polygon
+ const double mnAspectRatio;
+
+ /// Gradient colors
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > maColors;
+
+ /// Gradient color stops
+ const ::com::sun::star::uno::Sequence< double > maStops;
+
+ /// Type of gradient to render (as e.g. linear grads are not represented by maGradientPoly)
+ const GradientType meType;
+ };
+
+ static ::com::sun::star::uno::Sequence< OUString > getAvailableServiceNames();
+ static ParametricPolyPolygon* create(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const OUString& rServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs );
+
+ /// Dispose all internal references
+ virtual void SAL_CALL disposing();
+
+ // XParametricPolyPolygon2D
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > SAL_CALL getOutline( double t ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getColor( double t ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getPointColor( const ::com::sun::star::geometry::RealPoint2D& point ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XColorSpace > SAL_CALL getColorSpace() throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Query all defining values of this object atomically
+ Values getValues() const;
+
+ protected:
+ ~ParametricPolyPolygon(); // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ private:
+ static ParametricPolyPolygon* createLinearHorizontalGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops );
+ static ParametricPolyPolygon* createEllipticalGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double fAspect );
+ static ParametricPolyPolygon* createRectangularGradient( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double fAspect );
+
+ /// Private, because objects can only be created from the static factories
+ ParametricPolyPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ const ::basegfx::B2DPolygon& rGradientPoly,
+ GradientType eType,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops,
+ double nAspectRatio );
+ ParametricPolyPolygon( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice >& rDevice,
+ GradientType eType,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > >& colors,
+ const ::com::sun::star::uno::Sequence< double >& stops );
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XGraphicDevice > mxDevice;
+
+ /// All defining values of this object
+ const Values maValues;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_PARAMETRICPOLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/propertysethelper.hxx b/include/canvas/propertysethelper.hxx
new file mode 100644
index 000000000000..b90d9ef344e5
--- /dev/null
+++ b/include/canvas/propertysethelper.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_PROPERTYSETHELPER_HXX
+#define INCLUDED_CANVAS_PROPERTYSETHELPER_HXX
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <canvas/canvastools.hxx>
+
+#include <boost/function.hpp>
+#include <vector>
+#include <memory>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ /** Really simplistic XPropertySet helper for properties.
+
+ This class provides easy access to properties, referenced via
+ ASCII strings. The name/property modification callbacks pairs
+ are passed into this class via a vector. Each time a property
+ is set or queried, the corresponding getter or setter callback
+ is called.
+
+ Use this class as a delegate for the corresponding
+ XPropertySet methods, and take care of UNO XInterface and lock
+ handling by yourself.
+
+ The core responsibility of this this class is the name/value
+ mapping for property sets.
+ */
+ class CANVASTOOLS_DLLPUBLIC PropertySetHelper
+ {
+ public:
+ typedef boost::function0< ::com::sun::star::uno::Any > GetterType;
+ typedef boost::function1<void, const ::com::sun::star::uno::Any&> SetterType;
+ struct Callbacks
+ {
+ GetterType getter;
+ SetterType setter;
+ };
+ typedef tools::ValueMap< Callbacks > MapType;
+ typedef std::vector< MapType::MapEntry > InputMap;
+
+ class MakeMap : public InputMap
+ {
+ public:
+ MakeMap(const char* name,
+ const GetterType& getter,
+ const SetterType& setter)
+ {
+ MapType::MapEntry aEntry={name, {getter, setter}};
+ this->push_back(aEntry);
+ }
+ MakeMap(const char* name,
+ const GetterType& getter)
+ {
+ MapType::MapEntry aEntry={name, {getter, SetterType()}};
+ this->push_back(aEntry);
+ }
+ MakeMap& operator()(const char* name,
+ const GetterType& getter,
+ const SetterType& setter)
+ {
+ MapType::MapEntry aEntry={name, {getter, setter}};
+ this->push_back(aEntry);
+ return *this;
+ }
+ MakeMap& operator()(const char* name,
+ const GetterType& getter)
+ {
+ MapType::MapEntry aEntry={name, {getter, SetterType()}};
+ this->push_back(aEntry);
+ return *this;
+ }
+ };
+
+ /** Create helper with zero properties
+ */
+ PropertySetHelper();
+
+ /** Init helper with new name/value map
+
+ @param rMap
+ Vector of name/function pointers. Each name is offered as
+ a property, and reading/writing to this property is passed
+ on to the given function pointer.
+ */
+ void initProperties( const InputMap& rMap );
+
+ /** Add given properties to helper
+
+ @param rMap
+ Vector of name/function pointers. Each name is offered as
+ a property, and reading/writing to this property is passed
+ on to the given function pointer. These name/function
+ pairs are added to the already existing ones.
+ */
+ void addProperties( const InputMap& rMap );
+
+ /** Checks whether the given string corresponds to a valid
+ property name.
+
+ @return true, if the given name maps to a known property.
+ */
+ bool isPropertyName( const OUString& aPropertyName ) const;
+
+ /** Request the currently active map
+ */
+ const InputMap& getPropertyMap() const { return maMapEntries; }
+
+ // XPropertySet implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
+ void setPropertyValue( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Any& aValue );
+ ::com::sun::star::uno::Any getPropertyValue( const OUString& PropertyName ) const;
+ void addPropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
+ void removePropertyChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener );
+ void addVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener );
+ void removeVetoableChangeListener( const OUString& aPropertyName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& xListener );
+
+ private:
+ std::auto_ptr<MapType> mpMap;
+ InputMap maMapEntries;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_PROPERTYSETHELPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/bitmap.hxx b/include/canvas/rendering/bitmap.hxx
new file mode 100644
index 000000000000..295057bd832b
--- /dev/null
+++ b/include/canvas/rendering/bitmap.hxx
@@ -0,0 +1,314 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_BITMAP_HXX
+#define INCLUDED_CANVAS_BITMAP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/rendering/XCanvas.hpp>
+#include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/geometry/IntegerPoint2D.hpp>
+#include <canvas/rendering/icolorbuffer.hxx>
+#include <canvas/rendering/icachedprimitive.hxx>
+#include <canvas/rendering/isurfaceproxymanager.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <vector>
+
+namespace basegfx
+{
+ class B2IVector;
+ class B2DPoint;
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+namespace canvas
+{
+ class ImplBitmap;
+
+ /** Bitmap class, with XCanvas-like render interface.
+
+ This class provides a bitmap, that can be rendered into,
+ with an interface compatible to XCanvas. Furthermore, the
+ bitmaps held here can optionally be backed by (possibly
+ hw-accelerated) textures.
+ */
+ class Bitmap
+ {
+ public:
+ /** Create bitmap with given size
+
+ @param rSize
+ Size of the bitmap, in pixel
+
+ @param rMgr
+ SurfaceProxyManager, to use for HW acceleration
+
+ @param bWithAlpha
+ When true, the created bitmap will have an alpha channel,
+ false otherwise
+ */
+ Bitmap( const ::basegfx::B2IVector& rSize,
+ const ISurfaceProxyManagerSharedPtr& rMgr,
+ bool bWithAlpha );
+ ~Bitmap();
+
+ /// Query whether this bitmap contains alpha channel information
+ bool hasAlpha() const;
+
+ /// Query size of the bitmap in pixel
+ ::basegfx::B2IVector getSize() const;
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > getData(
+ ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
+
+ void setData(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerRectangle2D& rect );
+
+ void setPixel(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
+ const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
+
+ ::com::sun::star::uno::Sequence< sal_Int8 > getPixel(
+ ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const ::com::sun::star::geometry::IntegerPoint2D& pos );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rArea
+ Subset of the surface to render. Coordinate system are
+ surface area pixel, given area will be clipped to the
+ surface bounds.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Render the bitmap content to associated
+ SurfaceProxyManager's screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rClipPoly
+ Clip polygon for the surface. The clip polygon is also
+ subject to the output transformation.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform );
+
+ /** Clear whole bitmap with given color.
+
+ This method sets every single pixel of the bitmap to the
+ specified color value.
+ */
+ void clear( const ::com::sun::star::uno::Sequence< double >& color );
+
+ void fillB2DPolyPolygon(
+ const ::basegfx::B2DPolyPolygon& rPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+
+ // High-level drawing operations (from the XCanvas interface)
+ // ==========================================================
+
+ /// See XCanvas interface
+ void drawPoint( const ::com::sun::star::geometry::RealPoint2D& aPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ void drawLine( const ::com::sun::star::geometry::RealPoint2D& aStartPoint,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ void drawBezier( const ::com::sun::star::geometry::RealBezierSegment2D& aBezierSegment,
+ const ::com::sun::star::geometry::RealPoint2D& aEndPoint,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr strokePolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr strokeTexturedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr strokeTextureMappedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::geometry::XMapping2D >& xMapping,
+ const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr fillPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr fillTexturedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations );
+ /** See XCanvas interface
+
+ @param textureAnnotations
+ Vector of shared pointers to bitmap textures,
+ <em>corresponding</em> in indices to the textures
+ sequence. This is to decouple this interface from the
+ client's XBitmap-implementation class.
+ */
+ ICachedPrimitiveSharedPtr fillTextureMappedPolyPolygon(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::rendering::Texture >& textures,
+ const ::std::vector< ::boost::shared_ptr<Bitmap> >& textureAnnotations,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::geometry::XMapping2D >& xMapping );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmap(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmap(
+ const ::boost::shared_ptr<Bitmap>& rImage,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmapModulated(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap >& xBitmap,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+ /// See XCanvas interface
+ ICachedPrimitiveSharedPtr drawBitmapModulated(
+ const ::boost::shared_ptr<Bitmap>& rImage,
+ const ::com::sun::star::rendering::ViewState& viewState,
+ const ::com::sun::star::rendering::RenderState& renderState );
+
+ private:
+ friend class ImplBitmap;
+
+ const ::boost::scoped_ptr< ImplBitmap > mpImpl;
+ };
+
+ typedef ::boost::shared_ptr< Bitmap > BitmapSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_BITMAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/icachedprimitive.hxx b/include/canvas/rendering/icachedprimitive.hxx
new file mode 100644
index 000000000000..f15fed3e72e8
--- /dev/null
+++ b/include/canvas/rendering/icachedprimitive.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX
+#define INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ /** Objects with this interface are returned from every Bitmap
+ render operation.
+
+ These objects can be used to implement the
+ rendering::XCachedPrimitive interface, which in turn caches
+ render state and objects to facilitate quick redraws.
+ */
+ struct ICachedPrimitive
+ {
+ virtual ~ICachedPrimitive() {}
+
+ /** Redraw the primitive with the given view state
+
+ Note that the primitive will <em>always</em> be redrawn on
+ the bitmap it was created from.
+ */
+ virtual sal_Int8 redraw( const ::com::sun::star::rendering::ViewState& aState ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ICachedPrimitive > ICachedPrimitiveSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ICACHEDPRIMITIVE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/icolorbuffer.hxx b/include/canvas/rendering/icolorbuffer.hxx
new file mode 100644
index 000000000000..4226a9a6d759
--- /dev/null
+++ b/include/canvas/rendering/icolorbuffer.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ICOLORBUFFER_HXX
+#define INCLUDED_CANVAS_ICOLORBUFFER_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace canvas
+{
+ /** Interface for a raw memory pixel container
+
+ Use this interface to represent a surface of raw pixel (e.g. a
+ bitmap) to the canvas rendering framework.
+ */
+ struct IColorBuffer
+ {
+ /// The underlying pixel format for this buffer
+ enum Format
+ {
+ // 24-bit RGB pixel format, 8 bits per channel.
+ FMT_R8G8B8,
+
+ // 32-bit ARGB pixel format with alpha, 8 bits per channel.
+ FMT_A8R8G8B8,
+
+ // 32-bit RGB pixel format, 8 bits per channel.
+ FMT_X8R8G8B8,
+
+ // for enum to 32bit
+ FMT_UNKNOWN = static_cast<sal_uInt32>(-1)
+ };
+
+ virtual ~IColorBuffer() {}
+
+ /** Get a pointer to the raw memory bits of the pixel
+ */
+ virtual sal_uInt8* lock() const = 0;
+
+ /** unlock previous locked buffer
+ */
+ virtual void unlock() const = 0;
+
+ /** Get width in pixel
+ */
+ virtual sal_uInt32 getWidth() const = 0;
+
+ /** Get height in pixel
+ */
+ virtual sal_uInt32 getHeight() const = 0;
+
+ /** Offset, in bytes, between consecutive scan lines of the bitmap.
+ If the stride is positive, the bitmap is top-down.
+ If the stride is negative, the bitmap is bottom-up.
+ The returned value is only valid while the buffer is locked.
+ */
+ virtual sal_uInt32 getStride() const = 0;
+
+ /** Get format of the color buffer
+ */
+ virtual Format getFormat() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< IColorBuffer > IColorBufferSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ICOLORBUFFER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/irendermodule.hxx b/include/canvas/rendering/irendermodule.hxx
new file mode 100644
index 000000000000..413320eb85e9
--- /dev/null
+++ b/include/canvas/rendering/irendermodule.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_IRENDERMODULE_HXX
+#define INCLUDED_CANVAS_IRENDERMODULE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2IRange;
+ class B2IVector;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ struct ISurface;
+
+ struct Vertex
+ {
+ float r,g,b,a;
+ float u,v;
+ float x,y,z;
+ };
+
+ /** Output module interface for backend render implementations.
+
+ Implement this interface for each operating system- or
+ library-specific rendering backend, which needs coupling with
+ the canvas rendering framework (which can be shared between
+ all backend implementations).
+ */
+ struct IRenderModule
+ {
+ /** Type of primitive passed to the render module via
+ pushVertex()
+ */
+ enum PrimitiveType
+ {
+ PRIMITIVE_TYPE_UNKNOWN,
+ PRIMITIVE_TYPE_TRIANGLE,
+ PRIMITIVE_TYPE_QUAD
+ };
+
+ virtual ~IRenderModule() {}
+
+ /// Lock rendermodule against concurrent access
+ virtual void lock() const = 0;
+
+ /// Unlock rendermodule for concurrent access
+ virtual void unlock() const = 0;
+
+ /** Maximal size of VRAM pages available
+
+ This is typically the maximum texture size of the
+ hardware, or some arbitrary limit if the backend is
+ software.
+ */
+ virtual ::basegfx::B2IVector getPageSize() = 0;
+
+ /** Create a (possibly hardware-accelerated) surface
+
+ @return a pointer to a surface, which is an abstraction of
+ a piece of (possibly hardware-accelerated) texture memory.
+ */
+ virtual ::boost::shared_ptr<ISurface> createSurface( const ::basegfx::B2IVector& surfaceSize ) = 0;
+
+ /** Begin rendering the given primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void beginPrimitive( PrimitiveType eType ) = 0;
+
+ /** Finish rendering a primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void endPrimitive() = 0;
+
+ /** Add given vertex to current primitive
+
+ After issuing a beginPrimitive(), each pushVertex() adds a
+ vertex to the active primitive.
+ */
+ virtual void pushVertex( const Vertex& vertex ) = 0;
+
+ /** Query error status
+
+ @returns true, if an error occurred during primitive
+ construction.
+ */
+ virtual bool isError() = 0;
+ };
+
+ typedef ::boost::shared_ptr< IRenderModule > IRenderModuleSharedPtr;
+
+ /// Little RAII wrapper for guarding access to IRenderModule interface
+ class RenderModuleGuard : private ::boost::noncopyable
+ {
+ public:
+ explicit RenderModuleGuard( const IRenderModuleSharedPtr& rRenderModule ) :
+ mpRenderModule( rRenderModule )
+ {
+ mpRenderModule->lock();
+ }
+
+ ~RenderModuleGuard()
+ {
+ mpRenderModule->unlock();
+ }
+
+ private:
+ const IRenderModuleSharedPtr mpRenderModule;
+ };
+}
+
+#endif /* INCLUDED_CANVAS_IRENDERMODULE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurface.hxx b/include/canvas/rendering/isurface.hxx
new file mode 100644
index 000000000000..a79faf96a8c8
--- /dev/null
+++ b/include/canvas/rendering/isurface.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACE_HXX
+#define INCLUDED_CANVAS_ISURFACE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+ class B2IVector;
+}
+
+namespace canvas
+{
+ struct IColorBuffer;
+
+ struct ISurface
+ {
+ virtual ~ISurface() {}
+
+ /** Select texture behind this interface to be the current one
+ for primitive output.
+ */
+ virtual bool selectTexture() = 0;
+
+ /** Tells whether the surface is valid or not
+ */
+ virtual bool isValid() = 0;
+
+ /** Update surface content from given IColorBuffer
+
+ This method updates the given subarea of the surface from
+ the given color buffer bits.
+
+ @param rDestPos
+ Position in the surface, where the subset update should
+ have its left, top edge
+
+ @param rSourceRect
+ Size and position of the rectangular subset update in the
+ source color buffer
+
+ @param rSource
+ Source bits to use for the update
+
+ @return true, if the update was successful
+ */
+ virtual bool update( const ::basegfx::B2IPoint& rDestPos,
+ const ::basegfx::B2IRange& rSourceRect,
+ IColorBuffer& rSource ) = 0;
+
+ virtual ::basegfx::B2IVector getSize() = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurface > ISurfaceSharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurfaceproxy.hxx b/include/canvas/rendering/isurfaceproxy.hxx
new file mode 100644
index 000000000000..f8db605a38d3
--- /dev/null
+++ b/include/canvas/rendering/isurfaceproxy.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACEPROXY_HXX
+#define INCLUDED_CANVAS_ISURFACEPROXY_HXX
+
+#include <canvas/rendering/irendermodule.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPoint;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace canvas
+{
+ struct ISurfaceProxy
+ {
+ virtual ~ISurfaceProxy() {}
+
+ /** Notify the proxy that the color buffer has changed
+ */
+ virtual void setColorBufferDirty() = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rArea
+ Subset of the surface to render. Coordinate system are
+ surface area pixel, given area will be clipped to the
+ surface bounds.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rClipPoly
+ Clip polygon for the surface. The clip polygon is also
+ subject to the output transformation.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurfaceProxy > ISurfaceProxySharedPtr;
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACEPROXY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/rendering/isurfaceproxymanager.hxx b/include/canvas/rendering/isurfaceproxymanager.hxx
new file mode 100644
index 000000000000..98c7795a293e
--- /dev/null
+++ b/include/canvas/rendering/isurfaceproxymanager.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
+#define INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX
+
+#include <canvas/rendering/irendermodule.hxx>
+#include <canvas/rendering/icolorbuffer.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace canvas
+{
+ struct ISurfaceProxy;
+
+ /** Manager interface, which handles surface proxy objects.
+
+ Typically, each canvas instantiation has one
+ SurfaceProxyManager object, to handle their surfaces. Surfaces
+ itself are opaque objects, which encapsulate a framebuffer to
+ render upon, plus an optional (possibly accelerated) texture.
+ */
+ struct ISurfaceProxyManager
+ {
+ virtual ~ISurfaceProxyManager() {}
+
+ /** Create a surface proxy for a color buffer.
+
+ The whole idea is build around the concept that you create
+ some arbitrary buffer which contains the image data and
+ tell the texture manager about it. From there on you can
+ draw into this image using any kind of graphics api you
+ want. In the technical sense we allocate some space in
+ local videomemory or AGP memory which will be filled on
+ demand, which means if there exists any rendering
+ operation that needs to read from this memory location.
+ This method creates a logical hardware surface object
+ which uses the given color buffer as the image source.
+ Internally this texture may even be distributed to several
+ real hardware surfaces.
+ */
+ virtual ::boost::shared_ptr< ISurfaceProxy > createSurfaceProxy(
+ const IColorBufferSharedPtr& pBuffer ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ISurfaceProxyManager > ISurfaceProxyManagerSharedPtr;
+
+
+ /** Create a surface proxy for the given render module.
+ */
+ CANVASTOOLS_DLLPUBLIC ISurfaceProxyManagerSharedPtr createSurfaceProxyManager( const IRenderModuleSharedPtr& rRenderModule );
+}
+
+#endif /* INCLUDED_CANVAS_ISURFACEPROXYMANAGER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/spriteredrawmanager.hxx b/include/canvas/spriteredrawmanager.hxx
new file mode 100644
index 000000000000..7609b4f8f4a6
--- /dev/null
+++ b/include/canvas/spriteredrawmanager.hxx
@@ -0,0 +1,429 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX
+#define INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX
+
+#include <basegfx/range/b2dconnectedranges.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2irange.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <canvas/base/spritesurface.hxx>
+
+#include <list>
+#include <vector>
+#include <algorithm>
+
+#include <boost/utility.hpp>
+#include <boost/bind.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+/* Definition of SpriteRedrawManager class */
+
+namespace canvas
+{
+ /** This class manages smooth SpriteCanvas updates
+
+ Use this class to handle the ::canvas::SpriteSurface methods,
+ that track and process sprite update events. Recorded update
+ events are later grouped by connected areas (i.e. all sprites
+ that somehow overlap over a rectangular area are grouped
+ together); the forEachSpriteArea() method calls the passed
+ functor for each of those connected areas.
+
+ Note that, although this class generally works with IEEE
+ doubles, the calculation of connected areas happens in the
+ integer domain - it is generally expected that repaints can
+ only be divided at pixel boundaries, without causing visible
+ artifacts. Therefore, sprites that touch the same pixel (but
+ don't necessarily have the same floating point coordinates
+ there) will reside in a common sprite area and handled
+ together in the forEachSpriteArea functor call.
+ */
+ class CANVASTOOLS_DLLPUBLIC SpriteRedrawManager : private ::boost::noncopyable
+ {
+ public:
+ /** Data container for the connected components list
+ */
+ class SpriteInfo
+ {
+ public:
+ ~SpriteInfo() {}
+
+ /** Create sprite info
+
+ @param rRef
+ Sprite this info represents (might be the NULL ref)
+
+ @param rTrueUpdateArea
+ True (un-rounded) update area this sprite has recorded
+
+ @param bNeedsUpdate
+ When false, this sprite is not a member of the change
+ record list. Thus, it only needs redraw if within the
+ update area of other, changed sprites.
+
+ @internal
+ */
+ SpriteInfo( const Sprite::Reference& rRef,
+ const ::basegfx::B2DRange& rTrueUpdateArea,
+ bool bNeedsUpdate ) :
+ mpSprite( rRef ),
+ maTrueUpdateArea( rTrueUpdateArea ),
+ mbNeedsUpdate( bNeedsUpdate ),
+ mbIsPureMove( false )
+ {
+ }
+
+ /** Create sprite info, specify move type
+
+ @param rRef
+ Sprite this info represents (might be the NULL ref)
+
+ @param rTrueUpdateArea
+ True (un-rounded) update area this sprite has recorded
+
+ @param bNeedsUpdate
+ When false, this sprite is not a member of the change
+ record list. Thus, it only needs redraw if within the
+ update area of other, changed sprites.
+
+ @param bIsPureMove
+ When true, this sprite is _only_ moved, no other
+ changes happened.
+
+ @internal
+ */
+ SpriteInfo( const Sprite::Reference& rRef,
+ const ::basegfx::B2DRange& rTrueUpdateArea,
+ bool bNeedsUpdate,
+ bool bIsPureMove ) :
+ mpSprite( rRef ),
+ maTrueUpdateArea( rTrueUpdateArea ),
+ mbNeedsUpdate( bNeedsUpdate ),
+ mbIsPureMove( bIsPureMove )
+ {
+ }
+
+ const Sprite::Reference& getSprite() const { return mpSprite; }
+
+ // #i61843# need to return by value here, to be used safely from bind
+ ::basegfx::B2DRange getUpdateArea() const { return maTrueUpdateArea; }
+ bool needsUpdate() const { return mbNeedsUpdate; }
+ bool isPureMove() const { return mbIsPureMove; }
+
+ private:
+ Sprite::Reference mpSprite;
+ ::basegfx::B2DRange maTrueUpdateArea;
+ bool mbNeedsUpdate;
+ bool mbIsPureMove;
+ };
+
+
+ /** Helper struct for SpriteTracer template
+
+ This struct stores change information to a sprite's visual
+ appearance (move, content updated, and the like).
+ */
+ struct SpriteChangeRecord
+ {
+ typedef enum{ none=0, move, update } ChangeType;
+
+ SpriteChangeRecord() :
+ meChangeType( none ),
+ mpAffectedSprite(),
+ maOldPos(),
+ maUpdateArea()
+ {
+ }
+
+ SpriteChangeRecord( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) :
+ meChangeType( move ),
+ mpAffectedSprite( rSprite ),
+ maOldPos( rOldPos ),
+ maUpdateArea( rNewPos.getX(),
+ rNewPos.getY(),
+ rNewPos.getX() + rSpriteSize.getX(),
+ rNewPos.getY() + rSpriteSize.getY() )
+ {
+ }
+
+ SpriteChangeRecord( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) :
+ meChangeType( update ),
+ mpAffectedSprite( rSprite ),
+ maOldPos( rPos ),
+ maUpdateArea( rUpdateArea )
+ {
+ }
+
+ Sprite::Reference getSprite() const { return mpAffectedSprite; }
+
+ ChangeType meChangeType;
+ Sprite::Reference mpAffectedSprite;
+ ::basegfx::B2DPoint maOldPos;
+ ::basegfx::B2DRange maUpdateArea;
+ };
+
+ typedef ::std::vector< SpriteChangeRecord > VectorOfChangeRecords;
+ typedef ::std::list< Sprite::Reference > ListOfSprites;
+ typedef ::basegfx::B2DConnectedRanges< SpriteInfo > SpriteConnectedRanges;
+ typedef SpriteConnectedRanges::ComponentType AreaComponent;
+ typedef SpriteConnectedRanges::ConnectedComponents UpdateArea;
+ typedef ::std::vector< Sprite::Reference > VectorOfSprites;
+
+ SpriteRedrawManager();
+
+ /** Must be called when user of this object gets
+ disposed. Frees all internal references.
+ */
+ void disposing();
+
+ /** Functor, to be used from forEachSpriteArea
+ */
+ template< typename Functor > struct AreaUpdateCaller
+ {
+ AreaUpdateCaller( Functor& rFunc,
+ const SpriteRedrawManager& rManager ) :
+ mrFunc( rFunc ),
+ mrManager( rManager )
+ {
+ }
+
+ void operator()( const UpdateArea& rUpdateArea )
+ {
+ mrManager.handleArea( mrFunc, rUpdateArea );
+ }
+
+ Functor& mrFunc;
+ const SpriteRedrawManager& mrManager;
+ };
+
+ /** Call given functor for each sprite area that needs an
+ update.
+
+ This method calls the given functor for each update area
+ (calculated from the sprite change records).
+
+ @tpl Functor
+ Must provide the following four methods:
+ <pre>
+ void backgroundPaint( ::basegfx::B2DRange aUpdateRect );
+ void scrollUpdate( ::basegfx::B2DRange& o_rMoveStart,
+ ::basegfx::B2DRange& o_rMoveEnd,
+ UpdateArea aUpdateArea );
+ void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
+ const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
+ void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
+ const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
+ </pre>
+ The backgroundPaint() method is called to simply repaint
+ background content, the scrollUpdate() method is used to
+ scroll a given area, and paint background in the uncovered
+ areas, the opaqueUpdate() method is called when a sprite
+ can be painted in the given area without taking background
+ content into account, and finally, genericUpdate() is
+ called for complex updates, where first the background and
+ then all sprites consecutively have to be repainted.
+ */
+ template< typename Functor > void forEachSpriteArea( Functor& rFunc ) const
+ {
+ SpriteConnectedRanges aUpdateAreas;
+
+ setupUpdateAreas( aUpdateAreas );
+
+ aUpdateAreas.forEachAggregate(
+ AreaUpdateCaller< Functor >( rFunc, *this ) );
+ }
+
+ /** Call given functor for each active sprite.
+
+ This method calls the given functor for each active
+ sprite, in the order of sprite priority.
+
+ @tpl Functor
+ Must provide a Functor::operator( Sprite::Reference& )
+ method.
+ */
+ template< typename Functor > void forEachSprite( const Functor& rFunc ) const
+ {
+ ::std::for_each( maSprites.begin(),
+ maSprites.end(),
+ rFunc );
+ }
+
+ /// Clear sprite change records (typically directly after a screen update)
+ void clearChangeRecords();
+
+ // SpriteSurface interface, is delegated to e.g. from SpriteCanvas
+ void showSprite( const Sprite::Reference& rSprite );
+ void hideSprite( const Sprite::Reference& rSprite );
+ void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize );
+ void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea );
+
+ /** Internal, handles each distinct component for forEachAggregate()
+
+ The reason why this must be public is that it needs to be
+ accessible from the AreaUpdateCaller functor.
+
+ @internal
+ */
+ template< typename Functor > void handleArea( Functor& rFunc,
+ const UpdateArea& rUpdateArea ) const
+ {
+ // check whether this area contains changed sprites at all
+ // (if not, just ignore it)
+ if( areSpritesChanged( rUpdateArea ) )
+ {
+ // at least one of the sprites actually needs an
+ // update - process whole area.
+
+ // check whether this area could be handled special
+ // (background paint, direct update, scroll, etc.)
+ ::basegfx::B2DRange aMoveStart;
+ ::basegfx::B2DRange aMoveEnd;
+ if( rUpdateArea.maComponentList.empty() )
+ {
+ rFunc.backgroundPaint( rUpdateArea.maTotalBounds );
+ }
+ else
+ {
+ // cache number of sprites in this area (it's a
+ // list, and both isAreaUpdateScroll() and
+ // isAreaUpdateOpaque() need it).
+ const ::std::size_t nNumSprites(
+ rUpdateArea.maComponentList.size() );
+
+ if( isAreaUpdateScroll( aMoveStart,
+ aMoveEnd,
+ rUpdateArea,
+ nNumSprites ) )
+ {
+ rFunc.scrollUpdate( aMoveStart,
+ aMoveEnd,
+ rUpdateArea );
+ }
+ else
+ {
+ // potentially, more than a single sprite
+ // involved. Have to sort component lists for
+ // sprite prio.
+ VectorOfSprites aSortedUpdateSprites;
+ SpriteConnectedRanges::ComponentListType::const_iterator aCurr(
+ rUpdateArea.maComponentList.begin() );
+ const SpriteConnectedRanges::ComponentListType::const_iterator aEnd(
+ rUpdateArea.maComponentList.end() );
+ while( aCurr != aEnd )
+ {
+ const Sprite::Reference& rSprite( aCurr->second.getSprite() );
+ if( rSprite.is() )
+ aSortedUpdateSprites.push_back( rSprite );
+
+ ++aCurr;
+ }
+
+ ::std::sort( aSortedUpdateSprites.begin(),
+ aSortedUpdateSprites.end(),
+ SpriteWeakOrder() );
+
+ if( isAreaUpdateOpaque( rUpdateArea,
+ nNumSprites ) )
+ {
+ rFunc.opaqueUpdate( rUpdateArea.maTotalBounds,
+ aSortedUpdateSprites );
+ }
+ else
+ {
+ rFunc.genericUpdate( rUpdateArea.maTotalBounds,
+ aSortedUpdateSprites );
+ }
+ }
+ }
+ }
+ }
+
+ private:
+ /** Central method of this class. Calculates the set of
+ disjunct components that need an update.
+ */
+ void setupUpdateAreas( SpriteConnectedRanges& rUpdateAreas ) const;
+
+ bool areSpritesChanged( const UpdateArea& rUpdateArea ) const;
+
+ bool isAreaUpdateNotOpaque( const ::basegfx::B2DRange& rUpdateRect,
+ const AreaComponent& rComponent ) const;
+
+ bool isAreaUpdateOpaque( const UpdateArea& rUpdateArea,
+ ::std::size_t nNumSprites ) const;
+
+ /** Check whether given update area can be handled by a simple
+ scroll
+
+ @param o_rMoveStart
+ Start rect of the move
+
+ @param o_rMoveEnd
+ End rect of the move. The content must be moved from start
+ to end rect
+
+ @param rUpdateArea
+ Area to check for scroll update optimization
+ */
+ bool isAreaUpdateScroll( ::basegfx::B2DRange& o_rMoveStart,
+ ::basegfx::B2DRange& o_rMoveEnd,
+ const UpdateArea& rUpdateArea,
+ ::std::size_t nNumSprites ) const;
+
+
+ ListOfSprites maSprites; // list of active
+ // sprite
+ // objects. this
+ // list is only
+ // used for full
+ // repaints,
+ // otherwise, we
+ // rely on the
+ // active sprites
+ // itself to notify
+ // us.
+
+ VectorOfChangeRecords maChangeRecords; // vector of
+ // sprites
+ // changes
+ // since last
+ // updateScreen()
+ // call
+ };
+}
+
+#endif /* INCLUDED_CANVAS_SPRITEREDRAWMANAGER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx
new file mode 100644
index 000000000000..330e88cb88ad
--- /dev/null
+++ b/include/canvas/vclwrapper.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_VCLWRAPPER_HXX
+#define INCLUDED_CANVAS_VCLWRAPPER_HXX
+
+#include <osl/mutex.hxx>
+#include <vcl/svapp.hxx>
+
+namespace canvas
+{
+ namespace vcltools
+ {
+ /** This helper template wraps VCL objects, and protects
+ object deletion with the Solar mutex. All other operations
+ are unprotected, this must be handled by client code.
+
+ The reason for this template is the fact that VCL objects
+ hold by value in uno::Reference-handled classes are
+ deleted without having the chance to get inbetween and
+ lock the solar mutex.
+
+ This template handles that problem transparently, the only
+ inconvenience is the fact that object member access now
+ has to be performed via operator->, since . is not
+ overloadable.
+
+ Otherwise, the template preserves the value semantics of
+ the wrapped object, that is, copy operations are performed
+ not by copying pointers, but by copying the underlying
+ object. This includes constness, i.e. on a const
+ VCLObject, only const methods of the wrapped object can be
+ called. Simply imagine this to be a value object of type
+ "template argument", with the only peculiarity that
+ member/method access is performed by operator-> instead of
+ the non-existing "operator.".
+ */
+ template< class _Wrappee > class VCLObject
+ {
+ public:
+ typedef _Wrappee Wrappee;
+
+ VCLObject() :
+ mpWrappee( new Wrappee() )
+ {
+ }
+
+ // no explicit here. VCLObjects should be freely
+ // constructible with Wrappees, and AFAIK there is no other
+ // implicit conversion path that could cause harm here
+ VCLObject( Wrappee* pWrappee ) :
+ mpWrappee( pWrappee )
+ {
+ }
+
+ // This object has value semantics, thus, forward copy
+ // to wrappee
+ VCLObject( const VCLObject& rOrig )
+ {
+ if( rOrig.mpWrappee )
+ mpWrappee = new Wrappee( *rOrig.mpWrappee );
+ else
+ mpWrappee = NULL;
+ }
+
+ // This object has value semantics, thus, forward copy
+ // to wrappee
+ VCLObject( const Wrappee& rOrig ) :
+ mpWrappee( new Wrappee( rOrig ) )
+ {
+ }
+
+ // This object has value semantics, thus, forward
+ // assignment to wrappee
+ VCLObject& operator=( const VCLObject& rhs )
+ {
+ if( mpWrappee )
+ {
+ if( rhs.mpWrappee )
+ *mpWrappee = *rhs.mpWrappee;
+ }
+ else
+ {
+ if( rhs.mpWrappee )
+ mpWrappee = new Wrappee( *rhs.mpWrappee );
+ }
+
+ return *this;
+ }
+
+ ~VCLObject()
+ {
+ // This here is the whole purpose of the template:
+ // protecting object deletion with the solar mutex
+ SolarMutexGuard aGuard;
+
+ if( mpWrappee )
+ delete mpWrappee;
+ }
+
+ Wrappee* operator->() { return mpWrappee; }
+ const Wrappee* operator->() const { return mpWrappee; }
+
+ Wrappee& operator*() { return *mpWrappee; }
+ const Wrappee& operator*() const { return *mpWrappee; }
+
+ Wrappee& get() { return *mpWrappee; }
+ const Wrappee& get() const { return *mpWrappee; }
+
+ void swap( VCLObject& rOther )
+ {
+ ::std::swap( mpWrappee, rOther.mpWrappee );
+ }
+
+ private:
+
+ Wrappee* mpWrappee;
+ };
+
+ }
+}
+
+#endif /* INCLUDED_CANVAS_VCLWRAPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/verbosetrace.hxx b/include/canvas/verbosetrace.hxx
new file mode 100644
index 000000000000..d3810c4deaad
--- /dev/null
+++ b/include/canvas/verbosetrace.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_VERBOSETRACE_HXX
+#define INCLUDED_CANVAS_VERBOSETRACE_HXX
+
+#include "sal/config.h"
+
+#include "sal/detail/log.h"
+
+#define VERBOSE_TRACE(...) \
+ SAL_DETAIL_INFO_IF_FORMAT(true, "canvas.level2", __VA_ARGS__)
+
+#endif /* INCLUDED_CANVAS_VERBOSETRACE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/canvas/verifyinput.hxx b/include/canvas/verifyinput.hxx
new file mode 100644
index 000000000000..07d72b32ff6c
--- /dev/null
+++ b/include/canvas/verifyinput.hxx
@@ -0,0 +1,667 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CANVAS_VERIFYINPUT_HXX
+#define INCLUDED_CANVAS_VERIFYINPUT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+#include <algorithm>
+#include <boost/bind.hpp>
+#include <boost/current_function.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct RealPoint2D;
+ struct RealSize2D;
+ struct RealBezierSegment2D;
+ struct RealRectangle2D;
+ struct AffineMatrix2D;
+ struct Matrix2D;
+ struct IntegerPoint2D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ struct RenderState;
+ struct StrokeAttributes;
+ struct Texture;
+ struct ViewState;
+ struct IntegerBitmapLayout;
+ struct FontRequest;
+ struct FontInfo;
+ class XCanvas;
+} } } }
+
+
+namespace canvas
+{
+ namespace tools
+ {
+
+ // Input checking facilities
+ // ===================================================================
+
+ // This header provides methods to check all common
+ // css::rendering::* method input parameters against
+ // compliance to the API specification.
+
+ /** Verify that the given transformation contains valid floating point
+ values.
+
+ @param rMatrix
+ Matrix to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::AffineMatrix2D& rMatrix,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given transformation contains valid floating point
+ values.
+
+ @param rMatrix
+ Matrix to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::Matrix2D& rMatrix,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given point contains valid floating point
+ values.
+
+ @param rPoint
+ Point to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D& rPoint,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given bezier segment contains valid
+ floating point values.
+
+ @param rSegment
+ Segment to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealBezierSegment2D& rSegment,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given point contains valid floating point
+ values.
+
+ @param rPoint
+ Point to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D& rPoint,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given rectangle contains valid floating
+ point values.
+
+ @param rRect
+ Rect to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealRectangle2D& rRect,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for view state validity.
+
+ @param viewState
+ Viewstate to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::ViewState& viewState,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for render state validity.
+
+ @param renderState
+ Renderstate to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @param nMinColorComponents
+ Minimal number of color components available in
+ RenderState::DeviceColor
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::RenderState& renderState,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos,
+ sal_Int32 nMinColorComponents=0 );
+
+ /** Basic check for stroke attributes validity.
+
+ @param strokeAttributes
+ Attributes to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::StrokeAttributes& strokeAttributes,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for texture validity.
+
+ @param texture
+ Texture to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::Texture& texture,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for bitmap layout validity.
+
+ @param bitmapLayout
+ Bitmap layout to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for font info validity.
+
+ @param fontInfo
+ Font info to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontInfo& fontInfo,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for font request validity.
+
+ @param fontRequest
+ Font request to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontRequest& fontRequest,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Templatized check for uno::Reference validity.
+
+ @param rRef
+ Reference to check against non-NILness
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ template< class Interface > void verifyInput(
+ const ::com::sun::star::uno::Reference< Interface >& rRef,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos )
+ {
+ (void)pStr; (void)xIf; (void)nArgPos;
+
+ if( !rRef.is() )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ OUString::createFromAscii(pStr) + ": reference is NULL",
+ xIf,
+ nArgPos );
+#else
+ throw ::com::sun::star::lang::IllegalArgumentException();
+#endif
+ }
+ }
+
+ /** Templatized check for content-of-sequence validity.
+
+ @param rSequence
+ Sequence of things to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws an lang::IllegalArgumentException, if anything is wrong
+ */
+ template< typename SequenceContent > void verifyInput(
+ const ::com::sun::star::uno::Sequence< SequenceContent >& rSequence,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos )
+ {
+ const SequenceContent* pCurr = rSequence.getConstArray();
+ const SequenceContent* pEnd = pCurr + rSequence.getLength();
+ while( pCurr != pEnd )
+ verifyInput( *pCurr++, pStr, xIf, nArgPos );
+ }
+
+ /// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones)
+ template< typename T > void verifyInput( const T& /*rDummy*/,
+ const char* /*pStr*/,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& /*xIf*/,
+ ::sal_Int16 /*nArgPos*/ )
+ {
+ }
+
+ // TODO(Q2): Employ some template arglist magic here, to avoid
+ // this duplication of code...
+
+ template< typename Arg0 > void verifyArgs( const Arg0& rArg0,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ }
+
+ template< typename Arg0,
+ typename Arg1 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4,
+ typename Arg5 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const Arg5& rArg5,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ verifyInput( rArg5, pStr, xIf, 5 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4,
+ typename Arg5,
+ typename Arg6 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const Arg5& rArg5,
+ const Arg6& rArg6,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ verifyInput( rArg5, pStr, xIf, 5 );
+ verifyInput( rArg6, pStr, xIf, 6 );
+ }
+
+
+ /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when
+ range is violated
+ */
+ template< typename NumType > inline void verifyRange( NumType arg, NumType lowerBound, NumType upperBound )
+ {
+ if( arg < lowerBound ||
+ arg > upperBound )
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+ }
+
+ /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when
+ range is violated
+
+ The checked range is half open, i.e. only bound by the specified value.
+
+ @param arg
+ Arg to check
+
+ @param bound
+ Bound to check against
+
+ @param bLowerBound
+ When true, given bound is the lower bound. When false,
+ given bound is the upper bound.
+ */
+ template< typename NumType > inline void verifyRange( NumType arg, NumType bound, bool bLowerBound=true )
+ {
+ if( (bLowerBound && arg < bound) ||
+ (!bLowerBound && arg > bound) )
+ {
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ }
+ }
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ index range is violated
+ */
+ template< typename NumType > inline void verifyIndexRange( NumType arg, NumType lowerBound, NumType upperBound )
+ {
+ if( arg < lowerBound ||
+ arg > upperBound )
+ {
+ throw ::com::sun::star::lang::IndexOutOfBoundsException();
+ }
+ }
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ index range is violated
+
+ @param rect
+ Rect to verify
+
+ @param size
+ Given rectangle must be within ((0,0), (size.Width, size.Height))
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerRectangle2D& rect,
+ const ::com::sun::star::geometry::IntegerSize2D& size );
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ index range is violated
+
+ @param pos
+ Position to verify
+
+ @param size
+ Given position must be within ((0,0), (size.Width, size.Height))
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerPoint2D& pos,
+ const ::com::sun::star::geometry::IntegerSize2D& size );
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ the size is negative or null
+
+ @param size
+ Size to verify
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyBitmapSize( const ::com::sun::star::geometry::IntegerSize2D& size,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf );
+
+ /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
+ the size is negative or null
+
+ @param size
+ Size to verify
+ */
+ CANVASTOOLS_DLLPUBLIC void verifySpriteSize( const ::com::sun::star::geometry::RealSize2D& size,
+ const char* pStr,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >& xIf );
+ }
+}
+
+#endif /* INCLUDED_CANVAS_VERIFYINPUT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/codemaker.hxx b/include/codemaker/codemaker.hxx
new file mode 100644
index 000000000000..49d1d4b9cea8
--- /dev/null
+++ b/include/codemaker/codemaker.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_CODEMAKER_HXX
+#define INCLUDED_CODEMAKER_CODEMAKER_HXX
+
+#include "sal/config.h"
+
+namespace rtl {
+ class OString;
+ class OUString;
+}
+
+namespace codemaker {
+
+rtl::OString convertString(rtl::OUString const & string);
+
+}
+
+#endif // INCLUDED_CODEMAKER_CODEMAKER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/commoncpp.hxx b/include/codemaker/commoncpp.hxx
new file mode 100644
index 000000000000..8bff48fc0809
--- /dev/null
+++ b/include/codemaker/commoncpp.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_COMMONCPP_HXX
+#define INCLUDED_CODEMAKER_COMMONCPP_HXX
+
+#include "sal/config.h"
+
+#include "codemaker/unotype.hxx"
+
+namespace rtl {
+ class OString;
+ class OUString;
+}
+
+namespace codemaker { namespace cpp {
+
+/** Stick a namespace scope to c++ type
+
+ @param type
+ Undecorated type
+
+ @param ns_alias
+ Use common namespace aliases instead of fully specified (nested)
+ namespace. currently replaces com::sun::star with css.
+ */
+rtl::OString scopedCppName(rtl::OString const & type, bool ns_alias=true);
+
+rtl::OString translateUnoToCppType(
+ codemaker::UnoType::Sort sort, rtl::OUString const & nucleus);
+
+enum IdentifierTranslationMode {
+ ITM_GLOBAL,
+ ITM_NONGLOBAL,
+ ITM_KEYWORDSONLY
+};
+
+rtl::OString translateUnoToCppIdentifier(
+ rtl::OString const & identifier, rtl::OString const & prefix,
+ IdentifierTranslationMode transmode = ITM_GLOBAL,
+ rtl::OString const * forbidden = 0);
+
+} }
+
+#endif // INCLUDED_CODEMAKER_COMMONCPP_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/commonjava.hxx b/include/codemaker/commonjava.hxx
new file mode 100644
index 000000000000..54d9403cda57
--- /dev/null
+++ b/include/codemaker/commonjava.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_COMMONJAVA_HXX
+#define INCLUDED_CODEMAKER_COMMONJAVA_HXX
+
+#include "sal/config.h"
+
+#include "codemaker/unotype.hxx"
+
+namespace rtl { class OString; }
+
+namespace codemaker { namespace java {
+
+rtl::OString translateUnoToJavaType(
+ codemaker::UnoType::Sort sort, rtl::OString const & nucleus,
+ bool referenceType);
+
+rtl::OString translateUnoToJavaIdentifier(
+ rtl::OString const & identifier, rtl::OString const & prefix);
+
+} }
+
+#endif // INCLUDED_CODEMAKER_COMMONJAVA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/exceptiontree.hxx b/include/codemaker/exceptiontree.hxx
new file mode 100644
index 000000000000..5392386a3c07
--- /dev/null
+++ b/include/codemaker/exceptiontree.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
+#define INCLUDED_CODEMAKER_EXCEPTIONTREE_HXX
+
+#include "codemaker/global.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+
+#include <vector>
+
+class TypeManager;
+
+namespace codemaker {
+
+/**
+ Represents a node of the hierarchy from the ExceptionTree class.
+ */
+struct ExceptionTreeNode {
+ typedef std::vector< ExceptionTreeNode * > Children;
+
+ // Internally used by ExceptionTree:
+ ExceptionTreeNode(rtl::OString const & theName):
+ name(theName), present(false) {}
+
+ // Internally used by ExceptionTree:
+ ~ExceptionTreeNode() { clearChildren(); }
+
+ // Internally used by ExceptionTree:
+ void setPresent() { present = true; clearChildren(); }
+
+ // Internally used by ExceptionTree:
+ ExceptionTreeNode * add(rtl::OString const & theName);
+
+ rtl::OString name;
+ bool present;
+ Children children;
+
+private:
+ ExceptionTreeNode(ExceptionTreeNode &); // not implemented
+ void operator =(ExceptionTreeNode); // not implemented
+
+ void clearChildren();
+};
+
+/**
+ Represents the hierarchy formed by a set of UNO exception types.
+
+ The hierarchy is rooted at com.sun.star.uno.Exception. For each exception E
+ from the given set S, the hierarchy from com.sun.star.uno.Exception to the
+ first supertype E' of E which is itself a member of S is represented (i.e.,
+ subtypes that are hidden by supertypes are pruned from the hierarchy). The
+ exception com.sun.star.uno.RuntimeException and its subtypes are pruned
+ completely from the hierarchy. Each node of the hierarchy is represented by
+ an instance of ExceptionTreeNode, where name gives the name of the UNO
+ exception type, present is true iff the given exception type is a member of
+ the set S, and children contains all the relevant direct subtypes of the
+ given exception type, in no particular order (for nodes other than the root
+ node it holds that children is non-empty iff present is false).
+ */
+class ExceptionTree {
+public:
+ ExceptionTree(): m_root("com.sun.star.uno.Exception") {}
+
+ ~ExceptionTree() {}
+
+ /**
+ Builds the exception hierarchy, by adding one exception type at a time.
+
+ This function can be called more than once for the same exception name.
+
+ @param name the name of a UNO exception type; it is an error if the given
+ name does not represent a UNO exception type
+
+ @param manager a type manager, used to resolve type names; it is an error
+ if different calls to this member function use different, incompatible
+ type managers
+ */
+ void add(
+ rtl::OString const & name,
+ rtl::Reference< TypeManager > const & manager);
+
+ /**
+ Gives access to the resultant exception hierarchy.
+
+ @return a non-null pointer to the root of the exception hierarchy, as
+ formed by all previous calls to add; it is an error if any calls to add
+ follow the first call to getRoot
+ */
+ ExceptionTreeNode const * getRoot() const { return &m_root; }
+
+private:
+ ExceptionTree(ExceptionTree &); // not implemented
+ void operator =(ExceptionTree); // not implemented
+
+ ExceptionTreeNode m_root;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/generatedtypeset.hxx b/include/codemaker/generatedtypeset.hxx
new file mode 100644
index 000000000000..3d1a5615b0b1
--- /dev/null
+++ b/include/codemaker/generatedtypeset.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+#define INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+
+#include "rtl/string.hxx"
+
+#include <boost/unordered_set.hpp>
+
+/// @HTML
+
+namespace codemaker {
+
+/**
+ A simple class to track which types have already been processed by a code
+ maker.
+
+ <p>This class is not multi-thread&ndash;safe.</p>
+ */
+class GeneratedTypeSet {
+public:
+ GeneratedTypeSet() {}
+
+ ~GeneratedTypeSet() {}
+
+ /**
+ Add a type to the set of generated types.
+
+ <p>If the type was already present, nothing happens.</p>
+
+ @param type a UNO type registry name
+ */
+ void add(OString const & type) { m_set.insert(type); }
+
+ /**
+ Checks whether a given type has already been generated.
+
+ @param type a UNO type registry name
+
+ @return true iff the given type has already been generated
+ */
+ bool contains(OString const & type) const
+ { return m_set.find(type) != m_set.end(); }
+
+private:
+ GeneratedTypeSet(GeneratedTypeSet &); // not implemented
+ void operator =(GeneratedTypeSet); // not implemented
+
+ boost::unordered_set< OString, OStringHash > m_set;
+};
+
+}
+
+#endif // INCLUDED_CODEMAKER_GENERATEDTYPESET_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/global.hxx b/include/codemaker/global.hxx
new file mode 100644
index 000000000000..2c61ce88ec51
--- /dev/null
+++ b/include/codemaker/global.hxx
@@ -0,0 +1,135 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_GLOBAL_HXX
+#define INCLUDED_CODEMAKER_GLOBAL_HXX
+
+#include <list>
+#include <vector>
+#include <set>
+
+#include <stdio.h>
+
+#include "osl/file.hxx"
+#include "rtl/ustring.hxx"
+#include "rtl/strbuf.hxx"
+
+struct EqualString
+{
+ sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
+ {
+ return (str1 == str2);
+ }
+};
+
+struct HashString
+{
+ size_t operator()(const ::rtl::OString& str) const
+ {
+ return str.hashCode();
+ }
+};
+
+struct LessString
+{
+ sal_Bool operator()(const ::rtl::OString& str1, const ::rtl::OString& str2) const
+ {
+ return (str1 < str2);
+ }
+};
+
+typedef ::std::list< ::rtl::OString > StringList;
+typedef ::std::vector< ::rtl::OString > StringVector;
+typedef ::std::set< ::rtl::OString, LessString > StringSet;
+
+//*************************************************************************
+// FileStream
+//*************************************************************************
+enum FileAccessMode
+{
+ FAM_READ, // "r"
+ FAM_WRITE, // "w"
+ FAM_READWRITE_EXIST, // "r+"
+ FAM_READWRITE // "w+"
+};
+
+class FileStream
+{
+public:
+ FileStream();
+ virtual ~FileStream();
+
+ sal_Bool isValid();
+
+ void createTempFile(const ::rtl::OString& sPath);
+ void close();
+
+ ::rtl::OString getName() { return m_name; }
+
+ bool write(void const * buffer, sal_uInt64 size);
+
+ // friend functions
+ friend FileStream &operator<<(FileStream& o, sal_uInt32 i);
+ friend FileStream &operator<<(FileStream& o, char const * s);
+ friend FileStream &operator<<(FileStream& o, ::rtl::OString* s);
+ friend FileStream &operator<<(FileStream& o, const ::rtl::OString& s);
+ friend FileStream &operator<<(FileStream& o, ::rtl::OStringBuffer* s);
+ friend FileStream &operator<<(FileStream& o, const ::rtl::OStringBuffer& s);
+ friend FileStream & operator <<(FileStream & out, rtl::OUString const & s);
+
+private:
+ oslFileHandle m_file;
+ ::rtl::OString m_name;
+};
+
+
+//*************************************************************************
+// Helper functions
+//*************************************************************************
+::rtl::OString getTempDir(const ::rtl::OString& sFileName);
+
+::rtl::OString createFileNameFromType(const ::rtl::OString& destination,
+ const ::rtl::OString type,
+ const ::rtl::OString postfix,
+ sal_Bool bLowerCase=sal_False,
+ const ::rtl::OString prefix="");
+
+sal_Bool fileExists(const ::rtl::OString& fileName);
+sal_Bool makeValidTypeFile(const ::rtl::OString& targetFileName,
+ const ::rtl::OString& tmpFileName,
+ sal_Bool bFileCheck);
+sal_Bool removeTypeFile(const ::rtl::OString& fileName);
+
+::rtl::OUString convertToFileUrl(const ::rtl::OString& fileName);
+
+class CannotDumpException {
+public:
+ CannotDumpException(OUString const & message): message_(message) {}
+
+ virtual ~CannotDumpException() throw ();
+
+ OUString getMessage() const { return message_; }
+
+private:
+ OUString message_;
+};
+
+#endif // INCLUDED_CODEMAKER_GLOBAL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/options.hxx b/include/codemaker/options.hxx
new file mode 100644
index 000000000000..4a33e280ca69
--- /dev/null
+++ b/include/codemaker/options.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_OPTIONS_HXX
+#define INCLUDED_CODEMAKER_OPTIONS_HXX
+
+#include <boost/unordered_map.hpp>
+
+#include <codemaker/global.hxx>
+
+typedef ::boost::unordered_map
+<
+ ::rtl::OString,
+ ::rtl::OString,
+ HashString,
+ EqualString
+> OptionMap;
+
+class IllegalArgument
+{
+public:
+ IllegalArgument(const ::rtl::OString& msg)
+ : m_message(msg) {}
+
+ ::rtl::OString m_message;
+};
+
+class Options
+{
+public:
+ Options();
+ virtual ~Options();
+
+ virtual sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False)
+ throw( IllegalArgument ) = 0;
+
+ virtual ::rtl::OString prepareHelp() = 0;
+
+ const ::rtl::OString& getProgramName() const;
+ sal_Bool isValid(const ::rtl::OString& option) const;
+ const ::rtl::OString getOption(const ::rtl::OString& option) const
+ throw( IllegalArgument );
+
+ const StringVector& getInputFiles();
+
+ inline sal_uInt16 getNumberOfExtraInputFiles() const
+ { return (sal_uInt16)m_extra_input_files.size(); }
+ inline const StringVector& getExtraInputFiles() const
+ { return m_extra_input_files; }
+protected:
+ ::rtl::OString m_program;
+ StringVector m_inputFiles;
+ StringVector m_extra_input_files;
+ OptionMap m_options;
+};
+
+#endif // INCLUDED_CODEMAKER_OPTIONS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/typemanager.hxx b/include/codemaker/typemanager.hxx
new file mode 100644
index 000000000000..fc6aba69ab1d
--- /dev/null
+++ b/include/codemaker/typemanager.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_TYPEMANAGER_HXX
+#define INCLUDED_CODEMAKER_TYPEMANAGER_HXX
+
+#include "sal/config.h"
+
+#include <vector>
+
+#include "codemaker/unotype.hxx"
+#include "rtl/ref.hxx"
+#include "rtl/string.hxx"
+#include "rtl/textenc.h"
+#include "rtl/ustring.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+namespace unoidl {
+ class Entity;
+ class Manager;
+ class MapCursor;
+ class Provider;
+}
+
+class TypeManager: public salhelper::SimpleReferenceObject {
+public:
+ TypeManager();
+
+ void loadProvider(OUString const & uri, bool primary);
+
+ bool foundAtPrimaryProvider(OUString const & name) const;
+
+ codemaker::UnoType::Sort getSort(
+ OUString const & name, rtl::Reference< unoidl::Entity > * entity = 0,
+ rtl::Reference< unoidl::MapCursor > * cursor = 0) const;
+
+ codemaker::UnoType::Sort decompose(
+ OUString const & name, bool resolveTypedefs, OUString * nucleus,
+ sal_Int32 * rank, std::vector< OUString > * arguments,
+ rtl::Reference< unoidl::Entity > * entity) const;
+
+private:
+ virtual ~TypeManager();
+
+ rtl::Reference< unoidl::Manager > manager_;
+ std::vector< rtl::Reference< unoidl::Provider > > primaryProviders_;
+};
+
+
+inline OString u2b(OUString const & s) {
+ return OUStringToOString(s, RTL_TEXTENCODING_UTF8);
+}
+
+inline OUString b2u(OString const & s) {
+ return OStringToOUString(s, RTL_TEXTENCODING_UTF8);
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/codemaker/unotype.hxx b/include/codemaker/unotype.hxx
new file mode 100644
index 000000000000..b00de6658a99
--- /dev/null
+++ b/include/codemaker/unotype.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CODEMAKER_UNOTYPE_HXX
+#define INCLUDED_CODEMAKER_UNOTYPE_HXX
+
+#include "sal/types.h"
+
+#include <vector>
+
+namespace rtl { class OString; }
+
+namespace codemaker {
+
+namespace UnoType {
+ /**
+ An enumeration of all the sorts of relevant UNOIDL entities.
+ */
+ enum Sort {
+ SORT_VOID,
+ SORT_BOOLEAN,
+ SORT_BYTE,
+ SORT_SHORT,
+ SORT_UNSIGNED_SHORT,
+ SORT_LONG,
+ SORT_UNSIGNED_LONG,
+ SORT_HYPER,
+ SORT_UNSIGNED_HYPER,
+ SORT_FLOAT,
+ SORT_DOUBLE,
+ SORT_CHAR,
+ SORT_STRING,
+ SORT_TYPE,
+ SORT_ANY,
+ SORT_SEQUENCE_TYPE,
+ SORT_MODULE,
+ SORT_ENUM_TYPE,
+ SORT_PLAIN_STRUCT_TYPE,
+ SORT_POLYMORPHIC_STRUCT_TYPE_TEMPLATE,
+ SORT_INSTANTIATED_POLYMORPHIC_STRUCT_TYPE,
+ SORT_EXCEPTION_TYPE,
+ SORT_INTERFACE_TYPE,
+ SORT_TYPEDEF,
+ SORT_CONSTANT_GROUP,
+ SORT_SINGLE_INTERFACE_BASED_SERVICE,
+ SORT_ACCUMULATION_BASED_SERVICE,
+ SORT_INTERFACE_BASED_SINGLETON,
+ SORT_SERVICE_BASED_SINGLETON
+ };
+
+ /**
+ Decomposes a UNO type name or UNO type registry name.
+
+ @param type a binary UNO type name or UNO type registry name
+
+ @param rank if non-null, returns the rank of the denoted UNO type (which
+ is zero for any given type that does not denote a UNO sequence type)
+
+ @param arguments if non-null, the type arguments are stripped from an
+ instantiated polymorphic struct type and returned via this parameter (in
+ the correct order); if null, type arguments are not stripped from
+ instantiated polymorphic struct types
+
+ @return the base part of the given type
+ */
+ rtl::OString decompose(
+ rtl::OString const & type, sal_Int32 * rank = 0,
+ std::vector< rtl::OString > * arguments = 0);
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ChainablePropertySet.hxx b/include/comphelper/ChainablePropertySet.hxx
new file mode 100644
index 000000000000..2dfe5f3ca256
--- /dev/null
+++ b/include/comphelper/ChainablePropertySet.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CHAINABLEPROPERTYSET_HXX_
+#define _COMPHELPER_CHAINABLEPROPERTYSET_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ class ChainablePropertySetInfo;
+}
+
+/*
+ * A ChainablePropertySet has the following features:
+ *
+ * 1. It implements both the PropertySet and MultiPropertySet interfaces.
+ * 2. It can be 'included' in a MasterPropertySet to seamlessly appear as if
+ * if it's properties were in the master.
+ *
+ * To be used as a base class for PropertySets, the subclass must implement
+ * the 6 protected pure virtual functions. If a mutex is passed to the
+ * constructor, this is locked before any call to _getSingleValue or
+ * _setSingleValue and released after all processing has completed
+ * (including _postSetValues or _postGetValues )
+ *
+ * Any MasterPropertySet implementations that can include an
+ * implementation of a given ChainablePropertySet must be
+ * declared as a 'friend' in the implementation of the ChainablePropertySet.
+ *
+ */
+
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC ChainablePropertySet : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+ {
+ friend class MasterPropertySet;
+ protected:
+ ChainablePropertySetInfo *mpInfo;
+ osl::SolarMutex* mpMutex;
+ ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void _postGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ public:
+ ChainablePropertySet( comphelper::ChainablePropertySetInfo* pInfo, osl::SolarMutex* pMutex = NULL )
+ throw();
+ virtual ~ChainablePropertySet()
+ throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ChainablePropertySetInfo.hxx b/include/comphelper/ChainablePropertySetInfo.hxx
new file mode 100644
index 000000000000..ce28803036d5
--- /dev/null
+++ b/include/comphelper/ChainablePropertySetInfo.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX_
+#define _COMPHELPER_CHAINABLEPROPERTYSETINFO_HXX_
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+/*
+ * A ChainablePropertySetInfo is usually initialised with a pointer to the first element
+ * of a null-terminated static table of PropertyInfo structs. This is placed in a hash_map
+ * for fast access
+ *
+ */
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC ChainablePropertySetInfo:
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::beans::XPropertySetInfo >
+ {
+ friend class ChainablePropertySet;
+ friend class MasterPropertySet;
+ protected:
+ PropertyInfoHash maMap;
+ com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
+ public:
+ ChainablePropertySetInfo( PropertyInfo * pMap )
+ throw();
+
+ virtual ~ChainablePropertySetInfo()
+ throw();
+
+ void add( PropertyInfo* pMap, sal_Int32 nCount = -1 )
+ throw();
+ void remove( const OUString& aName )
+ throw();
+
+ // XPropertySetInfo
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
+ throw(::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/IdPropArrayHelper.hxx b/include/comphelper/IdPropArrayHelper.hxx
new file mode 100644
index 000000000000..497a39fd500d
--- /dev/null
+++ b/include/comphelper/IdPropArrayHelper.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+#define COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+
+#include <cppuhelper/component.hxx>
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/stl_types.hxx>
+#include <rtl/instance.hxx>
+#include <cppuhelper/propshlp.hxx>
+
+namespace cppu { class IPropertyArrayHelper; }
+
+namespace comphelper
+{
+ //************************************************************
+ // OIdPropertyArrayUsageHelper
+ //************************************************************
+ template <typename TYPE> struct OIdPropertyArrayUsageHelperMutex
+ : public rtl::Static< ::osl::Mutex, OIdPropertyArrayUsageHelperMutex<TYPE> > {};
+
+ typedef std::map< sal_Int32, ::cppu::IPropertyArrayHelper*, std::less< sal_Int32 > > OIdPropertyArrayMap;
+ template <class TYPE>
+ class OIdPropertyArrayUsageHelper
+ {
+ protected:
+ static sal_Int32 s_nRefCount;
+ static OIdPropertyArrayMap* s_pMap;
+
+ public:
+ OIdPropertyArrayUsageHelper();
+ virtual ~OIdPropertyArrayUsageHelper()
+ {
+ ::osl::MutexGuard aGuard(OIdPropertyArrayUsageHelperMutex<TYPE>::get());
+ OSL_ENSURE(s_nRefCount > 0, "OIdPropertyArrayUsageHelper::~OIdPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ // delete the element
+ for (OIdPropertyArrayMap::iterator i = s_pMap->begin(); i != s_pMap->end(); ++i)
+ delete (*i).second;
+ delete s_pMap;
+ s_pMap = NULL;
+ }
+ }
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if neccessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper(sal_Int32 nId);
+
+ protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with Mutex acquired.
+ <BR>
+ as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
+ assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
+ @return an pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const = 0;
+ };
+
+ //------------------------------------------------------------------
+ template<class TYPE>
+ sal_Int32 OIdPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+ template<class TYPE>
+ OIdPropertyArrayMap* OIdPropertyArrayUsageHelper< TYPE >::s_pMap = NULL;
+
+ //------------------------------------------------------------------
+ template <class TYPE>
+ OIdPropertyArrayUsageHelper<TYPE>::OIdPropertyArrayUsageHelper()
+ {
+ ::osl::MutexGuard aGuard(OIdPropertyArrayUsageHelperMutex<TYPE>::get());
+ // create the map if necessary
+ if (s_pMap == NULL)
+ s_pMap = new OIdPropertyArrayMap();
+ ++s_nRefCount;
+ }
+
+ //------------------------------------------------------------------
+ template <class TYPE>
+ ::cppu::IPropertyArrayHelper* OIdPropertyArrayUsageHelper<TYPE>::getArrayHelper(sal_Int32 nId)
+ {
+ OSL_ENSURE(s_nRefCount, "OIdPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ ::osl::MutexGuard aGuard(OIdPropertyArrayUsageHelperMutex<TYPE>::get());
+ // do we have the array already?
+ if (! (*s_pMap)[nId] )
+ {
+ (*s_pMap)[nId] = createArrayHelper(nId);
+ OSL_ENSURE((*s_pMap)[nId], "OIdPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ return (*s_pMap)[nId];
+ }
+}
+#endif // COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/InlineContainer.hxx b/include/comphelper/InlineContainer.hxx
new file mode 100644
index 000000000000..b23574bbad58
--- /dev/null
+++ b/include/comphelper/InlineContainer.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
+#define INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <map>
+#include <set>
+
+namespace comphelper
+{
+
+/** Creates a UNO-Sequence which contains an arbitrary number of elements.
+ Notice, that every call of the operator() issues a realloc, so this is not
+ suitable to create very large sequences.
+
+ usage:
+
+ uno::Sequence< t >( MakeSequence< t >( t_1 )( t_2 )...( t_n ) );
+ */
+template < typename T >
+class MakeSequence : public ::com::sun::star::uno::Sequence< T >
+{
+public:
+ explicit MakeSequence(const T &a)
+ : ::com::sun::star::uno::Sequence< T >( 1 )
+ {
+ this->operator[](0) = a;
+ }
+ MakeSequence& operator()(const T &a)
+ {
+ this->realloc( this->getLength() + 1 );
+ this->operator[]( this->getLength() - 1 ) = a;
+ return *this;
+ }
+};
+
+// ----------------------------------------
+
+/** Creates a vector which contains an arbitrary number of elements.
+
+ usage:
+
+ vector< t > aVec( MakeVector< t >( t_1 )( t_2 )...( t_n ) );
+ */
+template < typename T >
+class MakeVector : public ::std::vector< T >
+{
+public:
+ explicit MakeVector(const T &a)
+ : ::std::vector< T >(1, a)
+ {
+ }
+ MakeVector &operator()(const T &a)
+ {
+ this->push_back(a);
+ return *this;
+ }
+};
+
+// ----------------------------------------
+
+/** Creates a set which contains an arbitrary number of elements.
+
+ usage:
+
+ set< t > aSet( MakeSet< t >( t_1 )( t_2 )...( t_n ) );
+ */
+template < typename T >
+class MakeSet : public ::std::set< T >
+{
+public:
+ explicit MakeSet(const T &a)
+ : ::std::set< T >()
+ {
+ this->insert(this->end(), a);
+ }
+ MakeSet &operator()(const T &a)
+ {
+ this->insert(this->end(), a);
+ return *this;
+ }
+};
+
+// ----------------------------------------
+
+/** usage:
+
+ map< k, v > aMap( MakeMap< k, v >
+ ( key_1, value_1 )
+ ( key_2, value_2 )
+ ( key_3, value_3 )
+ ...
+ ( key_n, value_n )
+ );
+ */
+template < typename Key, typename Value >
+class MakeMap : public ::std::map< Key, Value >
+{
+private:
+ typedef typename ::std::map< Key, Value >::value_type value_type;
+public:
+ explicit MakeMap( const Key &k, const Value &v )
+ {
+ this->insert( value_type( k, v ) );
+ }
+ MakeMap &operator()( const Key &k, const Value &v )
+ {
+ this->insert( value_type( k, v ) );
+ return *this;
+ }
+
+ MakeMap &operator()( const MakeMap& rSource )
+ {
+ this->insert(rSource.begin(),rSource.end());
+ return *this;
+ }
+};
+
+} // namespace comphelper
+
+#endif
+// INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/MasterPropertySet.hxx b/include/comphelper/MasterPropertySet.hxx
new file mode 100644
index 000000000000..266137fdb9b4
--- /dev/null
+++ b/include/comphelper/MasterPropertySet.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MASTERPROPERTYSETHELPER_HXX_
+#define _COMPHELPER_MASTERPROPERTYSETHELPER_HXX_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include "comphelper/comphelperdllapi.h"
+#include <map>
+
+namespace comphelper
+{
+ class MasterPropertySetInfo;
+ class ChainablePropertySet;
+ struct SlaveData
+ {
+ ChainablePropertySet * mpSlave;
+ ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySet > mxSlave;
+ sal_Bool mbInit;
+ SlaveData ( ChainablePropertySet *pSlave);
+ inline sal_Bool IsInit () { return mbInit;}
+ inline void SetInit ( sal_Bool bInit) { mbInit = bInit; }
+ };
+}
+typedef std::map < sal_uInt8, comphelper::SlaveData* > SlaveMap;
+
+/*
+ * A MasterPropertySet implements all of the features of a ChainablePropertySet
+ * (it is not inherited from ChainablePropertySet to prevent MasterPropertySets
+ * being chained to each other), but also allows properties implemented in
+ * other ChainablePropertySets to be included as 'native' properties in a
+ * given MasterPropertySet implementation. These are registered using the
+ * 'registerSlave' method, and require that the implementation of the
+ * ChainablePropertySet and the implementation of the ChainablePropertySetInfo
+ * both declare the implementation of the MasterPropertySet as a friend.
+ */
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC MasterPropertySet : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+ {
+ protected:
+ MasterPropertySetInfo *mpInfo;
+ osl::SolarMutex* mpMutex;
+ sal_uInt8 mnLastId;
+ SlaveMap maSlaveMap;
+ ::com::sun::star::uno::Reference < com::sun::star::beans::XPropertySetInfo > mxInfo;
+
+ virtual void _preSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const ::com::sun::star::uno::Any &rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postSetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, ::com::sun::star::uno::Any & rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+ virtual void _postGetValues ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException ) = 0;
+
+ virtual void _preGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+ virtual void _getPropertyState( const comphelper::PropertyInfo& rInfo, ::com::sun::star::beans::PropertyState& rState )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void _postGetPropertyState ()
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
+
+ virtual void _setPropertyToDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyInfo& rEntry )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
+
+ public:
+ MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, ::osl::SolarMutex* pMutex = NULL )
+ throw();
+ virtual ~MasterPropertySet()
+ throw();
+ void registerSlave ( ChainablePropertySet *pNewSet )
+ throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/MasterPropertySetInfo.hxx b/include/comphelper/MasterPropertySetInfo.hxx
new file mode 100644
index 000000000000..d2c772e2c5d5
--- /dev/null
+++ b/include/comphelper/MasterPropertySetInfo.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MASTERPROPERTYSETINFO_HXX_
+#define _COMPHELPER_MASTERPROPERTYSETINFO_HXX_
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <comphelper/PropertyInfoHash.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ class COMPHELPER_DLLPUBLIC MasterPropertySetInfo:
+ public ::cppu::WeakImplHelper1<
+ ::com::sun::star::beans::XPropertySetInfo >
+ {
+ friend class MasterPropertySet;
+ protected:
+ PropertyDataHash maMap;
+ com::sun::star::uno::Sequence < com::sun::star::beans::Property > maProperties;
+ public:
+ MasterPropertySetInfo( PropertyInfo * pMap )
+ throw();
+ virtual ~MasterPropertySetInfo()
+ throw();
+ void add( PropertyInfo* pMap, sal_Int32 nCount = -1, sal_uInt8 nMapId = 0 )
+ throw();
+ void add( PropertyInfoHash &rHash, sal_uInt8 nMapId )
+ throw();
+
+ // XPropertySetInfo
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
+ throw(::com::sun::star::uno::RuntimeException);
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/PropertyInfoHash.hxx b/include/comphelper/PropertyInfoHash.hxx
new file mode 100644
index 000000000000..3241560b4a94
--- /dev/null
+++ b/include/comphelper/PropertyInfoHash.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTYINFOHASH_HXX_
+#define _COMPHELPER_PROPERTYINFOHASH_HXX_
+
+#include <rtl/ustring.hxx>
+#include <comphelper/TypeGeneration.hxx>
+#include <boost/unordered_map.hpp>
+namespace comphelper
+{
+ struct PropertyInfo
+ {
+ const sal_Char* mpName;
+ sal_uInt16 mnNameLen;
+ sal_Int32 mnHandle;
+ CppuTypes meCppuType;
+ sal_Int16 mnAttributes;
+ sal_uInt8 mnMemberId;
+ };
+ struct PropertyData
+ {
+ sal_uInt8 mnMapId;
+ PropertyInfo *mpInfo;
+ PropertyData ( sal_uInt8 nMapId, PropertyInfo *pInfo )
+ : mnMapId ( nMapId )
+ , mpInfo ( pInfo ) {}
+ };
+ struct eqFunc
+ {
+ sal_Bool operator()( const OUString &r1,
+ const OUString &r2) const
+ {
+ return r1 == r2;
+ }
+ };
+}
+
+typedef boost::unordered_map < OUString,
+ ::comphelper::PropertyInfo*,
+ OUStringHash,
+ ::comphelper::eqFunc > PropertyInfoHash;
+typedef boost::unordered_map < OUString,
+ ::comphelper::PropertyData*,
+ OUStringHash,
+ ::comphelper::eqFunc > PropertyDataHash;
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/SelectionMultiplex.hxx b/include/comphelper/SelectionMultiplex.hxx
new file mode 100644
index 000000000000..56e8375fd215
--- /dev/null
+++ b/include/comphelper/SelectionMultiplex.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX
+#define INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX
+
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= selection helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ class OSelectionChangeMultiplexer;
+
+ //==================================================================
+ //= OSelectionChangeListener
+ //==================================================================
+ /// simple listener adapter for selections
+ class COMPHELPER_DLLPUBLIC OSelectionChangeListener
+ {
+ friend class OSelectionChangeMultiplexer;
+
+ OSelectionChangeMultiplexer* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OSelectionChangeListener(::osl::Mutex& _rMutex)
+ : m_pAdapter(NULL), m_rMutex(_rMutex) { }
+ virtual ~OSelectionChangeListener();
+
+ virtual void _selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ // pseudo-private. Making it private now could break compatibility
+ void setAdapter( OSelectionChangeMultiplexer* _pAdapter );
+ };
+
+ //==================================================================
+ //= OSelectionChangeMultiplexer
+ //==================================================================
+ /// multiplexer for selection changes
+ class COMPHELPER_DLLPUBLIC OSelectionChangeMultiplexer :public cppu::WeakImplHelper1< ::com::sun::star::view::XSelectionChangeListener>
+ {
+ friend class OSelectionChangeListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier> m_xSet;
+ OSelectionChangeListener* m_pListener;
+ sal_Int32 m_nLockCount;
+ sal_Bool m_bListening : 1;
+ sal_Bool m_bAutoSetRelease : 1;
+
+ OSelectionChangeMultiplexer(const OSelectionChangeMultiplexer&);
+ OSelectionChangeMultiplexer& operator=(const OSelectionChangeMultiplexer&);
+ protected:
+ virtual ~OSelectionChangeMultiplexer();
+ public:
+ OSelectionChangeMultiplexer(OSelectionChangeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier>& _rxSet, sal_Bool _bAutoReleaseSet = sal_True);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // XSelectionChangeListener
+ virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ /// incremental lock
+ void lock();
+ /// incremental unlock
+ void unlock();
+ /// get the lock count
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ void dispose();
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // INCLUDED_COMPHELPER_SELECTION_MULTIPLEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/SettingsHelper.hxx b/include/comphelper/SettingsHelper.hxx
new file mode 100644
index 000000000000..d623fa3e5494
--- /dev/null
+++ b/include/comphelper/SettingsHelper.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SETTINGSHELPER_HXX_
+#define _COMPHELPER_SETTINGSHELPER_HXX_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase3.hxx>
+
+namespace comphelper
+{
+ class MasterPropertySet;
+ class MasterPropertySetInfo;
+ class ChainablePropertySet;
+ class ChainablePropertySetInfo;
+
+ typedef cppu::WeakImplHelper3
+ <
+ ::com::sun::star::beans::XPropertySet,
+ ::com::sun::star::beans::XMultiPropertySet,
+ ::com::sun::star::lang::XServiceInfo
+ >
+ HelperBaseNoState;
+ template < class ComphelperBase, class ComphelperBaseInfo > class SettingsHelperNoState :
+ public HelperBaseNoState,
+ public ComphelperBase
+ {
+ public:
+ SettingsHelperNoState ( ComphelperBaseInfo *pInfo, ::osl::SolarMutex* pMutex = NULL)
+ : ComphelperBase ( pInfo, pMutex )
+ {}
+ virtual ~SettingsHelperNoState () throw( ) {}
+ com::sun::star::uno::Any SAL_CALL queryInterface( const com::sun::star::uno::Type& aType ) throw (com::sun::star::uno::RuntimeException)
+ { return HelperBaseNoState::queryInterface( aType ); }
+ void SAL_CALL acquire( ) throw ()
+ { HelperBaseNoState::acquire( ); }
+ void SAL_CALL release( ) throw ()
+ { HelperBaseNoState::release( ); }
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw(::com::sun::star::uno::RuntimeException)
+ { return ComphelperBase::getPropertySetInfo(); }
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::setPropertyValue ( aPropertyName, aValue ); }
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { return ComphelperBase::getPropertyValue ( PropertyName ); }
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::addPropertyChangeListener ( aPropertyName, xListener ); }
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::removePropertyChangeListener ( aPropertyName, aListener ); }
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::addVetoableChangeListener ( PropertyName, aListener ); }
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::removeVetoableChangeListener ( PropertyName, aListener ); }
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues )
+ throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::setPropertyValues ( aPropertyNames, aValues ); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames )
+ throw(::com::sun::star::uno::RuntimeException)
+ { return ComphelperBase::getPropertyValues ( aPropertyNames ); }
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::addPropertiesChangeListener ( aPropertyNames, xListener ); }
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::removePropertiesChangeListener ( xListener ); }
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener )
+ throw(::com::sun::star::uno::RuntimeException)
+ { ComphelperBase::firePropertiesChangeEvent ( aPropertyNames, xListener ); }
+ };
+ typedef comphelper::SettingsHelperNoState
+ <
+ ::comphelper::MasterPropertySet,
+ ::comphelper::MasterPropertySetInfo
+ >
+ MasterHelperNoState;
+ typedef comphelper::SettingsHelperNoState
+ <
+ ::comphelper::ChainablePropertySet,
+ ::comphelper::ChainablePropertySetInfo
+ >
+ ChainableHelperNoState;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/TypeGeneration.hxx b/include/comphelper/TypeGeneration.hxx
new file mode 100644
index 000000000000..0ced57b31714
--- /dev/null
+++ b/include/comphelper/TypeGeneration.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_TYPEGENERATION_HXX_
+#define _COMPHELPER_TYPEGENERATION_HXX_
+
+#include <sal/types.h>
+#include "comphelper/comphelperdllapi.h"
+
+#define CPPU_E2T(type) ((com::sun::star::uno::Type*)type)
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class Type;
+} } } }
+namespace comphelper
+{
+ enum CppuTypes
+ {
+ CPPUTYPE_UNKNOWN, // 0 == unknown == error!!!!
+
+ CPPUTYPE_BOOLEAN, //getBooleanCppuType()
+ CPPUTYPE_INT8, //getCppuType( (sal_Int8*)0 )
+ CPPUTYPE_INT16, //getCppuType( (sal_Int16*)0 )
+ CPPUTYPE_INT32, //getCppuType( (sal_Int32*)0 )
+ CPPUTYPE_DOUBLE, //getCppuType( (double*)0 )
+ CPPUTYPE_FLOAT, //getCppuType( (float*)0 )
+ CPPUTYPE_OUSTRING, //getCppuType( (OUString*)0 )
+
+ CPPUTYPE_FONTSLANT, //getCppuType( (FontSlant*)0 )
+ CPPUTYPE_LOCALE, //getCppuType( (Locale*)0 )
+ CPPUTYPE_PROPERTYVALUE, //getCppuType( (Sequence<PropertyValue>*)0 )
+ CPPUTYPE_PROPERTYVALUES, //getCppuType( (Sequence<PropertyValues>*)0 )
+ CPPUTYPE_BORDERLINE, //getCppuType( (table::BorderLine*)0 )
+ CPPUTYPE_BREAK, //getCppuType( (style::BreakType*)0 )
+ CPPUTYPE_GRAPHICLOC, //getCppuType( (style::GraphicLocation*)0 )
+ CPPUTYPE_DROPCAPFMT, //getCppuType( (style::DropCapFormat*)0 )
+ CPPUTYPE_LINESPACE, //getCppuType( (style::LineSpacing*)0 )
+ CPPUTYPE_AWTSIZE, //getCppuType( (awt::Size*)0 )
+ CPPUTYPE_SHADOWFMT, //getCppuType( (table::ShadowFormat*)0 )
+ CPPUTYPE_TBLCOLSEP, //getCppuType( (Sequence<text::TableColumnSeparator>*)0 )
+ CPPUTYPE_PNTSEQSEQ, //getCppuType( (PointSequenceSequence*)0 )
+ CPPUTYPE_DOCIDXMRK, //getCppuType( (Sequence< Reference< XDocumentIndexMark > >*)0 )
+ CPPUTYPE_SEQINT8, //getCppuType( (Sequence<sal_Int8>*)0 )
+ CPPUTYPE_SEQTABSTOP, //getCppuType( (Sequence<style::TabStop>*)0 )
+ CPPUTYPE_SEQANCHORTYPE, //getCppuType( (Sequence<text::TextContentAnchorType>*)0 )
+ CPPUTYPE_SEQDEPTXTFLD, //getCppuType( (Sequence<Reference<XDependentTextField> >*)0 )
+ CPPUTYPE_TXTCNTANCHOR, //getCppuType( (text::TextContentAnchorType*)0 )
+ CPPUTYPE_WRAPTXTMODE, //getCppuType( (text::WrapTextMode*)0 )
+ CPPUTYPE_LINESTYLE, //getCppuType( (drawing::LineStyle*)0 )
+ CPPUTYPE_COLORMODE, //getCppuType( (drawing::ColorMode*)0 )
+ CPPUTYPE_PAGESTYLELAY, //getCppuType( (style::PageStyleLayout*)0 )
+ CPPUTYPE_VERTALIGN, //getCppuType( (style::VerticalAlignment*)0 )
+ CPPUTYPE_TABLEBORDER, //getCppuType( (table::TableBorder*)0 )
+ CPPUTYPE_TABLEBORDER2, //getCppuType( (table::TableBorder*)0 )
+ CPPUTYPE_GRFCROP, //getCppuType( (text::GraphicCrop*)0 )
+ CPPUTYPE_SECTFILELNK, //getCppuType( (text::SectionFileLink*)0 )
+ CPPUTYPE_PAGENUMTYPE, //getCppuType( (const PageNumberType*)0 )
+ CPPUTYPE_DATETIME, //getCppuType( (util::DateTime*)0 )
+ CPPUTYPE_DATE, //getCppuType( (util::Date*)0 )
+
+ CPPUTYPE_REFINTERFACE, //getCppuType( (Reference<XInterface>*)0 )
+ CPPUTYPE_REFIDXREPL, //getCppuType( (Reference<container::XIndexReplace>*)0 )
+ CPPUTYPE_REFNAMECNT, //getCppuType( (Reference<container::XNameContainer>*)0 )
+ CPPUTYPE_REFTEXTFRAME, //getCppuType( (Reference<text::XTextFrame>*)0 )
+ CPPUTYPE_REFTEXTSECTION, //getCppuType( (Reference<text::XTextSection>*)0 )
+ CPPUTYPE_REFFOOTNOTE, //getCppuType( (Reference<text::XFootnote>*)0 )
+ CPPUTYPE_REFTEXT, //getCppuType( (Reference<text::XText>*)0 )
+ CPPUTYPE_REFTEXTCOL, //getCppuType( (Reference<text::XTextColumns>*)0 )
+
+ CPPUTYPE_REFFORBCHARS, //getCppuType( (Reference<XForbiddenCharacters>*)0)
+ CPPUTYPE_REFIDXCNTNR, //getCppuType( (Reference<XIndexContainer>*)0)
+ CPPUTYPE_REFTEXTCNTNT, //getCppuType( (Reference<XTextContent>*)0)
+ CPPUTYPE_REFBITMAP, //getCppuType( (Reference<awt::XBitmap>*)0)
+ CPPUTYPE_REFNMREPLACE, //getCppuType( (Reference<container::XNameReplace>*)0)
+ CPPUTYPE_REFCELL, //getCppuType( (Reference<table::XCell>*)0)
+ CPPUTYPE_REFDOCINDEX, //getCppuType( (Reference<text::XDocumentIndex>*)0)
+ CPPUTYPE_REFDOCIDXMRK, //getCppuType( (Reference<text::XDocumentIndexMark>*)0)
+ CPPUTYPE_REFTXTFIELD, //getCppuType( (Reference<text::XTextField>*)0)
+ CPPUTYPE_REFTXTRANGE, //getCppuType( (Reference<text::XTextRange>*)0)
+ CPPUTYPE_REFTXTTABLE, //getCppuType( (Reference<text::XTextTable>*)0)
+ CPPUTYPE_AWTPOINT, //getCppuType( (awt::Point*)0 )
+ CPPUTYPE_REFLIBCONTAINER, //getCppuType( (Reference< script::XLibraryContainer >*)0)
+ CPPUTYPE_SEQANY, //getCppuType( (Sequence< uno::Any >*)0)
+ CPPUTYPE_REFRESULTSET, //getCppuType( (Reference< sdbc::XResultSet >*)0)
+ CPPUTYPE_REFCONNECTION, //getCppuType( (Reference< sdbc::XConnection >*)0)
+ CPPUTYPE_REFMODEL, //getCppuType( (Reference< frame::XModel >*)0)
+
+ CPPUTYPE_OUSTRINGS, //getCppuType( (Sequence<OUString>*)0 )
+ CPPUTYPE_REFCOMPONENT, //getCppuType( (Reference< lang::XComponent >*)0 )
+ // #i28749#
+ CPPUTYPE_TRANSFORMATIONINHORIL2R, //getCppuType( (drawing::HomogenMatrix3)* )
+ CPPUTYPE_SEQNAMEDVALUE, //getCppuType( (Sequence<beans::NamedValue>*)0 )
+ CPPUTYPE_REFXGRAPHIC, //getCppuType( Reference< graphic::XGraphic >*)0)
+ CPPUTYPE_TABLEBORDERDISTANCES, //getCppuType( (table::TableBorderDistances*)0 )
+ CPPUTPYE_REFEMBEDDEDOBJECT, // XEmbeddedObject::static_type
+ CPPUTYPE_FILLSTYLE, //getCppuType( (drawing::FillStyle*)0 )
+ CPPUTYPE_GRADIENT, //getCppuType( (awt::Gradient*)0 )
+
+ CPPUTYPE_END
+ };
+ COMPHELPER_DLLPUBLIC void GenerateCppuType (
+ CppuTypes eType, const com::sun::star::uno::Type*& pType );
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx
new file mode 100644
index 000000000000..d0eabc27b807
--- /dev/null
+++ b/include/comphelper/accessiblecomponenthelper.hxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <comphelper/accessiblecontexthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OCommonAccessibleComponent
+ //=====================================================================
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleComponent respectively XAccessibleExtendendComponent
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper
+ {
+ protected:
+ OCommonAccessibleComponent();
+ /// see the respective base class ctor for an extensive comment on this, please
+ OCommonAccessibleComponent( IMutex* _pExternalLock );
+ ~OCommonAccessibleComponent();
+
+ protected:
+ /// implements the calculation of the bounding rectangle - still waiting to be overwritten
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL implGetBounds( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ protected:
+ /** non-virtual versions of the methods which can be implemented using <method>implGetBounds</method>
+ note: getLocationOnScreen relies on a valid parent (XAccessibleContext::getParent()->getAccessibleContext()),
+ which itself implements XAccessibleComponent
+ */
+ sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //=====================================================================
+ //= OAccessibleComponentHelper
+ //=====================================================================
+
+ struct OAccessibleComponentHelper_Base :
+ public ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleComponent >
+ {
+ protected:
+ ~OAccessibleComponentHelper_Base() {}
+ };
+
+ /** a helper class for implementing an AccessibleContext which at the same time
+ supports an XAccessibleComponent interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleComponentHelper
+ :public OCommonAccessibleComponent
+ ,public OAccessibleComponentHelper_Base
+ {
+ protected:
+ OAccessibleComponentHelper( );
+ /// see the respective base class ctor for an extensive comment on this, please
+ OAccessibleComponentHelper( IMutex* _pExternalLock );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent - default implementations
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+ //=====================================================================
+ //= OAccessibleExtendedComponentHelper
+ //=====================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleExtendedComponent
+ > OAccessibleExtendedComponentHelper_Base;
+
+ /** a helper class for implementing an AccessibleContext which at the same time
+ supports an XAccessibleExtendedComponent interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleExtendedComponentHelper
+ :public OCommonAccessibleComponent
+ ,public OAccessibleExtendedComponentHelper_Base
+ {
+ protected:
+ OAccessibleExtendedComponentHelper( );
+ /// see the respective base class ctor for an extensive comment on this, please
+ OAccessibleExtendedComponentHelper( IMutex* _pExternalLock );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleComponent - default implementations
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx
new file mode 100644
index 000000000000..e6c5c10ab20f
--- /dev/null
+++ b/include/comphelper/accessiblecontexthelper.hxx
@@ -0,0 +1,345 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX
+
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= IMutex
+ //=====================================================================
+
+ // This whole thingie here (own mutex classes and such) is a HACK. I hate the SolarMutex.
+ // See below for more explanations ....
+
+ /** abstract interface for implementing a mutex
+ */
+ class COMPHELPER_DLLPUBLIC IMutex
+ {
+ public:
+ virtual ~IMutex();
+ virtual void acquire() = 0;
+ virtual void release() = 0;
+ };
+
+ //=====================================================================
+ //= OMutexGuard
+ //=====================================================================
+
+ class OMutexGuard
+ {
+ IMutex* m_pMutex;
+ public:
+ inline OMutexGuard( IMutex* _pMutex )
+ :m_pMutex( _pMutex )
+ {
+ if ( m_pMutex )
+ m_pMutex->acquire();
+ }
+
+ inline ~OMutexGuard( )
+ {
+ if ( m_pMutex )
+ m_pMutex->release();
+ }
+ };
+
+ //=====================================================================
+ //= OAccessibleContextHelper
+ //=====================================================================
+
+ class OContextHelper_Impl;
+ typedef ::cppu::WeakAggComponentImplHelper2 < ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ > OAccessibleContextHelper_Base;
+
+ /** helper class for implementing an AccessibleContext
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleContextHelper
+ :public ::comphelper::OBaseMutex
+ ,public OAccessibleContextHelper_Base
+ {
+ private:
+ OContextHelper_Impl* m_pImpl;
+
+ protected:
+ OAccessibleContextHelper( );
+ ~OAccessibleContextHelper( );
+
+ /** ctor
+
+ <p>If you need additional object safety for your class, and want to ensure that your own
+ mutex is locked before the mutex this class provides is, than use this ctor.</p>
+
+ <p>Beware that this is a hack. Unfortunately, OpenOffice.org has two different mutex hierarchies,
+ which are not compatible. In addition, wide parts of the code (especially VCL) is not thread-safe,
+ but instead relies on a <em>single global mutex</em>. As a consequence, components using
+ directly or indirectly such code need to care for this global mutex. Yes, this is as ugly as
+ anything.</p>
+
+ <p>Note that the external lock is used as additional lock, not as the only one. The own mutex of the
+ instance is used for internal actions, and every action which potentially involves external code
+ (for instance every call to a virtual method overridden by derivees) is <em>additionally</em> and
+ <em>first</em> guarded by with the external lock.</p>
+
+ <p>Beware of the lifetime of the lock - you must ensure that the lock exists at least as long as
+ the context does. A good approach to implement the lock may be to derive you own context
+ not only from OAccessibleContextHelper, but also from IMutex.</p>
+
+ <p>One more note. This lock is definitely not used once the dtor is reached. Means whatever
+ the dtor implementation does, it does <em>not</em> guard the external lock. See this as a contract.
+ <br/>You should ensure the same thing for own derivees which do not supply the lock themself,
+ but get them from yet another derivee.</p>
+ @see forgetExternalLock
+ */
+ OAccessibleContextHelper( IMutex* _pExternalLock );
+
+ /** late construction
+ @param _rxAccessible
+ the Accessible object which created this context.
+ <p>If your derived implementation implements the XAccessible (and does not follow the proposed
+ separation of XAccessible from XAccessibleContext), you may pass <code>this</code> here.</p>
+
+ <p>The object is hold weak, so it's life time is not affected.</p>
+
+ <p>The object is needed for performance reasons: for <method>getAccessibleIndexInParent</method>,
+ all children (which are XAccessible's theirself) of our parent have to be asked. If we know our
+ XAccessible, we can compare it with all the children, instead of asking all children for their
+ context and comparing this context with ourself.</p>
+ */
+ void lateInit( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAccessible );
+
+ /** retrieves the creator previously set with <method>lateInit</method>
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleCreator( ) const;
+
+ /** forgets the reference to the external lock, if present.
+
+ <p>This means any further locking will not be guard the external lock anymore, never.</p>
+
+ <p>To be used in derived classes which do not supply the external lock themself, but instead get
+ them passed from own derivees (or clients).</p>
+ */
+ void forgetExternalLock();
+
+ public:
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext - still waiting to be overwritten
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // XAccessibleContext - default implementations
+ /** default implementation for retrieving the index of this object within the parent
+ <p>This basic implementation here returns the index <code>i</code> of the child for which
+ <code>&lt;parent&gt;.getAccessibleChild( i )</code> equals our creator.</p>
+ */
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ /** default implementation for retrieving the locale
+ <p>This basic implementation returns the locale of the parent context,
+ as retrieved via getAccessibleParent()->getAccessibleContext.</p>
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ public:
+ // helper struct for granting selective access rights
+ struct OAccessControl
+ {
+ friend class OContextEntryGuard;
+ friend class OContextHelper_Impl;
+ friend class OExternalLockGuard;
+ private:
+ OAccessControl() { }
+ };
+
+ // ensures that the object is alive
+ inline void ensureAlive( const OAccessControl& ) const SAL_THROW( ( ::com::sun::star::lang::DisposedException ) );
+ inline IMutex* getExternalLock( const OAccessControl& );
+ inline ::osl::Mutex& GetMutex( const OAccessControl& );
+
+ protected:
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ protected:
+ // helper
+ /** notifies all AccessibleEventListeners of a certain event
+
+ @precond not too be called with our mutex locked
+ @param _nEventId
+ the id of the even. See AccessibleEventType
+ @param _rOldValue
+ the old value to be notified
+ @param _rNewValue
+ the new value to be notified
+ */
+ virtual void SAL_CALL NotifyAccessibleEvent(
+ const sal_Int16 _nEventId,
+ const ::com::sun::star::uno::Any& _rOldValue,
+ const ::com::sun::star::uno::Any& _rNewValue
+ );
+
+ // life time control
+ /// checks whether the object is alive (returns <TRUE/> then) or disposed
+ sal_Bool isAlive() const;
+ /// checks for beeing alive. If the object is already disposed (i.e. not alive), an exception is thrown.
+ void ensureAlive() const SAL_THROW( ( ::com::sun::star::lang::DisposedException ) );
+
+ /** ensures that the object is disposed.
+ @precond
+ to be called from within the destructor of your derived class only!
+ */
+ void ensureDisposed( );
+
+ /** shortcut for retrieving the context of the parent (returned by getAccessibleParent)
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ implGetParentContext() SAL_THROW( ( ::com::sun::star::uno::RuntimeException ) );
+
+ // access to the base class' broadcast helper/mutex
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return rBHelper; }
+ const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return rBHelper; }
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+ IMutex* getExternalLock( );
+ };
+
+ //---------------------------------------------------------------------
+ inline void OAccessibleContextHelper::ensureAlive( const OAccessControl& ) const SAL_THROW( ( ::com::sun::star::lang::DisposedException ) )
+ {
+ ensureAlive();
+ }
+
+ //---------------------------------------------------------------------
+ inline IMutex* OAccessibleContextHelper::getExternalLock( const OAccessControl& )
+ {
+ return getExternalLock();
+ }
+
+ //---------------------------------------------------------------------
+ inline ::osl::Mutex& OAccessibleContextHelper::GetMutex( const OAccessControl& )
+ {
+ return GetMutex();
+ }
+
+ //=====================================================================
+ //= OContextEntryGuard
+ //=====================================================================
+ typedef ::osl::ClearableMutexGuard OContextEntryGuard_Base;
+ /** helper class for guarding the entry into OAccessibleContextHelper methods.
+
+ <p>The class has two responsibilities:
+ <ul><li>it locks the mutex of an OAccessibleContextHelper instance, as long as the guard lives</li>
+ <li>it checks if an given OAccessibleContextHelper instance is alive, else an exception is thrown
+ our of the constructor of the guard</li>
+ </ul>
+ <br/>
+ This makes it your first choice (hopefully :) for guarding any interface method implementations of
+ you derived class.
+ </p>
+ */
+ class OContextEntryGuard : public OContextEntryGuard_Base
+ {
+ public:
+ /** constructs the guard
+
+ <p>The given context (it's mutex, respectively) is locked, and an exception is thrown if the context
+ is not alive anymore. In the latter case, of course, the mutex is freed, again.</p>
+
+ @param _pContext
+ the context which shall be guarded
+ @precond <arg>_pContext</arg> != NULL
+ */
+ inline OContextEntryGuard( OAccessibleContextHelper* _pContext );
+
+ /** destructs the guard.
+ <p>The context (it's mutex, respectively) is unlocked.</p>
+ */
+ inline ~OContextEntryGuard();
+ };
+
+ //.....................................................................
+ inline OContextEntryGuard::OContextEntryGuard( OAccessibleContextHelper* _pContext )
+ :OContextEntryGuard_Base( _pContext->GetMutex( OAccessibleContextHelper::OAccessControl() ) )
+ {
+ _pContext->ensureAlive( OAccessibleContextHelper::OAccessControl() );
+ }
+
+ //.....................................................................
+ inline OContextEntryGuard::~OContextEntryGuard()
+ {
+ }
+
+ //=====================================================================
+ //= OExternalLockGuard
+ //=====================================================================
+ class OExternalLockGuard
+ :public OMutexGuard
+ ,public OContextEntryGuard
+ {
+ public:
+ inline OExternalLockGuard( OAccessibleContextHelper* _pContext );
+ inline ~OExternalLockGuard( );
+ };
+
+ //.....................................................................
+ inline OExternalLockGuard::OExternalLockGuard( OAccessibleContextHelper* _pContext )
+ :OMutexGuard( _pContext->getExternalLock( OAccessibleContextHelper::OAccessControl() ) )
+ ,OContextEntryGuard( _pContext )
+ {
+ // #102438#
+ // Only lock the external mutex,
+ // release the ::osl::Mutex of the OAccessibleContextHelper instance.
+ // If you call into another UNO object with locked ::osl::Mutex,
+ // this may lead to dead locks.
+ clear();
+ }
+
+ //.....................................................................
+ inline OExternalLockGuard::~OExternalLockGuard( )
+ {
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_CONTEXT_HELPER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibleeventnotifier.hxx b/include/comphelper/accessibleeventnotifier.hxx
new file mode 100644
index 000000000000..f0a745baa5a8
--- /dev/null
+++ b/include/comphelper/accessibleeventnotifier.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+#define COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <osl/thread.hxx>
+#include <osl/conditn.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include "comphelper/comphelperdllapi.h"
+
+#include <map>
+#include <list>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= AccessibleEventNotifier
+ //=====================================================================
+ class COMPHELPER_DLLPUBLIC AccessibleEventNotifier
+ {
+ // typedefs
+ public:
+ typedef sal_uInt32 TClientId;
+
+ typedef ::std::pair< TClientId, ::com::sun::star::accessibility::AccessibleEventObject >
+ ClientEvent;
+
+ typedef ::cppu::OInterfaceContainerHelper EventListeners;
+ typedef ::std::map< TClientId, EventListeners*, ::std::less< TClientId > > ClientMap;
+
+ protected:
+ AccessibleEventNotifier( ); // never implemented
+ ~AccessibleEventNotifier( ); // never implemented
+
+ private:
+ COMPHELPER_DLLPRIVATE AccessibleEventNotifier( const AccessibleEventNotifier& ); // never implemented!
+ COMPHELPER_DLLPRIVATE AccessibleEventNotifier& operator=( const AccessibleEventNotifier& ); // never implemented!
+
+ public:
+ /** registers a client of this class, means a broadcaster of AccessibleEvents
+
+ <p>No precaution is taken to care for disposal of this component. When the component
+ dies, it <b>must</b> call <member>revokeClient</member> or <member>revokeClientNotifyDisposing</member>
+ explicitly itself.</p>
+ */
+ static TClientId registerClient( );
+
+ /** revokes a broadcaster of AccessibleEvents
+
+ <p>Note that no disposing event is fired when you use this method, the client is simply revoked.
+ You can for instance revoke a client if the last listener for it is revoked, but the client
+ itself is not disposed.<br/>
+ When the client is disposed, you should prefer <member>revokeClientNotifyDisposing</member></p>
+
+ <p>Any possibly pending events for this client are removed from the queue.</p>
+
+ @seealso revokeClientNotifyDisposing
+ */
+ static void revokeClient( const TClientId _nClient );
+
+ /** revokes a client, with additionally notifying a disposing event to all listeners registered for
+ this client
+
+ <p>Any other possibly pending events for this client are removed from the queue</p>
+
+ @param _nClient
+ the id of the client which should be revoked
+ @param _rxEventSource
+ the source to be notified together with the <member scope="com.sun.star.lang">XComponent::disposing</member>
+ call.
+ */
+ static void revokeClientNotifyDisposing(
+ const TClientId _nClient,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxEventSource
+ ) SAL_THROW( ( ) );
+
+ /** registers a listener for the given client
+
+ @param _nClient
+ the id of the client for which a listener should be registered
+ @return
+ the number of event listeners currently registered for this client
+ */
+ static sal_Int32 addEventListener(
+ const TClientId _nClient,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& _rxListener
+ ) SAL_THROW( ( ) );
+
+ /** revokes a listener for the given client
+
+ @param _nClient
+ the id of the client for which a listener should be revoked
+ @return
+ the number of event listeners currently registered for this client
+ */
+ static sal_Int32 removeEventListener(
+ const TClientId _nClient,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& _rxListener
+ ) SAL_THROW( ( ) );
+
+ /** adds an event, which is to be braodcasted, to the queue
+
+ @param _nClient
+ the id of the client which needs to broadcast the event
+ */
+ static void addEvent(
+ const TClientId _nClient,
+ const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent
+ ) SAL_THROW( ( ) );
+
+ private:
+ /// generates a new client id
+ COMPHELPER_DLLPRIVATE static TClientId generateId();
+
+ /** looks up a client in our client map, asserts if it cannot find it or no event thread is present
+
+ @precond
+ to be called with our mutex locked
+
+ @param _nClient
+ the id of the client to loopup
+ @param _rPos
+ out-parameter for the position of the client in the client map
+
+ @return
+ <TRUE/> if and only if the client could be found and <arg>_rPos</arg> has been filled with
+ it's position
+ */
+ COMPHELPER_DLLPRIVATE static sal_Bool implLookupClient( const TClientId _nClient, ClientMap::iterator& _rPos );
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblekeybindinghelper.hxx b/include/comphelper/accessiblekeybindinghelper.hxx
new file mode 100644
index 000000000000..4849b124cf87
--- /dev/null
+++ b/include/comphelper/accessiblekeybindinghelper.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+
+#include <vector>
+
+#include "comphelper/comphelperdllapi.h"
+
+//..............................................................................
+namespace comphelper
+{
+//..............................................................................
+
+ //==============================================================================
+ // OAccessibleKeyBindingHelper
+ //==============================================================================
+
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::accessibility::XAccessibleKeyBinding
+ > OAccessibleKeyBindingHelper_Base;
+
+ /** a helper class for implementing an accessible keybinding
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleKeyBindingHelper : public OAccessibleKeyBindingHelper_Base
+ {
+ private:
+ typedef ::std::vector< ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyStroke > > KeyBindings;
+
+ KeyBindings m_aKeyBindings;
+
+ protected:
+ ::osl::Mutex m_aMutex;
+
+ virtual ~OAccessibleKeyBindingHelper();
+
+ public:
+ OAccessibleKeyBindingHelper();
+ OAccessibleKeyBindingHelper( const OAccessibleKeyBindingHelper& rHelper );
+
+ void AddKeyBinding( const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyStroke >& rKeyBinding ) throw (::com::sun::star::uno::RuntimeException);
+ void AddKeyBinding( const ::com::sun::star::awt::KeyStroke& rKeyStroke ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleKeyBinding
+ virtual sal_Int32 SAL_CALL getAccessibleKeyBindingCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyStroke > SAL_CALL getAccessibleKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//..............................................................................
+} // namespace comphelper
+//..............................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibleselectionhelper.hxx b/include/comphelper/accessibleselectionhelper.hxx
new file mode 100644
index 000000000000..e1bb5dd5f1ef
--- /dev/null
+++ b/include/comphelper/accessibleselectionhelper.hxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
+
+#include <comphelper/uno3.hxx>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+#define ACCESSIBLE_SELECTION_CHILD_ALL ((sal_Int32)-1)
+#define ACCESSIBLE_SELECTION_CHILD_SELF ((sal_Int32)-2)
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OCommonAccessibleSelection
+ //=====================================================================
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleSelection
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleSelection
+ {
+ protected:
+
+ OCommonAccessibleSelection();
+
+ ~OCommonAccessibleSelection();
+
+ protected:
+
+ // access to context - still waiting to be overwritten
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ implGetAccessibleContext()
+ throw ( ::com::sun::star::uno::RuntimeException ) = 0;
+
+ // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual sal_Bool
+ implIsSelected( sal_Int32 nAccessibleChildIndex )
+ throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx)
+ virtual void
+ implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) = 0;
+
+ protected:
+
+ /** non-virtual versions of the methods which can be implemented using <method>implIsSelected</method> and <method>implSelect</method>
+ */
+ void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+ //=====================================================================
+ //= OAccessibleSelectionHelper
+ //=====================================================================
+
+ typedef ::cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleSelection > OAccessibleSelectionHelper_Base;
+
+ /** a helper class for implementing an AccessibleSelection which at the same time
+ supports an XAccessibleSelection interface.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleSelectionHelper : public OAccessibleComponentHelper,
+ public OCommonAccessibleSelection,
+ public OAccessibleSelectionHelper_Base
+ {
+ protected:
+
+ /// see the respective base class ctor for an extensive comment on this, please
+ OAccessibleSelectionHelper( IMutex* _pExternalLock );
+
+ // return ourself here by default
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > implGetAccessibleContext() throw ( ::com::sun::star::uno::RuntimeException );
+
+ public:
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleSelection - default implementations
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_SELECTION_HELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessibletexthelper.hxx b/include/comphelper/accessibletexthelper.hxx
new file mode 100644
index 000000000000..ea3f505ee7fe
--- /dev/null
+++ b/include/comphelper/accessibletexthelper.hxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_TEXT_HELPER_HXX
+#define COMPHELPER_ACCESSIBLE_TEXT_HELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <comphelper/accessiblecomponenthelper.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+
+//..............................................................................
+namespace comphelper
+{
+//..............................................................................
+
+ //==============================================================================
+ // OCommonAccessibleText
+ //==============================================================================
+ /** base class encapsulating common functionality for the helper classes implementing
+ the XAccessibleText
+ */
+ class COMPHELPER_DLLPUBLIC OCommonAccessibleText
+ {
+ private:
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > m_xBreakIter;
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification > m_xCharClass;
+
+ protected:
+ OCommonAccessibleText();
+ virtual ~OCommonAccessibleText();
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > implGetBreakIterator();
+ ::com::sun::star::uno::Reference < ::com::sun::star::i18n::XCharacterClassification > implGetCharacterClassification();
+ sal_Bool implIsValidBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nLength );
+ virtual sal_Bool implIsValidIndex( sal_Int32 nIndex, sal_Int32 nLength );
+ virtual sal_Bool implIsValidRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex, sal_Int32 nLength );
+ virtual OUString implGetText() = 0;
+ virtual ::com::sun::star::lang::Locale implGetLocale() = 0;
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) = 0;
+ virtual void implGetGlyphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual sal_Bool implGetWordBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetSentenceBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+ /** non-virtual versions of the methods
+ */
+ sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ public:
+
+ /** Helper method, that detects the difference between
+ two strings and returns the deleted selection and
+ the inserted selection if available.
+
+ @returns true if there are differences between the
+ two strings and false if both are equal
+
+ @see ::com::sun::star::accessibility::AccessibleEventId
+ ::com::sun::star::accessibility::TextSegment
+ */
+ static bool implInitTextChangedEvent(
+ const OUString& rOldString,
+ const OUString& rNewString,
+ /*out*/ ::com::sun::star::uno::Any& rDeleted,
+ /*out*/ ::com::sun::star::uno::Any& rInserted); // throw()
+ };
+
+
+ //==============================================================================
+ // OAccessibleTextHelper
+ //==============================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleText
+ > OAccessibleTextHelper_Base;
+
+ /** a helper class for implementing an AccessibleExtendedComponent which at the same time
+ supports an XAccessibleText interface
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleTextHelper : public OAccessibleExtendedComponentHelper,
+ public OCommonAccessibleText,
+ public OAccessibleTextHelper_Base
+ {
+ protected:
+ // see the respective base class ctor for an extensive comment on this, please
+ OAccessibleTextHelper( IMutex* _pExternalLock );
+
+ public:
+ // XInterface
+ DECLARE_XINTERFACE( )
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleText
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ };
+
+//..............................................................................
+} // namespace comphelper
+//..............................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_TEXT_HELPER_HXX
+
+
+// -----------------------------------------------------------------------------
+//
+// OAccessibleTextHelper is a helper class for implementing the
+// XAccessibleText interface.
+//
+// The following methods have a default implementation:
+//
+// getCharacter
+// getCharacterCount
+// getSelectedText
+// getSelectionStart
+// getSelectionEnd
+// getText
+// getTextRange
+// getTextAtIndex
+// getTextBeforeIndex
+// getTextBehindIndex
+//
+// The following methods must be overriden by derived classes:
+//
+// implGetText
+// implGetLocale
+// implGetSelection
+// getCaretPosition
+// setCaretPosition
+// getCharacterAttributes
+// getCharacterBounds
+// getIndexAtPoint
+// setSelection
+// copyText
+//
+// -----------------------------------------------------------------------------
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accessiblewrapper.hxx b/include/comphelper/accessiblewrapper.hxx
new file mode 100644
index 000000000000..fbd65d638899
--- /dev/null
+++ b/include/comphelper/accessiblewrapper.hxx
@@ -0,0 +1,410 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCESSIBLE_WRAPPER_HXX
+#define COMPHELPER_ACCESSIBLE_WRAPPER_HXX
+
+#include <comphelper/proxyaggregation.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/sequence.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <comphelper/stl_types.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.............................................................................
+namespace comphelper
+{
+//.............................................................................
+
+ //=========================================================================
+ //= OAccessibleWrapper
+ //=========================================================================
+
+ class OAccessibleContextWrapper;
+ class OWrappedAccessibleChildrenManager;
+
+ struct OAccessibleWrapper_Base :
+ public ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessible >
+ {
+ protected:
+ ~OAccessibleWrapper_Base() {}
+ };
+
+ /** a class which aggregates a proxy for an XAccessible, and wrapping the context returned by this
+ XAccessible.
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleWrapper:public OAccessibleWrapper_Base
+ ,public OComponentProxyAggregation
+
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParentAccessible;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_aContext;
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xInnerAccessible;
+
+ public:
+ /** ctor
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessible
+ the object to wrap
+
+ @param _rxParentAccessible
+ The XAccessible which is our parent
+ */
+ OAccessibleWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxInnerAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ );
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // returns the context without creating it
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ getContextNoCreate( ) const;
+
+ protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
+ getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getParent() const { return m_xParentAccessible; }
+
+ // own overridables
+ virtual OAccessibleContextWrapper* createAccessibleContext(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerContext
+ );
+
+ protected:
+ ~OAccessibleWrapper( );
+
+ private:
+ COMPHELPER_DLLPRIVATE OAccessibleWrapper( ); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleWrapper( const OAccessibleWrapper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleWrapper& operator=( const OAccessibleWrapper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OAccessibleContextWrapperHelper
+ //=========================================================================
+
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::accessibility::XAccessibleEventListener
+ > OAccessibleContextWrapperHelper_Base;
+
+ /** Helper for wrapping an XAccessibleContext by aggregating a proxy for it.
+
+ <p>This class does not have own ref counting. In addition, it does not implement
+ the XAccesibleContext interface, but provides all the methods from this interface
+ which must be implemented using the inner context (such as getAccessibleChild*).</p>
+
+ <p>Children of the aggregated XAccessibleContext are wrapped, too.</p>
+
+ <p>AccessibleEvents fired by the inner context are multiplexed, especially, any references to
+ children in such events are translated. This means that even in such events, no un-wrapped object
+ will ever leave this class - if the aggregated context notifies an child event, the child passed
+ to the event is wrapped</p>
+
+ @seealso OAccessibleContextWrapper
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleContextWrapperHelper
+ :private OComponentProxyAggregationHelper
+ ,public OAccessibleContextWrapperHelper_Base
+ {
+ protected:
+ /// the context we're wrapping (properly typed, in opposite to OComponentProxyAggregationHelper::m_xInner)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
+ m_xInnerContext;
+ /// the XAccessible which created this context
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xOwningAccessible;
+ /// the XAccessible which is to be returned in getAccessibleParent
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ m_xParentAccessible;
+
+ OWrappedAccessibleChildrenManager* m_pChildMapper; // for mapping children from our inner context to our callers
+
+ protected:
+ /** ctor
+
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessibleContext
+ the object to wrap
+
+ @param _rxOwningAccessible
+ The XAccessible which created this object. This is necessary because children
+ of our wrapped context meed to be wrapped, too, and if they're asked for a parent,
+ they of course should return the proper parent<br/>
+ The object will be held with a hard reference
+
+ @param _rxParentAccessible
+ The XAccessible to return in the getAccessibleParent call
+ */
+ OAccessibleContextWrapperHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ ::cppu::OBroadcastHelper& _rBHelper,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ );
+
+ /// to be called from within your ctor - does the aggregation of a proxy for m_xInnerContext
+ void aggregateProxy(
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ protected:
+ // XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventListener
+ virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent/OComponentProxyAggregationHelper
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ // own overridables
+ /** notify an accessible event which has been translated (if necessary)
+
+ <p>Usually, you derive your clas from both OAccessibleContextWrapperHelper and XAccessibleEventBroadcaster,
+ and simply call all your XAccessibleEventListener with the given event.</p>
+
+ <p>The mutex of the BroadcastHelper passed to the instance's ctor is <em>not</em> locked when calling
+ into this method</p>
+ */
+ virtual void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException) = 0;
+
+ protected:
+ ~OAccessibleContextWrapperHelper( );
+
+ OAccessibleContextWrapperHelper( ); // never implemented
+ OAccessibleContextWrapperHelper( const OAccessibleContextWrapperHelper& ); // never implemented
+ OAccessibleContextWrapperHelper& operator=( const OAccessibleContextWrapperHelper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OAccessibleContextWrapper
+ //=========================================================================
+ typedef ::cppu::PartialWeakComponentImplHelper2< ::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ , ::com::sun::star::accessibility::XAccessibleContext
+ > OAccessibleContextWrapper_CBase;
+
+ class COMPHELPER_DLLPUBLIC OAccessibleContextWrapper
+ :public OBaseMutex
+ ,public OAccessibleContextWrapper_CBase
+ ,public OAccessibleContextWrapperHelper
+ {
+ private:
+ ::comphelper::AccessibleEventNotifier::TClientId m_nNotifierClient; // for notifying AccessibleEvents
+
+ public:
+ /** ctor
+
+ @param _rxContext
+ a service factory
+
+ @param _rxInnerAccessibleContext
+ the object to wrap
+
+ @param _rxOwningAccessible
+ The XAccessible which created this object. This is necessary because children
+ of our wrapped context meed to be wrapped, too, and if they're asked for a parent,
+ they of course should return the proper parent<br/>
+ The object will be held with a hard reference
+
+ @param _rxParentAccessible
+ The XAccessible to return in the getAccessibleParent call
+ */
+ OAccessibleContextWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxInnerAccessibleContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxOwningAccessible,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParentAccessible
+ );
+
+ // XInterface
+ DECLARE_XINTERFACE( )
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // OAccessibleContextWrapper
+ virtual void notifyTranslatedEvent( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+ virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener(xListener); }
+ virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener)throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener(xListener); }
+
+ // OComponentHelper
+ using OAccessibleContextWrapperHelper::disposing;
+ virtual void SAL_CALL disposing() throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~OAccessibleContextWrapper();
+
+ private:
+ COMPHELPER_DLLPRIVATE OAccessibleContextWrapper(); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleContextWrapper( const OAccessibleContextWrapper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OAccessibleContextWrapper& operator=( const OAccessibleContextWrapper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OWrappedAccessibleChildrenManager
+ //=========================================================================
+
+ typedef ::std::map < ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ , ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ , OInterfaceCompare< ::com::sun::star::accessibility::XAccessible >
+ > AccessibleMap;
+ // TODO: think about if we should hold these objects weak
+
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::lang::XEventListener
+ > OWrappedAccessibleChildrenManager_Base;
+ /** manages wrapping XAccessible's to XAccessible's
+ */
+ class COMPHELPER_DLLPUBLIC OWrappedAccessibleChildrenManager : public OWrappedAccessibleChildrenManager_Base
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible >
+ m_aOwningAccessible; // the XAccessible which belongs to the XAccessibleContext which we work for
+ AccessibleMap m_aChildrenMap; // for caching children
+ sal_Bool m_bTransientChildren; // are we prohibited to cache our children?
+
+ public:
+ /// ctor
+ OWrappedAccessibleChildrenManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
+ );
+
+ /** specifies if the children are to be consideren transient (i.e.: not cached)
+ <p>to be called only once per lifetime</p>
+ */
+ void setTransientChildren( sal_Bool _bSet = sal_True );
+
+ /** sets the XAccessible which belongs to the XAccessibleContext which we work for
+ <p>to be called only once per lifetime</p>
+ */
+ void setOwningAccessible( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAcc );
+
+ /// retrieves a wrapper for the given accessible
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ getAccessibleWrapperFor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxKey,
+ sal_Bool _bCreate = sal_True
+ );
+
+ /// erases the given key from the map (if it is present there)
+ void removeFromCache( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxKey );
+
+ /// invalidates (i.e. empties) the map
+ void invalidateAll( );
+
+ /** disposes (i.e. cleares) the manager
+
+ <p>Note that the XAccessibleContext's of the mapped XAccessible objects are disposed, too.</p>
+ */
+ void dispose();
+
+ /** handles a notification as got from the parent of the children we're managing
+ <p>This applies only to the notifications which have a direct impact on our map.</p>
+ */
+ void handleChildNotification( const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent );
+
+ /** translates events as got from the parent of the children we're managing
+ <p>This applies only to the notifications which deal with child objects which we manage.</p>
+ */
+ void translateAccessibleEvent(
+ const ::com::sun::star::accessibility::AccessibleEventObject& _rEvent,
+ ::com::sun::star::accessibility::AccessibleEventObject& _rTranslatedEvent
+ );
+
+ protected:
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ void implTranslateChildEventValue( const ::com::sun::star::uno::Any& _rInValue, ::com::sun::star::uno::Any& _rOutValue );
+
+ protected:
+ ~OWrappedAccessibleChildrenManager( );
+
+ private:
+ COMPHELPER_DLLPRIVATE OWrappedAccessibleChildrenManager( ); // never implemented
+ COMPHELPER_DLLPRIVATE OWrappedAccessibleChildrenManager( const OWrappedAccessibleChildrenManager& ); // never implemented
+ COMPHELPER_DLLPRIVATE OWrappedAccessibleChildrenManager& operator=( const OWrappedAccessibleChildrenManager& ); // never implemented
+ };
+
+//.............................................................................
+} // namespace accessibility
+//.............................................................................
+
+#endif // COMPHELPER_ACCESSIBLE_WRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/accimplaccess.hxx b/include/comphelper/accimplaccess.hxx
new file mode 100644
index 000000000000..3407c5a7b8b4
--- /dev/null
+++ b/include/comphelper/accimplaccess.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ACCIMPLACCESS_HXX
+#define COMPHELPER_ACCIMPLACCESS_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+// forward declaration
+namespace com { namespace sun { namespace star { namespace accessibility {
+ class XAccessible;
+ class XAccessibleContext;
+}}}}
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OAccessibleImplementationAccess
+ //=====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XUnoTunnel
+ > OAccImpl_Base;
+ struct OAccImpl_Impl;
+
+ /** This is a helper class which allows accessing several aspects of the implementation
+ of an AccessibleContext.
+
+ <p>For instance, when you want to implement a context which can be re-parented, you:
+ <ul><li>derive your class from <type>OAccessibleImplementationAccess</type></li>
+ <li>use <code>setAccessibleParent( <em>component</em>, <em>new_parent</em> )</code>
+ </ul>
+ </p>
+
+ <p>Another aspect which can be controlled from the outside are states. If you have a class which
+ has only partial control over it's states, you may consider deriving from OAccessibleImplementationAccess.<br/>
+ For instance, say you have an implementation (say component A) which is <em>unable</em> to know or to
+ determine if the represented object is selected, but another component (say B) which uses A (and integrates
+ it into a tree of accessibility components) is.<br/>
+ In this case, if A is derived from OAccessibleImplementationAccess, B can manipulate this
+ foreign-controlled state flag "SELECTED" by using the static helper methods on this class.</p>
+
+ <p>Please note that the support for foreign controlled states is rather restrictive: You can't have states
+ which <em>may be</em> controlled by a foreign instances. This is implied by the fact that a derived
+ class can ask for states which are <em>set</em> only, not for the ones which are <em>reset</em> currently.
+ </p>
+ */
+ class COMPHELPER_DLLPUBLIC OAccessibleImplementationAccess : public OAccImpl_Base
+ {
+ private:
+ OAccImpl_Impl* m_pImpl;
+
+ protected:
+ /// retrieves the parent previously set via <method>setAccessibleParent</method>
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ implGetForeignControlledParent( ) const;
+
+ /** retrieves the set of currently set states which are controlled by a foreign instance
+ @return
+ a bit mask, where a set bit 2^n means that the AccessibleStateType n has been set
+ */
+ sal_Int64 implGetForeignControlledStates( ) const;
+
+ /// sets the accessible parent component
+ virtual void setAccessibleParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxAccParent );
+
+ /// sets or resets a bit of the foreign controlled states
+ virtual void setStateBit( const sal_Int16 _nState, const sal_Bool _bSet );
+
+ protected:
+ OAccessibleImplementationAccess( );
+ virtual ~OAccessibleImplementationAccess( );
+
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
+
+ public:
+ /** tries to access the implementation of an OAccessibleImplementationAccess derivee which is known as
+ interface only.
+
+ @param _rxComponent
+ is the component which should be examined.
+ @return
+ the pointer to the implementation, if successful. The only known error condition so far
+ is an invalid context (which means it is <NULL/>, or the implementation is not derived
+ from <type>OAccessibleImplementationAccess</type>, or retrieving the implementation failed).
+ */
+ static OAccessibleImplementationAccess* getImplementation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxComponent
+ );
+
+
+ /** sets the parent for a derived implementation
+
+ @param _rxComponent
+ is the component which's new parent should be set
+ @param _rxNewParent
+ is the new parent of the component
+ @return
+ <TRUE/> in case of success, <FALSE/> otherwise. For error condition please look at
+ <method>getImplementation</method>.
+ */
+ static sal_Bool setAccessibleParent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >& _rxComponent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxNewParent
+ );
+
+
+ private:
+ COMPHELPER_DLLPRIVATE static const ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+
+#endif // COMPHELPER_ACCIMPLACCESS_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anycompare.hxx b/include/comphelper/anycompare.hxx
new file mode 100644
index 000000000000..fb17b7ca67ec
--- /dev/null
+++ b/include/comphelper/anycompare.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ANYCOMPARE_HXX
+#define COMPHELPER_ANYCOMPARE_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+
+#include <comphelper/extract.hxx>
+
+#include <functional>
+#include <memory>
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= IKeyPredicateLess
+ //==================================================================================================================
+ class SAL_NO_VTABLE IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const = 0;
+ virtual ~IKeyPredicateLess() {}
+ };
+
+ //==================================================================================================================
+ //= LessPredicateAdapter
+ //==================================================================================================================
+ struct LessPredicateAdapter : public ::std::binary_function< ::com::sun::star::uno::Any, ::com::sun::star::uno::Any, bool >
+ {
+ LessPredicateAdapter( const IKeyPredicateLess& _predicate )
+ :m_predicate( _predicate )
+ {
+ }
+
+ bool operator()( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ return m_predicate.isLess( _lhs, _rhs );
+ }
+
+ private:
+ IKeyPredicateLess const & m_predicate;
+
+ private:
+ LessPredicateAdapter(); // never implemented
+ };
+
+ //==================================================================================================================
+ //= ScalarPredicateLess
+ //==================================================================================================================
+ template< typename SCALAR >
+ class ScalarPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ SCALAR lhs(0), rhs(0);
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+ //==================================================================================================================
+ //= StringPredicateLess
+ //==================================================================================================================
+ class StringPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+ };
+
+ //==================================================================================================================
+ //= StringCollationPredicateLess
+ //==================================================================================================================
+ class StringCollationPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ StringCollationPredicateLess( ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator )
+ :m_collator( i_collator )
+ {
+ }
+
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ OUString lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return m_collator->compareString( lhs, rhs ) < 0;
+ }
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const m_collator;
+ };
+
+ //==================================================================================================================
+ //= TypePredicateLess
+ //==================================================================================================================
+ class TypePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ ::com::sun::star::uno::Type lhs, rhs;
+ if ( !( _lhs >>= lhs )
+ || !( _rhs >>= rhs )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs.getTypeName() < rhs.getTypeName();
+ }
+ };
+
+ //==================================================================================================================
+ //= EnumPredicateLess
+ //==================================================================================================================
+ class EnumPredicateLess : public IKeyPredicateLess
+ {
+ public:
+ EnumPredicateLess( ::com::sun::star::uno::Type const & _enumType )
+ :m_enumType( _enumType )
+ {
+ }
+
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ sal_Int32 lhs(0), rhs(0);
+ if ( !::cppu::enum2int( lhs, _lhs )
+ || !::cppu::enum2int( rhs, _rhs )
+ || !_lhs.getValueType().equals( m_enumType )
+ || !_rhs.getValueType().equals( m_enumType )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return lhs < rhs;
+ }
+
+ private:
+ ::com::sun::star::uno::Type const m_enumType;
+ };
+
+ //==================================================================================================================
+ //= InterfacePredicateLess
+ //==================================================================================================================
+ class InterfacePredicateLess : public IKeyPredicateLess
+ {
+ public:
+ virtual bool isLess( ::com::sun::star::uno::Any const & _lhs, ::com::sun::star::uno::Any const & _rhs ) const
+ {
+ if ( ( _lhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE )
+ || ( _rhs.getValueTypeClass() != ::com::sun::star::uno::TypeClass_INTERFACE )
+ )
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > lhs( _lhs, ::com::sun::star::uno::UNO_QUERY );
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rhs( _rhs, ::com::sun::star::uno::UNO_QUERY );
+ return lhs.get() < rhs.get();
+ }
+ };
+
+ //==================================================================================================================
+ //= getStandardLessPredicate
+ //==================================================================================================================
+ /** creates a default IKeyPredicateLess instance for the given UNO type
+ @param i_type
+ the type for which a predicate instance should be created
+ @param i_collator
+ specifies a collator instance to use, or <NULL/>. If <NULL/>, strings will be compared using the <code>&lt</code>
+ operator, otherwise the collator will be used. The parameter is ignored if <arg>i_type</arg> does not specify
+ the string type.
+ @return
+ a default implementation of IKeyPredicateLess, which is able to compare values of the given type. If no
+ such default implementation is known for the given type, then <NULL/> is returned.
+ */
+ ::std::auto_ptr< IKeyPredicateLess > COMPHELPER_DLLPUBLIC
+ getStandardLessPredicate(
+ ::com::sun::star::uno::Type const & i_type,
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > const & i_collator
+ );
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_ANYCOMPARE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/anytostring.hxx b/include/comphelper/anytostring.hxx
new file mode 100644
index 000000000000..e68779854292
--- /dev/null
+++ b/include/comphelper/anytostring.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_ANYTOSTRING_HXX
+#define INCLUDED_COMPHELPER_ANYTOSTRING_HXX
+
+#include "rtl/ustring.hxx"
+#include "com/sun/star/uno/Any.hxx"
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+/** Creates a STRING representation out of an ANY value.
+
+ @param value
+ ANY value
+ @return
+ STRING representation of given ANY value
+*/
+COMPHELPER_DLLPUBLIC OUString anyToString( ::com::sun::star::uno::Any const & value );
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/asyncnotification.hxx b/include/comphelper/asyncnotification.hxx
new file mode 100644
index 000000000000..19c1910dbc8f
--- /dev/null
+++ b/include/comphelper/asyncnotification.hxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_ASYNCNOTIFICATION_HXX
+#define COMPHELPER_ASYNCNOTIFICATION_HXX
+
+#include "sal/config.h"
+
+#include "boost/scoped_ptr.hpp"
+#include "comphelper/comphelperdllapi.h"
+#include "rtl/ref.hxx"
+#include "sal/types.h"
+#include "salhelper/thread.hxx"
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= AnyEvent
+ //====================================================================
+ /** the very basic instance to hold a description of an event
+ */
+ class COMPHELPER_DLLPUBLIC AnyEvent : ::rtl::IReference
+ {
+ private:
+ oslInterlockedCount m_refCount;
+
+ public:
+ AnyEvent();
+
+ virtual oslInterlockedCount SAL_CALL acquire();
+ virtual oslInterlockedCount SAL_CALL release();
+
+ protected:
+ virtual ~AnyEvent();
+
+ private:
+ AnyEvent( AnyEvent& ); // not defined
+ void operator=( AnyEvent& ); // not defined
+ };
+
+ //====================================================================
+ //= typedefs
+ //====================================================================
+ typedef ::rtl::Reference< AnyEvent > AnyEventRef;
+
+ //====================================================================
+ //= IEventProcessor
+ //====================================================================
+ /** an event processor
+
+ @see AsyncEventNotifier
+ */
+ class SAL_NO_VTABLE IEventProcessor
+ {
+ public:
+ /** process a single event
+ */
+ virtual void processEvent( const AnyEvent& _rEvent ) = 0;
+
+ virtual void SAL_CALL acquire() = 0;
+ virtual void SAL_CALL release() = 0;
+
+ protected:
+ ~IEventProcessor() {}
+ };
+
+ //====================================================================
+ //= AsyncEventNotifier
+ //====================================================================
+ struct EventNotifierImpl;
+
+ /** a helper class for notifying events asynchronously
+
+ If you need to notify certain events to external components, you usually should
+ not do this while you have mutexes locked, to prevent multi-threading issues.
+
+ However, you do not always have complete control over all mutex guards on the stack.
+ If, in such a case, the listener notification is one-way, you can decide to do it
+ asynchronously.
+
+ The ->AsyncEventNotifier helps you to process such events asynchronously. Every
+ event is tied to an ->IEventProcessor which is responsible for processing it.
+
+ The AsyncEventNotifier is implemented as a thread itself, which sleeps as long as there are no
+ events in the queue. As soon as you add an event, the thread is woken up, processes the event,
+ and sleeps again.
+ */
+ class COMPHELPER_DLLPUBLIC AsyncEventNotifier: public salhelper::Thread
+ {
+ friend struct EventNotifierImpl;
+
+ private:
+ boost::scoped_ptr< EventNotifierImpl > m_pImpl;
+
+ SAL_DLLPRIVATE virtual ~AsyncEventNotifier();
+
+ // Thread
+ SAL_DLLPRIVATE virtual void execute();
+
+ public:
+ /** constructs a notifier thread
+
+ @param name the thread name, see ::osl_setThreadName; must not be
+ null
+ */
+ AsyncEventNotifier(char const * name);
+
+ /** terminates the thread
+
+ Note that this is a cooporative termination - if you call this from a thread different
+ from the notification thread itself, then it will block until the notification thread
+ finished processing the current event. If you call it from the notification thread
+ itself, it will return immediately, and the thread will be terminated as soon as
+ the current notification is finished.
+ */
+ virtual void SAL_CALL terminate();
+
+ /** adds an event to the queue, together with the instance which is responsible for
+ processing it
+
+ @param _rEvent
+ the event to add to the queue
+ @param _xProcessor
+ the processor for the event.<br/>
+ Beware of life time issues here. If your event processor dies or becomes otherwise
+ nonfunctional, you are responsible for removing all respective events from the queue.
+ You can do this by calling ->removeEventsForProcessor
+ */
+ void addEvent( const AnyEventRef& _rEvent, const ::rtl::Reference< IEventProcessor >& _xProcessor );
+
+ /** removes all events for the given event processor from the queue
+ */
+ void removeEventsForProcessor( const ::rtl::Reference< IEventProcessor >& _xProcessor );
+ };
+
+ //====================================================================
+ //= EventHolder
+ //====================================================================
+ /** AnyEvent derivee holding an foreign event instance
+ */
+ template < typename EVENT_OBJECT >
+ class EventHolder : public AnyEvent
+ {
+ public:
+ typedef EVENT_OBJECT EventObjectType;
+
+ private:
+ EventObjectType m_aEvent;
+
+ public:
+ inline EventHolder( const EventObjectType& _rEvent )
+ :m_aEvent( _rEvent )
+ {
+ }
+
+ inline const EventObjectType& getEventObject() const { return m_aEvent; }
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_ASYNCNOTIFICATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/attributelist.hxx b/include/comphelper/attributelist.hxx
new file mode 100644
index 000000000000..dd10e13c70ab
--- /dev/null
+++ b/include/comphelper/attributelist.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_ATTRIBUTE_LIST_HXX
+#define _COMPHELPER_ATTRIBUTE_LIST_HXX
+
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+struct AttributeList_Impl;
+
+class COMPHELPER_DLLPUBLIC AttributeList : public ::cppu::WeakImplHelper1
+<
+ ::com::sun::star::xml::sax::XAttributeList
+>
+{
+ AttributeList_Impl *m_pImpl;
+public:
+ AttributeList();
+ virtual ~AttributeList();
+
+ // methods that are not contained in any interface
+ void AddAttribute( const OUString &sName , const OUString &sType , const OUString &sValue );
+
+ // ::com::sun::star::xml::sax::XAttributeList
+ virtual sal_Int16 SAL_CALL getLength(void)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getNameByIndex(sal_Int16 i)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getTypeByIndex(sal_Int16 i)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getTypeByName(const OUString& aName)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getValueByIndex(sal_Int16 i)
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual OUString SAL_CALL getValueByName(const OUString& aName)
+ throw( ::com::sun::star::uno::RuntimeException );
+
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_ATTRIBUTE_LIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/basicio.hxx b/include/comphelper/basicio.hxx
new file mode 100644
index 000000000000..42eea8076e47
--- /dev/null
+++ b/include/comphelper/basicio.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_BASIC_IO_HXX_
+#define _COMPHELPER_BASIC_IO_HXX_
+
+#include <com/sun/star/io/XPersistObject.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+namespace stario = ::com::sun::star::io;
+namespace staruno = ::com::sun::star::uno;
+namespace starawt = ::com::sun::star::awt;
+
+// sal_Bool
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Bool& _rVal);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Bool _bVal);
+
+// OUString
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, OUString& _rStr);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const OUString& _rStr);
+
+// sal_Int16
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int16& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int16 _nValue);
+
+// sal_uInt16
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt16& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt16 _nValue);
+
+// sal_uInt32
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_uInt32& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_uInt32 _nValue);
+
+// sal_Int16
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32& _rValue);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, sal_Int32 _nValue);
+
+// FontDescriptor
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& InStream, starawt::FontDescriptor& rVal);
+COMPHELPER_DLLPUBLIC const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& OutStream, const starawt::FontDescriptor& rVal);
+
+// sequences
+template <class ELEMENT>
+const staruno::Reference<stario::XObjectInputStream>& operator >> (const staruno::Reference<stario::XObjectInputStream>& _rxInStream, staruno::Sequence<ELEMENT>& _rSeq)
+{
+ sal_Int32 nLen = _rxInStream->readLong();
+ _rSeq.realloc(nLen);
+ if (nLen)
+ {
+ ELEMENT* pElement = _rSeq.getArray();
+ for (sal_Int32 i=0; i<nLen; ++i, ++pElement)
+ _rxInStream >> *pElement;
+ }
+ return _rxInStream;
+}
+
+template <class ELEMENT>
+const staruno::Reference<stario::XObjectOutputStream>& operator << (const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream, const staruno::Sequence<ELEMENT>& _rSeq)
+{
+ sal_Int32 nLen = _rSeq.getLength();
+ _rxOutStream->writeLong(nLen);
+ if (nLen)
+ {
+ const ELEMENT* pElement = _rSeq.getConstArray();
+ for (sal_Int32 i = 0; i < nLen; ++i, ++pElement)
+ _rxOutStream << *pElement;
+ }
+ return _rxOutStream;
+}
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_BASIC_IO_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/broadcasthelper.hxx b/include/comphelper/broadcasthelper.hxx
new file mode 100644
index 000000000000..d8cf69eeb17b
--- /dev/null
+++ b/include/comphelper/broadcasthelper.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
+#define _COMPHELPER_BROADCASTHELPER_HXX_
+
+#include <osl/mutex.hxx>
+#include <cppuhelper/interfacecontainer.h>
+
+//... namespace comphelper .......................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //==================================================================================
+ //= OMutexAndBroadcastHelper - a class which holds a Mutex and a OBroadcastHelper;
+ //= needed because when deriving from OPropertySetHelper,
+ //= the OBroadcastHelper has to be initialized before
+ //= the OPropertySetHelper
+ //==================================================================================
+ class OMutexAndBroadcastHelper
+ {
+ protected:
+ ::osl::Mutex m_aMutex;
+ ::cppu::OBroadcastHelper m_aBHelper;
+
+ public:
+ OMutexAndBroadcastHelper() : m_aBHelper( m_aMutex ) { }
+
+ ::osl::Mutex& GetMutex() { return m_aMutex; }
+ ::cppu::OBroadcastHelper& GetBroadcastHelper() { return m_aBHelper; }
+ const ::cppu::OBroadcastHelper& GetBroadcastHelper() const { return m_aBHelper; }
+
+ };
+
+ // base class for all classes who are derived from OPropertySet and from OComponent
+ // @deprecated, you should use cppu::BaseMutex instead (cppuhelper/basemutex.hxx)
+
+ class OBaseMutex
+ {
+ protected:
+ mutable ::osl::Mutex m_aMutex;
+ };
+}
+#endif // _COMPHELPER_BROADCASTHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/classids.hxx b/include/comphelper/classids.hxx
new file mode 100644
index 000000000000..39ab6095802e
--- /dev/null
+++ b/include/comphelper/classids.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_CLASSIDS_HXX
+#define _COMPHELPER_CLASSIDS_HXX
+
+/*
+ * StarWriter
+ */
+
+/* 3.0 */
+
+#define SO3_SW_CLASSID_30 \
+ 0xDC5C7E40L, 0xB35C, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SW_CLASSID_40 \
+ 0x8b04e9b0, 0x420e, 0x11d0, 0xa4, 0x5e, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SW_CLASSID_50 \
+ 0xc20cf9d1, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+ /* 6.0, 7, 8 */
+
+#define SO3_SW_CLASSID_60 \
+ 0x8BC6B165, 0xB1B2, 0x4EDD, 0xAA, 0x47, 0xDA, \
+ 0xE2, 0xEE, 0x68, 0x9D, 0xD6
+
+ /* ole embed 6.0, 7 */
+
+#define SO3_SW_OLE_EMBED_CLASSID_60 \
+ 0x30a2652a, 0xddf7, 0x45e7, 0xac, 0xa6, 0x3e, \
+ 0xab, 0x26, 0xfc, 0x8a, 0x4e
+
+ /* ole embed 8 */
+
+#define SO3_SW_OLE_EMBED_CLASSID_8 \
+ 0xf616b81f, 0x7bb8, 0x4f22, 0xb8, 0xa5, 0x47, \
+ 0x42, 0x8d, 0x59, 0xf8, 0xad
+
+/* aktuell */
+
+#define SO3_SW_CLASSID SO3_SW_CLASSID_60
+
+/*
+ * StarWriter/Web
+ */
+
+/* 4.0 */
+
+#define SO3_SWWEB_CLASSID_40 \
+ 0xf0caa840, 0x7821, 0x11d0, 0xa4, 0xa7, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SWWEB_CLASSID_50 \
+ 0xc20cf9d2, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+/* 6.0, 7, 8 */
+
+#define SO3_SWWEB_CLASSID_60 \
+ 0xA8BBA60C, 0x7C60, 0x4550, 0x91, 0xCE, 0x39, \
+ 0xC3, 0x90, 0x3F, 0xAC, 0x5E
+
+/* aktuell */
+
+#define SO3_SWWEB_CLASSID SO3_SWWEB_CLASSID_60
+
+/*
+ * Globaldokument
+ */
+
+/* 4.0 */
+
+#define SO3_SWGLOB_CLASSID_40 \
+ 0x340ac970, 0xe30d, 0x11d0, 0xa5, 0x3f, 0x0, \
+ 0xa0, 0x24, 0x9d, 0x57, 0xb1
+
+/* 5.0 */
+
+#define SO3_SWGLOB_CLASSID_50 \
+ 0xc20cf9d3, 0x85ae, 0x11d1, 0xaa, 0xb4, 0x0, \
+ 0x60, 0x97, 0xda, 0x56, 0x1a
+
+/* 6.0, 7, 8 */
+
+#define SO3_SWGLOB_CLASSID_60 \
+ 0xB21A0A7C, 0xE403, 0x41FE, 0x95, 0x62, 0xBD, \
+ 0x13, 0xEA, 0x6F, 0x15, 0xA0
+
+/* aktuell */
+
+#define SO3_SWGLOB_CLASSID SO3_SWGLOB_CLASSID_60
+
+//---------------------------------------------------
+
+/*
+ * StarCalc
+ */
+
+/* 3.0 */
+
+#define SO3_SC_CLASSID_30 \
+ 0x3F543FA0L, 0xB6A6, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SC_CLASSID_40 \
+ 0x6361d441L, 0x4235, 0x11d0, 0x89, 0xcb, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SC_CLASSID_50 \
+ 0xc6a5b861L, 0x85d6, 0x11d1, 0x89, 0xcb, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SC_CLASSID_60 \
+ 0x47BBB4CB, 0xCE4C, 0x4E80, 0xA5, 0x91, 0x42, \
+ 0xD9, 0xAE, 0x74, 0x95, 0x0F
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SC_OLE_EMBED_CLASSID_60 \
+ 0x7b342dc4, 0x139a, 0x4a46, 0x8a, 0x93, 0xdb, \
+ 0x8, 0x27, 0xcc, 0xee, 0x9c
+
+/* ole embed 8 */
+
+#define SO3_SC_OLE_EMBED_CLASSID_8 \
+ 0x7fa8ae11, 0xb3e3, 0x4d88, 0xaa, 0xbf, 0x25, \
+ 0x55, 0x26, 0xcd, 0x1c, 0xe8
+
+/* aktuell */
+
+#define SO3_SC_CLASSID SO3_SC_CLASSID_60
+
+/****************************************************
+* StarImpress
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SIMPRESS_CLASSID_30 \
+ 0xAF10AAE0L, 0xB36D, 0x101B, 0x99, 0x61, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SIMPRESS_CLASSID_40 \
+ 0x12d3cc0L, 0x4216, 0x11d0, 0x89, 0xcb, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SIMPRESS_CLASSID_50 \
+ 0x565c7221L, 0x85bc, 0x11d1, 0x89, 0xd0, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SIMPRESS_CLASSID_60 \
+ 0x9176E48A, 0x637A, 0x4D1F, 0x80, 0x3B, 0x99, \
+ 0xD9, 0xBF, 0xAC, 0x10, 0x47
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SIMPRESS_OLE_EMBED_CLASSID_60 \
+ 0xe5a0b632, 0xdfba, 0x4549, 0x93, 0x46, 0xe4, \
+ 0x14, 0xda, 0x6, 0xe6, 0xf8
+
+/* ole embed 8 */
+
+#define SO3_SIMPRESS_OLE_EMBED_CLASSID_8 \
+ 0xee5d1ea4, 0xd445, 0x4289, 0xb2, 0xfc, 0x55, \
+ 0xfc, 0x93, 0x69, 0x39, 0x17
+
+/* aktuell */
+
+#define SO3_SIMPRESS_CLASSID SO3_SIMPRESS_CLASSID_60
+
+/****************************************************
+* StarDraw
+****************************************************/
+
+/* 5.0 */
+
+#define SO3_SDRAW_CLASSID_50 \
+ 0x2e8905a0L, 0x85bd, 0x11d1, 0x89, 0xd0, 0x0, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+#define SO3_SDRAW_CLASSID_60 \
+ 0x4BAB8970, 0x8A3B, 0x45B3, 0x99, 0x1C, 0xCB, \
+ 0xEE, 0xAC, 0x6B, 0xD5, 0xE3
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SDRAW_OLE_EMBED_CLASSID_60 \
+ 0x41662fc2, 0xd57, 0x4aff, 0xab, 0x27, 0xad, \
+ 0x2e, 0x12, 0xe7, 0xc2, 0x73
+
+/* ole embed 8 */
+
+#define SO3_SDRAW_OLE_EMBED_CLASSID_8 \
+ 0x448bb771, 0xcfe2, 0x47c4, 0xbc, 0xdf, 0x1f, \
+ 0xbf, 0x37, 0x8e, 0x20, 0x2c
+
+/* aktuell */
+
+#define SO3_SDRAW_CLASSID SO3_SDRAW_CLASSID_60
+
+/****************************************************
+* StarChart
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SCH_CLASSID_30 \
+ 0xFB9C99E0L, 0x2C6D, 0x101C, 0x8E, 0x2C, 0x00, \
+ 0x00, 0x1B, 0x4C, 0xC7, 0x11
+
+/* 4.0 */
+
+#define SO3_SCH_CLASSID_40 \
+ 0x2b3b7e0L, 0x4225, 0x11d0, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SCH_CLASSID_50 \
+ 0xbf884321L, 0x85dd, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0 */
+
+#define SO3_SCH_CLASSID_60 \
+ 0x12DCAE26, 0x281F, 0x416F, 0xA2, 0x34, 0xC3, \
+ 0x08, 0x61, 0x27, 0x38, 0x2E
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SCH_OLE_EMBED_CLASSID_60 \
+ 0xd415cd93, 0x35c4, 0x4c6f, 0x81, 0x9d, 0xa6, \
+ 0x64, 0xa1, 0xc8, 0x13, 0xae
+
+/* ole embed 8 */
+
+#define SO3_SCH_OLE_EMBED_CLASSID_8 \
+ 0xdd0a57f, 0xcf3b, 0x4fd2, 0xbd, 0xa4, 0x94, \
+ 0x42, 0x71, 0x9b, 0x2a, 0x73
+
+/* aktuell */
+
+#define SO3_SCH_CLASSID SO3_SCH_CLASSID_60
+
+/****************************************************
+* StarImage
+****************************************************/
+
+/* 3.0 */
+
+#define SO3_SIM_CLASSID_30 \
+ 0xEA60C941L, 0x2C6C, 0x101C, 0x8E, 0x2C, 0x00, \
+ 0x00, 0x1B, 0x4C, 0xC7, 0x11
+
+/* 4.0 */
+
+#define SO3_SIM_CLASSID_40 \
+ 0x447BB8A0L, 0x41FB, 0x11D0, 0x89, 0xCA, 0x00, \
+ 0x80, 0x29, 0xE4, 0xB0, 0xB1
+
+/* 5.0 */
+
+#define SO3_SIM_CLASSID_50 \
+ 0x65c68d00L, 0x85de, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* aktuell */
+
+#define SO3_SIM_CLASSID SO3_SIM_CLASSID_50
+
+/***************************************************
+* StarMath
+***************************************************/
+
+/* 3.0 */
+
+#define SO3_SM_CLASSID_30 \
+ 0xD4590460L, 0x35FD, 0x101C, 0xB1, 0x2A, 0x04, \
+ 0x02, 0x1C, 0x00, 0x70, 0x02
+
+/* 4.0 */
+
+#define SO3_SM_CLASSID_40 \
+ 0x2b3b7e1L, 0x4225, 0x11d0, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 5.0 */
+
+#define SO3_SM_CLASSID_50 \
+ 0xffb5e640L, 0x85de, 0x11d1, 0x89, 0xd0, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+/* 6.0, 7, 8 */
+
+#define SO3_SM_CLASSID_60 \
+ 0x078B7ABA, 0x54FC, 0x457F, 0x85, 0x51, 0x61, \
+ 0x47, 0xE7, 0x76, 0xA9, 0x97
+
+/* ole embed 6.0, 7 */
+
+#define SO3_SM_OLE_EMBED_CLASSID_60 \
+ 0xd0484de6, 0xaaee, 0x468a, 0x99, 0x1f, 0x8d, \
+ 0x4b, 0x7, 0x37, 0xb5, 0x7a
+
+/* ole embed 8 */
+
+#define SO3_SM_OLE_EMBED_CLASSID_8 \
+ 0xd2d59cd1, 0xa6a, 0x4d36, 0xae, 0x20, 0x47, \
+ 0x81, 0x70, 0x77, 0xd5, 0x7c
+
+/* aktuell */
+
+#define SO3_SM_CLASSID SO3_SM_CLASSID_60
+
+#define SO3_OUT_CLASSID \
+ 0x970b1e82, 0xcf2d, 0x11cf, 0x89, 0xca, 0x00, \
+ 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+#define SO3_DUMMY_CLASSID \
+ 0x970b1fff, 0xcf2d, 0x11cf, \
+ 0x89,0xca,0x00,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_APPLET_CLASSID \
+ 0x970b1e81, 0xcf2d, 0x11cf, \
+ 0x89,0xca,0x00,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_PLUGIN_CLASSID \
+ 0x4caa7761, 0x6b8b, 0x11cf, \
+ 0x89,0xca,0x0,0x80,0x29,0xe4,0xb0,0xb1
+
+#define SO3_IFRAME_CLASSID \
+ 0x1a8a6701, 0xde58, 0x11cf, \
+ 0x89, 0xca, 0x0, 0x80, 0x29, 0xe4, 0xb0, 0xb1
+
+#define SO3_GLOBAL_CLASSID \
+ 0x475198a8, 0x694c, 0x4bd8, \
+ 0xb0, 0x2f, 0xd9, 0xb7, 0x6b, 0xcf, 0x31, 0x28
+
+#define SO3_RPT_CLASSID_90 \
+ 0xd7896d52, 0xb7af, 0x4820, \
+ 0x9d, 0xfe, 0xd4, 0x04, 0xd0, 0x15, 0x96, 0x0f
+
+#define SO3_RPT_SCH_CLASSID_90 \
+ 0x80243d39, 0x6741, 0x46c5, \
+ 0x92, 0x6e, 0x06, 0x91, 0x64, 0xff, 0x87, 0xbb
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/comphelperdllapi.h b/include/comphelper/comphelperdllapi.h
new file mode 100644
index 000000000000..88d35f61c359
--- /dev/null
+++ b/include/comphelper/comphelperdllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPERDLLAPI_H
+#define INCLUDED_COMPHELPERDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(COMPHELPER_DLLIMPLEMENTATION)
+#define COMPHELPER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define COMPHELPER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define COMPHELPER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_COMPHELPERDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentbase.hxx b/include/comphelper/componentbase.hxx
new file mode 100644
index 000000000000..b4035a60f77b
--- /dev/null
+++ b/include/comphelper/componentbase.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_COMPONENTBASE_HXX
+#define COMPHELPER_COMPONENTBASE_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include <cppuhelper/interfacecontainer.hxx>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= ComponentBase
+ //====================================================================
+ class COMPHELPER_DLLPUBLIC ComponentBase
+ {
+ protected:
+ /** creates a ComponentBase instance
+
+ The instance is not initialized. As a consequence, every ComponentMethodGuard instantiated for
+ this component will throw a <type scope="com::sun::star::lang">NotInitializedException</type>,
+ until ->setInitialized() is called.
+ */
+ ComponentBase( ::cppu::OBroadcastHelper& _rBHelper )
+ :m_rBHelper( _rBHelper )
+ ,m_bInitialized( false )
+ {
+ }
+
+ struct NoInitializationNeeded { };
+
+ /** creates a ComponentBase instance
+
+ The instance is already initialized, so there's no need to call setInitialized later on. Use this
+ constructor for component implementations which do not require explicit initialization.
+ */
+ ComponentBase( ::cppu::OBroadcastHelper& _rBHelper, NoInitializationNeeded )
+ :m_rBHelper( _rBHelper )
+ ,m_bInitialized( true )
+ {
+ }
+
+ ~ComponentBase() {}
+
+ /** marks the instance as initialized
+
+ Subsequent instantiations of a ComponentMethodGuard won't throw the NotInitializedException now.
+ */
+ inline void setInitialized() { m_bInitialized = true; }
+
+ public:
+ /// helper struct to grant access to selected public methods to the ComponentMethodGuard class
+ struct GuardAccess { friend class ComponentMethodGuard; private: GuardAccess() { } };
+
+ /// retrieves the component's mutex
+ inline ::osl::Mutex& getMutex( GuardAccess ) { return getMutex(); }
+ /// checks whether the component is already disposed, throws a DisposedException if so.
+ inline void checkDisposed( GuardAccess ) const { impl_checkDisposed_throw(); }
+ /// checks whether the component is already initialized, throws a NotInitializedException if not.
+ inline void checkInitialized( GuardAccess ) const { impl_checkInitialized_throw(); }
+
+ protected:
+ /// retrieves the component's broadcast helper
+ inline ::cppu::OBroadcastHelper& getBroadcastHelper() { return m_rBHelper; }
+ /// retrieves the component's mutex
+ inline ::osl::Mutex& getMutex() { return m_rBHelper.rMutex; }
+ /// determines whether the instance is already disposed
+ inline bool impl_isDisposed() const { return m_rBHelper.bDisposed; }
+
+ /// checks whether the component is already disposed. Throws a DisposedException if so.
+ void impl_checkDisposed_throw() const;
+
+ /// checks whether the component is already initialized. Throws a NotInitializedException if not.
+ void impl_checkInitialized_throw() const;
+
+ /// determines whether the component is already initialized
+ inline bool
+ impl_isInitialized_nothrow() const { return m_bInitialized; }
+
+ /** returns the context to be used when throwing exceptions
+
+ The default implementation returns <NULL/>.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ getComponent() const;
+
+ private:
+ ::cppu::OBroadcastHelper& m_rBHelper;
+ bool m_bInitialized;
+ };
+
+ class ComponentMethodGuard
+ {
+ public:
+ enum MethodType
+ {
+ /// allow the method to be called only when being initialized and not being disposed
+ Default,
+ /// allow the method to be called without being initialized
+ WithoutInit
+
+ };
+
+ ComponentMethodGuard( ComponentBase& _rComponent, const MethodType _eType = Default )
+ :m_aMutexGuard( _rComponent.getMutex( ComponentBase::GuardAccess() ) )
+ {
+ if ( _eType != WithoutInit )
+ _rComponent.checkInitialized( ComponentBase::GuardAccess() );
+ _rComponent.checkDisposed( ComponentBase::GuardAccess() );
+ }
+
+ ~ComponentMethodGuard()
+ {
+ }
+
+ inline void clear()
+ {
+ m_aMutexGuard.clear();
+ }
+ inline void reset()
+ {
+ m_aMutexGuard.reset();
+ }
+
+ private:
+ ::osl::ResettableMutexGuard m_aMutexGuard;
+ };
+
+//........................................................................
+} // namespace ComponentBase
+//........................................................................
+
+#endif // COMPHELPER_COMPONENTBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentcontext.hxx b/include/comphelper/componentcontext.hxx
new file mode 100644
index 000000000000..d6461502be54
--- /dev/null
+++ b/include/comphelper/componentcontext.hxx
@@ -0,0 +1,243 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_COMPONENTCONTEXT_HXX
+#define COMPHELPER_COMPONENTCONTEXT_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= ComponentContext
+ //====================================================================
+ /** a helper class for working with a component context
+ */
+ class COMPHELPER_DLLPUBLIC ComponentContext
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xORB;
+
+ public:
+ /** constructs an instance
+ @param _rxContext
+ the component context to manage
+ @throws ::com::sun::star::lang::NullPointerException
+ if the given context, or its component factory, are <NULL/>
+ */
+ ComponentContext( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
+
+ /** constructs an instance
+ @param _rxLegacyFactory
+ the legacy service factor to obtain the <type scope="com::sun::star::uno">XComponentContext</type> from
+ @throws ::com::sun::star::uno::RuntimeException
+ if the given factory or does not have a DefaultContext property to obtain
+ a component context
+ @throws ::com::sun::star::lang::NullPointerException
+ if the given factory is <NULL/>, or provides a component context being <NULL/>, or provides
+ a component context whose component factory is <NULL/>
+ */
+ ComponentContext( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxLegacyFactory );
+
+ /** returns the ->XComponentContext interface
+ */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ getUNOContext() const { return m_xContext; }
+
+ /** determines whether the context is not <NULL/>
+ */
+ inline sal_Bool is() const
+ {
+ return m_xContext.is();
+ }
+
+ /** creates a component using our component factory/context
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponent( const OUString& _rServiceName, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ _out_rxComponent.clear();
+ _out_rxComponent = _out_rxComponent.query(
+ m_xORB->createInstanceWithContext( _rServiceName, m_xContext )
+ );
+ return _out_rxComponent.is();
+ }
+
+ /** creates a component using our component factory/context
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponent( const sal_Char* _pAsciiServiceName, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ return createComponent( OUString::createFromAscii( _pAsciiServiceName ), _out_rxComponent );
+ }
+
+ /** creates a component using our component factory/context, passing creation arguments
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponentWithArguments( const OUString& _rServiceName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ _out_rxComponent.clear();
+ _out_rxComponent = _out_rxComponent.query(
+ m_xORB->createInstanceWithArgumentsAndContext( _rServiceName, _rArguments, m_xContext )
+ );
+ return _out_rxComponent.is();
+ }
+
+ /** creates a component using our component factory/context, passing creation arguments
+ @throws ::com::sun::star::uno::Exception
+ @return
+ <TRUE/> if and only if the component could be successfully created
+ */
+ template < typename INTERFACE >
+ bool createComponentWithArguments( const sal_Char* _pAsciiServiceName, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments, ::com::sun::star::uno::Reference< INTERFACE >& _out_rxComponent ) const
+ {
+ return createComponentWithArguments( OUString::createFromAscii( _pAsciiServiceName ), _rArguments, _out_rxComponent );
+ }
+
+ /** creates a component using our component factory/context
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponent( const OUString& _rServiceName ) const;
+
+ /** creates a component using our component factory/context
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponent( const sal_Char* _pAsciiServiceName ) const
+ {
+ return createComponent( OUString::createFromAscii( _pAsciiServiceName ) );
+ }
+
+ /** creates a component using our component factory/context, passing creation arguments
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponentWithArguments(
+ const OUString& _rServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments
+ ) const;
+
+ /** creates a component using our component factory/context, passing creation arguments
+
+ @throws ::com::sun::star::lang::ServiceNotRegisteredException
+ if the given service is not registered
+ @throws Exception
+ if an exception occurred during creating the component
+ @return
+ the newly created component. Is never <NULL/>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createComponentWithArguments(
+ const sal_Char* _pAsciiServiceName,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments
+ ) const
+ {
+ return createComponentWithArguments( OUString::createFromAscii( _pAsciiServiceName ), _rArguments );
+ }
+
+ /** retrieves a singleton instance from the context
+
+ Singletons are collected below the <code>/singletons</code> key in a component context,
+ so accessing them means retrieving the value under <code>/singletons/&lt;instance_name&gt;</code>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getSingleton( const OUString& _rInstanceName ) const;
+
+ /** retrieves a singleton instance from the context
+
+ Singletons are collected below the <code>/singletons</code> key in a component context,
+ so accessing them means retrieving the value under <code>/singletons/&lt;instance_name&gt;</code>.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getSingleton( const sal_Char* _pAsciiInstanceName ) const
+ {
+ return getSingleton( OUString::createFromAscii( _pAsciiInstanceName ) );
+ }
+
+ /** returns the ->XMultiServiceFactory interface of ->m_xORB, for passing to
+ older code which does not yet support ->XMultiComponentFactory
+ @throws ::com::sun::star::uno::RuntimeException
+ if our our component factory does not support this interface
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ getLegacyServiceFactory() const;
+
+ /** retrieves a value from our component context
+ @param _rName
+ the name of the value to retrieve
+ @return
+ the context value with the given name
+ @seealso XComponentContext::getValueByName
+ @seealso getContextValueByAsciiName
+ */
+ ::com::sun::star::uno::Any
+ getContextValueByName( const OUString& _rName ) const;
+
+ /** retrieves a value from our component context, specified by 8-bit ASCII string
+ @param _rName
+ the name of the value to retrieve, as ASCII character string
+ @return
+ the context value with the given name
+ @seealso XComponentContext::getValueByName
+ @seealso getContextValueByName
+ */
+ inline ::com::sun::star::uno::Any
+ getContextValueByAsciiName( const sal_Char* _pAsciiName ) const
+ {
+ return getContextValueByName( OUString::createFromAscii( _pAsciiName ) );
+ }
+
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_COMPONENTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentguard.hxx b/include/comphelper/componentguard.hxx
new file mode 100644
index 000000000000..eb1cfbcc24a8
--- /dev/null
+++ b/include/comphelper/componentguard.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_COMPONENTGUARD_HXX
+#define COMPHELPER_COMPONENTGUARD_HXX
+
+#include <com/sun/star/lang/DisposedException.hpp>
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= ComponentGuard
+ //==================================================================================================================
+ class ComponentGuard
+ {
+ public:
+ ComponentGuard( ::cppu::OWeakObject& i_component, ::cppu::OBroadcastHelper & i_broadcastHelper )
+ :m_aGuard( i_broadcastHelper.rMutex )
+ {
+ if ( i_broadcastHelper.bDisposed )
+ throw ::com::sun::star::lang::DisposedException( OUString(), &i_component );
+ }
+
+ ~ComponentGuard()
+ {
+ }
+
+ void clear() { m_aGuard.clear(); }
+ void reset() { m_aGuard.reset(); }
+
+ private:
+ ::osl::ResettableMutexGuard m_aGuard;
+ };
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_COMPONENTGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/componentmodule.hxx b/include/comphelper/componentmodule.hxx
new file mode 100644
index 000000000000..9ce8a137ede2
--- /dev/null
+++ b/include/comphelper/componentmodule.hxx
@@ -0,0 +1,261 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
+#define COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppuhelper/factory.hxx>
+
+#include <osl/mutex.hxx>
+
+#include <rtl/string.hxx>
+#include <rtl/instance.hxx>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ /** factory factory declaration
+ */
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleComponentFactory > (SAL_CALL *FactoryInstantiation)
+ (
+ ::cppu::ComponentFactoryFunc _pFactoryFunc,
+ OUString const& _rComponentName,
+ ::com::sun::star::uno::Sequence< OUString > const & _rServiceNames,
+ rtl_ModuleCount*
+ ) SAL_THROW(());
+
+ //=========================================================================
+ //= ComponentDescription
+ //=========================================================================
+ struct COMPHELPER_DLLPUBLIC ComponentDescription
+ {
+ /// the implementation name of the component
+ OUString sImplementationName;
+ /// the services supported by the component implementation
+ ::com::sun::star::uno::Sequence< OUString > aSupportedServices;
+ /** the name under which the component implementation should be registered as singleton,
+ or empty if the component does not implement a singleton.
+ */
+ OUString sSingletonName;
+ /// the function to create an instance of the component
+ ::cppu::ComponentFactoryFunc pComponentCreationFunc;
+ /// the function to create a factory for the component (usually <code>::cppu::createSingleComponentFactory</code>)
+ FactoryInstantiation pFactoryCreationFunc;
+
+ ComponentDescription()
+ :sImplementationName()
+ ,aSupportedServices()
+ ,sSingletonName()
+ ,pComponentCreationFunc( NULL )
+ ,pFactoryCreationFunc( NULL )
+ {
+ }
+
+ ComponentDescription(
+ const OUString& _rImplementationName,
+ const ::com::sun::star::uno::Sequence< OUString >& _rSupportedServices,
+ const OUString& _rSingletonName,
+ ::cppu::ComponentFactoryFunc _pComponentCreationFunc,
+ FactoryInstantiation _pFactoryCreationFunc
+ )
+ :sImplementationName( _rImplementationName )
+ ,aSupportedServices( _rSupportedServices )
+ ,sSingletonName( _rSingletonName )
+ ,pComponentCreationFunc( _pComponentCreationFunc )
+ ,pFactoryCreationFunc( _pFactoryCreationFunc )
+ {
+ }
+ };
+
+ //=========================================================================
+ //= OModule
+ //=========================================================================
+ class OModuleImpl;
+ class COMPHELPER_DLLPUBLIC OModule
+ {
+ private:
+ oslInterlockedCount m_nClients; /// number of registered clients
+ OModuleImpl* m_pImpl; /// impl class. lives as long as at least one client for the module is registered
+
+ protected:
+ mutable ::osl::Mutex m_aMutex; /// access safety
+
+ public:
+ OModule();
+
+ virtual ~OModule();
+
+ /** register a component implementing a service with the given data.
+ @param _rImplementationName
+ the implementation name of the component
+ @param _rServiceNames
+ the services the component supports
+ @param _pCreateFunction
+ a function for creating an instance of the component
+ @param _pFactoryFunction
+ a function for creating a factory for that component
+ */
+ void registerImplementation(
+ const OUString& _rImplementationName,
+ const ::com::sun::star::uno::Sequence< OUString >& _rServiceNames,
+ ::cppu::ComponentFactoryFunc _pCreateFunction,
+ FactoryInstantiation _pFactoryFunction = ::cppu::createSingleComponentFactory );
+
+ /** registers a component given by <type>ComponentDescription</type>
+ */
+ void registerImplementation( const ComponentDescription& _rComp );
+
+ /** creates a Factory for the component with the given implementation name.
+ <p>Usually used from within component_getFactory.<p/>
+ @param _pImplementationName
+ the implementation name of the component
+ @return
+ the XInterface access to a factory for the component
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getComponentFactory(
+ const OUString& _rImplementationName );
+
+ /** version of getComponentFactory which directly takes the char argument you got in your component_getFactory call
+ */
+ void* getComponentFactory( const sal_Char* _pImplementationName );
+
+ public:
+ class ClientAccess { friend class OModuleClient; private: ClientAccess() { } };
+ /// register a client for the module
+ void registerClient( ClientAccess );
+ /// revoke a client for the module
+ void revokeClient( ClientAccess );
+
+ protected:
+ /** called when the first client has been registered
+ @precond
+ <member>m_aMutex</member> is locked
+ */
+ virtual void onFirstClient();
+
+ /** called when the last client has been revoked
+ @precond
+ <member>m_aMutex</member> is locked
+ */
+ virtual void onLastClient();
+
+ private:
+ OModule( const OModule& ); // never implemented
+ OModule& operator=( const OModule& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OModuleClient
+ //=========================================================================
+ /** base class for objects which uses any global module-specific resources
+ */
+ class COMPHELPER_DLLPUBLIC OModuleClient
+ {
+ protected:
+ OModule& m_rModule;
+
+ public:
+ OModuleClient( OModule& _rModule ) :m_rModule( _rModule ) { m_rModule.registerClient( OModule::ClientAccess() ); }
+ ~OModuleClient() { m_rModule.revokeClient( OModule::ClientAccess() ); }
+ };
+
+ //==========================================================================
+ //= OAutoRegistration
+ //==========================================================================
+ template <class TYPE>
+ class OAutoRegistration
+ {
+ public:
+ /** automatically provides all component information to an OModule instance
+ <p>Assumed that the template argument has the three methods
+ <ul>
+ <li><code>static OUString getImplementationName_static()</code><li/>
+ <li><code>static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static()</code><li/>
+ <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code>
+ </li>
+ <ul/>
+ the instantiation of this object will automatically register the class via <member>OModule::registerImplementation</member>.
+ <p/>
+ The factory creation function used is <code>::cppu::createSingleComponentFactory</code>.
+ */
+ OAutoRegistration( OModule& _rModule );
+ };
+
+ template <class TYPE>
+ OAutoRegistration<TYPE>::OAutoRegistration( OModule& _rModule )
+ {
+ _rModule.registerImplementation(
+ TYPE::getImplementationName_static(),
+ TYPE::getSupportedServiceNames_static(),
+ TYPE::Create
+ );
+ }
+
+ //==========================================================================
+ //= OSingletonRegistration
+ //==========================================================================
+ template <class TYPE>
+ class OSingletonRegistration
+ {
+ public:
+ /** automatically provides all component information to an OModule instance,
+ for a singleton component
+
+ <p>Assumed that the template argument has the three methods
+ <ul>
+ <li><code>static OUString getImplementationName_static()</code><li/>
+ <li><code>static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_static()</code><li/>
+ <li><code>static OUString getSingletonName_static()</code></li>
+ <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code>
+ </li>
+ <ul/>
+ the instantiation of this object will automatically register the class via <member>OModule::registerImplementation</member>.
+ </p>
+ */
+ OSingletonRegistration( OModule& _rModule );
+ };
+
+ template <class TYPE>
+ //--------------------------------------------------------------------------
+ OSingletonRegistration<TYPE>::OSingletonRegistration( OModule& _rModule )
+ {
+ _rModule.registerImplementation( ComponentDescription(
+ TYPE::getImplementationName_static(),
+ TYPE::getSupportedServiceNames_static(),
+ TYPE::getSingletonName_static(),
+ &TYPE::Create,
+ &::cppu::createSingleComponentFactory
+ ) );
+ }
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_INC_COMPHELPER_COMPONENTMODULE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx
new file mode 100644
index 000000000000..8eecc7facd91
--- /dev/null
+++ b/include/comphelper/configuration.hxx
@@ -0,0 +1,331 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_CONFIGURATION_HXX
+#define INCLUDED_COMPHELPER_CONFIGURATION_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "boost/optional.hpp"
+#include "boost/shared_ptr.hpp"
+#include "com/sun/star/uno/Any.hxx"
+#include "com/sun/star/uno/Reference.hxx"
+#include "comphelper/comphelperdllapi.h"
+#include "comphelper/processfactory.hxx"
+#include "sal/types.h"
+
+namespace com { namespace sun { namespace star {
+ namespace configuration { class XReadWriteAccess; }
+ namespace container {
+ class XHierarchicalNameAccess;
+ class XHierarchicalNameReplace;
+ class XNameAccess;
+ class XNameContainer;
+ }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+
+namespace detail { class ConfigurationWrapper; }
+
+/// A batch of configuration changes that is committed as a whole.
+///
+/// Client code needs to call commit explicitly; otherwise the changes are lost
+/// when the instance is destroyed.
+///
+/// This is the only class from this header file that client code should use
+/// directly.
+class COMPHELPER_DLLPUBLIC ConfigurationChanges: private boost::noncopyable {
+public:
+ static boost::shared_ptr< ConfigurationChanges > create(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext());
+
+ ~ConfigurationChanges();
+
+ void commit() const;
+
+private:
+ SAL_DLLPRIVATE ConfigurationChanges(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE void setPropertyValue(
+ OUString const & path, com::sun::star::uno::Any const & value)
+ const;
+
+ SAL_DLLPRIVATE com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameReplace >
+ getGroup(OUString const & path) const;
+
+ SAL_DLLPRIVATE
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >
+ getSet(OUString const & path) const;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::configuration::XReadWriteAccess > access_;
+
+ friend class detail::ConfigurationWrapper;
+};
+
+namespace detail {
+
+/// @internal
+class COMPHELPER_DLLPUBLIC ConfigurationWrapper: private boost::noncopyable {
+public:
+ static ConfigurationWrapper const & get(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE explicit ConfigurationWrapper(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context);
+
+ SAL_DLLPRIVATE ~ConfigurationWrapper();
+
+ com::sun::star::uno::Any getPropertyValue(OUString const & path) const;
+
+ void setPropertyValue(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path, com::sun::star::uno::Any const & value)
+ const;
+
+ com::sun::star::uno::Any getLocalizedPropertyValue(
+ OUString const & path) const;
+
+ void setLocalizedPropertyValue(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path, com::sun::star::uno::Any const & value)
+ const;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameAccess >
+ getGroupReadOnly(OUString const & path) const;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameReplace >
+ getGroupReadWrite(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path) const;
+
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
+ getSetReadOnly(OUString const & path) const;
+
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >
+ getSetReadWrite(
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ OUString const & path) const;
+
+ boost::shared_ptr< ConfigurationChanges > createChanges() const;
+
+private:
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ context_;
+
+ com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameAccess > access_;
+};
+
+/// @internal
+template< typename T > struct Convert: private boost::noncopyable {
+ static com::sun::star::uno::Any toAny(T const & value)
+ { return com::sun::star::uno::makeAny(value); }
+
+ static T fromAny(com::sun::star::uno::Any const & value)
+ { return value.get< T >(); }
+
+private:
+ Convert(); // not defined
+ ~Convert(); // not defined
+};
+
+/// @internal
+template< typename T > struct Convert< boost::optional< T > >:
+ private boost::noncopyable
+{
+ static com::sun::star::uno::Any toAny(boost::optional< T > const & value) {
+ return value
+ ? com::sun::star::uno::makeAny(value.get())
+ : com::sun::star::uno::Any();
+ }
+
+ static boost::optional< T > fromAny(com::sun::star::uno::Any const & value)
+ {
+ return value.hasValue()
+ ? boost::optional< T >(value.get< T >()) : boost::optional< T >();
+ }
+
+private:
+ Convert(); // not defined
+ ~Convert(); // not defined
+};
+
+}
+
+/// A type-safe wrapper around a (non-localized) configuration property.
+///
+/// Automatically generated headers for the various configuration properties
+/// derive from this template and make available its member functions to access
+/// each given configuration property.
+template< typename T, typename U > struct ConfigurationProperty:
+ private boost::noncopyable
+{
+ /// Get the value of the given (non-localized) configuration property.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static U get(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ // Folding this into one statement causes a bogus error at least with
+ // Red Hat GCC 4.6.2-1:
+ com::sun::star::uno::Any a(
+ detail::ConfigurationWrapper::get(context).getPropertyValue(
+ T::path()));
+ return detail::Convert< U >::fromAny(a);
+ }
+
+ /// Set the value of the given (non-localized) configuration property, via a
+ /// given changes batch.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static void set(
+ U const & value,
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ detail::ConfigurationWrapper::get(context).setPropertyValue(
+ batch, T::path(), detail::Convert< U >::toAny(value));
+ }
+
+private:
+ ConfigurationProperty(); // not defined
+ ~ConfigurationProperty(); // not defined
+};
+
+/// A type-safe wrapper around a localized configuration property.
+///
+/// Automatically generated headers for the various localized configuration
+/// properties derive from this template and make available its member functions
+/// to access each given localized configuration property.
+template< typename T, typename U > struct ConfigurationLocalizedProperty:
+ private boost::noncopyable
+{
+ /// Get the value of the given localized configuration property, for the
+ /// locale currently set at the
+ /// com.sun.star.configuration.theDefaultProvider.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static U get(
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ // Folding this into one statement causes a bogus error at least with
+ // Red Hat GCC 4.6.2-1:
+ com::sun::star::uno::Any a(
+ detail::ConfigurationWrapper::get(context).
+ getLocalizedPropertyValue(T::path()));
+ return detail::Convert< U >::fromAny(a);
+ }
+
+ /// Set the value of the given localized configuration property, for the
+ /// locale currently set at the
+ /// com.sun.star.configuration.theDefaultProvider, via a given changes
+ /// batch.
+ ///
+ /// For nillable properties, U is of type boost::optional<U'>.
+ static void set(
+ U const & value,
+ boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ detail::ConfigurationWrapper::get(context).setLocalizedPropertyValue(
+ batch, T::path(), detail::Convert< U >::toAny(value));
+ }
+
+private:
+ ConfigurationLocalizedProperty(); // not defined
+ ~ConfigurationLocalizedProperty(); // not defined
+};
+
+/// A type-safe wrapper around a configuration group.
+///
+/// Automatically generated headers for the various configuration groups derive
+/// from this template and make available its member functions to access each
+/// given configuration group.
+template< typename T > struct ConfigurationGroup: private boost::noncopyable {
+ /// Get read-only access to the given configuration group.
+ static com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameAccess >
+ get(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getGroupReadOnly(
+ T::path());
+ }
+
+ /// Get read/write access to the given configuration group, storing any
+ /// modifications via the given changes batch.
+ static com::sun::star::uno::Reference<
+ com::sun::star::container::XHierarchicalNameReplace >
+ get(boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getGroupReadWrite(
+ batch, T::path());
+ }
+
+private:
+ ConfigurationGroup(); // not defined
+ ~ConfigurationGroup(); // not defined
+};
+
+/// A type-safe wrapper around a configuration set.
+///
+/// Automatically generated headers for the various configuration sets derive
+/// from this template and make available its member functions to access each
+/// given configuration set.
+template< typename T > struct ConfigurationSet: private boost::noncopyable {
+ /// Get read-only access to the given configuration set.
+ static
+ com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >
+ get(com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getSetReadOnly(
+ T::path());
+ }
+
+ /// Get read/write access to the given configuration set, storing any
+ /// modifications via the given changes batch.
+ static
+ com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >
+ get(boost::shared_ptr< ConfigurationChanges > const & batch,
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ const & context = comphelper::getProcessComponentContext())
+ {
+ return detail::ConfigurationWrapper::get(context).getSetReadWrite(
+ batch, T::path());
+ }
+
+private:
+ ConfigurationSet(); // not defined
+ ~ConfigurationSet(); // not defined
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/configurationhelper.hxx b/include/comphelper/configurationhelper.hxx
new file mode 100644
index 000000000000..b267e4c0c564
--- /dev/null
+++ b/include/comphelper/configurationhelper.hxx
@@ -0,0 +1,240 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
+#define _COMPHELPER_CONFIGURATIONHELPER_HXX_
+
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
+#include <comphelper/sequenceasvector.hxx>
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//_______________________________________________
+// namespaces
+
+namespace comphelper{
+
+
+//-----------------------------------------------
+class COMPHELPER_DLLPUBLIC ConfigurationHelper
+{
+ public:
+
+ //-----------------------------------------------
+ /** specify all possible modes, which can be used to open a configuration access.
+ *
+ * @see openConfig()
+ * @see readDirectKey()
+ * @see writeDirectKey()
+ */
+ enum EConfigurationModes
+ {
+ /// opens configuration in read/write mode (without LAZY writing!)
+ E_STANDARD = 0,
+ /// configuration will be opened readonly
+ E_READONLY = 1,
+ /// all localized nodes will be interpreted as XInterface instead of interpreting it as atomic value nodes
+ E_ALL_LOCALES = 2,
+ /// enable lazy writing
+ E_LAZY_WRITE = 4
+ };
+
+ //-----------------------------------------------
+ /** returns access to the specified configuration package.
+ *
+ * This method should be used, if e.g. more then one request to the same
+ * configuration package is needed. The configuration access can be cached
+ * outside and used inbetween.
+ *
+ * @param rxContext
+ * the uno service manager, which should be used to create the
+ * configuration access.
+ *
+ * @param sPackage
+ * the name of the configuration package.
+ * e.g. <ul>
+ * <li>org.openoffice.Office.Common</li>
+ * <li>org.openoffice.Office.Common/Menu</li>
+ * </ul>
+ *
+ * @param eMode
+ * specify the open mode for the returned configuration access.
+ * It's interpreted as a flag field and can be any useful combination
+ * of values of EConfigurationModes.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the configuration could not be opened.
+ */
+ static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ sal_Int32 eMode );
+
+ //-----------------------------------------------
+ /** reads the value of an existing(!) configuration key,
+ * which is searched relative to the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relativ to this access point.
+ *
+ * @param xCFG
+ * the configuration root, where sRelPath should be interpreted.
+ * as relativ path
+ *
+ * @param sRelPath
+ * path relative to xCFG parameter.
+ *
+ * @param sKey
+ * the configuration node, where we should read the value.
+ *
+ * @return [css.uno.Any]
+ * the value of sKey.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::container::NoSuchElementException if the specified
+ * key does not exists.
+ */
+ static css::uno::Any readRelativeKey(const css::uno::Reference< css::uno::XInterface > xCFG ,
+ const OUString& sRelPath,
+ const OUString& sKey );
+
+ //-----------------------------------------------
+ /** writes a new value for an existing(!) configuration key,
+ * which is searched relative to the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relativ to this access point.
+ *
+ * @param xCFG
+ * the configuration root, where sRelPath should be interpreted.
+ * as relativ path
+ *
+ * @param sRelPath
+ * path relative to xCFG parameter.
+ *
+ * @param sKey
+ * the configuration node, where we should write the new value.
+ *
+ * @param aValue
+ * the new value for sKey.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::container::NoSuchElementException if the specified
+ * key does not exists or css::uno::Exception if the provided configuration
+ * access does not allow writing for this key.
+ */
+ static void writeRelativeKey(const css::uno::Reference< css::uno::XInterface > xCFG ,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ const css::uno::Any& aValue );
+
+ //-----------------------------------------------
+ /** it checks if the specified set node exists ... or create an empty one
+ * otherwise.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here ... and
+ * all operations are made relativ to this access point.
+ *
+ * Further this method must be used only with configuration set's.
+ * Atomic keys can't be "created" ... they "exists everytimes".
+ *
+ * @param xCFG
+ * the configuration root, where sRelPathToSet should be interpreted
+ * as relativ path.
+ *
+ * @param sRelPathToSet
+ * path relative to xCFG parameter.
+ *
+ * @param sSetNode
+ * the set node, which should be checked if its exists ...
+ * or which should be created with default values.
+ *
+ * @return A reference to the found (or new created) set node.
+ * Cant be NULL .. in such case an exception occure !
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the provided configuration
+ * access does not allow writing for this set.
+ */
+ static css::uno::Reference< css::uno::XInterface > makeSureSetNodeExists(const css::uno::Reference< css::uno::XInterface > xCFG ,
+ const OUString& sRelPathToSet,
+ const OUString& sSetNode );
+
+ //-----------------------------------------------
+ /** commit all changes made on the specified configuration access.
+ *
+ * This method must be used in combination with openConfig().
+ * The cached configuration access must be provided here.
+ *
+ * @param xCFG
+ * the configuration root, where changes should be commited.
+ *
+ * @throw Any exceptions the underlying configuration can throw.
+ * E.g. css::uno::Exception if the provided configuration
+ * access does not allow writing for this set.
+ */
+ static void flush(const css::uno::Reference< css::uno::XInterface >& xCFG);
+
+ //-----------------------------------------------
+ /** does the same then openConfig() & readRelativeKey() together.
+ *
+ * This method should be used for reading one key at one code place only.
+ * Because it opens the specified configuration package, reads the key and
+ * closes the configuration again.
+ *
+ * So its not very useful to use this method for reading multiple keys at the same time.
+ * (Excepting these keys exists inside different configuration packages ...))
+ */
+ static css::uno::Any readDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ sal_Int32 eMode );
+
+ //-----------------------------------------------
+ /** does the same then openConfig() / writeRelativeKey() & flush() together.
+ *
+ * This method should be used for writing one key at one code place only.
+ * Because it opens the specified configuration package, writes the key, flush
+ * all changes and closes the configuration again.
+ *
+ * So its not very useful to use this method for writing multiple keys at the same time.
+ * (Excepting these keys exists inside different configuration packages ...))
+ */
+ static void writeDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const OUString& sPackage,
+ const OUString& sRelPath,
+ const OUString& sKey ,
+ const css::uno::Any& aValue ,
+ sal_Int32 eMode );
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_CONFIGURATIONHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/container.hxx b/include/comphelper/container.hxx
new file mode 100644
index 000000000000..d6c5be927873
--- /dev/null
+++ b/include/comphelper/container.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CONTAINER_HXX_
+#define _COMPHELPER_CONTAINER_HXX_
+
+#include <vector>
+#include "com/sun/star/uno/Reference.hxx"
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//========================================================================
+//= IndexAccessIterator
+//========================================================================
+/** an iterator that iterates through all elements, starting from an XIndexAccess (pre-order)
+*/
+class COMPHELPER_DLLPUBLIC IndexAccessIterator
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xStartingPoint;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xCurrentObject;
+ // The current object
+ ::std::vector<sal_Int32> m_arrChildIndizies;
+
+ // I'm moving through a tree, but its elements have no GetNextSibling,
+ // so I have to remember where each child is in relation to its parent.
+ // That is the path from the root node to m_xCurrentObject
+
+ OUString m_ustrProperty;
+ // The Name of the requested property
+
+public:
+ IndexAccessIterator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xStartingPoint);
+
+ virtual ~IndexAccessIterator();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> Next();
+
+ virtual void Invalidate() { m_xCurrentObject = NULL; }
+
+protected:
+ virtual sal_Bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& /*rElement*/) { return sal_True; }
+
+ // This can be used to exclude certain elements; elements for which
+ // this function returns sal_True will be simply skipped.
+ // If this element is returned from Next(), then one can get
+ // here get a little more information on the element.
+ // That's why this method is not const.
+ virtual sal_Bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& /*xContainer*/) const { return sal_True; }
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_CONTAINER_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/containermultiplexer.hxx b/include/comphelper/containermultiplexer.hxx
new file mode 100644
index 000000000000..725265e493c6
--- /dev/null
+++ b/include/comphelper/containermultiplexer.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
+#define _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
+
+#include <com/sun/star/container/XContainer.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/mutex.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ class OContainerListenerAdapter;
+ //=====================================================================
+ //= OContainerListener
+ //=====================================================================
+ /** a non-UNO container listener
+ <p>Useful if you have a non-refcountable class which should act as container listener.<br/>
+ In this case, derive this class from OContainerListener, and create an adapter
+ <type>OContainerListenerAdapter</type> which multiplexes the changes.</p>
+ */
+ class COMPHELPER_DLLPUBLIC OContainerListener
+ {
+ friend class OContainerListenerAdapter;
+ protected:
+ OContainerListenerAdapter* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OContainerListener(::osl::Mutex& _rMutex);
+ virtual ~OContainerListener();
+
+ virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _Event ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ void setAdapter(OContainerListenerAdapter* _pAdapter);
+ };
+
+ //=====================================================================
+ //= OContainerListenerAdapter
+ //=====================================================================
+ class COMPHELPER_DLLPUBLIC OContainerListenerAdapter
+ :public cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener >
+ {
+ friend class OContainerListener;
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >
+ m_xContainer;
+ OContainerListener* m_pListener;
+ sal_Int32 m_nLockCount;
+
+ virtual ~OContainerListenerAdapter();
+
+ public:
+ OContainerListenerAdapter(OContainerListener* _pListener,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _rxContainer);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // XContainerListener
+ virtual void SAL_CALL elementInserted( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementRemoved( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL elementReplaced( const ::com::sun::star::container::ContainerEvent& Event ) throw(::com::sun::star::uno::RuntimeException);
+
+ // locking the multiplexer
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ /// dispose the object. No multiplexing anymore
+ void dispose();
+
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >&
+ getContainer() const { return m_xContainer; }
+ };
+
+//.........................................................................
+} // namespace dbaui
+//.........................................................................
+
+#endif // _COMPHELPER_CONTAINERMULTIPLEXER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx
new file mode 100644
index 000000000000..24fd868c0735
--- /dev/null
+++ b/include/comphelper/docpasswordhelper.hxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_DOCPASSWORDHELPR_HXX
+#define COMPHELPER_DOCPASSWORDHELPR_HXX
+
+#include <com/sun/star/beans/NamedValue.hpp>
+#include "comphelper/comphelperdllapi.h"
+#include <vector>
+#include "comphelper/docpasswordrequest.hxx"
+
+namespace com { namespace sun { namespace star { namespace task { class XInteractionHandler; } } } }
+namespace com { namespace sun { namespace star { namespace beans { struct PropertyValue; } } } }
+
+namespace comphelper {
+
+class MediaDescriptor;
+
+// ============================================================================
+
+enum DocPasswordVerifierResult
+{
+ DocPasswordVerifierResult_OK,
+ DocPasswordVerifierResult_WRONG_PASSWORD,
+ DocPasswordVerifierResult_ABORT
+};
+
+// ============================================================================
+
+/** Base class for a password verifier used by the DocPasswordHelper class
+ below.
+
+ Users have to implement the virtual functions and pass an instance of the
+ verifier to one of the password request functions.
+ */
+class COMPHELPER_DLLPUBLIC IDocPasswordVerifier
+{
+public:
+ virtual ~IDocPasswordVerifier();
+
+ /** Will be called everytime a password needs to be verified.
+
+ @param rPassword
+ The password to be verified
+
+ @param o_rEncryptionData
+ Output parameter, that is filled with the EncryptionData generated
+ from the password. The data is filled only if the validation was
+ successful.
+
+ @return The result of the verification.
+ - DocPasswordVerifierResult_OK, if and only if the passed password
+ is valid and can be used to process the related document.
+ - DocPasswordVerifierResult_WRONG_PASSWORD, if the password is
+ wrong. The user may be asked again for a new password.
+ - DocPasswordVerifierResult_ABORT, if an unrecoverable error
+ occurred while password verification. The password request loop
+ will be aborted.
+ */
+ virtual DocPasswordVerifierResult verifyPassword( const OUString& rPassword, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0;
+
+ /** Will be called everytime an encryption data needs to be verified.
+
+ @param rEncryptionData
+ The data will be validated
+
+ @return The result of the verification.
+ - DocPasswordVerifierResult_OK, if and only if the passed encryption data
+ is valid and can be used to process the related document.
+ - DocPasswordVerifierResult_WRONG_PASSWORD, if the encryption data is
+ wrong.
+ - DocPasswordVerifierResult_ABORT, if an unrecoverable error
+ occured while data verification. The password request loop
+ will be aborted.
+ */
+ virtual DocPasswordVerifierResult verifyEncryptionData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& o_rEncryptionData ) = 0;
+
+};
+
+// ============================================================================
+
+/** Helper that asks for a document password and checks its validity.
+ */
+class COMPHELPER_DLLPUBLIC DocPasswordHelper
+{
+public:
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the information related
+ to "Password to modify" provided by user. The result
+ sequence contains the hash and the algorithm-related
+ info.
+
+ @param aString
+ The string for which the info should be generated
+
+ @return
+ The sequence containing the hash and the algorithm-related info
+ */
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ GenerateNewModifyPasswordInfo( const OUString& aPassword );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function allows to check whether
+ the "Password to modify" provided by user is the correct one.
+
+ @param aString
+ The string containing the provided password
+
+ @param aInfo
+ The sequence containing the hash and the algorithm-info
+
+ @return
+ <TRUE/> if the password is correct one
+ <FALSE/> otherwise
+ */
+
+ static sal_Bool IsModifyPasswordCorrect(
+ const OUString& aPassword,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aInfo );
+
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" feature of Word.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @return
+ The hash represented by sal_uInt32
+ */
+
+ static sal_uInt32 GetWordHashAsUINT32(
+ const OUString& aString );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection of Excel.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sal_uInt16
+ */
+
+ static sal_uInt16 GetXLHashAsUINT16(
+ const OUString& aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates the hash code based on the algorithm
+ specified by MS for "Password to modify" and passwords related to
+ table protection.
+
+ @param aString
+ The string for which the hash should be calculated
+
+ @param nEnc
+ The encoding that should be used to generate the 8-bit string
+ before the hash is generated
+
+ @return
+ The hash represented by sequence of bytes in BigEndian form
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetXLHashAsSequence(
+ const OUString& aString,
+ rtl_TextEncoding nEnc = RTL_TEXTENCODING_UTF8 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates a random sequence of bytes of
+ requested length.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateRandomByteSequence(
+ sal_Int32 nLength );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const OUString& aPassword,
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const sal_uInt16 pPassData[16],
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function tries to request and verify a password to load a
+ protected document.
+
+ First, the list of default passwords will be tried if provided. This is
+ needed by import filters for external file formats that have to check a
+ predefined password in some cases without asking the user for a
+ password. Every password is checked using the passed password verifier.
+
+ If not successful, the passed password of a medium is tried, that has
+ been set e.g. by an API call to load a document. If existing, the
+ password is checked using the passed password verifier.
+
+ If still not successful, the passed interaction handler is used to
+ request a password from the user. This will be repeated until the
+ passed password verifier validates the entered password, or if the user
+ chooses to cancel password input.
+
+ @param rVerifier
+ The password verifier used to check every processed password.
+
+ @param rMediaPassword
+ If not empty, will be passed to the password validator before
+ requesting a password from the user. This password usually should
+ be querried from a media descriptor.
+
+ @param rxInteractHandler
+ The interaction handler that will be used to request a password
+ from the user, e.g. by showing a password input dialog.
+
+ @param rDocumentName
+ The name of the related document that will be shown in the password
+ input dialog.
+
+ @param eRequestType
+ The password request type that will be passed to the
+ DocPasswordRequest object created internally. See
+ docpasswordrequest.hxx for more details.
+
+ @param pDefaultPasswords
+ If not null, contains default passwords that will be tried before a
+ password will be requested from the media descriptor or the user.
+
+ @param pbIsDefaultPassword
+ (output parameter) If not null, the type of the found password will
+ be returned. True means the password has been found in the passed
+ list of default passwords. False means the password has been taken
+ from the rMediaPassword parameter or has been entered by the user.
+
+ @return
+ If not empty, contains the password that has been validated by the
+ passed password verifier. If empty, no valid password has been
+ found, or the user has chossen to cancel password input.
+ */
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword(
+ IDocPasswordVerifier& rVerifier,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rMediaEncData,
+ const OUString& rMediaPassword,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::task::XInteractionHandler >& rxInteractHandler,
+ const OUString& rDocumentName,
+ DocPasswordRequestType eRequestType,
+ const ::std::vector< OUString >* pDefaultPasswords = 0,
+ bool* pbIsDefaultPassword = 0 );
+
+ // ------------------------------------------------------------------------
+
+ /** This helper function tries to find a password for the document
+ described by the passed media descriptor.
+
+ First, the list of default passwords will be tried if provided. This is
+ needed by import filters for external file formats that have to check a
+ predefined password in some cases without asking the user for a
+ password. Every password is checked using the passed password verifier.
+
+ If not successful, the passed media descriptor is asked for a password,
+ that has been set e.g. by an API call to load a document. If existing,
+ the password is checked using the passed password verifier.
+
+ If still not successful, the interaction handler contained in the
+ passed nmedia descriptor is used to request a password from the user.
+ This will be repeated until the passed password verifier validates the
+ entered password, or if the user chooses to cancel password input.
+
+ @param rVerifier
+ The password verifier used to check every processed password.
+
+ @param rMediaDesc
+ The media descriptor of the document that needs to be opened with
+ a password. If a valid password (that is not contained in the
+ passed list of default passwords) was found, it will be inserted
+ into the "Password" property of this descriptor.
+
+ @param eRequestType
+ The password request type that will be passed to the
+ DocPasswordRequest object created internally. See
+ docpasswordrequest.hxx for more details.
+
+ @param pDefaultPasswords
+ If not null, contains default passwords that will be tried before a
+ password will be requested from the media descriptor or the user.
+
+ @return
+ If not empty, contains the password that has been validated by the
+ passed password verifier. If empty, no valid password has been
+ found, or the user has chossen to cancel password input.
+ */
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > requestAndVerifyDocPassword(
+ IDocPasswordVerifier& rVerifier,
+ MediaDescriptor& rMediaDesc,
+ DocPasswordRequestType eRequestType,
+ const ::std::vector< OUString >* pDefaultPasswords = 0 );
+
+ // ------------------------------------------------------------------------
+
+private:
+ ~DocPasswordHelper();
+};
+
+// ============================================================================
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/docpasswordrequest.hxx b/include/comphelper/docpasswordrequest.hxx
new file mode 100644
index 000000000000..54a32f522ae6
--- /dev/null
+++ b/include/comphelper/docpasswordrequest.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_DOCPASSWORDREQUEST_HXX
+#define COMPHELPER_DOCPASSWORDREQUEST_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include <com/sun/star/task/PasswordRequestMode.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/weak.hxx>
+
+
+namespace comphelper {
+
+class AbortContinuation;
+class PasswordContinuation;
+
+// ============================================================================
+
+/** Selects which UNO document password request type to use. */
+enum DocPasswordRequestType
+{
+ DocPasswordRequestType_STANDARD, /// Uses the standard com.sun.star.task.DocumentPasswordRequest request.
+ DocPasswordRequestType_MS /// Uses the com.sun.star.task.DocumentMSPasswordRequest request.
+};
+
+// ============================================================================
+
+class COMPHELPER_DLLPUBLIC SimplePasswordRequest :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
+{
+public:
+ explicit SimplePasswordRequest( com::sun::star::task::PasswordRequestMode eMode );
+ virtual ~SimplePasswordRequest();
+
+ // XInterface / OWeakObject
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ sal_Bool isPassword() const;
+
+ OUString getPassword() const;
+
+private:
+ // XInteractionRequest
+ virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Any maRequest;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
+ AbortContinuation * mpAbort;
+ PasswordContinuation * mpPassword;
+};
+
+// ============================================================================
+
+/** Implements the task.XInteractionRequest interface for requesting a password
+ string for a document.
+ */
+class COMPHELPER_DLLPUBLIC DocPasswordRequest :
+ public ::com::sun::star::task::XInteractionRequest,
+ public ::cppu::OWeakObject
+{
+public:
+ explicit DocPasswordRequest(
+ DocPasswordRequestType eType,
+ ::com::sun::star::task::PasswordRequestMode eMode,
+ const OUString& rDocumentName,
+ sal_Bool bPasswordToModify = sal_False );
+ virtual ~DocPasswordRequest();
+
+ // XInterface / OWeakObject
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ sal_Bool isPassword() const;
+
+ OUString getPassword() const;
+
+ OUString getPasswordToModify() const;
+ sal_Bool getRecommendReadOnly() const;
+
+private:
+ // XInteractionRequest
+ virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Any maRequest;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > maContinuations;
+ AbortContinuation * mpAbort;
+ PasswordContinuation * mpPassword;
+};
+
+// ============================================================================
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/documentconstants.hxx b/include/comphelper/documentconstants.hxx
new file mode 100644
index 000000000000..2bc00220995f
--- /dev/null
+++ b/include/comphelper/documentconstants.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_DOCUMENTCONSTANTS_HXX
+#define _COMPHELPER_DOCUMENTCONSTANTS_HXX
+
+#include <rtl/ustring.hxx>
+
+// formats of SO6/7
+#define MIMETYPE_VND_SUN_XML_WRITER_ASCII "application/vnd.sun.xml.writer"
+#define MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII "application/vnd.sun.xml.writer.web"
+#define MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII "application/vnd.sun.xml.writer.global"
+#define MIMETYPE_VND_SUN_XML_DRAW_ASCII "application/vnd.sun.xml.draw"
+#define MIMETYPE_VND_SUN_XML_IMPRESS_ASCII "application/vnd.sun.xml.impress"
+#define MIMETYPE_VND_SUN_XML_CALC_ASCII "application/vnd.sun.xml.calc"
+#define MIMETYPE_VND_SUN_XML_CHART_ASCII "application/vnd.sun.xml.chart"
+#define MIMETYPE_VND_SUN_XML_MATH_ASCII "application/vnd.sun.xml.math"
+#define MIMETYPE_VND_SUN_XML_BASE_ASCII "application/vnd.sun.xml.base"
+
+#define MIMETYPE_VND_SUN_XML_WRITER OUString( MIMETYPE_VND_SUN_XML_WRITER_ASCII )
+#define MIMETYPE_VND_SUN_XML_WRITER_WEB OUString( MIMETYPE_VND_SUN_XML_WRITER_WEB_ASCII )
+#define MIMETYPE_VND_SUN_XML_WRITER_GLOBAL OUString( MIMETYPE_VND_SUN_XML_WRITER_GLOBAL_ASCII )
+#define MIMETYPE_VND_SUN_XML_DRAW OUString( MIMETYPE_VND_SUN_XML_DRAW_ASCII )
+#define MIMETYPE_VND_SUN_XML_IMPRESS OUString( MIMETYPE_VND_SUN_XML_IMPRESS_ASCII )
+#define MIMETYPE_VND_SUN_XML_CALC OUString( MIMETYPE_VND_SUN_XML_CALC_ASCII )
+#define MIMETYPE_VND_SUN_XML_CHART OUString( MIMETYPE_VND_SUN_XML_CHART_ASCII )
+#define MIMETYPE_VND_SUN_XML_MATH OUString( MIMETYPE_VND_SUN_XML_MATH_ASCII )
+#define MIMETYPE_VND_SUN_XML_BASE OUString( MIMETYPE_VND_SUN_XML_BASE_ASCII )
+
+// template formats of SO6/7
+#define MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE_ASCII "application/vnd.sun.xml.writer.template"
+#define MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE_ASCII "application/vnd.sun.xml.draw.template"
+#define MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE_ASCII "application/vnd.sun.xml.impress.template"
+#define MIMETYPE_VND_SUN_XML_CALC_TEMPLATE_ASCII "application/vnd.sun.xml.calc.template"
+
+#define MIMETYPE_VND_SUN_XML_WRITER_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_WRITER_ASCII )
+#define MIMETYPE_VND_SUN_XML_DRAW_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_DRAW_ASCII )
+#define MIMETYPE_VND_SUN_XML_IMPRESS_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_IMPRESS_ASCII )
+#define MIMETYPE_VND_SUN_XML_CALC_TEMPLATE OUString( MIMETYPE_VND_SUN_XML_CALC_ASCII )
+
+// formats of SO8
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII "application/vnd.oasis.opendocument.text"
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII "application/vnd.oasis.opendocument.text-web"
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII "application/vnd.oasis.opendocument.text-master"
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII "application/vnd.oasis.opendocument.graphics"
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII "application/vnd.oasis.opendocument.presentation"
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII "application/vnd.oasis.opendocument.spreadsheet"
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII "application/vnd.oasis.opendocument.chart"
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII "application/vnd.oasis.opendocument.formula"
+#define MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII "application/vnd.oasis.opendocument.base"
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII "application/vnd.sun.xml.report"
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII "application/vnd.sun.xml.report.chart"
+
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_WEB_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_GLOBAL_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING OUString( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION OUString( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET OUString( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART OUString( MIMETYPE_OASIS_OPENDOCUMENT_CHART_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA OUString( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_DATABASE OUString( MIMETYPE_OASIS_OPENDOCUMENT_DATABASE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT OUString( MIMETYPE_OASIS_OPENDOCUMENT_REPORT_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART OUString( MIMETYPE_OASIS_OPENDOCUMENT_REPORT_CHART_ASCII )
+
+// template formats of SO8
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII "application/vnd.oasis.opendocument.text-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII "application/vnd.oasis.opendocument.graphics-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII "application/vnd.oasis.opendocument.presentation-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII "application/vnd.oasis.opendocument.spreadsheet-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII "application/vnd.oasis.opendocument.chart-template"
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII "application/vnd.oasis.opendocument.formula-template"
+
+#define MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_TEXT_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_DRAWING_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_SPREADSHEET_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_CHART_TEMPLATE_ASCII )
+#define MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE OUString( MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_TEMPLATE_ASCII )
+
+// ODF versions
+#define ODFVER_010_TEXT_ASCII "1.0"
+#define ODFVER_011_TEXT_ASCII "1.1"
+#define ODFVER_012_TEXT_ASCII "1.2"
+
+#define ODFVER_010_TEXT OUString( ODFVER_010_TEXT_ASCII )
+#define ODFVER_011_TEXT OUString( ODFVER_011_TEXT_ASCII )
+#define ODFVER_012_TEXT OUString( ODFVER_012_TEXT_ASCII )
+#endif
+
+// filter flags
+// TODO/LATER: The flags should be part of the UNO specification
+
+// Note that these flag bits have parallel names in
+// filter/source/config/cache/constant.hxx. Some of the bits are
+// missing from there, and some have different names. But the meaning
+// is presumably the same, and the values are the same.
+
+// http://www.mail-archive.com/dev@openoffice.org/msg05047.html says:
+
+// I can just sum up what comes into my mind, hope I don't miss one:
+
+// Import - should be self explaining
+// Export - should be self explaining
+// Template - deprecated
+// TemplatePath - filter for a documenttemplate
+// Own - one of the OOo file formats
+// Alien - no zip container based format
+// Preferred - preferred filter for a particular type
+// Asynchron - deprecated, only HTML-filter isn't synchron
+// 3rdPartyFilter - implemented as a UNO component
+// Default - default filter for this document type
+// NotInFileDialog - should be self explaining
+// NotInChooser - as above
+
+// (The 3rdPartyFilter flag is here called StarONE)
+
+// At some point (4.0?) we should drop the duplicate set of names over
+// in filter, and rename the obscure ones to describe their meaning
+// using terms that are understandable.
+
+#define SFX_FILTER_IMPORT 0x00000001L
+#define SFX_FILTER_EXPORT 0x00000002L
+#define SFX_FILTER_TEMPLATE 0x00000004L
+#define SFX_FILTER_INTERNAL 0x00000008L
+#define SFX_FILTER_TEMPLATEPATH 0x00000010L
+#define SFX_FILTER_OWN 0x00000020L
+#define SFX_FILTER_ALIEN 0x00000040L
+#define SFX_FILTER_USESOPTIONS 0x00000080L
+
+#define SFX_FILTER_DEFAULT 0x00000100L
+#define SFX_FILTER_EXECUTABLE 0x00000200L
+#define SFX_FILTER_SUPPORTSSELECTION 0x00000400L
+#define SFX_FILTER_MAPTOAPPPLUG 0x00000800L
+#define SFX_FILTER_NOTINFILEDLG 0x00001000L
+#define SFX_FILTER_NOTINCHOOSER 0x00002000L
+#define SFX_FILTER_ASYNC 0x00004000L
+#define SFX_FILTER_CREATOR 0x00008000L
+#define SFX_FILTER_OPENREADONLY 0x00010000L
+#define SFX_FILTER_MUSTINSTALL 0x00020000L
+#define SFX_FILTER_CONSULTSERVICE 0x00040000L
+
+#define SFX_FILTER_STARONEFILTER 0x00080000L
+#define SFX_FILTER_PACKED 0x00100000L
+
+#define SFX_FILTER_BROWSERPREFERED 0x00400000L
+
+#define SFX_FILTER_ENCRYPTION 0x01000000L
+#define SFX_FILTER_PASSWORDTOMODIFY 0x02000000L
+
+#define SFX_FILTER_PREFERED 0x10000000L
+
+#define SFX_FILTER_VERSION_NONE 0
+#define SFX_FILTER_NOTINSTALLED SFX_FILTER_MUSTINSTALL | SFX_FILTER_CONSULTSERVICE
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/documentinfo.hxx b/include/comphelper/documentinfo.hxx
new file mode 100644
index 000000000000..48bc39a8cc00
--- /dev/null
+++ b/include/comphelper/documentinfo.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_DOCUMENTINFO_HXX
+#define COMPHELPER_DOCUMENTINFO_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/frame/XModel.hpp>
+
+//........................................................................
+namespace comphelper {
+//........................................................................
+
+ //====================================================================
+ //= DocumentInfo
+ //====================================================================
+ class COMPHELPER_DLLPUBLIC DocumentInfo
+ {
+ public:
+ /** retrieves the UI title of the given document
+ */
+ static OUString getDocumentTitle( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& _rxDocument );
+
+ private:
+ DocumentInfo(); // never implemented
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_DOCUMENTINFO_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/embeddedobjectcontainer.hxx b/include/comphelper/embeddedobjectcontainer.hxx
new file mode 100644
index 000000000000..0347e12ba2c2
--- /dev/null
+++ b/include/comphelper/embeddedobjectcontainer.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_OBJECTCONTAINER_HXX_
+#define _COMPHELPER_OBJECTCONTAINER_HXX_
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+#include <rtl/ustring.hxx>
+
+namespace comphelper
+{
+ class EmbeddedObjectContainer;
+ /** Helper interface to give access to some common object which replace the SfxObjectShell
+ */
+ class SAL_NO_VTABLE IEmbeddedHelper
+ {
+ public:
+ virtual EmbeddedObjectContainer& getEmbeddedObjectContainer() const = 0;
+ virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > getInteractionHandler() const = 0;
+ virtual bool isEnableSetModified() const = 0;
+
+ protected:
+ ~IEmbeddedHelper() {}
+ };
+
+struct EmbedImpl;
+class COMPHELPER_DLLPUBLIC EmbeddedObjectContainer
+{
+ EmbedImpl* pImpl;
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > Get_Impl( const OUString&,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xCopy);
+
+public:
+ // add an embedded object to the container storage
+ sal_Bool StoreEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString&, sal_Bool );
+
+ // add an embedded object that has been imported from the container storage - should only be called by filters!
+ void AddEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, const OUString& );
+
+ EmbeddedObjectContainer();
+ EmbeddedObjectContainer( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& );
+ EmbeddedObjectContainer( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >&,
+ const com::sun::star::uno::Reference < com::sun::star::uno::XInterface >& );
+ ~EmbeddedObjectContainer();
+
+ void SwitchPersistence( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& );
+ sal_Bool CommitImageSubStorage();
+ void ReleaseImageSubStorage();
+
+ OUString CreateUniqueObjectName();
+
+ // get a list of object names that have been added so far
+ com::sun::star::uno::Sequence < OUString > GetObjectNames();
+
+ // check for existence of objects at all
+ sal_Bool HasEmbeddedObjects();
+
+ // check existence of an object - either by identity or by name
+ sal_Bool HasEmbeddedObject( const OUString& );
+ sal_Bool HasEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+ sal_Bool HasInstantiatedEmbeddedObject( const OUString& );
+
+ // get the object name of an object - this is the persist name if the object has persistence
+ OUString GetEmbeddedObjectName( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+
+ // retrieve an embedded object by name that either has been added already or is available in the container storage
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > GetEmbeddedObject( const OUString& );
+
+ // create an object from a ClassId
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ CreateEmbeddedObject( const com::sun::star::uno::Sequence < sal_Int8 >&, OUString& );
+
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ CreateEmbeddedObject( const com::sun::star::uno::Sequence < sal_Int8 >&,
+ const com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue >&, OUString& );
+
+ // insert an embedded object into the container - objects persistent representation will be added to the storage
+ sal_Bool InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& );
+
+ // load an embedded object from a MediaDescriptor and insert it into the container
+ // a new object will be created from the new content and returned
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ InsertEmbeddedObject( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, OUString& );
+
+ // create an embedded link based on a MediaDescriptor and insert it into the container
+ // a new object will be created from the new content and returned
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ InsertEmbeddedLink( const ::com::sun::star::uno::Sequence < ::com::sun::star::beans::PropertyValue >&, OUString& );
+
+ // create an object from a stream that contains its persistent representation and insert it as usual (usually called from clipboard)
+ // a new object will be created from the new content and returned
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >
+ InsertEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >&, OUString& );
+
+ // copy an embedded object into the storage, open the new copy and return it
+ ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject > CopyAndGetEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, /* TODO const OUString& aOrigName,*/ OUString& rName );
+
+ // move an embedded object from one container to another one
+ sal_Bool MoveEmbeddedObject( EmbeddedObjectContainer& rSrc, const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString& );
+
+ // remove an embedded object from the container and from the storage; if object can't be closed
+ sal_Bool RemoveEmbeddedObject( const OUString& rName, sal_Bool bClose=sal_True );
+ sal_Bool RemoveEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, sal_Bool bClose=sal_True );
+
+ // close and remove an embedded object from the container without removing it from the storage
+ sal_Bool CloseEmbeddedObject( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& );
+
+ // move an embedded object to another container (keep the persistent name)
+ sal_Bool MoveEmbeddedObject( const OUString& rName, EmbeddedObjectContainer& );
+
+ // get the stored graphical representation for the object
+ com::sun::star::uno::Reference < com::sun::star::io::XInputStream > GetGraphicStream( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >&, OUString* pMediaType=0 );
+
+ // get the stored graphical representation by the object name
+ com::sun::star::uno::Reference < com::sun::star::io::XInputStream > GetGraphicStream( const OUString& aName, OUString* pMediaType=0 );
+
+ // add a graphical representation for an object
+ sal_Bool InsertGraphicStream( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream, const OUString& rObjectName, const OUString& rMediaType );
+
+ // try to add a graphical representation for an object in optimized way ( might fail )
+ sal_Bool InsertGraphicStreamDirectly( const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream, const OUString& rObjectName, const OUString& rMediaType );
+
+ // remove a graphical representation for an object
+ sal_Bool RemoveGraphicStream( const OUString& rObjectName );
+
+ // copy the graphical representation from different container
+ sal_Bool TryToCopyGraphReplacement( EmbeddedObjectContainer& rSrc,
+ const OUString& aOrigName,
+ const OUString& aTargetName );
+
+ void CloseEmbeddedObjects();
+ sal_Bool StoreChildren(sal_Bool _bOasisFormat,sal_Bool _bObjectsOnly);
+ sal_Bool StoreAsChildren( sal_Bool _bOasisFormat
+ ,sal_Bool _bCreateEmbedded
+ ,const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& _xStorage);
+
+ static com::sun::star::uno::Reference< com::sun::star::io::XInputStream > GetGraphicReplacementStream(
+ sal_Int64 nViewAspect,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >&,
+ OUString* pMediaType );
+
+ /** call setPersistentEntry for each embedded object in the container
+ *
+ * \param _xStorage The storeage where to store the objects.
+ * \param _bClearModifedFlag If <TRUE/> then the modifed flag will be set to <FALSE/> otherwise nothing happen.
+ * \return <FALSE/> if no error occurred, otherwise <TRUE/>.
+ */
+ sal_Bool SetPersistentEntries(const com::sun::star::uno::Reference< com::sun::star::embed::XStorage >& _xStorage,bool _bClearModifedFlag = true);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/enumhelper.hxx b/include/comphelper/enumhelper.hxx
new file mode 100644
index 000000000000..9870291b22f5
--- /dev/null
+++ b/include/comphelper/enumhelper.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_ENUMHELPER_HXX_
+#define _COMPHELPER_ENUMHELPER_HXX_
+
+#include <vector>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <osl/mutex.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace starcontainer = ::com::sun::star::container;
+ namespace staruno = ::com::sun::star::uno;
+ namespace starlang = ::com::sun::star::lang;
+
+//==================================================================
+//= OEnumerationLock
+//==================================================================
+struct OEnumerationLock
+{
+ public:
+ ::osl::Mutex m_aLock;
+};
+
+//==================================================================
+//= OEnumerationByName
+//==================================================================
+/** provides an <type scope="com.sun.star.container">XEnumeration</type> access based
+ on an object implementing the <type scope="com.sun.star.container">XNameAccess</type> interface
+*/
+class COMPHELPER_DLLPUBLIC OEnumerationByName : private OEnumerationLock
+ , public ::cppu::WeakImplHelper2< starcontainer::XEnumeration ,
+ starlang::XEventListener >
+{
+ staruno::Sequence< OUString > m_aNames;
+ sal_Int32 m_nPos;
+ staruno::Reference< starcontainer::XNameAccess > m_xAccess;
+ sal_Bool m_bListening;
+
+public:
+ OEnumerationByName(const staruno::Reference< starcontainer::XNameAccess >& _rxAccess);
+ OEnumerationByName(const staruno::Reference< starcontainer::XNameAccess >& _rxAccess,
+ const staruno::Sequence< OUString >& _aNames );
+ virtual ~OEnumerationByName();
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(staruno::RuntimeException);
+ virtual staruno::Any SAL_CALL nextElement( )
+ throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
+
+ virtual void SAL_CALL disposing(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
+
+private:
+ COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
+ COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
+};
+
+//==================================================================
+//= OEnumerationByIndex
+//==================================================================
+/** provides an <type scope="com.sun.star.container">XEnumeration</type> access based
+ on an object implementing the <type scope="com.sun.star.container">XNameAccess</type> interface
+*/
+class COMPHELPER_DLLPUBLIC OEnumerationByIndex : private OEnumerationLock
+ , public ::cppu::WeakImplHelper2< starcontainer::XEnumeration ,
+ starlang::XEventListener >
+{
+ sal_Int32 m_nPos;
+ staruno::Reference< starcontainer::XIndexAccess > m_xAccess;
+ sal_Bool m_bListening;
+
+public:
+ OEnumerationByIndex(const staruno::Reference< starcontainer::XIndexAccess >& _rxAccess);
+ virtual ~OEnumerationByIndex();
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(staruno::RuntimeException);
+ virtual staruno::Any SAL_CALL nextElement( )
+ throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
+
+ virtual void SAL_CALL disposing(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
+
+private:
+ COMPHELPER_DLLPRIVATE void impl_startDisposeListening();
+ COMPHELPER_DLLPRIVATE void impl_stopDisposeListening();
+};
+
+//==================================================================
+//= OAnyEnumeration
+//==================================================================
+/** provides an <type scope="com.sun.star.container">XEnumeration</type>
+ for an outside set vector of Any's.
+
+*/
+class COMPHELPER_DLLPUBLIC OAnyEnumeration : private OEnumerationLock
+ , public ::cppu::WeakImplHelper1< starcontainer::XEnumeration >
+{
+ sal_Int32 m_nPos;
+ staruno::Sequence< staruno::Any > m_lItems;
+
+public:
+ OAnyEnumeration(const staruno::Sequence< staruno::Any >& lItems);
+ virtual ~OAnyEnumeration();
+
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(staruno::RuntimeException);
+ virtual staruno::Any SAL_CALL nextElement( )
+ throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
+
+};
+
+//.........................................................................
+}
+//... namespace comphelper .......................................................
+
+#endif // _COMPHELPER_ENUMHELPER_HXX_
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/eventattachermgr.hxx b/include/comphelper/eventattachermgr.hxx
new file mode 100644
index 000000000000..a525e7c4ea54
--- /dev/null
+++ b/include/comphelper/eventattachermgr.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_EVENTATTACHERMGR_HXX_
+#define _COMPHELPER_EVENTATTACHERMGR_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace com { namespace sun { namespace star {
+namespace uno {
+ class Exception;
+ class XComponentContext;
+}
+namespace script {
+ class XEventAttacherManager;
+}
+namespace beans {
+ class XIntrospection;
+}
+} } }
+
+
+namespace comphelper
+{
+
+COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager >
+createEventAttacherManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext )
+ throw( ::com::sun::star::uno::Exception );
+
+}
+
+#endif // _COMPHELPER_EVENTATTACHERMGR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/evtlistenerhlp.hxx b/include/comphelper/evtlistenerhlp.hxx
new file mode 100644
index 000000000000..c1bb01fa3aa4
--- /dev/null
+++ b/include/comphelper/evtlistenerhlp.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_EVENTLISTENERHELPER_HXX
+#define COMPHELPER_EVENTLISTENERHELPER_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <osl/diagnose.h>
+#include <cppuhelper/weakref.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //==========================================================================
+ //= OCommandsListener
+ // is helper class to avoid a cycle in refcount between the XEventListener
+ // and the member XEventBroadcaster
+ //==========================================================================
+ class COMPHELPER_DLLPUBLIC OEventListenerHelper : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
+ {
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::lang::XEventListener> m_xListener;
+ public:
+ OEventListenerHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener);
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+ };
+//........................................................................
+} // namespace comphelper
+//........................................................................
+#endif // COMPHELPER_EVENTLISTENERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/evtmethodhelper.hxx b/include/comphelper/evtmethodhelper.hxx
new file mode 100644
index 000000000000..7ecf08a0fc57
--- /dev/null
+++ b/include/comphelper/evtmethodhelper.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_EVENTMEHODHELPER_HXX
+#define COMPHELPER_EVENMETHODHELPER_HXX
+#include <comphelper/sequence.hxx>
+//........................................................................
+namespace comphelper
+{
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< OUString> getEventMethodsForType(const ::com::sun::star::uno::Type& type);
+//........................................................................
+
+} // namespace comphelper
+//........................................................................
+#endif // COMPHELPER_EVENTMEHODHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/extract.hxx b/include/comphelper/extract.hxx
new file mode 100644
index 000000000000..30cbaaefc6c9
--- /dev/null
+++ b/include/comphelper/extract.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_EXTRACT_HXX_
+#define _COMPHELPER_EXTRACT_HXX_
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/TypeClass.hpp>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include "cppu/unotype.hxx"
+
+namespace cppu
+{
+
+/**
+ * Sets enum from int32 value. This function does NOT check for valid enum values!
+ *<BR>
+ * @param nEnum int32 enum value
+ * @param rType enum type
+ * @return enum or emoty any.
+ */
+inline ::com::sun::star::uno::Any SAL_CALL int2enum(
+ sal_Int32 nEnum, const ::com::sun::star::uno::Type & rType )
+{
+ if (rType.getTypeClass() == ::com::sun::star::uno::TypeClass_ENUM)
+ {
+ int nVal = nEnum;
+ return ::com::sun::star::uno::Any( &nVal, rType );
+ }
+ return ::com::sun::star::uno::Any();
+}
+
+/**
+ * Sets int32 from enum or int in any.
+ *<BR>
+ * @param rnEnum [out] int32 enum value
+ * @param rAny enum or int
+ * @param sal_True if enum or int value was set else sal_False.
+ */
+inline sal_Bool SAL_CALL enum2int( sal_Int32 & rnEnum, const ::com::sun::star::uno::Any & rAny )
+{
+ if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_ENUM)
+ {
+ rnEnum = * reinterpret_cast< const int * >( rAny.getValue() );
+ return sal_True;
+ }
+
+ return rAny >>= rnEnum;
+}
+
+/**
+ * Sets int32 from enum or int in any with additional typecheck
+ * <BR>
+ * @param rAny enum or int
+ * @param eRet the enum value as int. If there is not enum of the given type or
+ * a ::com::sun::star::lang::IllegalArgumentException is thrown
+ */
+template< typename E >
+inline void SAL_CALL any2enum( E & eRet, const ::com::sun::star::uno::Any & rAny )
+ throw( ::com::sun::star::lang::IllegalArgumentException )
+{
+ // check for type save enum
+ if (! (rAny >>= eRet))
+ {
+ // if not enum, maybe integer?
+ sal_Int32 nValue = 0;
+ if (! (rAny >>= nValue))
+ throw ::com::sun::star::lang::IllegalArgumentException();
+
+ eRet = (E)nValue;
+ }
+}
+
+/**
+ * Template function to create an uno::Any from an enum
+ *
+ * @DEPRECATED : use makeAny< E >()
+ *
+ */
+template< typename E >
+inline ::com::sun::star::uno::Any SAL_CALL enum2any( E eEnum )
+{
+ return ::com::sun::star::uno::Any( &eEnum, ::cppu::UnoType< E >::get() );
+}
+
+/**
+ * Extracts interface from an any. If given any does not hold the demanded interface,
+ * it will be queried for it.
+ * If no interface is available, the out ref will be cleared.
+ *<BR>
+ * @param rxOut [out] demanded interface
+ * @param rAny interface
+ * @return sal_True if any reference (including the null ref) was retrieved from any else sal_False.
+ */
+template< class T >
+inline sal_Bool SAL_CALL extractInterface(
+ ::com::sun::star::uno::Reference< T > & rxOut,
+ const ::com::sun::star::uno::Any & rAny )
+{
+ rxOut.clear();
+ return (rAny >>= rxOut);
+}
+
+/**
+ * extracts a boolean either as a sal_Bool or an integer from
+ * an any. If there is no sal_Bool or integer inside the any
+ * a ::com::sun::star::lang::IllegalArgumentException is thrown
+ *
+ */
+inline sal_Bool SAL_CALL any2bool( const ::com::sun::star::uno::Any & rAny )
+ throw( ::com::sun::star::lang::IllegalArgumentException )
+{
+ if (rAny.getValueTypeClass() == ::com::sun::star::uno::TypeClass_BOOLEAN)
+ {
+ return *(sal_Bool *)rAny.getValue();
+ }
+ else
+ {
+ sal_Int32 nValue = 0;
+ if (! (rAny >>= nValue))
+ throw ::com::sun::star::lang::IllegalArgumentException();
+ return nValue != 0;
+ }
+}
+
+/**
+ * Puts a boolean in an any.
+ *
+ * @DEPRECATED : use makeAny< sal_Bool >()
+ *
+ */
+inline ::com::sun::star::uno::Any SAL_CALL bool2any( sal_Bool bBool )
+{
+ return ::com::sun::star::uno::Any( &bBool, ::getCppuBooleanType() );
+}
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/fileformat.h b/include/comphelper/fileformat.h
new file mode 100644
index 000000000000..dbd3f32a1f9a
--- /dev/null
+++ b/include/comphelper/fileformat.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_FILEFORMAT_H_
+#define _COMPHELPER_FILEFORMAT_H_
+
+/* file format versions *************************************************/
+
+#define SOFFICE_FILEFORMAT_31 3450
+#define SOFFICE_FILEFORMAT_40 3580
+#define SOFFICE_FILEFORMAT_50 5050
+#define SOFFICE_FILEFORMAT_60 6200
+#define SOFFICE_FILEFORMAT_8 6800
+#define SOFFICE_FILEFORMAT_CURRENT SOFFICE_FILEFORMAT_8
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/flagguard.hxx b/include/comphelper/flagguard.hxx
new file mode 100644
index 000000000000..af1f1ea1e4fd
--- /dev/null
+++ b/include/comphelper/flagguard.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_FLAGGUARD_HXX
+#define COMPHELPER_FLAGGUARD_HXX
+
+#include "comphelper/scopeguard.hxx"
+
+//......................................................................................................................
+namespace comphelper
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= FlagRestorationGuard
+ //==================================================================================================================
+ class COMPHELPER_DLLPUBLIC FlagRestorationGuard : public ScopeGuard
+ {
+ public:
+ FlagRestorationGuard( bool& i_flagRef, bool i_temporaryValue, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
+ :ScopeGuard( ::boost::bind( RestoreFlag, ::boost::ref( i_flagRef ), !!i_flagRef ), i_excHandling )
+ {
+ i_flagRef = i_temporaryValue;
+ }
+
+ ~FlagRestorationGuard();
+
+ private:
+ static void RestoreFlag( bool& i_flagRef, bool i_originalValue )
+ {
+ i_flagRef = i_originalValue;
+ }
+ };
+
+ //==================================================================================================================
+ //= FlagGuard
+ //==================================================================================================================
+ class COMPHELPER_DLLPUBLIC FlagGuard : public ScopeGuard
+ {
+ public:
+ explicit FlagGuard( bool& i_flagRef, exc_handling i_excHandling = IGNORE_EXCEPTIONS )
+ :ScopeGuard( ::boost::bind( ResetFlag, ::boost::ref( i_flagRef ) ), i_excHandling )
+ {
+ i_flagRef = true;
+ }
+
+ ~FlagGuard();
+
+ private:
+ static void ResetFlag( bool& i_flagRef )
+ {
+ i_flagRef = false;
+ }
+ };
+
+//......................................................................................................................
+} // namespace comphelper
+//......................................................................................................................
+
+#endif // COMPHELPER_FLAGGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/genericpropertyset.hxx b/include/comphelper/genericpropertyset.hxx
new file mode 100644
index 000000000000..e46c30a4cad4
--- /dev/null
+++ b/include/comphelper/genericpropertyset.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_GENERICPROPERTYSET_HXX_
+#define _COMPHELPER_GENERICPROPERTYSET_HXX_
+
+#include <comphelper/propertysetinfo.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GenericPropertySet_CreateInstance( PropertySetInfo* pInfo );
+}
+
+#endif // _COMPHELPER_GENERICPROPERTYSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/guarding.hxx b/include/comphelper/guarding.hxx
new file mode 100644
index 000000000000..3931c0284e31
--- /dev/null
+++ b/include/comphelper/guarding.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_GUARDING_HXX_
+#define _COMPHELPER_GUARDING_HXX_
+
+#include <osl/mutex.hxx>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+// ===================================================================================================
+// = class MutexRelease -
+// ===================================================================================================
+
+/** opposite of OGuard :)
+ (a mutex is released within the constructor and acquired within the desctructor)
+ use only when you're sure the mutex is acquired !
+*/
+template <class MUTEX>
+class ORelease
+{
+ MUTEX& m_rMutex;
+
+public:
+ ORelease(MUTEX& _rMutex) : m_rMutex(_rMutex) { _rMutex.release(); }
+ ~ORelease() { m_rMutex.acquire(); }
+};
+
+typedef ORelease< ::osl::Mutex > MutexRelease;
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_GUARDING_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ihwrapnofilter.hxx b/include/comphelper/ihwrapnofilter.hxx
new file mode 100644
index 000000000000..eb0b13957874
--- /dev/null
+++ b/include/comphelper/ihwrapnofilter.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_INTERACTIONHANDLERWRAPPER_HXX_
+#define _COMPHELPER_INTERACTIONHANDLERWRAPPER_HXX_
+
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TASK_XINTERACITONREQUEST_
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_
+#include <com/sun/star/lang/XInitialization.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_DOUBLEINITIALIZATIONEXCEPTION_
+#include <com/sun/star/frame/DoubleInitializationException.hpp>
+#endif
+
+#include <cppuhelper/implbase2.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper {
+
+ class COMPHELPER_DLLPUBLIC OIHWrapNoFilterDialog : public ::cppu::WeakImplHelper2
+ < ::com::sun::star::task::XInteractionHandler2
+ , ::com::sun::star::lang::XServiceInfo >
+ {
+ com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > m_xInter;
+
+ public:
+ OIHWrapNoFilterDialog( com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler > xInteraction );
+ ~OIHWrapNoFilterDialog();
+
+ static OUString SAL_CALL impl_staticGetImplementationName();
+ static ::com::sun::star::uno::Sequence< OUString > SAL_CALL impl_staticGetSupportedServiceNames();
+
+
+ //____________________________________________________________________________________________________
+ // XInteractionHandler
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL handle( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest)
+ throw( com::sun::star::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XInteractionHandler2
+ //____________________________________________________________________________________________________
+
+ virtual sal_Bool SAL_CALL handleInteractionRequest( const com::sun::star::uno::Reference< com::sun::star::task::XInteractionRequest >& xRequest)
+ throw( com::sun::star::uno::RuntimeException );
+
+ //____________________________________________________________________________________________________
+ // XInitialization
+ //____________________________________________________________________________________________________
+
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw ( ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::frame::DoubleInitializationException ) ;
+
+ //____________________________________________________________________________________________________
+ // XServiceInfo
+ //____________________________________________________________________________________________________
+
+ virtual OUString SAL_CALL getImplementationName()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw ( ::com::sun::star::uno::RuntimeException );
+
+ };
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/implbase_var.hxx b/include/comphelper/implbase_var.hxx
new file mode 100644
index 000000000000..fee9eb695c08
--- /dev/null
+++ b/include/comphelper/implbase_var.hxx
@@ -0,0 +1,436 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** This header generates the following template classes with a variable number
+ of interfaces:
+
+ comphelper::ImplHelper<N> <typename Ifc1, ..., typename Ifc<N> >
+ comphelper::WeakImplHelper<N> <typename Ifc1, ..., typename Ifc<N> >
+ comphelper::WeakComponentImplHelper<N> <typename Ifc1, ...,
+ typename Ifc<N> >
+ comphelper::ImplInheritanceHelper<N> <typename BaseClass,
+ typename Ifc1, ..., typename Ifc<N> >
+
+ as already present in headers cppuhelper/implbase<1-12>.hxx and
+ cppuhelper/compbase<1-12>.hxx.
+ <N> denotes the number of interface types passed as template arguments.
+ Don't use this header for interface numbers up to 12;
+ always use the existing cppuhelper/(impl|comp)base<1-12>.hxx headers
+ for this purpose, which eases debugging.
+
+ Including this header requires a little discipline, because it has no
+ include guards. Please use the following external include guard rule
+ where <N> is the number of interface types:
+
+ #ifndef INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_<N>
+ #define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_<N>
+ #define COMPHELPER_IMPLBASE_INTERFACE_NUMBER <N>
+ #include "comphelper/implbase_var.hxx"
+ #endif
+
+ Additionally you can
+
+ #define COMPHELPER_IMPLBASE_MAX_CTOR_ARGS <N>
+
+ to control the maximum number of templated ctor arguments for the
+ ImplInheritanceHelper<N> classes.
+ The default is a maximum of 6 arguments.
+*/
+
+#ifndef COMPHELPER_IMPLBASE_INTERFACE_NUMBER
+#error "you have to define COMPHELPER_IMPLBASE_INTERFACE_NUMBER prior to including comphelper/implbase_var.hxx!"
+#endif // ! defined(COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+
+#if !defined(COMPHELPER_IMPLBASE_TEST_PHASE) && COMPHELPER_IMPLBASE_INTERFACE_NUMBER <= 12
+#error "include proper header file: cppuhelper/implbase<N>.hxx or cppuhelper/compbase<N>.hxx!"
+#endif
+
+#ifndef COMPHELPER_IMPLBASE_MAX_CTOR_ARGS
+#define COMPHELPER_IMPLBASE_MAX_CTOR_ARGS 6 // default
+#endif
+
+#include "cppuhelper/implbase_ex.hxx"
+#include "rtl/instance.hxx"
+#include "cppuhelper/compbase_ex.hxx"
+
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repetition.hpp"
+#include "boost/preprocessor/arithmetic/add.hpp"
+
+namespace comphelper {
+
+// Suppress warnings about hidden functions in case any of the IfcN has
+// functions named dispose, addEventListener, or removeEventListener:
+#if defined __SUNPRO_CC
+#pragma disable_warn
+#endif
+
+namespace detail {
+
+struct BOOST_PP_CAT(class_data, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+{
+ sal_Int16 m_nTypes;
+ sal_Bool m_storedTypeRefs;
+ sal_Bool m_storedId;
+ sal_Int8 m_id[16];
+ ::cppu::type_entry m_typeEntries[COMPHELPER_IMPLBASE_INTERFACE_NUMBER + 1];
+};
+
+/// @internal
+template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc), typename Impl >
+struct BOOST_PP_CAT(ImplClassData, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+{
+ ::cppu::class_data * operator()() {
+ static BOOST_PP_CAT(class_data, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ s_cd = {
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER + 1, sal_False, sal_False,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ {
+#define COMPHELPER_IMPLBASE_classdataList(z_, n_, unused_) \
+{ { BOOST_PP_CAT(Ifc, n_)::static_type }, \
+ reinterpret_cast<sal_IntPtr>( static_cast< BOOST_PP_CAT(Ifc, n_) * >( \
+ reinterpret_cast<Impl *>(16) ) ) - 16 },
+ BOOST_PP_REPEAT(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ COMPHELPER_IMPLBASE_classdataList, ~)
+#undef COMPHELPER_IMPLBASE_classdataList
+ { { ::com::sun::star::lang::XTypeProvider::static_type },
+ reinterpret_cast<sal_IntPtr>(
+ static_cast< ::com::sun::star::lang::XTypeProvider * >(
+ reinterpret_cast<Impl *>(16) ) ) - 16 }
+ }
+ };
+ return reinterpret_cast< ::cppu::class_data * >(&s_cd);
+ }
+};
+
+} // namespace detail
+
+/** Implementation helper implementing interface
+ ::com::sun::star::lang::XTypeProvider and method
+ XInterface::queryInterface(), but no reference counting.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for
+ these interface(s) including acquire()/release() and delegates incoming
+ queryInterface() calls to this base class.
+*/
+template< BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(ImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(ImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+protected:
+ BOOST_PP_CAT(ImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)() {}
+ virtual ~BOOST_PP_CAT(ImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)() {}
+
+public:
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_query( rType, cd::get(), this ); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+/** Implementation helper implementing interfaces
+ ::com::sun::star::lang::XTypeProvider and
+ ::com::sun::star::uno::XInterface
+ which supports weak mechanism to be held weakly
+ (supporting ::com::sun::star::uno::XWeak thru ::cppu::OWeakObject).
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for
+ these interface(s).
+*/
+template< BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(WeakImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::cppu::OWeakObject,
+ public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(WeakImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+public:
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::WeakImplHelper_query(
+ rType, cd::get(), this, static_cast<OWeakObject *>(this) );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { OWeakObject::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { OWeakObject::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::WeakImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+/** Implementation helper implementing interfaces
+ ::com::sun::star::lang::XTypeProvider and
+ ::com::sun::star::uno::XInterface inherting from a BaseClass.
+
+ All acquire() and release() calls are delegated to the BaseClass.
+ Upon queryInterface(), if a demanded interface is not supported by this
+ class directly, the request is delegated to the BaseClass.
+
+ @attention
+ The BaseClass has to be complete in a sense, that
+ ::com::sun::star::uno::XInterface and
+ ::com::sun::star::lang::XTypeProvider are implemented properly.
+ The BaseClass must have at least one ctor that can be called with
+ COMPHELPER_IMPLBASE_MAX_CTOR_ARGS or fewer arguments.
+
+ @derive
+ Inherit from this class giving your additional interface(s) to be
+ implemented as template argument(s). Your sub class defines method
+ implementations for these interface(s).
+*/
+template <typename BaseClass,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(ImplInheritanceHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public BaseClass,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(ImplInheritanceHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BaseClass,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+protected:
+#define COMPHELPER_IMPLBASE_templctor_args(z_, n_, unused_) \
+ BOOST_PP_CAT(T, n_) const& BOOST_PP_CAT(arg, n_)
+#define COMPHELPER_IMPLBASE_templctor(z_, n_, classname_) \
+ template< BOOST_PP_ENUM_PARAMS( BOOST_PP_ADD(n_, 1), typename T) > \
+ explicit BOOST_PP_CAT(classname_, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)( \
+ BOOST_PP_ENUM(BOOST_PP_ADD(n_, 1), \
+ COMPHELPER_IMPLBASE_templctor_args, ~) ) \
+ : BaseClass( BOOST_PP_ENUM_PARAMS(BOOST_PP_ADD(n_, 1), arg) ) {}
+
+ BOOST_PP_CAT(ImplInheritanceHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)()
+ : BaseClass() {}
+ BOOST_PP_REPEAT(COMPHELPER_IMPLBASE_MAX_CTOR_ARGS,
+ COMPHELPER_IMPLBASE_templctor, ImplInheritanceHelper)
+
+public:
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::com::sun::star::uno::Any const aRet(
+ ::cppu::ImplHelper_queryNoXInterface( rType, cd::get(), this ) );
+ if (aRet.hasValue())
+ return aRet;
+ return BaseClass::queryInterface( rType );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { BaseClass::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { BaseClass::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::ImplInhHelper_getTypes(
+ cd::get(), BaseClass::getTypes() );
+ }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+// not needed anymore:
+#undef COMPHELPER_IMPLBASE_templctor_args
+#undef COMPHELPER_IMPLBASE_templctor
+
+/** Implementation helper supporting
+ ::com::sun::star::lang::XTypeProvider and
+ ::com::sun::star::lang::XComponent.
+
+ Upon disposing objects of this class, sub-classes receive a disposing()
+ call. Objects of this class can be held weakly, i.e. by a
+ ::com::sun::star::uno::WeakReference.
+
+ @attention
+ The life-cycle of the passed mutex reference has to be longer than objects
+ of this class.
+
+ @derive
+ Inherit from this class giving your interface(s) to be implemented as
+ template argument(s). Your sub class defines method implementations for
+ these interface(s).
+*/
+template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(WeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::cppu::WeakComponentImplHelperBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(WeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+public:
+ BOOST_PP_CAT(WeakComponentImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)(
+ ::osl::Mutex & rMutex ) : WeakComponentImplHelperBase(rMutex) {}
+
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::WeakComponentImplHelper_query(
+ rType, cd::get(), this,
+ static_cast< ::cppu::WeakComponentImplHelperBase * >(this) );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { WeakComponentImplHelperBase::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+
+ // implement XComponent directly avoiding ambiguities:
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::dispose(); }
+ virtual void SAL_CALL addEventListener(
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>
+ const & xListener ) throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::addEventListener( xListener ); }
+ virtual void SAL_CALL removeEventListener(
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>
+ const & xListener ) throw (::com::sun::star::uno::RuntimeException)
+ { WeakComponentImplHelperBase::removeEventListener( xListener ); }
+};
+
+template < BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER,
+ typename Ifc) >
+class SAL_NO_VTABLE BOOST_PP_CAT(PartialWeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ : public ::cppu::WeakComponentImplHelperBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, public Ifc)
+{
+ /// @internal
+ struct cd : public ::rtl::StaticAggregate<
+ ::cppu::class_data,
+ BOOST_PP_CAT(detail::ImplClassData,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)
+ <
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc),
+ BOOST_PP_CAT(PartialWeakComponentImplHelper,
+ COMPHELPER_IMPLBASE_INTERFACE_NUMBER)<
+ BOOST_PP_ENUM_PARAMS(COMPHELPER_IMPLBASE_INTERFACE_NUMBER, Ifc)>
+ > > {};
+
+public:
+ BOOST_PP_CAT(PartialWeakComponentImplHelper, COMPHELPER_IMPLBASE_INTERFACE_NUMBER)(
+ ::osl::Mutex & rMutex ) : WeakComponentImplHelperBase(rMutex) {}
+
+ virtual ::com::sun::star::uno::Any
+ SAL_CALL queryInterface( ::com::sun::star::uno::Type const& rType )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ return ::cppu::WeakComponentImplHelper_query(
+ rType, cd::get(), this,
+ static_cast< ::cppu::WeakComponentImplHelperBase * >(this) );
+ }
+ virtual void SAL_CALL acquire() throw ()
+ { WeakComponentImplHelperBase::acquire(); }
+ virtual void SAL_CALL release() throw ()
+ { WeakComponentImplHelperBase::release(); }
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type >
+ SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::WeakComponentImplHelper_getTypes( cd::get() ); }
+ virtual ::com::sun::star::uno::Sequence<sal_Int8>
+ SAL_CALL getImplementationId()
+ throw (::com::sun::star::uno::RuntimeException)
+ { return ::cppu::ImplHelper_getImplementationId( cd::get() ); }
+};
+
+
+} // namespace comphelper
+
+// undef for multiple use/inclusion of this header:
+#undef COMPHELPER_IMPLBASE_MAX_CTOR_ARGS
+#undef COMPHELPER_IMPLBASE_INTERFACE_NUMBER
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/implementationreference.hxx b/include/comphelper/implementationreference.hxx
new file mode 100644
index 000000000000..7957d6437ff5
--- /dev/null
+++ b/include/comphelper/implementationreference.hxx
@@ -0,0 +1,267 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
+#define _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+
+namespace comphelper
+{
+
+ /** Holds a uno::Reference alongside a C++ implementation pointer
+
+ This template is useful to accomplish the following task: the
+ client needs an implementation pointer to an object providing
+ UNO interfaces. It is unsafe to simply store a C++ pointer,
+ because of the automatic UNO lifetime control. It is
+ inconvenient to always cast the UNO interface to the C++
+ implementation, and what's more, it's mostly unclear to the
+ casual code reader.
+
+ Thus, this template nicely encapsulate the stated intention,
+ by holding a uno::Reference internally, and providing simple
+ C++ pointer semantics to the outside. As a differentiator to
+ ::rtl::Reference, this template features a getRef() method,
+ giving you friction-less access to the internal UNO interface,
+ without extra querying.
+
+ By the way, the pointer semantic of this template include
+ transitive constness. That means, if this template's instance
+ is const (e.g. because it is a member of a class which is
+ accessed in a const method), the pointer returned is also
+ const.
+
+ As this template is geared towards fast, internal pointer
+ access, validity of the UNO reference is _not_ checked for
+ every pointer access. The client of this template is
+ responsible to check that, whereever necessary, via the is()
+ method.
+
+ @tpl CppType
+ The C++ type this class should mimick a pointer to (not the
+ pointer type itself!).
+
+ @tpl UnoType
+ The UNO interface type of the object (a uno::Reference to this
+ type is held internally).
+
+ @tpl XIfType
+ An unambiguous derivative of UnoType. This is defaulted to
+ the second template parameter (UnoType), which should normally
+ just work, since one typically has only single inheritance in
+ UNO.<p>
+ Alternatively, when using the
+ ImplementationReference::createFromQuery() method to create an
+ instance, this type can serve a different need: if the
+ provided CppType only derives from XInterface (generally
+ speaking, derives from a UNO interface above UnoType in the
+ class hierarchy), then the default XIfType constitutes a
+ possibly invalid downcast to UnoType. Setting XIfType equal to
+ CppTypes's most derived UNO interface type then solves this
+ problem (which is not as arcane as it seems to be. Just
+ imagine you're providing a C++ abstract interface, which must
+ provide UNO reference semantics. Naturally, you will derive
+ this C++ interface only from XInterface, to reduce the number
+ of ambiguous classes. Even more naturally, it is reasonable to
+ have UnoType be something different from XInterface, governed
+ by the usage of the C++ interface)
+
+ @sample ImplementationReference< MyCppType, XMyInterface >
+
+ @sample ImplementationReference< MyAbstractCppType, XMyInterface, XInterface >
+ for an abstract C++ class
+
+ @see ::rtl::Reference
+
+ */
+ template < class CppType,
+ class UnoType,
+ class XIfType=UnoType > class ImplementationReference
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType ImplementationType;
+ typedef XIfType UnambiguousXInterfaceType;
+
+ /** Default-construct an ImplementationReference
+
+ Uno reference will be invalid, implementation pointer will
+ be NULL.
+ */
+ ImplementationReference() :
+ mxRef(),
+ mpImpl( NULL )
+ {
+ }
+
+ /** Create an ImplementationReference from C++ pointer.
+
+ This constructor does not perform an explicit
+ QueryInterface on the provided implementation object, but
+ constructs the UNO reference directly from the given
+ pointer. This is the fastest, and most often the best way
+ to create an ImplementationReference. If the conversion
+ between the implementation object and the required UNO
+ interface is ambiguous, provide the third template
+ parameter with a type that can be unambiguously upcasted
+ to the UNO interface (the second template parameter).
+
+ There are cases, however, where performing a
+ QueryInterface is the better, albeit slower choice. In
+ these cases, createFromQuery() should be used.
+
+ @param pImpl
+ Pointer to the C++ implementation type
+
+ @see createFromQuery()
+ */
+ explicit ImplementationReference( ImplementationType* pImpl ) :
+ mxRef( static_cast<UnambiguousXInterfaceType*>(pImpl) ),
+ mpImpl( pImpl )
+ {
+ }
+
+ struct CreateFromQuery { };
+ /** Create an ImplementationReference from C++ pointer
+
+ @param pImpl
+ The pointer to the C++ implementation type, which is
+ queried for the template-parameterized UNO type.
+
+ @param dummy
+ Dummy parameter, to distinguish this contructor from the
+ default unary one (which does not perform a
+ QueryInterface)
+ */
+ ImplementationReference( ImplementationType* pImpl, CreateFromQuery ) :
+ mxRef( static_cast<UnambiguousXInterfaceType*>(pImpl),
+ ::com::sun::star::uno::UNO_QUERY ),
+ mpImpl( pImpl )
+ {
+ }
+
+ /** Factory method to create an ImplementationReference from
+ C++ pointer.
+
+ This is a static version of the constructor which creates
+ an instance of an implementation type which is explicitly
+ queried for the ImplementationReference's
+ template-parameterized UNO type.
+
+ @sample
+ mpRef = mpRef.createFromQuery( new ImplementationType );
+ */
+ static ImplementationReference createFromQuery( ImplementationType* pImpl )
+ {
+ return ImplementationReference( pImpl, CreateFromQuery() );
+ }
+
+ /** Query whether the pointer is still valid.
+
+ Hands off also from the implementation pointer if this
+ returns false!
+ */
+ bool is() const { return mxRef.is(); }
+
+ /** Get a pointer to the implementation object
+
+ Compatibility method to get an auto_ptr-compatible
+ interface
+ */
+ ImplementationType* get() { return mpImpl; }
+ const ImplementationType* get() const { return mpImpl; }
+
+ /** Release all references
+
+ Compatibility method to get an auto_ptr-compatible
+ interface
+ */
+ void reset() { dispose(); }
+
+ /** Release all references
+
+ This method releases the UNO interface reference, and
+ clears the C++ pointer to NULL.
+ */
+ void dispose() { mxRef = NULL; mpImpl=NULL; }
+
+ ImplementationType* operator->() { return mpImpl; }
+ const ImplementationType* operator->() const { return mpImpl; }
+
+ ImplementationType& operator*() { return *mpImpl; }
+ const ImplementationType& operator*() const { return *mpImpl; }
+
+ /// Access to the underlying UNO reference, without extra querying
+ ::com::sun::star::uno::Reference< UnoInterfaceType > getRef() { return mxRef; }
+
+ /// Access to the underlying UNO reference, without extra querying
+ const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; }
+
+ // default destructor, copy constructor and assignment will do
+ // ~ImplementationReference();
+ // ImplementationReference( const ImplementationReference& );
+ // ImplementationReference& operator= ( const ImplementationReference& );
+
+ /** Comparison operator
+
+ Object identity is defined to be identity of the
+ implementation pointers. This is in general invalid when
+ comparing pointers to UNO objects (ambiguous class
+ hierarchies, optimizations in the bridges, etc.), but okay
+ for raw C++ pointers (which is what's compared herein).
+ */
+ bool operator==( const ImplementationReference& rhs ) const
+ {
+ return mpImpl == rhs.mpImpl;
+ }
+
+ /** less-than operator
+
+ Object order is defined to be the ordering of the
+ implementation pointers. This is in general invalid when
+ comparing pointers to UNO objects (ambiguous class
+ hierarchies, optimizations in the bridges, etc.), but okay
+ for raw C++ pointers (which is what's used herein).
+
+ This ordering complies with STL's strict weak ordering
+ concept.
+ */
+ bool operator<( const ImplementationReference& rhs ) const
+ {
+ return mpImpl < rhs.mpImpl;
+ }
+
+ private:
+
+ // the interface, hard reference to prevent object from vanishing
+ ::com::sun::star::uno::Reference< UnoInterfaceType > mxRef;
+
+ // the c++ object, for our internal stuff
+ ImplementationType* mpImpl;
+
+ };
+
+}
+
+#endif // _COMPHELPER_IMPLEMENTATIONREFERENCE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/interaction.hxx b/include/comphelper/interaction.hxx
new file mode 100644
index 000000000000..bbd925efd3fa
--- /dev/null
+++ b/include/comphelper/interaction.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_INTERACTION_HXX_
+#define _COMPHELPER_INTERACTION_HXX_
+
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/task/XInteractionPassword.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=========================================================================
+ //= OInteractionSelect
+ //=========================================================================
+ /** base class for concrete XInteractionContinuation implementations.<p/>
+ Instances of the classes maintain a flag indicating if the handler was called.
+ */
+ class OInteractionSelect
+ {
+ sal_Bool m_bSelected : 1; /// indicates if the select event occurred
+
+ protected:
+ OInteractionSelect() : m_bSelected(sal_False) { }
+
+ public:
+ /// determines whether or not this handler was selected
+ sal_Bool wasSelected() const { return m_bSelected; }
+ /// resets the state to "not selected", so you may reuse the handler
+ void reset() { m_bSelected = sal_False; }
+
+ protected:
+ void implSelected() { m_bSelected = sal_True; }
+ };
+
+ //=========================================================================
+ //= OInteraction
+ //=========================================================================
+ /** template for instantiating concret interaction handlers<p/>
+ the template argument must eb an interface derived from XInteractionContinuation
+ */
+ template <class INTERACTION>
+ class OInteraction
+ :public ::cppu::WeakImplHelper1< INTERACTION >
+ ,public OInteractionSelect
+ {
+ public:
+ OInteraction() { }
+
+ // XInteractionContinuation
+ virtual void SAL_CALL select( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //.........................................................................
+ template <class INTERACTION>
+ void SAL_CALL OInteraction< INTERACTION >::select( ) throw(::com::sun::star::uno::RuntimeException)
+ {
+ implSelected();
+ }
+
+ //=========================================================================
+ //= OInteractionApprove
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionApprove > OInteractionApprove;
+
+ //=========================================================================
+ //= OInteractionDispprove
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionDisapprove > OInteractionDisapprove;
+
+ //=========================================================================
+ //= OInteractionAbort
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionAbort > OInteractionAbort;
+
+ //=========================================================================
+ //= OInteractionRetry
+ //=========================================================================
+ typedef OInteraction< ::com::sun::star::task::XInteractionRetry > OInteractionRetry;
+
+ //=========================================================================
+ //= OInteractionPassword
+ //=========================================================================
+ class COMPHELPER_DLLPUBLIC OInteractionPassword : public OInteraction< ::com::sun::star::task::XInteractionPassword >
+ {
+ public:
+ OInteractionPassword()
+ {
+ }
+
+ OInteractionPassword( const OUString& _rInitialPassword )
+ :m_sPassword( _rInitialPassword )
+ {
+ }
+
+ // XInteractionPassword
+ virtual void SAL_CALL setPassword( const OUString& _Password ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getPassword( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ OUString m_sPassword;
+ };
+
+ //=========================================================================
+ //= OInteractionRequest
+ //=========================================================================
+ typedef ::cppu::WeakImplHelper1 < ::com::sun::star::task::XInteractionRequest
+ > OInteractionRequest_Base;
+ /** implements an interaction request (<type scope="com.sun.star.task">XInteractionRequest</type>)<p/>
+ at run time, you can freely add any interaction continuation objects
+ */
+ class COMPHELPER_DLLPUBLIC OInteractionRequest : public OInteractionRequest_Base
+ {
+ ::com::sun::star::uno::Any
+ m_aRequest; /// the request we represent
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
+ m_aContinuations; /// all registered continuations
+
+ public:
+ OInteractionRequest(const ::com::sun::star::uno::Any& _rRequestDescription);
+
+ /// add a new continuation
+ void addContinuation(const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >& _rxContinuation);
+
+ // XInteractionRequest
+ virtual ::com::sun::star::uno::Any SAL_CALL getRequest( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_INTERACTION_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/listenernotification.hxx b/include/comphelper/listenernotification.hxx
new file mode 100644
index 000000000000..21e2ea74723b
--- /dev/null
+++ b/include/comphelper/listenernotification.hxx
@@ -0,0 +1,298 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
+#define COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
+
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+#include <memory>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= OListenerContainer
+ //====================================================================
+ /** abstract base class which manages a listener container, including
+ THB's listener notification pattern which cares for removing listeners
+ which throw an DisposedException upon notification
+
+ Using this class is pretty easy:
+ <ul>
+ <li>Derive from it, and overwrite implNotify.</li>
+ <li>Use <member>impl_addListener</member> and <member>impl_removeListener</member> in your
+ XFoo::addFooListener and XFoo::removeFooListener methods.</li>
+ <li>call <member>impl_notify</member> whenever the event you want to notify happened</li>
+ <li>call <member>disposing</member> upon the disposal of your broadcaster.</li>
+ </ul>
+
+ See <type>OListenerContainerBase</type> for an implementation which even saves
+ you some more work, by doing the casts for you.
+
+ @see http://www.openoffice.org/servlets/ReadMsg?list=interface-announce&msgId=494345
+ @see OListenerContainerBase
+ */
+ class COMPHELPER_DLLPUBLIC OListenerContainer
+ {
+ private:
+ ::cppu::OInterfaceContainerHelper m_aListeners;
+
+ public:
+ /** sends a XEventObject::disposing notification to all listeners, and clears the
+ listener container
+
+ You'll usually call this from within your own dispose/disposing method
+ */
+ void disposing( const ::com::sun::star::lang::EventObject& _rEventSource );
+
+ /** clears the container without calling <member scope="com::sun::star::lang">XEventListener::disposing</member>
+ at the listeners
+ */
+ void clear();
+
+ /** determines whether the listener container is currently empty
+ */
+ inline bool
+ empty() const SAL_THROW(());
+
+ /** determines the number of elements in the container
+ */
+ inline size_t
+ size() const SAL_THROW(());
+
+ /** creates an iterator for looping through all registered listeners
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > createIterator()
+ {
+ ::std::auto_ptr< ::cppu::OInterfaceIteratorHelper > pIterator( new ::cppu::OInterfaceIteratorHelper( m_aListeners ) );
+ return pIterator;
+ }
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ protected:
+ OListenerContainer( ::osl::Mutex& _rMutex );
+
+ virtual ~OListenerContainer();
+
+ void impl_addListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener );
+ void impl_removeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener );
+
+ /** notifies all listeners of the given event, using THB's notification pattern
+
+ internally, this method will call <member>implNotify</member> for every listener
+
+ @return
+ <TRUE/> if all listeners have been notified, <FALSE/> else. The latter can happen
+ if <member>implNotify</member> cancelles the notification loop.
+
+ @see implNotify
+ */
+ bool impl_notify( const ::com::sun::star::lang::EventObject& _rEvent ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ protected:
+ /** call a single listener
+
+ @pure
+
+ @throws ::com::sun::star::uno::Exception
+ if the listener throws an exception during notification. Please don't catch
+ any listener exceptions in your implementation of this method, simply let them
+ pass to the caller.
+
+ @param _rxListener
+ specifies the listener to call. Is guaranteed to not be <NULL/>
+ @param _rEvent
+ the event to broadcast. This is the same as passed to <member>notify</member>, so if
+ your base class knows the type passed into <member>notify</member>, it can safely assume
+ that <arg>_rEvent</arg> is also of this type.
+
+ @return
+ <TRUE/> if the remaining listeners should be called, <FALSE/> if the notification
+ loop should be cancelled
+
+ @see notify
+ */
+ virtual bool implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ) = 0;
+ };
+
+ //====================================================================
+ inline bool OListenerContainer::empty() const SAL_THROW(())
+ {
+ return ( m_aListeners.getLength() == 0 );
+ }
+
+ inline size_t OListenerContainer::size() const SAL_THROW(())
+ {
+ return m_aListeners.getLength();
+ }
+
+ //====================================================================
+ //= OSimpleListenerContainer
+ //====================================================================
+ /** helper class for simple notification of the form LISTENER::METHOD( EVENT )
+
+ This class is not threadsafe!
+
+ @param LISTENER
+ the listener class to call, e.g. <type scope="com::sun::star::lang">XEventListener</type>
+ @param EVENT
+ the event type to notify, e.g. <type scope="com::sun::star::lang">EventObject</type>
+ */
+ template< class LISTENER, class EVENT >
+ class OSimpleListenerContainer : protected OListenerContainer
+ {
+ public:
+ typedef LISTENER ListenerClass;
+ typedef EVENT EventClass;
+ typedef void ( SAL_CALL LISTENER::*NotificationMethod )( const EventClass& );
+
+ private:
+ NotificationMethod m_pNotificationMethod;
+
+ public:
+ OSimpleListenerContainer( ::osl::Mutex& _rMutex )
+ :OListenerContainer( _rMutex )
+ ,m_pNotificationMethod( NULL )
+ {
+ }
+
+ inline void addListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_addListener( _rxListener.get() );
+ }
+
+ inline void removeListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_removeListener( _rxListener.get() );
+ }
+
+ // publish some otherwise hidden base functionality
+ using OListenerContainer::disposing;
+ using OListenerContainer::clear;
+ using OListenerContainer::empty;
+ using OListenerContainer::size;
+ using OListenerContainer::createIterator;
+
+ /// typed notification
+ inline bool notify( const EventClass& _rEvent, NotificationMethod _pNotify ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ protected:
+ inline virtual bool implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+ };
+
+ //--------------------------------------------------------------------
+ template< class LISTENER, class EVENT >
+ inline bool OSimpleListenerContainer< LISTENER, EVENT >::notify( const EventClass& _rEvent, NotificationMethod _pNotify ) SAL_THROW(( ::com::sun::star::uno::Exception ))
+ {
+ m_pNotificationMethod = _pNotify;
+ bool bRet = OListenerContainer::impl_notify( _rEvent );
+ m_pNotificationMethod = NULL;
+ return bRet;
+ }
+
+ //--------------------------------------------------------------------
+ template< class LISTENER, class EVENT >
+ inline bool OSimpleListenerContainer< LISTENER, EVENT >::implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent ) SAL_THROW( ( ::com::sun::star::uno::Exception ) )
+ {
+ const EventClass& rTypedEvent( static_cast< const EventClass& >( _rEvent ) );
+ ListenerClass* pTypedListener( static_cast< ListenerClass* >( _rxListener.get() ) );
+ (pTypedListener->*m_pNotificationMethod)( rTypedEvent );
+ return true;
+ }
+
+ //====================================================================
+ //= OListenerContainerBase
+ //====================================================================
+ /** is a specialization of OListenerContainer which saves you some additional type casts,
+ by making the required listener and event types template arguments.
+ */
+ template< class LISTENER, class EVENT >
+ class OListenerContainerBase : public OListenerContainer
+ {
+ public:
+ typedef LISTENER ListenerClass;
+ typedef EVENT EventClass;
+
+ public:
+ inline OListenerContainerBase( ::osl::Mutex& _rMutex ) : OListenerContainer( _rMutex )
+ {
+ }
+
+ inline void addTypedListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_addListener( _rxListener.get() );
+ }
+
+ inline void removeTypedListener( const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener )
+ {
+ OListenerContainer::impl_removeListener( _rxListener.get() );
+ }
+
+ inline bool notify( const EventClass& _rEvent )
+ {
+ return OListenerContainer::impl_notify( _rEvent );
+ }
+
+ using OListenerContainer::impl_notify;
+
+ protected:
+ inline virtual bool implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) );
+
+ virtual bool implTypedNotify(
+ const ::com::sun::star::uno::Reference< ListenerClass >& _rxListener,
+ const EventClass& _rEvent
+ ) SAL_THROW( ( ::com::sun::star::uno::Exception ) ) = 0;
+ };
+
+ template< class LISTENER, class EVENT >
+ inline bool OListenerContainerBase< LISTENER, EVENT >::implNotify(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& _rxListener,
+ const ::com::sun::star::lang::EventObject& _rEvent ) SAL_THROW( ( ::com::sun::star::uno::Exception ) )
+ {
+ return implTypedNotify(
+ ::com::sun::star::uno::Reference< ListenerClass >( static_cast< ListenerClass* >( _rxListener.get() ) ),
+ static_cast< const EventClass& >( _rEvent )
+ );
+ }
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_INC_COMPHELPER_LISTENERNOTIFICATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/logging.hxx b/include/comphelper/logging.hxx
new file mode 100644
index 000000000000..b6356384af3d
--- /dev/null
+++ b/include/comphelper/logging.hxx
@@ -0,0 +1,726 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_LOGGING_HXX
+#define COMPHELPER_LOGGING_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/logging/XLogHandler.hpp>
+#include <com/sun/star/logging/LogLevel.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= string conversions, employed by the templatized log* members of
+ //= EventLogger
+ //====================================================================
+
+ namespace log { namespace convert
+ {
+ inline const OUString& convertLogArgToString( const OUString& _rValue )
+ {
+ return _rValue;
+ }
+
+ inline OUString convertLogArgToString( const sal_Char* _pAsciiValue )
+ {
+ return OUString::createFromAscii( _pAsciiValue );
+ }
+
+ inline OUString convertLogArgToString( double _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( float _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int64 _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int32 _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Int16 _nValue ) { return OUString::valueOf( (sal_Int32)_nValue ); }
+ inline OUString convertLogArgToString( sal_Unicode _nValue ) { return OUString::valueOf( _nValue ); }
+ inline OUString convertLogArgToString( sal_Bool _nValue ) { return OUString::valueOf( _nValue ); }
+
+ } } // namespace log::convert
+
+ //====================================================================
+ //= EventLogger
+ //====================================================================
+ class EventLogger_Impl;
+ typedef ::boost::optional< OUString > OptionalString;
+
+ /** encapsulates an <type scope="com::sun::star::logging">XLogger</type>
+
+ The class silences several (unlikely) errors which could potentially happen
+ when working with a logger. Additionally, it provides some convenience methods
+ for logging events.
+
+ You can use this class as follows
+<pre>
+ EventLogger aLogger( xContext, sLoggerName );
+ ....
+ aLogger.log( LogLevel::SEVERE, sSomeMessage );
+ aLogger.logp( LogLevel::CONFIG, "MyClass", "MyMethod", sSomeMessage, SomeParameter1, SomeParameter2, SomeParameter3 );
+</pre>
+
+ The <code>log</code> and <code>logp</code> calls support up to 6 parameters, which can be of
+ arbitrary type. For every parameter, there must exist a function <code>convertLogArgToString</code>
+ which takes an argument of the respective type, and returns a string.
+
+ After a parameter has been converted to a string using the above mentioned
+ <code>convertLogArgToString</code> function, a placeholder $1$ (resp. $2$ resp. $4$ ...)
+ in the message will be replaced with this string, and the resulting message will be logged.
+ */
+ class COMPHELPER_DLLPUBLIC EventLogger
+ {
+ protected:
+ ::boost::shared_ptr< EventLogger_Impl > m_pImpl;
+
+ public:
+ /** creates an <code>EventLogger</code> instance working with a css.logging.XLogger
+ instance given by ASCII name.
+
+ @param _rxContext
+ the component context to create services
+
+ @param _rLoggerName
+ the ASCII name of the logger to create.
+ */
+ EventLogger(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const sal_Char* _pAsciiLoggerName
+ );
+
+ ~EventLogger();
+
+ public:
+ /// determines whether an event with the given level would be logged
+ bool isLoggable( const sal_Int32 _nLogLevel ) const;
+
+ //----------------------------------------------------------------
+ //- XLogger::log equivalents/wrappers
+ //- string messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool log( const sal_Int32 _nLogLevel, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::log equivalents/wrappers
+ //- ASCII messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ) );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Char* _pMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, OUString::createFromAscii( _pMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::logp equivalents/wrappers
+ //- string messages
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the logp level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const OUString& _rMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, _rMessage,
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::logp equivalents/wrappers
+ //- ASCII messages
+
+ /// logs a given ASCII message, without any arguments, or source class/method names
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ) );
+ return false;
+ }
+
+ /** logs a given ASCII message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the logp level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Char* _pAsciiMessage, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, OUString::createFromAscii( _pAsciiMessage ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ protected:
+ bool impl_log(
+ const sal_Int32 _nLogLevel,
+ const sal_Char* _pSourceClass,
+ const sal_Char* _pSourceMethod,
+ const OUString& _rMessage,
+ const OptionalString& _rArgument1 = OptionalString(),
+ const OptionalString& _rArgument2 = OptionalString(),
+ const OptionalString& _rArgument3 = OptionalString(),
+ const OptionalString& _rArgument4 = OptionalString(),
+ const OptionalString& _rArgument5 = OptionalString(),
+ const OptionalString& _rArgument6 = OptionalString()
+ ) const;
+ };
+
+ //====================================================================
+ //= ResourceBasedEventLogger
+ //====================================================================
+ struct ResourceBasedEventLogger_Data;
+ /** extends the EventLogger class with functionality to load log messages from
+ a resource bundle.
+ */
+ class COMPHELPER_DLLPUBLIC ResourceBasedEventLogger : public EventLogger
+ {
+ private:
+ ::boost::shared_ptr< ResourceBasedEventLogger_Data > m_pData;
+
+ public:
+ /** creates a resource based event logger
+ @param _rxContext
+ the component context for creating new components
+ @param _pResourceBundleBaseName
+ the ASCII base name of the resource bundle to use. Will be used
+ in conjunction with XResourceBundleLoader::loadResource.
+ @param _pAsciiLoggerName
+ the ASCII name of the logger to work with. If NULL, the office-wide
+ default logger will be used.
+
+ */
+ ResourceBasedEventLogger(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const sal_Char* _pResourceBundleBaseName,
+ const sal_Char* _pAsciiLoggerName = NULL
+ );
+
+ //----------------------------------------------------------------
+ //- XLogger::log equivalents/wrappers
+ //- resource IDs
+
+ /// logs a given message, without any arguments, or source class/method names
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ) );
+ return false;
+ }
+
+ /** logs a given message, replacing a placeholder in the message with an argument
+
+ The function takes, additionally to the log level and the message, an arbitrary
+ argument. This argument is converted to a string using an overloaded function
+ named <code>convertLogArgToString</code>. Then, a placeholder &quot;$1$&quot;
+ is searched in the message string, and replaced with the argument string.
+ */
+ template< typename ARGTYPE1 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool log( const sal_Int32 _nLogLevel, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, NULL, NULL, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ //----------------------------------------------------------------
+ //- XLogger::logp equivalents/wrappers
+ //- resource IDs
+
+ /// logs a given ASCII message, without any arguments, or source class/method names
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ) );
+ return false;
+ }
+
+ /** logs a given ASCII message, replacing a placeholder in the message with an argument
+ */
+ template< typename ARGTYPE1 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 2 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 3 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 4 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 5 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ) );
+ return false;
+ }
+
+ /// logs a given ASCII message, replacing 6 placeholders in the message with respective values
+ template< typename ARGTYPE1, typename ARGTYPE2, typename ARGTYPE3, typename ARGTYPE4, typename ARGTYPE5, typename ARGTYPE6 >
+ bool logp( const sal_Int32 _nLogLevel, const sal_Char* _pSourceClass, const sal_Char* _pSourceMethod, const sal_Int32 _nMessageResID, ARGTYPE1 _argument1, ARGTYPE2 _argument2, ARGTYPE3 _argument3, ARGTYPE4 _argument4, ARGTYPE5 _argument5, ARGTYPE6 _argument6 ) const
+ {
+ if ( isLoggable( _nLogLevel ) )
+ return impl_log( _nLogLevel, _pSourceClass, _pSourceMethod, impl_loadStringMessage_nothrow( _nMessageResID ),
+ OptionalString( log::convert::convertLogArgToString( _argument1 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument2 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument3 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument4 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument5 ) ),
+ OptionalString( log::convert::convertLogArgToString( _argument6 ) ) );
+ return false;
+ }
+
+ private:
+ OUString impl_loadStringMessage_nothrow( const sal_Int32 _nMessageResID ) const;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_LOGGING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/make_shared_from_uno.hxx b/include/comphelper/make_shared_from_uno.hxx
new file mode 100644
index 000000000000..2a70094a3f94
--- /dev/null
+++ b/include/comphelper/make_shared_from_uno.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX
+#define INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX
+
+#include "boost/shared_ptr.hpp"
+#include <functional>
+
+namespace comphelper {
+
+/// @internal
+namespace detail {
+/// @internal
+template <typename T> struct ReleaseFunc : ::std::unary_function<T *, void> {
+ void operator()( T * p ) const { p->release(); }
+};
+} // namespace detail
+
+/** Makes a boost::shared_ptr from a ref-counted UNO object pointer.
+ This makes sense if the object is used via UNO (implementing some X
+ interface) and also internally using its implementation class, e.g.
+
+ <pre>
+ boost::shared_ptr<MyUnoImpl> const ptr(
+ comphelper::make_shared_from_UNO( new MyUnoImpl ) );
+ ...
+ xUno->callingUno( uno::Reference<XSomeInterface>( ptr.get() ) );
+ ...
+ takeSharedPtr( ptr );
+ ...
+ </pre>
+
+ @attention The shared_ptr operates on a separate reference counter, so
+ weak pointers (boost::weak_ptr) are invalidated when the last
+ shared_ptr is destroyed, although the UNO object may still be
+ alive.
+
+ @param p object pointer
+ @return shared_ptr to object
+*/
+template <typename T>
+inline ::boost::shared_ptr<T> make_shared_from_UNO( T * p )
+{
+ p->acquire();
+ return ::boost::shared_ptr<T>( p, detail::ReleaseFunc<T>() );
+}
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_MAKE_SHARED_FROM_UNO_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/makesequence.hxx b/include/comphelper/makesequence.hxx
new file mode 100644
index 000000000000..bc35657db9a8
--- /dev/null
+++ b/include/comphelper/makesequence.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_MAKESEQUENCE_HXX_INCLUDED
+#define COMPHELPER_MAKESEQUENCE_HXX_INCLUDED
+
+#include "com/sun/star/uno/Sequence.hxx"
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repetition.hpp"
+#include "boost/preprocessor/arithmetic/add.hpp"
+
+namespace comphelper {
+
+/** Creates a uno::Sequence out of one parameter.
+*/
+template <typename T>
+inline ::com::sun::star::uno::Sequence<T> makeSequence( T const& element )
+{
+ return ::com::sun::star::uno::Sequence<T>( &element, 1 );
+}
+
+#define COMPHELPER_MAKESEQUENCE_assign(z_, n_, unused_) \
+ p[n_] = BOOST_PP_CAT(element, n_);
+
+/** The following preprocessor repetitions generate functions like
+
+ <pre>
+ template <typename T>
+ inline ::com::sun::star::uno::Sequence<T> makeSequence(
+ T const& element0, T const& element1, ... );
+ </pre>
+
+ which make a sequence out of the passed elements.
+
+ The maximum number of elements can be set by defining
+ COMPHELPER_MAKESEQUENCE_MAX_ARGS; its default is 12.
+*/
+#define COMPHELPER_MAKESEQUENCE_make(z_, n_, unused_) \
+template <typename T> \
+inline ::com::sun::star::uno::Sequence<T> makeSequence( \
+ BOOST_PP_ENUM_PARAMS(n_, T const& element) ) \
+{ \
+ ::com::sun::star::uno::Sequence<T> seq( n_ ); \
+ T * p = seq.getArray(); \
+ BOOST_PP_REPEAT(n_, COMPHELPER_MAKESEQUENCE_assign, ~) \
+ return seq; \
+}
+
+#ifndef COMPHELPER_MAKESEQUENCE_MAX_ARGS
+#define COMPHELPER_MAKESEQUENCE_MAX_ARGS 12
+#endif
+
+BOOST_PP_REPEAT_FROM_TO(2, BOOST_PP_ADD(COMPHELPER_MAKESEQUENCE_MAX_ARGS, 1),
+ COMPHELPER_MAKESEQUENCE_make, ~)
+
+#undef COMPHELPER_MAKESEQUENCE_MAX_ARGS
+#undef COMPHELPER_MAKESEQUENCE_make
+#undef COMPHELPER_MAKESEQUENCE_assign
+
+} // namespace comphelper
+
+#endif // ! defined(COMPHELPER_MAKESEQUENCE_HXX_INCLUDED)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/mediadescriptor.hxx b/include/comphelper/mediadescriptor.hxx
new file mode 100644
index 000000000000..7c7174644292
--- /dev/null
+++ b/include/comphelper/mediadescriptor.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MEDIADESCRIPTOR_HXX_
+#define _COMPHELPER_MEDIADESCRIPTOR_HXX_
+
+#include <comphelper/sequenceashashmap.hxx>
+#include <rtl/ustring.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace io {
+ class XInputStream;
+} } } }
+
+namespace comphelper{
+
+/** @short can be used to work with a <type scope="::com::sun::star::document">MediaDescriptor</type>
+ struct.
+
+ @descr It wraps a ::boost::unordered_map around the Sequence< css::beans::PropertyValue >, which
+ represent the MediaDescriptor item.
+ Further this helper defines often used functions (as e.g. open of the required streams,
+ consistent checks etcpp.) and it defines all useable property names.
+
+ @attention This class isnt threadsafe and must be guarded from outside!
+ */
+class COMPHELPER_DLLPUBLIC MediaDescriptor : public SequenceAsHashMap
+{
+ public:
+
+ //---------------------------------------
+ /** @short these methods can be used to get the different property names
+ as static const OUString values.
+
+ @descr Because definition and declaration of static const class members
+ does not work as expected under windows (under unix it works as well)
+ these way must be used :-(
+ */
+ static const OUString& PROP_ABORTED();
+ static const OUString& PROP_ASTEMPLATE();
+ static const OUString& PROP_COMPONENTDATA();
+ static const OUString& PROP_DOCUMENTSERVICE();
+ static const OUString& PROP_ENCRYPTIONDATA();
+ static const OUString& PROP_FILENAME();
+ static const OUString& PROP_FILTERNAME();
+ static const OUString& PROP_FILTERPROVIDER();
+ static const OUString& PROP_FILTEROPTIONS();
+ static const OUString& PROP_FRAME();
+ static const OUString& PROP_FRAMENAME();
+ static const OUString& PROP_HIDDEN();
+ static const OUString& PROP_INPUTSTREAM();
+ static const OUString& PROP_INTERACTIONHANDLER();
+ static const OUString& PROP_JUMPMARK();
+ static const OUString& PROP_MACROEXECUTIONMODE();
+ static const OUString& PROP_MEDIATYPE();
+ static const OUString& PROP_MINIMIZED();
+ static const OUString& PROP_NOAUTOSAVE();
+ static const OUString& PROP_OPENNEWVIEW();
+ static const OUString& PROP_OUTPUTSTREAM();
+ static const OUString& PROP_PASSWORD();
+ static const OUString& PROP_POSTDATA();
+ static const OUString& PROP_PREVIEW();
+ static const OUString& PROP_READONLY();
+ static const OUString& PROP_REFERRER();
+ static const OUString& PROP_SALVAGEDFILE();
+ static const OUString& PROP_STATUSINDICATOR();
+ static const OUString& PROP_STREAM();
+ static const OUString& PROP_STREAMFOROUTPUT();
+ static const OUString& PROP_TEMPLATENAME();
+ static const OUString& PROP_TITLE();
+ static const OUString& PROP_TYPENAME();
+ static const OUString& PROP_UCBCONTENT();
+ static const OUString& PROP_UPDATEDOCMODE();
+ static const OUString& PROP_URL();
+ static const OUString& PROP_VERSION();
+ static const OUString& PROP_DOCUMENTTITLE();
+ static const OUString& PROP_MODEL();
+ static const OUString& PROP_VIEWONLY();
+ static const OUString& PROP_DOCUMENTBASEURL();
+
+ static const OUString& PROP_DEEPDETECTION();
+
+ //-------------------------------------------
+ // interface
+ public:
+ //---------------------------------------
+ /** @short these ctors do nothing - excepting that they forward
+ the given parameters to the base class ctors.
+
+ @descr The ctros must be overwritten to resolve conflicts with
+ the default ctors of the compiler :-(.
+ */
+ MediaDescriptor();
+ MediaDescriptor(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lSource);
+
+ //---------------------------------------
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automaticly,
+ to solve problems!
+
+ In case of local file the system file locking is used.
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ sal_Bool addInputStream();
+
+ //---------------------------------------
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automaticly,
+ to solve problems!
+
+ In case of local file the system file locking is used based on
+ configuration settings.
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ sal_Bool addInputStreamOwnLock();
+
+ //---------------------------------------
+ /** @short it checks if the descriptor describes a readonly stream.
+
+ @descr The descriptor itself isnt changed doing so.
+ It's only checked if the stream seems to be based
+ of a real readonly file.
+
+ @Attention
+ We dont check the property "ReadOnly" here. Because
+ this property can be set from outside and overwrites
+ the readonly state of the stream.
+ If e.g. the stream could be opened read/write ...
+ but "ReadOnly" property is set to TRUE, this means:
+ show a readonly UI on top of this read/write stream.
+
+ @return TRUE, if the stream must be interpreted as readonly ...
+ FALSE otherwise.
+ */
+ sal_Bool isStreamReadOnly() const;
+
+ //---------------------------------------
+ /** Returns a value from the sequence contained in the property
+ 'ComponentData' of this media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>.
+
+ @return The value with the specified name, if existing in the
+ sequence of the 'ComponentData' property, otherwise an empty
+ Any.
+ */
+ ::com::sun::star::uno::Any getComponentDataEntry(
+ const OUString& rName ) const;
+
+ //---------------------------------------
+ /** Inserts a value into the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>. The passed value
+ will be inserted into the sequence, or, if already existing,
+ will be overwritten.
+
+ @param rName The name of the value to be inserted into the
+ sequence of the 'ComponentData' property.
+
+ @param rValue The value to be inserted into the sequence of the
+ 'ComponentData' property.
+ */
+ void setComponentDataEntry(
+ const OUString& rName,
+ const ::com::sun::star::uno::Any& rValue );
+
+ //---------------------------------------
+ /** Removes a value from the sequence contained in the property
+ 'ComponentData' of the media descriptor.
+
+ @descr The property 'ComponentData' should be empty, or should
+ contain a value of type sequence<com.sun.star.beans.NamedValue>
+ or sequence<com.sun.star.beans.PropertyValue>. The value with
+ the passed name will be removed from the sequence, if existing.
+
+ @param rName The name of the value to be removed from the sequence
+ of the 'ComponentData' property.
+ */
+ void clearComponentDataEntry(
+ const OUString& rName );
+
+ //-------------------------------------------
+ // helper
+ private:
+
+ //---------------------------------------
+ /** @short tries to open a stream by using the given PostData stream.
+
+ @descr The stream is used directly ...
+
+ The MediaDescriptor itself is changed inside this method.
+ Means: the stream is added internal and not returned by a value.
+
+ @param _rxPostData
+ the PostData stream.
+
+ @return TRUE if the stream could be added successfully.
+ Note: If FALSE is returned, the error was already handled inside!
+
+ @throw [css::uno::RuntimeException]
+ if the MediaDescriptor seems to be invalid!
+
+ @throw [css::lang::IllegalArgumentException]
+ if the given PostData stream is <NULL/>.
+ */
+ COMPHELPER_DLLPRIVATE sal_Bool impl_openStreamWithPostData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& _rxPostData
+ ) throw(::com::sun::star::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @short tries to open a stream by using the given URL.
+
+ @descr First it tries to open the content in r/w mode (if its
+ allowed to do so). Only in case its not allowed or it failed
+ the stream will be tried to open in readonly mode.
+
+ The MediaDescriptor itself is changed inside this method.
+ Means: the stream is added internal and not returned by a value.
+
+ @param sURL
+ the URL for open.
+
+ @param bLockFile
+ specifies whether the file should be locked
+
+ @return TRUE if the stream could be added successfully.
+ Note: If FALSE is returned, the error was already handled inside!
+
+ @throw [css::uno::RuntimeException]
+ if the MediaDescriptor seems to be invalid!
+ */
+ COMPHELPER_DLLPRIVATE sal_Bool impl_openStreamWithURL(
+ const OUString& sURL,
+ sal_Bool bLockFile
+ ) throw(::com::sun::star::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @short some URL parts can make trouble for opening streams (e.g. jumpmarks.)
+ An URL should be "normalized" before its used.
+
+ @param sURL
+ the original URL (e.g. including a jumpmark)
+
+ @return [string]
+ the "normalized" URL (e.g. without jumpmark)
+ */
+ COMPHELPER_DLLPRIVATE OUString impl_normalizeURL(const OUString& sURL);
+
+ //---------------------------------------
+ /** @short it checks if the descriptor already has a valid
+ InputStream item and creates a new one, if not.
+
+ @descr This method uses the current items of this MediaDescriptor,
+ to open the stream (as e.g. URL, ReadOnly, PostData etcpp.).
+ It creates a seekable stream and put it into the descriptor.
+
+ A might existing InteractionHandler will be used automaticly,
+ to solve problems!
+
+ @param bLockFile
+ specifies whether the file should be locked
+
+ @return TRUE, if the stream was already part of the descriptor or could
+ be created as new item. FALSE otherwise.
+ */
+ COMPHELPER_DLLPRIVATE sal_Bool impl_addInputStream( sal_Bool bLockFile );
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_MEDIADESCRIPTOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/mimeconfighelper.hxx b/include/comphelper/mimeconfighelper.hxx
new file mode 100644
index 000000000000..6e2b128d5a23
--- /dev/null
+++ b/include/comphelper/mimeconfighelper.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_MIMECONFIGHELPER_HXX_
+#define _COMPHELPER_MIMECONFIGHELPER_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XContainerQuery.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/embed/VerbDescriptor.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+
+namespace comphelper {
+
+class COMPHELPER_DLLPUBLIC MimeConfigurationHelper
+{
+ ::osl::Mutex m_aMutex;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xObjectConfig;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xVerbsConfig;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xMediaTypeConfig;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xFilterFactory;
+
+public:
+
+ MimeConfigurationHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+
+ static OUString GetStringClassIDRepresentation( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassIDRepresentation( const OUString& aClassID );
+
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ GetConfigurationByPath( const OUString& aPath );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetObjConfiguration();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetVerbsConfiguration();
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetMediaTypeConfiguration();
+
+
+ OUString GetDocServiceNameFromFilter( const OUString& aFilterName );
+
+ OUString GetDocServiceNameFromMediaType( const OUString& aMediaType );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjPropsFromConfigEntry(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xObjectProps );
+
+ sal_Bool GetVerbByShortcut( const OUString& aVerbShortcut,
+ ::com::sun::star::embed::VerbDescriptor& aDescriptor );
+
+ OUString GetExplicitlyRegisteredObjClassID( const OUString& aMediaType );
+
+
+ // retrieving object description from configuration
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByStringClassID(
+ const OUString& aStringClassID );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByClassID(
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByMediaType(
+ const OUString& aMediaType );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByFilter(
+ const OUString& aFilterName );
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetObjectPropsByDocumentName(
+ const OUString& aDocumentName );
+
+ // retrieving object factory from configuration
+ OUString GetFactoryNameByStringClassID( const OUString& aStringClassID );
+ OUString GetFactoryNameByClassID( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID );
+ OUString GetFactoryNameByDocumentName( const OUString& aDocName );
+ OUString GetFactoryNameByMediaType( const OUString& aMediaType );
+
+ // typedetection related
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > GetFilterFactory();
+
+ OUString UpdateMediaDescriptorWithFilterName(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
+ sal_Bool bIgnoreType );
+ OUString UpdateMediaDescriptorWithFilterName(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObject );
+#ifdef WNT
+ sal_Int32 GetFilterFlags( const OUString& aFilterName );
+
+ sal_Bool AddFilterNameCheckOwnFile(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr );
+#endif
+
+ OUString GetDefaultFilterFromServiceName( const OUString& aServName, sal_Int32 nVersion );
+
+ OUString GetExportFilterFromImportFilter( const OUString& aImportFilterName );
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SearchForFilter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerQuery >& xFilterQuery,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aSearchRequest,
+ sal_Int32 nMustFlags,
+ sal_Int32 nDontFlags );
+
+ static sal_Bool ClassIDsEqual( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID1,
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID2 );
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GetSequenceClassID( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3,
+ sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11,
+ sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15 );
+};
+
+}
+
+#endif // _COMPHELPER_MIMECONFIGHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/namecontainer.hxx b/include/comphelper/namecontainer.hxx
new file mode 100644
index 000000000000..6ac5aff190fb
--- /dev/null
+++ b/include/comphelper/namecontainer.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_NAMECONTAINER_HXX_
+#define _COMPHELPER_NAMECONTAINER_HXX_
+
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+ NameContainer_createInstance( ::com::sun::star::uno::Type aType );
+}
+
+#endif // _COMPHELPER_NAMECONTAINER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/namedvaluecollection.hxx b/include/comphelper/namedvaluecollection.hxx
new file mode 100644
index 000000000000..93b53dd14c6c
--- /dev/null
+++ b/include/comphelper/namedvaluecollection.hxx
@@ -0,0 +1,376 @@
+/* -*- 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 COMPHELPER_NAMEDVALUECOLLECTION_HXX
+#define COMPHELPER_NAMEDVALUECOLLECTION_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <memory>
+#include <algorithm>
+#include <vector>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ // ====================================================================
+ // = NamedValueCollection
+ // ====================================================================
+ struct NamedValueCollection_Impl;
+ /** a collection of named values, packed in various formats.
+ */
+ class COMPHELPER_DLLPUBLIC NamedValueCollection
+ {
+ private:
+ ::std::auto_ptr< NamedValueCollection_Impl > m_pImpl;
+
+ public:
+ NamedValueCollection();
+
+ NamedValueCollection( const NamedValueCollection& _rCopySource );
+
+ NamedValueCollection& operator=( const NamedValueCollection& i_rCopySource );
+
+ /** constructs a collection
+ @param _rElements
+ the wrapped elements of the collection. The <code>Any</code> might contain a sequence of
+ property values, a sequence of named values, or directly a property value or named value.
+ All other cases are worth an assertion in non-product builds.
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Any& _rElements );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of Any's containing either PropertyValue's or NamedValue's.
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of PropertyValues's
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments );
+
+ /** constructs a collection
+ @param _rArguments
+ a sequence of NamedValue's
+ */
+ NamedValueCollection( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments );
+
+ ~NamedValueCollection();
+
+ inline void assign( const ::com::sun::star::uno::Any& i_rWrappedElements )
+ {
+ impl_assign( i_rWrappedElements );
+ }
+
+ inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ inline void assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments )
+ {
+ impl_assign( _rArguments );
+ }
+
+ inline void clear()
+ {
+ impl_assign( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >() );
+ }
+
+ /** determines whether or not named values can be extracted from the given value
+
+ @return
+ <TRUE/> if and only if the given <code>Any</code> contains a <code>NamedValue</code>, a
+ <code>PropertyValue</code>, or a sequence thereof.
+ */
+ static bool canExtractFrom( ::com::sun::star::uno::Any const & i_value );
+
+ /// returns the number of elements in the collection
+ size_t size() const;
+
+ /// determines whether the collection is empty
+ bool empty() const;
+
+ /** returns the names of all elements in the collection
+ */
+ ::std::vector< OUString >
+ getNames() const;
+
+ /** merges the content of another collection into |this|
+ @param _rAdditionalValues
+ the collection whose values are to be merged
+ @param _bOverwriteExisting
+ defines whether or not elements which are already present in |this|
+ should be overwritten (<TRUE/>) or preserved (<FALSE/>).
+ @return |*this|
+ */
+ NamedValueCollection&
+ merge(
+ const NamedValueCollection& _rAdditionalValues,
+ bool _bOverwriteExisting
+ );
+
+ /** retrieves a value with a given name from the collection, if it is present
+
+ @param _pAsciiValueName
+ the ASCII name of the value to retrieve
+
+ @param _out_rValue
+ is the output parameter taking the desired value upon successful return. If
+ a value with the given name is not present in the collection, or if a wrong-typed
+ value is present, then this parameter will not be touched.
+
+ @return
+ <TRUE/> if there is a value with the given name, which could successfully
+ be extraced. In this case, <arg>_out_rValue</arg> will contain the requested
+ value.<br/>
+ <FALSE/>, if there is no value with the given name.
+ @throws IllegalArgumentException
+ in case there is a value with the given name, but it cannot legally assigned to
+ _out_rValue.
+ */
+ template < typename VALUE_TYPE >
+ bool get_ensureType( const sal_Char* _pAsciiValueName, VALUE_TYPE& _out_rValue ) const
+ {
+ return get_ensureType( OUString::createFromAscii( _pAsciiValueName ), &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
+ }
+
+ template < typename VALUE_TYPE >
+ bool get_ensureType( const OUString& _rValueName, VALUE_TYPE& _out_rValue ) const
+ {
+ return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
+ }
+
+ /** retrieves a value with a given name, or defaults it to a given value, if its not present
+ in the colllection
+ */
+ template < typename VALUE_TYPE >
+ VALUE_TYPE getOrDefault( const sal_Char* _pAsciiValueName, const VALUE_TYPE& _rDefault ) const
+ {
+ return getOrDefault( OUString::createFromAscii( _pAsciiValueName ), _rDefault );
+ }
+
+ template < typename VALUE_TYPE >
+ VALUE_TYPE getOrDefault( const OUString& _rValueName, const VALUE_TYPE& _rDefault ) const
+ {
+ VALUE_TYPE retVal( _rDefault );
+ get_ensureType( _rValueName, retVal );
+ return retVal;
+ }
+
+ /** retrieves a (untyped) value with a given name
+
+ If the collection does not contain a value with the given name, an empty
+ Any is returned.
+ */
+ const ::com::sun::star::uno::Any& get( const sal_Char* _pAsciiValueName ) const
+ {
+ return get( OUString::createFromAscii( _pAsciiValueName ) );
+ }
+
+ /** retrieves a (untyped) value with a given name
+
+ If the collection does not contain a value with the given name, an empty
+ Any is returned.
+ */
+ const ::com::sun::star::uno::Any& get( const OUString& _rValueName ) const
+ {
+ return impl_get( _rValueName );
+ }
+
+ /// determines whether a value with a given name is present in the collection
+ inline bool has( const sal_Char* _pAsciiValueName ) const
+ {
+ return impl_has( OUString::createFromAscii( _pAsciiValueName ) );
+ }
+
+ /// determines whether a value with a given name is present in the collection
+ inline bool has( const OUString& _rValueName ) const
+ {
+ return impl_has( _rValueName );
+ }
+
+ /** puts a value into the collection
+
+ @return <TRUE/> if and only if a value was already present previously, in
+ which case it has been overwritten.
+ */
+ template < typename VALUE_TYPE >
+ inline bool put( const sal_Char* _pAsciiValueName, const VALUE_TYPE& _rValue )
+ {
+ return impl_put( OUString::createFromAscii( _pAsciiValueName ), ::com::sun::star::uno::makeAny( _rValue ) );
+ }
+
+ /** puts a value into the collection
+
+ @return <TRUE/> if and only if a value was already present previously, in
+ which case it has been overwritten.
+ */
+ template < typename VALUE_TYPE >
+ inline bool put( const OUString& _rValueName, const VALUE_TYPE& _rValue )
+ {
+ return impl_put( _rValueName, ::com::sun::star::uno::makeAny( _rValue ) );
+ }
+
+ inline bool put( const sal_Char* _pAsciiValueName, const ::com::sun::star::uno::Any& _rValue )
+ {
+ return impl_put( OUString::createFromAscii( _pAsciiValueName ), _rValue );
+ }
+
+ inline bool put( const OUString& _rValueName, const ::com::sun::star::uno::Any& _rValue )
+ {
+ return impl_put( _rValueName, _rValue );
+ }
+
+ /** removes the value with the given name from the collection
+
+ @return <TRUE/> if and only if a value with the given name existed in the collection.
+ */
+ inline bool remove( const sal_Char* _pAsciiValueName )
+ {
+ return impl_remove( OUString::createFromAscii( _pAsciiValueName ) );
+ }
+
+ /** removes the value with the given name from the collection
+
+ @return <TRUE/> if and only if a value with the given name existed in the collection.
+ */
+ inline bool remove( const OUString& _rValueName )
+ {
+ return impl_remove( _rValueName );
+ }
+
+ /** transforms the collection to a sequence of PropertyValues
+
+ @return
+ the number of elements in the sequence
+ */
+ sal_Int32 operator >>= ( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _out_rValues ) const;
+
+ /** transforms the collection to a sequence of NamedValues
+
+ @return
+ the number of elements in the sequence
+ */
+ sal_Int32 operator >>= ( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rValues ) const;
+
+ /** transforms the collection into a sequence of PropertyValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ getPropertyValues() const
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aValues;
+ *this >>= aValues;
+ return aValues;
+ }
+
+ /** returns a Sequence< Any >, containing PropertyValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getWrappedPropertyValues() const
+ {
+ return impl_wrap< ::com::sun::star::beans::PropertyValue >();
+ }
+
+ /** returns a Sequence< Any >, containing NamedValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+ getWrappedNamedValues() const
+ {
+ return impl_wrap< ::com::sun::star::beans::NamedValue >();
+ }
+
+ /** transforms the collection into a sequence of NamedValues
+ */
+ inline ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
+ getNamedValues() const
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > aValues;
+ *this >>= aValues;
+ return aValues;
+ }
+
+ private:
+ void impl_assign( const ::com::sun::star::uno::Any& i_rWrappedElements );
+ void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& _rArguments );
+ void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rArguments );
+ void impl_assign( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArguments );
+
+ bool get_ensureType(
+ const OUString& _rValueName,
+ void* _pValueLocation,
+ const ::com::sun::star::uno::Type& _rExpectedValueType
+ ) const;
+
+ const ::com::sun::star::uno::Any&
+ impl_get( const OUString& _rValueName ) const;
+
+ bool impl_has( const OUString& _rValueName ) const;
+
+ bool impl_put( const OUString& _rValueName, const ::com::sun::star::uno::Any& _rValue );
+
+ bool impl_remove( const OUString& _rValueName );
+
+ template< class VALUE_TYPE >
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > impl_wrap() const
+ {
+ ::com::sun::star::uno::Sequence< VALUE_TYPE > aValues;
+ *this >>= aValues;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aWrappedValues( aValues.getLength() );
+ ::com::sun::star::uno::Any (* const makeAny)(const VALUE_TYPE&) = ::com::sun::star::uno::makeAny< VALUE_TYPE >;
+ ::std::transform(
+ aValues.getConstArray(),
+ aValues.getConstArray() + aValues.getLength(),
+ aWrappedValues.getArray(),
+ makeAny
+ );
+ return aWrappedValues;
+ }
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_NAMEDVALUECOLLECTION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/newarray.hxx b/include/comphelper/newarray.hxx
new file mode 100644
index 000000000000..b64095ae8ff4
--- /dev/null
+++ b/include/comphelper/newarray.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_NEW_ARRAY_HXX
+#define COMPHELPER_NEW_ARRAY_HXX
+
+#include <limits>
+#include <new>
+#include <stddef.h>
+
+namespace comphelper {
+
+template<typename T> T *
+newArray_null(size_t const n) throw()
+{
+ if (((::std::numeric_limits<size_t>::max)() / sizeof(T)) <= n) {
+ return 0;
+ }
+ return new (::std::nothrow) T[n];
+}
+
+template<typename T> T *
+newArray_ex(size_t const n)
+{
+ if (((::std::numeric_limits<size_t>::max)() / sizeof(T)) <= n) {
+ throw ::std::bad_alloc();
+ }
+ return new T[n];
+}
+
+} // namespace comphelper
+
+#endif // COMPHELPER_NEW_ARRAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/numberedcollection.hxx b/include/comphelper/numberedcollection.hxx
new file mode 100644
index 000000000000..6a311767658d
--- /dev/null
+++ b/include/comphelper/numberedcollection.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_NUMBEREDCOLLECTION_HXX_
+#define _COMPHELPER_NUMBEREDCOLLECTION_HXX_
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+#include <vector>
+#include <boost/unordered_map.hpp>
+
+
+namespace comphelper{
+
+/** @short defines a collection of UNO components, where every component will get it's own unique number.
+
+ @descr Such number will be unique at runtime only ... but it supports fragmentation.
+ Note: This collection uses weak refrences only to know her components.
+ So lifetime of thise components must be controlled outside.
+
+ @threadsafe
+ */
+class COMPHELPER_DLLPUBLIC NumberedCollection : private ::cppu::BaseMutex
+ , public ::cppu::WeakImplHelper1< css::frame::XUntitledNumbers >
+{
+ //-------------------------------------------
+ // types, const
+ private:
+
+ struct TNumberedItem
+ {
+ css::uno::WeakReference< css::uno::XInterface > xItem;
+ ::sal_Int32 nNumber;
+ };
+
+ typedef ::boost::unordered_map<
+ long ,
+ TNumberedItem ,
+ ::boost::hash< long > ,
+ ::std::equal_to< long > > TNumberedItemHash;
+
+ typedef ::std::vector< long > TDeadItemList;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short lightweight constructor.
+ */
+ NumberedCollection();
+
+ //---------------------------------------
+ /** @short free all internaly used resources.
+ */
+ virtual ~NumberedCollection();
+
+ //---------------------------------------
+ /** set an outside component which uses this container and must be set
+ as source of all broadcasted messages, exceptions.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be allowed. It will reset the internal
+ member reference only.
+
+ @param xOwner
+ the new owner of this collection.
+ */
+ void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner);
+
+ //---------------------------------------
+ /** set the localized prefix to be used for untitled components.
+
+ Localization has to be done outside. This container will return
+ those value then. There are no further checks. Its up to you to define
+ a suitable string here :-)
+
+ @param sPrefix
+ the new prefix for untitled components.
+ */
+ void setUntitledPrefix(const OUString& sPrefix);
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual ::sal_Int32 SAL_CALL leaseNumber(const css::uno::Reference< css::uno::XInterface >& xComponent)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual void SAL_CALL releaseNumber(::sal_Int32 nNumber)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual void SAL_CALL releaseNumberForComponent(const css::uno::Reference< css::uno::XInterface >& xComponent)
+ throw (css::lang::IllegalArgumentException,
+ css::uno::RuntimeException );
+
+ //---------------------------------------
+ /** @see css.frame.XUntitledNumbers */
+ virtual OUString SAL_CALL getUntitledPrefix()
+ throw (css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // internal
+ private:
+
+ //---------------------------------------
+ /** @short trys to find an unique number not already used within this collection.
+
+ @descr It reuses the smalles number which isnt used by any component
+ of this collection. (fragmentation!) If collection is full (means there
+ is no free number) the special value INVALID_NUMBER will be returned.
+
+ @note Those method cant be called within a multithreaded environment ..
+ Because such number wont be "reserved" for the calli of these method
+ it can happen that two calls returns the same number (reasoned by the fact that first calli
+ doesnt used the returned number already.
+
+ So the outside code has to make sure that retrieving and using of those number
+ will be an atomic operation.
+
+ @return an unique number or special value INVALID_NUMBER if collection is full.
+ */
+ ::sal_Int32 impl_searchFreeNumber ();
+
+ void impl_cleanUpDeadItems ( TNumberedItemHash& lItems ,
+ const TDeadItemList& lDeadItems);
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /// localized string to be used for untitled components
+ OUString m_sUntitledPrefix;
+
+ /// cache of all "leased numbers" and its bound components
+ TNumberedItemHash m_lComponents;
+
+ /// used as source of broadcasted messages or exceptions (can be null !)
+ css::uno::WeakReference< css::uno::XInterface > m_xOwner;
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_NUMBEREDCOLLECTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/numbers.hxx b/include/comphelper/numbers.hxx
new file mode 100644
index 000000000000..b64fe341da4f
--- /dev/null
+++ b/include/comphelper/numbers.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_NUMBERS_HXX_
+#define _COMPHELPER_NUMBERS_HXX_
+
+#include <com/sun/star/util/XNumberFormats.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+ namespace starlang = ::com::sun::star::lang;
+ namespace starutil = ::com::sun::star::util;
+
+ /// returns the ::com::sun::star::util::NumberFormat of the given key under the given formats
+ COMPHELPER_DLLPUBLIC sal_Int16 getNumberFormatType(const staruno::Reference<starutil::XNumberFormats>& xFormats, sal_Int32 nKey);
+
+ /// returns the ::com::sun::star::util::NumberFormat of the given key under the given formatter
+ COMPHELPER_DLLPUBLIC sal_Int16 getNumberFormatType(const staruno::Reference<starutil::XNumberFormatter>& xFormatter, sal_Int32 nKey);
+
+ /// returns the decimals of the given numeric number formatunder the given formats
+ COMPHELPER_DLLPUBLIC staruno::Any getNumberFormatDecimals(const staruno::Reference<starutil::XNumberFormats>& xFormats, sal_Int32 nKey);
+
+ /** returns the standard format for the given type and the given _rLocale
+ */
+ sal_Int32 getStandardFormat(
+ const staruno::Reference<starutil::XNumberFormatter>& xFormatter,
+ sal_Int16 nType,
+ const starlang::Locale& _rLocale);
+
+ /** retrieves a the value of a given property for a given format key, relating to a given formatter
+ */
+ COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Any getNumberFormatProperty(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ sal_Int32 _nKey,
+ const OUString& _rPropertyName
+ );
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_NUMBERS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/officeresourcebundle.hxx b/include/comphelper/officeresourcebundle.hxx
new file mode 100644
index 000000000000..5e6d9e1bccc5
--- /dev/null
+++ b/include/comphelper/officeresourcebundle.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX
+#define COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX
+
+#include <comphelper/comphelperdllapi.h>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/ustring.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= OfficeResourceBundle
+ //====================================================================
+ class ResourceBundle_Impl;
+ /** wraps the <type scope="com::sun::star::resource">OfficeResourceAccess</type> service
+ */
+ class COMPHELPER_DLLPUBLIC OfficeResourceBundle
+ {
+ private:
+ ::std::auto_ptr< ResourceBundle_Impl > m_pImpl;
+
+ public:
+ /** constructs a resource bundle with the resource bundle given as 8-bit ASCII name
+
+ This is a convenience constructor only, it does nothing different than the constructor
+ taking an unicode string.
+
+ @param _context
+ the component context to operate in
+ @param _bundleBaseName
+ the base name of the resource file which should be accessed (*without* the SUPD!)
+ @raises ::com::sun::star::lang::NullPointerException
+ if the given component context is <NULL/>
+ */
+ OfficeResourceBundle(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _context,
+ const sal_Char* _bundleBaseAsciiName
+ );
+
+ /** destroys the instance
+ */
+ ~OfficeResourceBundle();
+
+ /** loads the string with the given resource id from the resource bundle
+ @param _resourceId
+ the id of the string to load
+ @return
+ the requested resource string. If no string with the given id exists in the resource bundle,
+ an empty string is returned. In a non-product version, an OSL_ENSURE will notify you of this
+ then.
+ */
+ OUString loadString( sal_Int32 _resourceId ) const;
+
+ /** determines whether the resource bundle has a string with the given id
+ @param _resourceId
+ the id of the string whose existence is to be checked
+ @return
+ <TRUE/> if and only if a string with the given ID exists in the resource
+ bundle.
+ */
+ bool hasString( sal_Int32 _resourceId ) const;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_OFFICE_RESOURCE_BUNDLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/ofopxmlhelper.hxx b/include/comphelper/ofopxmlhelper.hxx
new file mode 100644
index 000000000000..e054d0dbc909
--- /dev/null
+++ b/include/comphelper/ofopxmlhelper.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_OFOPXMLHELPER_HXX
+#define _COMPHELPER_OFOPXMLHELPER_HXX
+
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <com/sun/star/beans/StringPair.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+
+namespace comphelper
+{
+
+// this helper class is designed to allow to parse ContentType- and Relationship-related information from OfficeOpenXML format
+class COMPHELPER_DLLPUBLIC OFOPXMLHelper : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
+{
+ sal_uInt16 m_nFormat; // which format to parse
+
+ // Relations info related strings
+ OUString m_aRelListElement;
+ OUString m_aRelElement;
+ OUString m_aIDAttr;
+ OUString m_aTypeAttr;
+ OUString m_aTargetModeAttr;
+ OUString m_aTargetAttr;
+
+ // ContentType related strings
+ OUString m_aTypesElement;
+ OUString m_aDefaultElement;
+ OUString m_aOverrideElement;
+ OUString m_aExtensionAttr;
+ OUString m_aPartNameAttr;
+ OUString m_aContentTypeAttr;
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > m_aResultSeq;
+ ::com::sun::star::uno::Sequence< OUString > m_aElementsSeq; // stack of elements being parsed
+
+ OFOPXMLHelper( sal_uInt16 nFormat ); // must not be created directly
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > GetParsingResult();
+
+ static COMPHELPER_DLLPRIVATE ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > > SAL_CALL ReadSequence_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream, const OUString& aStringID, sal_uInt16 nFormat, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+public:
+ ~OFOPXMLHelper();
+
+ // returns sequence of elements, where each element is described by sequence of tags,
+ // where each tag is described by StringPair ( First - name, Second - value )
+ // the first tag of each element sequence must be "Id"
+ static
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >
+ SAL_CALL
+ ReadRelationsInfoSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const OUString aStreamName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // returns sequence containing two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ static
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >
+ SAL_CALL
+ ReadContentTypeSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // writes sequence of elements, where each element is described by sequence of tags,
+ // where each tag is described by StringPair ( First - name, Second - value )
+ // the first tag of each element sequence must be "Id"
+ static
+ void SAL_CALL WriteRelationsInfoSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair > >& aSequence,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // writes two entries of type sequence<StringPair>
+ // the first sequence describes "Default" elements, where each element is described
+ // by StringPair object ( First - Extension, Second - ContentType )
+ // the second sequence describes "Override" elements, where each element is described
+ // by StringPair object ( First - PartName, Second - ContentType )
+ static
+ void SAL_CALL WriteContentSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStream,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aDefaultsSequence,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::StringPair >& aOverridesSequence,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext )
+ throw( ::com::sun::star::uno::Exception );
+
+ // XDocumentHandler
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startElement( const OUString& aName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endElement( const OUString& aName ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/optional.hxx b/include/comphelper/optional.hxx
new file mode 100644
index 000000000000..031a30328340
--- /dev/null
+++ b/include/comphelper/optional.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_COMPHELPER_OPTIONAL_HXX
+#define INCLUDED_COMPHELPER_OPTIONAL_HXX
+
+#include "com/sun/star/beans/Optional.hpp"
+#include "boost/optional.hpp"
+
+namespace comphelper {
+
+/// Object generators for boost::optional<T>, beans::Optional<T>:
+
+template <typename T>
+inline ::boost::optional<T> make_optional( T const& v )
+{
+ return ::boost::optional<T>(v);
+}
+
+template <typename T>
+inline ::boost::optional<T> make_optional(
+ ::com::sun::star::beans::Optional<T> const& o )
+{
+ if (o.IsPresent)
+ return ::boost::optional<T>(o.Value);
+ else
+ return ::boost::optional<T>();
+}
+
+template <typename T>
+inline ::com::sun::star::beans::Optional<T> makeOptional( T const& v )
+{
+// CPPU_IS_CPP_MAPPING_OF_NON_VOID_UNO_TYPE(T);
+ return ::com::sun::star::beans::Optional<T>(true, v);
+}
+
+template <typename T>
+inline ::com::sun::star::beans::Optional<T> makeOptional(
+ ::boost::optional<T> const& o )
+{
+// CPPU_IS_CPP_MAPPING_OF_NON_VOID_UNO_TYPE(T);
+ if (o)
+ return ::com::sun::star::beans::Optional<T>(true, *o);
+ else
+ return ::com::sun::star::beans::Optional<T>();
+}
+
+inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional(
+ ::boost::optional<bool> const& o )
+{
+ if (o)
+ return ::com::sun::star::beans::Optional<sal_Bool>(true, *o);
+ else
+ return ::com::sun::star::beans::Optional<sal_Bool>();
+}
+
+inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional( bool v )
+{
+ return ::com::sun::star::beans::Optional<sal_Bool>(true, v);
+}
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_OPTIONAL_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/oslfile2streamwrap.hxx b/include/comphelper/oslfile2streamwrap.hxx
new file mode 100644
index 000000000000..f43297b28b43
--- /dev/null
+++ b/include/comphelper/oslfile2streamwrap.hxx
@@ -0,0 +1,89 @@
+/* -*- 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 _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
+#define _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <osl/file.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+//==================================================================
+// FmUnoIOStream,
+// Stream to read and write data, based on File
+//==================================================================
+class COMPHELPER_DLLPUBLIC OSLInputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XInputStream>
+{
+ ::osl::Mutex m_aMutex;
+ ::osl::File* m_pFile;
+
+public:
+ OSLInputStreamWrapper(::osl::File& _rStream);
+ virtual ~OSLInputStreamWrapper();
+
+// stario::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes(staruno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL skipBytes(sal_Int32 nBytesToSkip) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw(stario::NotConnectedException, staruno::RuntimeException);
+ virtual void SAL_CALL closeInput() throw(stario::NotConnectedException, staruno::RuntimeException);
+};
+
+//==================================================================
+// FmUnoOutStream,
+// data sink for the files
+//==================================================================
+class OSLOutputStreamWrapper : public ::cppu::WeakImplHelper1<stario::XOutputStream>
+{
+public:
+ COMPHELPER_DLLPUBLIC OSLOutputStreamWrapper(::osl::File& _rFile);
+
+private:
+ virtual ~OSLOutputStreamWrapper();
+
+// stario::XOutputStream
+ virtual void SAL_CALL writeBytes(const staruno::Sequence< sal_Int8 >& aData) throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL flush() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+ virtual void SAL_CALL closeOutput() throw(stario::NotConnectedException, stario::BufferSizeExceededException, staruno::RuntimeException);
+
+ ::osl::File& rFile;
+};
+
+} // namespace comphelper
+
+
+#endif // _COMPHELPER_STREAM_OSLFILEWRAPPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/processfactory.hxx b/include/comphelper/processfactory.hxx
new file mode 100644
index 000000000000..e6833fc49327
--- /dev/null
+++ b/include/comphelper/processfactory.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROCESSFACTORY_HXX_
+#define _COMPHELPER_PROCESSFACTORY_HXX_
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace com { namespace sun { namespace star { namespace lang {
+ class XMultiServiceFactory;
+} } } }
+
+namespace comphelper
+{
+
+/**
+ * This function set the process service factory.
+ *
+ * @author Juergen Schmidt
+ */
+COMPHELPER_DLLPUBLIC void setProcessServiceFactory(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr);
+
+/**
+ * This function gets the process service factory.
+ *
+ * If no service factory is set the function throws a RuntimeException.
+ *
+ * @author Juergen Schmidt
+ */
+COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getProcessServiceFactory();
+
+/** Obtains a component context from a service factory.
+
+ Throws a RuntimeException if no component context can be obtained.
+
+ @param factory may be null
+ @return may be null
+ */
+COMPHELPER_DLLPUBLIC
+com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+getComponentContext(
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ const & factory);
+
+/**
+ * This function gets the process service factory's default component context.
+ *
+ * Throws a RuntimeException if no component context can be obtained.
+ */
+COMPHELPER_DLLPUBLIC
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+getProcessComponentContext();
+
+}
+
+
+extern "C" {
+/// @internal ATTENTION returns ACQUIRED pointer! release it explicitly!
+COMPHELPER_DLLPUBLIC
+::com::sun::star::uno::XComponentContext *
+comphelper_getProcessComponentContext();
+} // extern "C"
+
+#endif // _COMPHELPER_PROCESSFACTORY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propagg.hxx b/include/comphelper/propagg.hxx
new file mode 100644
index 000000000000..3a6ca83e36c1
--- /dev/null
+++ b/include/comphelper/propagg.hxx
@@ -0,0 +1,325 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_AGGREGATION_HXX_
+#define _COMPHELPER_PROPERTY_AGGREGATION_HXX_
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <comphelper/propstate.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+#include <map>
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//==================================================================
+//= OPropertyAccessor
+//= internal helper class for OPropertyArrayAggregationHelper
+//==================================================================
+namespace internal
+{
+ struct OPropertyAccessor
+ {
+ sal_Int32 nOriginalHandle;
+ sal_Int32 nPos;
+ bool bAggregate;
+
+ OPropertyAccessor(sal_Int32 _nOriginalHandle, sal_Int32 _nPos, bool _bAggregate)
+ :nOriginalHandle(_nOriginalHandle) ,nPos(_nPos) ,bAggregate(_bAggregate) { }
+ OPropertyAccessor()
+ :nOriginalHandle(-1) ,nPos(-1) ,bAggregate(false) { }
+
+ bool operator==(const OPropertyAccessor& rOb) const { return nPos == rOb.nPos; }
+ bool operator <(const OPropertyAccessor& rOb) const { return nPos < rOb.nPos; }
+ };
+
+ typedef std::map< sal_Int32, OPropertyAccessor, ::std::less< sal_Int32 > > PropertyAccessorMap;
+ typedef PropertyAccessorMap::iterator PropertyAccessorMapIterator;
+ typedef PropertyAccessorMap::const_iterator ConstPropertyAccessorMapIterator;
+}
+
+//==================================================================
+/**
+ * used as callback for a OPropertyArrayAggregationHelper
+ */
+class IPropertyInfoService
+{
+public:
+ /** get the prefered handle for the given property
+ @param _rName the property name
+ @return the handle the property should be refered by, or -1 if there are no
+ preferences for the given property
+ */
+ virtual sal_Int32 getPreferedPropertyId(const OUString& _rName) = 0;
+
+protected:
+ ~IPropertyInfoService() {}
+};
+
+/**
+ * used for implementing an cppu::IPropertyArrayHelper for classes
+ * aggregating property sets
+ */
+
+#define DEFAULT_AGGREGATE_PROPERTY_ID 10000
+//------------------------------------------------------------------
+class COMPHELPER_DLLPUBLIC OPropertyArrayAggregationHelper: public ::cppu::IPropertyArrayHelper
+{
+ friend class OPropertySetAggregationHelper;
+protected:
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> m_aProperties;
+ internal::PropertyAccessorMap m_aPropertyAccessors;
+
+public:
+ /** construct the object.
+ @param _rProperties the properties of the object doing the aggregation. These properties
+ are used without any checks, so the caller has to ensure that the names and
+ handles are valid.
+ @param _rAggProperties the properties of the aggregate, usually got via an call to getProperties on the
+ XPropertySetInfo of the aggregate.
+ The names of the properties are used without any checks, so the caller has to ensure
+ that there are no doubles.
+ The handles are stored for later quick access, but the outside-handles the
+ aggregate properties get depend from the following two parameters.
+ @param _pInfoService
+ If not NULL, the object pointed to is used to calc handles which should be used
+ for refering the aggregate's properties from outside.
+ If one of the properties returned from the info service conflict with other handles
+ alread present (e.g. through _rProperties), the property is handled as if -1 was returned.
+ If NULL (or, for a special property, a call to getPreferedPropertyId returns -1),
+ the aggregate property(ies) get a new handle which they can be refered by from outside.
+ @param _nFirstAggregateId
+ if the object is about to create new handles for the aggregate properties, it uses
+ id's ascending from this given id.
+ No checks are made if the handle range determined by _nFirstAggregateId conflicts with other
+ handles within _rProperties.
+ */
+ OPropertyArrayAggregationHelper(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& _rProperties,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& _rAggProperties,
+ IPropertyInfoService* _pInfoService = NULL,
+ sal_Int32 _nFirstAggregateId = DEFAULT_AGGREGATE_PROPERTY_ID);
+
+
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Bool SAL_CALL fillPropertyMembersByHandle( OUString* _pPropName, sal_Int16* _pAttributes,
+ sal_Int32 _nHandle) ;
+
+ /// inherited from IPropertyArrayHelper
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property> SAL_CALL getProperties();
+ /// inherited from IPropertyArrayHelper
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName(const OUString& _rPropertyName)
+ throw(::com::sun::star::beans::UnknownPropertyException);
+
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& _rPropertyName) ;
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Int32 SAL_CALL getHandleByName(const OUString & _rPropertyName);
+ /// inherited from IPropertyArrayHelper
+ virtual sal_Int32 SAL_CALL fillHandles( /*out*/sal_Int32* _pHandles, const ::com::sun::star::uno::Sequence< OUString >& _rPropNames );
+
+ /** returns information about a property of the aggregate.
+ @param _pPropName points to a string to receive the property name. No name is returned if this is NULL.
+ @param _pOriginalHandle points to a sal_Int32 to receive the original property hande. No original handle is returned
+ if this is NULL.
+ @param _nHandle the handle of the property as got by, for instance, fillHandles
+
+ @return sal_True, if _nHandle marks an aggregate property, otherwise sal_False
+ */
+ virtual bool SAL_CALL fillAggregatePropertyInfoByHandle(OUString* _pPropName, sal_Int32* _pOriginalHandle,
+ sal_Int32 _nHandle) const;
+
+ /** returns information about a property given by handle
+ */
+ sal_Bool getPropertyByHandle( sal_Int32 _nHandle, ::com::sun::star::beans::Property& _rProperty ) const;
+
+
+ enum PropertyOrigin
+ {
+ AGGREGATE_PROPERTY,
+ DELEGATOR_PROPERTY,
+ UNKNOWN_PROPERTY
+ };
+ /** prefer this one over the XPropertySetInfo of the aggregate!
+
+ <p>The reason is that OPropertyArrayAggregationHelper is the only instance which really knows
+ which properties of the aggregate are to be exposed. <br/>
+
+ For instance, some derivee of OPropertySetAggregationHelper may decide to create an
+ OPropertyArrayAggregationHelper which contains only a subset of the aggregate properties. This way,
+ some of the aggregate properties may be hidded to the public.<br/>
+
+ When using the XPropertySetInfo of the aggregate set to determine the existence of a property, then this
+ would return false positives.</p>
+ */
+ PropertyOrigin classifyProperty( const OUString& _rName );
+
+protected:
+ const ::com::sun::star::beans::Property* findPropertyByName(const OUString& _rName) const;
+};
+
+//==================================================================
+namespace internal
+{
+ class PropertyForwarder;
+}
+
+/**
+ * helper class for implementing the property-set-related interfaces
+ * for an object doin' aggregation
+ * supports at least XPropertySet and XMultiPropertySet
+ *
+ */
+class COMPHELPER_DLLPUBLIC OPropertySetAggregationHelper :public OPropertyStateHelper
+ ,public ::com::sun::star::beans::XPropertiesChangeListener
+ ,public ::com::sun::star::beans::XVetoableChangeListener
+{
+ friend class internal::PropertyForwarder;
+
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState> m_xAggregateState;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xAggregateSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet> m_xAggregateMultiSet;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet> m_xAggregateFastSet;
+
+ internal::PropertyForwarder* m_pForwarder;
+ sal_Bool m_bListening : 1;
+
+public:
+ OPropertySetAggregationHelper( ::cppu::OBroadcastHelper& rBHelper );
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& aType) throw(::com::sun::star::uno::RuntimeException);
+
+// XEventListener
+ virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException);
+
+// XFastPropertySet
+ virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aValue) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// XPropertySet
+ virtual void SAL_CALL addPropertyChangeListener(const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener(const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// XPropertiesChangeListener
+ virtual void SAL_CALL propertiesChange(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyChangeEvent >& evt) throw(::com::sun::star::uno::RuntimeException);
+
+// XVetoableChangeListener
+ virtual void SAL_CALL vetoableChange(const ::com::sun::star::beans::PropertyChangeEvent& aEvent) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
+
+// XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues(const ::com::sun::star::uno::Sequence< OUString >& PropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener(const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException);
+
+// XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+// OPropertySetHelper
+ /** still waiting to be overwritten ...
+ you <B>must<B/> use an OPropertyArrayAggregationHelper here, as the implementation strongly relies on this.
+ */
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() = 0;
+
+ /** only implemented for "forwarded" properties, every other property must be handled
+ in the derivee, and will assert if passed herein
+ */
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ /** only implemented for "forwarded" properties, every other property must be handled
+ in the derivee, and will assert if passed herein
+ */
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) throw ( ::com::sun::star::uno::Exception );
+
+protected:
+ ~OPropertySetAggregationHelper();
+
+ virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const;
+ virtual void SAL_CALL disposing();
+
+ sal_Int32 getOriginalHandle( sal_Int32 _nHandle ) const;
+ OUString getPropertyName( sal_Int32 _nHandle ) const;
+
+ /** declares the property with the given (public) handle as one to be forwarded to the aggregate
+
+ Sometimes, you might want to <em>overwrite</em> properties at the aggregate. That is,
+ though the aggregate implements this property, and still is to hold the property value,
+ you want to do additional handling upon setting the property, but then forward the value
+ to the aggregate.
+
+ Use this method to declare such properties.
+
+ When a "forwarded property" is set from outside, the class first calls
+ <member>forwardingPropertyValue</member> for any preprocessing, then forwards the property
+ value to the aggregate, and then calls <member>forwardedPropertyValue</member>.
+
+ When you declare a property as "forwarded", the class takes care for some multi-threading
+ issues, for instance, it won't fire any property change notifications which result from
+ forwarding a property value, unless it's safe to do so (i.e. unless our mutex is
+ released).
+
+ @see forwardingPropertyValue
+ @see forwardedPropertyValue
+ */
+ void declareForwardedProperty( sal_Int32 _nHandle );
+
+ /** checks whether we're actually forwarding a property value to our aggregate
+
+ @see declareForwardedProperty
+ @see forwardingPropertyValue
+ @see forwardedPropertyValue
+ */
+ bool isCurrentlyForwardingProperty( sal_Int32 _nHandle ) const;
+
+ /** called immediately before a property value which is overwritten in this instance
+ is forwarded to the aggregate
+
+ @see declareForwardedProperty
+ @see forwardedPropertyValue
+ */
+ virtual void SAL_CALL forwardingPropertyValue( sal_Int32 _nHandle );
+
+ /** called immediately after a property value which is overwritten in this instance
+ has been forwarded to the aggregate
+
+ @see declareForwardedProperty
+ @see forwardingPropertyValue
+ */
+ virtual void SAL_CALL forwardedPropertyValue( sal_Int32 _nHandle, bool _bSuccess );
+
+ /// must be called before aggregation, if aggregation is used
+ void setAggregation(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&) throw( ::com::sun::star::lang::IllegalArgumentException );
+ void startListening();
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTY_AGGREGATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/proparrhlp.hxx b/include/comphelper/proparrhlp.hxx
new file mode 100644
index 000000000000..840213e88427
--- /dev/null
+++ b/include/comphelper/proparrhlp.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+#define _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+
+#include <comphelper/stl_types.hxx>
+#include <comphelper/propagg.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <osl/mutex.hxx>
+#include <osl/diagnose.h>
+#include <rtl/instance.hxx>
+
+namespace cppu {
+ class IPropertyArrayHelper;
+}
+
+//... namespace comphelper ................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+ namespace starbeans = ::com::sun::star::beans;
+
+
+//==================================================================
+
+template <typename TYPE> struct OPropertyArrayUsageHelperMutex
+ : public rtl::Static< ::osl::Mutex, OPropertyArrayUsageHelperMutex<TYPE> > {};
+
+
+template <class TYPE>
+class OPropertyArrayUsageHelper
+{
+protected:
+ static sal_Int32 s_nRefCount;
+ static ::cppu::IPropertyArrayHelper* s_pProps;
+
+public:
+ OPropertyArrayUsageHelper();
+ virtual ~OPropertyArrayUsageHelper()
+ { // ARGHHHHHHH ..... would like to implement this after the class
+ // definition (as we do with all other methods) but SUNPRO 5 compiler
+ // (linker) doesn't like this
+ ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex<TYPE>::get());
+ OSL_ENSURE(s_nRefCount > 0, "OPropertyArrayUsageHelper::~OPropertyArrayUsageHelper : suspicious call : have a refcount of 0 !");
+ if (!--s_nRefCount)
+ {
+ delete s_pProps;
+ s_pProps = NULL;
+ }
+ }
+
+ /** call this in the getInfoHelper method of your derived class. The method returns the array helper of the
+ class, which is created if neccessary.
+ */
+ ::cppu::IPropertyArrayHelper* getArrayHelper();
+
+protected:
+ /** used to implement the creation of the array helper which is shared amongst all instances of the class.
+ This method needs to be implemented in derived classes.
+ <BR>
+ The method gets called with Mutex acquired.
+ <BR>
+ as long as IPropertyArrayHelper has no virtual destructor, the implementation of ~OPropertyArrayUsageHelper
+ assumes that you created an ::cppu::OPropertyArrayHelper when deleting s_pProps.
+ @return an pointer to the newly created array helper. Must not be NULL.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const = 0;
+};
+
+//==================================================================
+/** a OPropertyArrayUsageHelper which will create an OPropertyArrayAggregationHelper
+*/
+template <class TYPE>
+class OAggregationArrayUsageHelper: public OPropertyArrayUsageHelper<TYPE>
+{
+protected:
+ /** overwrite this in your derived class. initialize the two sequences with your and your aggregate's
+ properties.
+ <BR>
+ The method gets called with Mutex acquired.
+ @param _rProps out parameter to be filled with the property descriptions of your own class
+ @param _rAggregateProps out parameter to be filled with the properties of your aggregate.
+ */
+ virtual void fillProperties(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps
+ ) const = 0;
+
+ /** creates an OPropertyArrayAggregationHelper filled with properties for which's initialization
+ fillProperties is called. getInfoService and getFirstAggregateId may be overwritten to determine
+ the additional parameters of the OPropertyArrayAggregationHelper.
+ */
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+
+ /** the return value is used for the construction of the OPropertyArrayAggregationHelper.
+ Beware of the lifetime of the returned object, as it has to exist 'til the last instance
+ of this class dies.
+ */
+ virtual IPropertyInfoService* getInfoService() const { return NULL; }
+
+ /** the return value is used for the construction of the OPropertyArrayAggregationHelper.
+ */
+ virtual sal_Int32 getFirstAggregateId() const { return DEFAULT_AGGREGATE_PROPERTY_ID; }
+};
+
+//------------------------------------------------------------------
+template<class TYPE>
+sal_Int32 OPropertyArrayUsageHelper< TYPE >::s_nRefCount = 0;
+
+template<class TYPE>
+::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper< TYPE >::s_pProps = NULL;
+
+//------------------------------------------------------------------
+template <class TYPE>
+OPropertyArrayUsageHelper<TYPE>::OPropertyArrayUsageHelper()
+{
+ ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex<TYPE>::get());
+ ++s_nRefCount;
+}
+
+//------------------------------------------------------------------
+template <class TYPE>
+::cppu::IPropertyArrayHelper* OPropertyArrayUsageHelper<TYPE>::getArrayHelper()
+{
+ OSL_ENSURE(s_nRefCount, "OPropertyArrayUsageHelper::getArrayHelper : suspicious call : have a refcount of 0 !");
+ if (!s_pProps)
+ {
+ ::osl::MutexGuard aGuard(OPropertyArrayUsageHelperMutex<TYPE>::get());
+ if (!s_pProps)
+ {
+ s_pProps = createArrayHelper();
+ OSL_ENSURE(s_pProps, "OPropertyArrayUsageHelper::getArrayHelper : createArrayHelper returned nonsense !");
+ }
+ }
+ return s_pProps;
+}
+
+//------------------------------------------------------------------
+template <class TYPE> inline
+::cppu::IPropertyArrayHelper* OAggregationArrayUsageHelper<TYPE>::createArrayHelper() const
+{
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aAggregateProps;
+ fillProperties(aProps, aAggregateProps);
+ OSL_ENSURE(aProps.getLength(), "OAggregationArrayUsageHelper::createArrayHelper : fillProperties returned nonsense !");
+ return new OPropertyArrayAggregationHelper(aProps, aAggregateProps, getInfoService(), getFirstAggregateId());
+}
+
+//.........................................................................
+}
+//... namespace comphelper ................................................
+
+#endif // _COMPHELPER_PROPERTY_ARRAY_HELPER_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/property.hxx b/include/comphelper/property.hxx
new file mode 100644
index 000000000000..95fe122d51a6
--- /dev/null
+++ b/include/comphelper/property.hxx
@@ -0,0 +1,205 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#define _COMPHELPER_PROPERTY_HXX_
+
+#include <cppuhelper/proptypehlp.hxx>
+#include <comphelper/extract.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <functional>
+#include "comphelper/comphelperdllapi.h"
+#include "cppu/unotype.hxx"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace comphelper .......................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace starbeans = ::com::sun::star::beans;
+ namespace staruno = ::com::sun::star::uno;
+
+/** compare two properties by name
+*/
+ //--------------------------------------------------------------------------
+ // comparing two property instances
+ struct PropertyCompareByName : public ::std::binary_function< ::com::sun::star::beans::Property, ::com::sun::star::beans::Property, bool >
+ {
+ bool operator() (const ::com::sun::star::beans::Property& x, const ::com::sun::star::beans::Property& y) const
+ {
+ return x.Name.compareTo(y.Name) < 0;// ? true : false;
+ }
+ };
+
+ //--------------------------------------------------------------------------
+ /** compare two properties by name
+ */
+ struct PropertyStringEqualFunctor : ::std::binary_function< ::com::sun::star::beans::Property, OUString, bool >
+ {
+ // ................................................................
+ inline bool operator()( const ::com::sun::star::beans::Property& lhs, const OUString& rhs ) const
+ {
+ return lhs.Name == rhs ;
+ }
+ // ................................................................
+ inline bool operator()( const OUString& lhs, const ::com::sun::star::beans::Property& rhs ) const
+ {
+ return lhs == rhs.Name ;
+ }
+ };
+ //--------------------------------------------------------------------------
+ // comparing two property instances
+ struct PropertyEqualByName : public ::std::binary_function< ::com::sun::star::beans::Property, ::com::sun::star::beans::Property, bool >
+ {
+ bool operator() (const ::com::sun::star::beans::Property& x, const ::com::sun::star::beans::Property& y) const
+ {
+ return x.Name == y.Name ;
+ }
+ };
+
+//------------------------------------------------------------------
+/// remove the property with the given name from the given sequence
+COMPHELPER_DLLPUBLIC void RemoveProperty(staruno::Sequence<starbeans::Property>& seqProps, const OUString& _rPropName);
+
+//------------------------------------------------------------------
+/** within the given property sequence, modify attributes of a special property
+ @param _rProps the sequence of properties to search in
+ @param _sPropName the name of the property which's attributes should be modified
+ @param _nAddAttrib the attributes which should be added
+ @param _nRemoveAttrib the attributes which should be removed
+*/
+COMPHELPER_DLLPUBLIC void ModifyPropertyAttributes(staruno::Sequence<starbeans::Property>& _rProps, const OUString& _sPropName, sal_Int16 _nAddAttrib, sal_Int16 _nRemoveAttrib);
+
+//------------------------------------------------------------------
+/** check if the given set has the given property.
+*/
+COMPHELPER_DLLPUBLIC sal_Bool hasProperty(const OUString& _rName, const staruno::Reference<starbeans::XPropertySet>& _rxSet);
+
+//------------------------------------------------------------------
+/** copy properties between property sets, in compliance with the property
+ attributes of the target object
+*/
+COMPHELPER_DLLPUBLIC void copyProperties(const staruno::Reference<starbeans::XPropertySet>& _rxSource,
+ const staruno::Reference<starbeans::XPropertySet>& _rxDest);
+
+//==================================================================
+//= property conversion helpers
+//==================================================================
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+template <typename T>
+sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, const T& _rCurrentValue)
+{
+ sal_Bool bModified(sal_False);
+ T aNewValue = T();
+ ::cppu::convertPropertyValue(aNewValue, _rValueToSet);
+ if (aNewValue != _rCurrentValue)
+ {
+ _rConvertedValue <<= aNewValue;
+ _rOldValue <<= _rCurrentValue;
+ bModified = sal_True;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue for enum values
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+template <class ENUMTYPE>
+sal_Bool tryPropertyValueEnum(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, const ENUMTYPE& _rCurrentValue)
+{
+ if (cppu::getTypeFavourUnsigned(&_rCurrentValue).getTypeClass()
+ != staruno::TypeClass_ENUM)
+ return tryPropertyValue(_rConvertedValue, _rOldValue, _rValueToSet, _rCurrentValue);
+
+ sal_Bool bModified(sal_False);
+ ENUMTYPE aNewValue;
+ ::cppu::any2enum(aNewValue, _rValueToSet);
+ // will throw an exception if not convertible
+
+ if (aNewValue != _rCurrentValue)
+ {
+ _rConvertedValue <<= aNewValue;
+ _rOldValue <<= _rCurrentValue;
+ bModified = sal_True;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue for boolean properties
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to a boolean type
+*/
+inline sal_Bool tryPropertyValue(staruno::Any& /*out*/_rConvertedValue, staruno::Any& /*out*/_rOldValue, const staruno::Any& _rValueToSet, sal_Bool _bCurrentValue)
+{
+ sal_Bool bModified(sal_False);
+ sal_Bool bNewValue(sal_False);
+ ::cppu::convertPropertyValue(bNewValue, _rValueToSet);
+ if (bNewValue != _bCurrentValue)
+ {
+ _rConvertedValue.setValue(&bNewValue, ::getBooleanCppuType());
+ _rOldValue.setValue(&_bCurrentValue, ::getBooleanCppuType());
+ bModified = sal_True;
+ }
+ return bModified;
+}
+
+/** helper for implementing ::cppu::OPropertySetHelper::convertFastPropertyValue
+ @param _rConvertedValue the conversion result (if successful)
+ @param _rOldValue the old value of the property, calculated from _rCurrentValue
+ @param _rValueToSet the new value which is about to be set
+ @param _rCurrentValue the current value of the property
+ @param _rExpectedType the type which the property should have (if not void)
+ @return sal_True, if the value could be converted and has changed
+ sal_False, if the value could be converted and has not changed
+ @exception InvalidArgumentException thrown if the value could not be converted to the requested type (which is the template argument)
+*/
+COMPHELPER_DLLPUBLIC sal_Bool tryPropertyValue(staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, const staruno::Any& _rValueToSet, const staruno::Any& _rCurrentValue, const staruno::Type& _rExpectedType);
+
+//.........................................................................
+}
+//... namespace comphelper .......................................................
+
+#endif // _COMPHELPER_PROPERTY_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertybag.hxx b/include/comphelper/propertybag.hxx
new file mode 100644
index 000000000000..92c0026ba845
--- /dev/null
+++ b/include/comphelper/propertybag.hxx
@@ -0,0 +1,227 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROPERTYBAG_HXX
+#define COMPHELPER_PROPERTYBAG_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include <comphelper/propertycontainerhelper.hxx>
+
+#include <memory>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ struct PropertyBag_Impl;
+ //====================================================================
+ //= PropertyBag
+ //====================================================================
+ /** provides a bag of properties associated with their values
+
+ This class can, for instance, be used for components which need to implement
+ the com.sun.star.beans.PropertyBag service.
+ */
+ class COMPHELPER_DLLPUBLIC PropertyBag : protected OPropertyContainerHelper
+ {
+ private:
+ ::std::auto_ptr< PropertyBag_Impl > m_pImpl;
+
+ public:
+ PropertyBag();
+ virtual ~PropertyBag();
+
+ /** allow adding property with empty string as name
+ (by default, such names are rejected with IllegalActionException).
+ @param i_isAllowed
+ iff true, empty property name will be allowed
+ */
+ void setAllowEmptyPropertyName(bool i_isAllowed = true);
+
+ /** adds a property to the bag
+
+ The type of the property is determined from its initial value (<code>_rInitialValue</code>).
+
+ @param _rName
+ the name of the new property. Must not be empty unless
+ explicitly allowed with setAllowEmptyPropertyName.
+ @param _nHandle
+ the handle of the new property
+ @param _nAttributes
+ the attributes of the property
+ @param _rInitialValue
+ the initial value of the property. Must not be <NULL/>, to allow
+ determining the property type.
+
+ @throws ::com::sun::star::beans::IllegalTypeException
+ if the initial value is <NULL/>
+ @throws ::com::sun::star::beans::PropertyExistException
+ if the name or the handle are already used
+ @throws ::com::sun::star::beans::IllegalArgumentException
+ if the name is empty
+ */
+ void addProperty(
+ const OUString& _rName,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes,
+ const ::com::sun::star::uno::Any& _rInitialValue
+ );
+
+ /** adds a property to the bag
+
+ The initial value of the property is <NULL/>.
+
+ @param _rName
+ the name of the new property. Must not be empty unless
+ explicitly allowed with setAllowEmptyPropertyName.
+ @param _rType
+ the type of the new property
+ @param _nHandle
+ the handle of the new property
+ @param _nAttributes
+ the attributes of the property
+
+ @throws ::com::sun::star::beans::IllegalTypeException
+ if the initial value is <NULL/>
+ @throws ::com::sun::star::beans::PropertyExistException
+ if the name or the handle are already used
+ @throws ::com::sun::star::beans::IllegalArgumentException
+ if the name is empty
+ */
+ void addVoidProperty(
+ const OUString& _rName,
+ const ::com::sun::star::uno::Type& _rType,
+ sal_Int32 _nHandle,
+ sal_Int32 _nAttributes
+ );
+
+ /** removes a property from the bag
+ @param _rName
+ the name of the to-be-removed property.
+ @throws UnknownPropertyException
+ if the bag does not contain a property with the given name
+ @throws NotRemoveableException
+ if the property with the given name is not removeable, as indicated
+ by the property attributes used in a previous <code>addProperty</code>
+ call.
+ */
+ void removeProperty(
+ const OUString& _rName
+ );
+
+ /** describes all properties in the bag
+ @param _out_rProps
+ takes, upon return, the descriptions of all properties in the bag
+ */
+ inline void describeProperties(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& _out_rProps
+ ) const
+ {
+ OPropertyContainerHelper::describeProperties( _out_rProps );
+ }
+
+ /** retrieves the value of a property given by handle
+ @param _nHandle
+ the handle of the property whose value is to be retrieved
+ @param _out_rValue
+ output parameter taking the property value
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void getFastPropertyValue(
+ sal_Int32 _nHandle,
+ ::com::sun::star::uno::Any& _out_rValue
+ ) const;
+
+ /** converts a to-be-set value of a property (given by handle) so that it can
+ be used in subsequent calls to setFastPropertyValue
+ @param _nHandle
+ the handle of the property
+ @param _rNewValue
+ the new value, which should be converted
+ @param _out_rConvertedValue
+ output parameter taking the converted value
+ @param _out_rCurrentValue
+ output parameter taking the current value of the
+ property
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ @throws IllegalArgumentException
+ if the given value cannot be lossless converted into a value
+ for the given property.
+ */
+ bool convertFastPropertyValue(
+ sal_Int32 _nHandle,
+ const ::com::sun::star::uno::Any& _rNewValue,
+ ::com::sun::star::uno::Any& _out_rConvertedValue,
+ ::com::sun::star::uno::Any& _out_rCurrentValue
+ ) const;
+
+ /** sets a new value for a property given by handle
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void setFastPropertyValue(
+ sal_Int32 _nHandle,
+ const ::com::sun::star::uno::Any& _rValue
+ );
+
+ /** returns the default value for a property given by handle
+
+ The default value of a property is its initial value, as passed
+ to ->addProperty.
+
+ @param _nHandle
+ handle of the property whose default value is to be obtained
+ @param _out_rValue
+ the default value
+ @throws UnknownPropertyException
+ if the given handle does not denote a property in the bag
+ */
+ void getPropertyDefaultByHandle(
+ sal_Int32 _nHandle,
+ ::com::sun::star::uno::Any& _out_rValue
+ ) const;
+
+ /** determines whether a property with a given name is part of the bag
+ */
+ inline bool hasPropertyByName( const OUString& _rName ) const
+ {
+ return isRegisteredProperty( _rName );
+ }
+
+ /** determines whether a property with a given handle is part of the bag
+ */
+ inline bool hasPropertyByHandle( sal_Int32 _nHandle ) const
+ {
+ return isRegisteredProperty( _nHandle );
+ }
+ protected:
+ using OPropertyContainerHelper::convertFastPropertyValue;
+ using OPropertyContainerHelper::getFastPropertyValue;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_PROPERTYBAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertycontainer.hxx b/include/comphelper/propertycontainer.hxx
new file mode 100644
index 000000000000..3d208413a722
--- /dev/null
+++ b/include/comphelper/propertycontainer.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTYCONTAINER_HXX_
+#define _COMPHELPER_PROPERTYCONTAINER_HXX_
+
+#include <comphelper/propertycontainerhelper.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//==========================================================================
+//= OPropertyContainer
+//==========================================================================
+typedef ::cppu::OPropertySetHelper OPropertyContainer_Base;
+/** a OPropertySetHelper implementation which is just a simple container for properties represented
+ by class members, usually in a derived class.
+ <BR>
+ A restriction of this class is that no value conversions are made on a setPropertyValue call. Though
+ the base class supports this with the convertFastPropertyValue method, the OPropertyContainer accepts only
+ values which already have the correct type, it's unable to convert, for instance, a long to a short.
+*/
+class COMPHELPER_DLLPUBLIC OPropertyContainer
+ :public OPropertyContainer_Base
+ ,public OPropertyContainerHelper
+{
+public:
+ // this dtor is needed otherwise we can get a wrong delete operator
+ virtual ~OPropertyContainer();
+
+protected:
+ OPropertyContainer(::cppu::OBroadcastHelper& _rBHelper);
+
+ /// for scripting : the types of the interfaces supported by this class
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+
+// OPropertySetHelper overridables
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::lang::IllegalArgumentException);
+
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ throw (::com::sun::star::uno::Exception);
+
+ using OPropertyContainer_Base::getFastPropertyValue;
+ virtual void SAL_CALL getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
+ // disambiguate a base class method (XFastPropertySet)
+ virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTYCONTAINER_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertycontainerhelper.hxx b/include/comphelper/propertycontainerhelper.hxx
new file mode 100644
index 000000000000..dacefd8737a6
--- /dev/null
+++ b/include/comphelper/propertycontainerhelper.hxx
@@ -0,0 +1,203 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+#define COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+
+#include <cppuhelper/propshlp.hxx>
+#include <com/sun/star/uno/Type.hxx>
+#include <com/sun/star/beans/Property.hpp>
+#include <vector>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+// infos about one single property
+struct COMPHELPER_DLLPUBLIC PropertyDescription
+{
+ // the possibilities where a property holding object may be located
+ enum LocationType
+ {
+ ltDerivedClassRealType, // within the derived class, it's a "real" (non-Any) type
+ ltDerivedClassAnyType, // within the derived class, it's a <type scope="com.sun.star.uno">Any</type>
+ ltHoldMyself // within m_aHoldProperties
+ };
+ // the location of an object holding a property value :
+ union LocationAccess
+ {
+ void* pDerivedClassMember; // a pointer to a member of an object of a derived class
+ sal_Int32 nOwnClassVectorIndex; // an index within m_aHoldProperties
+ };
+
+ ::com::sun::star::beans::Property
+ aProperty;
+ LocationType eLocated; // where is the object containing the value located ?
+ LocationAccess aLocation; // access to the property value
+
+ PropertyDescription()
+ :aProperty( OUString(), -1, ::com::sun::star::uno::Type(), 0 )
+ ,eLocated( ltHoldMyself )
+ {
+ aLocation.nOwnClassVectorIndex = -1;
+ }
+};
+
+//==========================================================================
+//= OPropertyContainerHelper
+//==========================================================================
+/** helper class for managing property values, and implementing most of the X*Property* interfaces
+
+ The property values are usually held in derived classes, but can also be given to the
+ responsibility of this class here.
+
+ For more information, see http://wiki.services.openoffice.org/wiki/Development/Cpp/Helper/PropertyContainerHelper.
+*/
+class COMPHELPER_DLLPUBLIC OPropertyContainerHelper
+{
+ typedef ::std::vector< ::com::sun::star::uno::Any > PropertyContainer;
+ typedef PropertyContainer::iterator PropertyContainerIterator;
+ typedef PropertyContainer::const_iterator ConstPropertyContainerIterator;
+ PropertyContainer m_aHoldProperties;
+ // the properties which are hold by this class' instance, not the derived one's
+
+private:
+ typedef ::std::vector< PropertyDescription > Properties;
+ typedef Properties::iterator PropertiesIterator;
+ typedef Properties::const_iterator ConstPropertiesIterator;
+ Properties m_aProperties;
+
+ sal_Bool m_bUnused;
+
+protected:
+ OPropertyContainerHelper();
+ ~OPropertyContainerHelper();
+
+ /** register a property. The property is represented through a member of the derived class which calls
+ this methdod.
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _pPointerToMember the pointer to the member representing the property
+ within the derived class.
+ @param _rMemberType the cppu type of the property represented by the object
+ to which _pPointerToMember points.
+ */
+ void registerProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ void* _pPointerToMember, const ::com::sun::star::uno::Type& _rMemberType);
+
+
+ /** register a property. The property is represented through a ::com::sun::star::uno::Any member of the
+ derived class which calls this methdod.
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _pPointerToMember the pointer to the member representing the property
+ within the derived class, which has to be a ::com::sun::star::uno::Any.
+ @param _rExpectedType the expected type of the property. NOT the type of the object to which
+ _pPointerToMember points (this is always an Any).
+ */
+ void registerMayBeVoidProperty(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ ::com::sun::star::uno::Any* _pPointerToMember, const ::com::sun::star::uno::Type& _rExpectedType);
+
+ /** register a property. The repository will create an own object holding this property, so there is no
+ need to declare an extra member in your derived class
+ @param _rName the name of the property
+ @param _nHandle the handle of the property
+ @param _nAttributes the attributes of the property
+ @param _rType the type of the property
+ @param _pInitialValue the initial value of the property. May be null if _nAttributes includes
+ the ::com::sun::star::beans::PropertyAttribute::MAYBEVOID flag.
+ Else it must be a pointer to an object of the type described by _rType.
+ */
+ void registerPropertyNoMember(const OUString& _rName, sal_Int32 _nHandle, sal_Int32 _nAttributes,
+ const ::com::sun::star::uno::Type& _rType, const void* _pInitialValue);
+
+ /** revokes a previously registered property
+ @throw com::sun::star::beans::UnknownPropertyException
+ if no property with the given handle is registered
+ */
+ void revokeProperty( sal_Int32 _nHandle );
+
+
+ /// checkes whether a property with the given handle has been registered
+ sal_Bool isRegisteredProperty( sal_Int32 _nHandle ) const;
+
+ /// checkes whether a property with the given name has been registered
+ sal_Bool isRegisteredProperty( const OUString& _rName ) const;
+
+
+ // helper for implementing OPropertySetHelper overridables
+ sal_Bool convertFastPropertyValue(
+ ::com::sun::star::uno::Any & rConvertedValue,
+ ::com::sun::star::uno::Any & rOldValue,
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ SAL_THROW((::com::sun::star::lang::IllegalArgumentException));
+
+ void setFastPropertyValue(
+ sal_Int32 nHandle,
+ const ::com::sun::star::uno::Any& rValue
+ )
+ SAL_THROW((::com::sun::star::uno::Exception));
+
+ void getFastPropertyValue(
+ ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle
+ ) const;
+
+// helper
+ /** appends the descriptions of all properties which were registered 'til that moment to the given sequence,
+ keeping the array sorted (by name)
+ @precond
+ the given sequence is already sorted by name
+ @param _rProps
+ initial property sequence which is to be extended
+ */
+ void describeProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps) const;
+
+ /** retrieves the description for a registered property
+ @throw com::sun::star::beans::UnknownPropertyException
+ if no property with the given name is registered
+ */
+ const ::com::sun::star::beans::Property&
+ getProperty( const OUString& _rName ) const;
+
+private:
+ /// insertion of _rProp into m_aProperties, keeping the sort order
+ COMPHELPER_DLLPRIVATE void implPushBackProperty(const PropertyDescription& _rProp);
+
+ /// search the PropertyDescription for the given handle (within m_aProperties)
+ COMPHELPER_DLLPRIVATE PropertiesIterator searchHandle(sal_Int32 _nHandle);
+
+private:
+ COMPHELPER_DLLPRIVATE OPropertyContainerHelper( const OPropertyContainerHelper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OPropertyContainerHelper& operator=( const OPropertyContainerHelper& ); // never implemented
+};
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_PROPERTYCONTAINERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysethelper.hxx b/include/comphelper/propertysethelper.hxx
new file mode 100644
index 000000000000..ecc600c37d3c
--- /dev/null
+++ b/include/comphelper/propertysethelper.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTYSETHELPER_HXX_
+#define _COMPHELPER_PROPERTYSETHELPER_HXX_
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace comphelper ................................................
+namespace comphelper
+{
+//.........................................................................
+
+class PropertySetInfo;
+struct PropertyMapEntry;
+class PropertySetHelperImpl;
+
+class COMPHELPER_DLLPUBLIC PropertySetHelper : public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::beans::XMultiPropertySet
+{
+private:
+ PropertySetHelperImpl* mp;
+
+protected:
+ virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
+ virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException ) = 0;
+
+ virtual void _getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::beans::PropertyState* pStates ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ virtual void _setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any _getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+public:
+ PropertySetHelper( comphelper::PropertySetInfo* pInfo ) throw();
+ PropertySetHelper( comphelper::PropertySetInfo* pInfo, __sal_NoAcquire ) throw();
+ virtual ~PropertySetHelper() throw();
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//... namespace comphelper..................................................
+
+#endif // _UTL_PROPERTYSETHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertysetinfo.hxx b/include/comphelper/propertysetinfo.hxx
new file mode 100644
index 000000000000..e0b863e8f2ca
--- /dev/null
+++ b/include/comphelper/propertysetinfo.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTSETINFO_HXX_
+#define _COMPHELPER_PROPERTSETINFO_HXX_
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/stl_types.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//... namespace comphelper .......................................................
+namespace comphelper
+{
+//.........................................................................
+
+struct PropertyMapEntry
+{
+ const sal_Char* mpName;
+ sal_uInt16 mnNameLen;
+ sal_Int32 mnHandle;
+ const com::sun::star::uno::Type* mpType;
+ sal_Int16 mnAttributes;
+ sal_uInt8 mnMemberId;
+};
+
+DECLARE_STL_USTRINGACCESS_MAP( PropertyMapEntry*, PropertyMap );
+
+class PropertyMapImpl;
+
+/** this class implements a XPropertySetInfo that is initialized with arrays of PropertyMapEntry.
+ It is used by the class PropertySetHelper.
+*/
+class COMPHELPER_DLLPUBLIC PropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
+{
+private:
+ PropertyMapImpl* mpMap;
+public:
+ PropertySetInfo() throw();
+ PropertySetInfo( PropertyMapEntry* pMap ) throw();
+ virtual ~PropertySetInfo() throw();
+
+ /** returns a stl map with all PropertyMapEntry pointer.<p>
+ The key is the property name.
+ */
+ const PropertyMap* getPropertyMap() const throw();
+
+ /** adds an array of PropertyMapEntry to this instance.<p>
+ The end is marked with a PropertyMapEntry where mpName equals NULL</p>
+ */
+ void add( PropertyMapEntry* pMap ) throw();
+
+ /** removes an already added PropertyMapEntry which string in mpName equals to aName */
+ void remove( const OUString& aName ) throw();
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const OUString& aName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//... namespace comphelper .......................................................
+
+#endif // _UTL_PROPERTSETINFO_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propertystatecontainer.hxx b/include/comphelper/propertystatecontainer.hxx
new file mode 100644
index 000000000000..acd368646628
--- /dev/null
+++ b/include/comphelper/propertystatecontainer.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROPERTYSTATECONTAINER_HXX
+#define COMPHELPER_PROPERTYSTATECONTAINER_HXX
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <comphelper/uno3.hxx>
+#include <osl/diagnose.h>
+#include "comphelper/comphelperdllapi.h"
+
+#include <map>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OPropertyStateContainer
+ //=====================================================================
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::beans::XPropertyState
+ > OPropertyStateContainer_TBase;
+
+ /** helper implementation for components which have properties with a default
+
+ <p>This class is not intended for direct use, you need to derive from it.</p>
+
+ @see com.sun.star.beans.XPropertyState
+ */
+ class COMPHELPER_DLLPUBLIC OPropertyStateContainer
+ :public OPropertyContainer
+ ,public OPropertyStateContainer_TBase
+ {
+ protected:
+ /** ctor
+ @param _rBHelper
+ help to be used for broadcasting events
+ */
+ OPropertyStateContainer( ::cppu::OBroadcastHelper& _rBHelper );
+
+ // ................................................................
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ................................................................
+ // own overridables
+ // these are the impl-methods for the XPropertyState members - they are implemented already by this class,
+ // but you may want to override them for whatever reasons (for instance, if your derived class
+ // supports the AMBIGUOUS state for properties)
+
+ /** get the PropertyState of the property denoted by the given handle
+
+ <p>Already implemented by this base class, no need to override</p>
+ @precond <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle( sal_Int32 _nHandle );
+
+ /** set the property denoted by the given handle to it's default value
+
+ <p>Already implemented by this base class, no need to override</p>
+ @precond <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual void setPropertyToDefaultByHandle( sal_Int32 _nHandle );
+
+ /** get the default value for the property denoted by the given handle
+
+ @precond
+ <arg>_nHandle</arg> is a valid property handle
+ */
+ virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const = 0;
+
+ protected:
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ protected:
+ /** returns the handle for the given name
+
+ @throw UnknownPropertyException if the given name is not a registered property
+ */
+ sal_Int32 getHandleForName( const OUString& _rPropertyName ) SAL_THROW( ( ::com::sun::star::beans::UnknownPropertyException ) );
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // COMPHELPER_PROPERTYSTATECONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propmultiplex.hxx b/include/comphelper/propmultiplex.hxx
new file mode 100644
index 000000000000..28795e57ce8a
--- /dev/null
+++ b/include/comphelper/propmultiplex.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_MULTIPLEX_HXX_
+#define _COMPHELPER_PROPERTY_MULTIPLEX_HXX_
+
+#include <comphelper/propstate.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ class OPropertyChangeMultiplexer;
+
+ //==================================================================
+ //= OPropertyChangeListener
+ //==================================================================
+ /// simple listener adapter for property sets
+ class COMPHELPER_DLLPUBLIC OPropertyChangeListener
+ {
+ friend class OPropertyChangeMultiplexer;
+
+ OPropertyChangeMultiplexer* m_pAdapter;
+ ::osl::Mutex& m_rMutex;
+
+ public:
+ OPropertyChangeListener(::osl::Mutex& _rMutex)
+ : m_pAdapter(NULL), m_rMutex(_rMutex) { }
+ virtual ~OPropertyChangeListener();
+
+ virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) = 0;
+ virtual void _disposing(const ::com::sun::star::lang::EventObject& _rSource) throw( ::com::sun::star::uno::RuntimeException);
+
+ protected:
+ /** If the derivee also owns the mutex which we know as reference, then call this within your
+ derivee's dtor.
+ */
+ void disposeAdapter();
+
+ // pseudo-private. Making it private now could break compatibility
+ void setAdapter( OPropertyChangeMultiplexer* _pAdapter );
+ };
+
+ //==================================================================
+ //= OPropertyChangeMultiplexer
+ //==================================================================
+ /// multiplexer for property changes
+ class COMPHELPER_DLLPUBLIC OPropertyChangeMultiplexer :public cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertyChangeListener>
+ {
+ friend class OPropertyChangeListener;
+ ::com::sun::star::uno::Sequence< OUString > m_aProperties;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xSet;
+ OPropertyChangeListener* m_pListener;
+ sal_Int32 m_nLockCount;
+ sal_Bool m_bListening : 1;
+ sal_Bool m_bAutoSetRelease : 1;
+
+
+ virtual ~OPropertyChangeMultiplexer();
+ public:
+ OPropertyChangeMultiplexer(OPropertyChangeListener* _pListener, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxSet, sal_Bool _bAutoReleaseSet = sal_True);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw( ::com::sun::star::uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw( ::com::sun::star::uno::RuntimeException);
+
+ /// incremental lock
+ void lock();
+ /// incremental unlock
+ void unlock();
+ /// get the lock count
+ sal_Int32 locked() const { return m_nLockCount; }
+
+ void addProperty(const OUString& aPropertyName);
+ void dispose();
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTY_MULTIPLEX_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/propstate.hxx b/include/comphelper/propstate.hxx
new file mode 100644
index 000000000000..727f40d96824
--- /dev/null
+++ b/include/comphelper/propstate.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_PROPERTY_STATE_HXX_
+#define _COMPHELPER_PROPERTY_STATE_HXX_
+
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/proptypehlp.hxx>
+#include <cppuhelper/weak.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+//=========================================================================
+//= property helper classes
+//=========================================================================
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //==================================================================
+ //= OPropertyStateHelper
+ //==================================================================
+ /// helper class for implementing property states
+ class COMPHELPER_DLLPUBLIC OPropertyStateHelper :public ::cppu::OPropertySetHelper2
+ ,public ::com::sun::star::beans::XPropertyState
+ {
+ public:
+ OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp):OPropertySetHelper2(rBHlp) { }
+ OPropertyStateHelper(::cppu::OBroadcastHelper& rBHlp,
+ ::cppu::IEventNotificationHook *i_pFireEvents);
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& aType) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL
+ getPropertyState(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState> SAL_CALL
+ getPropertyStates(const ::com::sun::star::uno::Sequence< OUString >& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL
+ setPropertyToDefault(const OUString& PropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL
+ getPropertyDefault(const OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // access via handle
+ virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
+ virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
+ virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
+
+ protected:
+ virtual ~OPropertyStateHelper();
+
+ void firePropertyChange(sal_Int32 nHandle, const ::com::sun::star::uno::Any& aNewValue, const ::com::sun::star::uno::Any& aOldValue);
+
+ protected:
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ };
+
+ //==================================================================
+ //= OPropertyStateHelper
+ //==================================================================
+ class COMPHELPER_DLLPUBLIC OStatefulPropertySet :public ::cppu::OWeakObject
+ ,public ::com::sun::star::lang::XTypeProvider
+ ,public OMutexAndBroadcastHelper // order matters: before OPropertyStateHelper/OPropertySetHelper
+ ,public OPropertyStateHelper
+ {
+ protected:
+ OStatefulPropertySet();
+ virtual ~OStatefulPropertySet();
+
+ protected:
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+ };
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_PROPERTY_STATE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/proxyaggregation.hxx b/include/comphelper/proxyaggregation.hxx
new file mode 100644
index 000000000000..2c01a7a3587f
--- /dev/null
+++ b/include/comphelper/proxyaggregation.hxx
@@ -0,0 +1,221 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_PROXY_AGGREGATION
+#define COMPHELPER_PROXY_AGGREGATION
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/compbase_ex.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+/* class hierarchy herein:
+
+ +-------------------+ helper class for aggregating the proxy to another object
+ | OProxyAggregation | - not ref counted
+ +-------------------+ - no UNO implementation, i.e. not derived from XInterface
+ ^ (neither direct nor indirect)
+ |
+ |
+ +----------------------------------+ helper class for aggregating a proxy to an XComponent
+ | OComponentProxyAggregationHelper | - life time coupling: if the inner component (the "aggregate")
+ +----------------------------------+ is disposed, the outer (the delegator) is disposed, too, and
+ ^ vice versa
+ | - UNO based, implementing XEventListener
+ |
+ +----------------------------+ component aggregating another XComponent
+ | OComponentProxyAggregation | - life time coupling as above
+ +----------------------------+ - ref-counted
+ - implements an XComponent itself
+
+ If you need to
+
+ - wrap a foreign object which is a XComponent
+ => use OComponentProxyAggregation
+ - call componentAggregateProxyFor in your ctor
+ - call implEnsureDisposeInDtor in your dtor
+
+ - wrap a foreign object which is a XComponent, but already have ref-counting mechanisms
+ inherited from somewhere else
+ => use OComponentProxyAggregationHelper
+ - override dispose - don't forget to call the base class' dispose!
+ - call componentAggregateProxyFor in your ctor
+
+ - wrap a foreign object which is no XComponent
+ => use OProxyAggregation
+ - call baseAggregateProxyFor in your ctor
+*/
+
+//.............................................................................
+namespace comphelper
+{
+//.............................................................................
+
+ //=========================================================================
+ //= OProxyAggregation
+ //=========================================================================
+ /** helper class for aggregating a proxy for a foreign object
+ */
+ class OProxyAggregation
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxyAggregate;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xProxyTypeAccess;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ protected:
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getComponentContext()
+ {
+ return m_xContext;
+ }
+
+ protected:
+ OProxyAggregation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext );
+ ~OProxyAggregation();
+
+ /// to be called from within your ctor
+ void baseAggregateProxyFor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ // XInterface and XTypeProvider
+ ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ OProxyAggregation( ); // never implemented
+ OProxyAggregation( const OProxyAggregation& ); // never implemented
+ OProxyAggregation& operator=( const OProxyAggregation& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OComponentProxyAggregationHelper
+ //=========================================================================
+ /** a helper class for aggregating a proxy to an XComponent
+
+ <p>The object couples the life time of itself and the component: if one of the both
+ dies (in a sense of being disposed), the other one dies, too.</p>
+
+ <p>The class itself does not implement XComponent so you need to forward any XComponent::dispose
+ calls which your derived class gets to the dispose method of this class.</p>
+ */
+
+ class COMPHELPER_DLLPUBLIC OComponentProxyAggregationHelper :public ::cppu::ImplHelper1 < com::sun::star::lang::XEventListener
+ >
+ ,private OProxyAggregation
+ {
+ private:
+ typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XEventListener
+ > BASE; // prevents some MSVC problems
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >
+ m_xInner;
+ ::cppu::OBroadcastHelper& m_rBHelper;
+
+ protected:
+ // OProxyAggregation
+ using OProxyAggregation::getComponentContext;
+
+ // XInterface
+ ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER( )
+
+ protected:
+ OComponentProxyAggregationHelper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ ::cppu::OBroadcastHelper& _rBHelper
+ );
+ virtual ~OComponentProxyAggregationHelper( );
+
+ /// to be called from within your ctor
+ void componentAggregateProxyFor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComponent,
+ oslInterlockedCount& _rRefCount,
+ ::cppu::OWeakObject& _rDelegator
+ );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ private:
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregationHelper( ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregationHelper( const OComponentProxyAggregationHelper& ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregationHelper& operator=( const OComponentProxyAggregationHelper& ); // never implemented
+ };
+
+ //=========================================================================
+ //= OComponentProxyAggregation
+ //=========================================================================
+ class COMPHELPER_DLLPUBLIC OComponentProxyAggregation :public OBaseMutex
+ ,public cppu::WeakComponentImplHelperBase
+ ,public OComponentProxyAggregationHelper
+ {
+ protected:
+ OComponentProxyAggregation(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxComponent
+ );
+
+ virtual ~OComponentProxyAggregation();
+
+ // XInterface
+ DECLARE_XINTERFACE()
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing() throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XComponent/OComponentProxyAggregationHelper
+ virtual void SAL_CALL dispose() throw( ::com::sun::star::uno::RuntimeException );
+
+ protected:
+ // be called from within the dtor of derived classes
+ void implEnsureDisposeInDtor( );
+
+ private:
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregation( ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregation( const OComponentProxyAggregation& ); // never implemented
+ COMPHELPER_DLLPRIVATE OComponentProxyAggregation& operator=( const OComponentProxyAggregation& ); // never implemented
+ };
+
+//.............................................................................
+} // namespace comphelper
+//.............................................................................
+
+
+#endif // COMPHELPER_PROXY_AGGREGATION
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/scoped_disposing_ptr.hxx b/include/comphelper/scoped_disposing_ptr.hxx
new file mode 100644
index 000000000000..dabf9f473e92
--- /dev/null
+++ b/include/comphelper/scoped_disposing_ptr.hxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _SCOPED_DISPOSING_PTR
+#define _SCOPED_DISPOSING_PTR
+
+#include <cppuhelper/implbase1.hxx>
+#include <boost/utility.hpp>
+#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
+
+// for locking SolarMutex: svapp + mutex
+#include <vcl/svapp.hxx>
+#include <osl/mutex.hxx>
+
+namespace comphelper
+{
+//Similar to boost::scoped_ptr, except additionally releases the ptr on XComponent::disposing and/or XTerminateListener::notifyTermination if supported
+template<class T> class scoped_disposing_ptr : private boost::noncopyable
+{
+private:
+ boost::scoped_ptr<T> m_aItem;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XTerminateListener> m_xTerminateListener;
+public:
+ scoped_disposing_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
+ : m_aItem(p)
+ {
+ m_xTerminateListener = new TerminateListener(rComponent, *this);
+ }
+
+ virtual void reset(T * p = 0)
+ {
+ m_aItem.reset(p);
+ }
+
+ T & operator*() const
+ {
+ return *m_aItem;
+ }
+
+ T * get() const
+ {
+ return m_aItem.get();
+ }
+
+ T * operator->() const
+ {
+ return m_aItem.get();
+ }
+
+ operator bool () const
+ {
+ return static_cast< bool >(m_aItem);
+ }
+
+ virtual ~scoped_disposing_ptr()
+ {
+ reset();
+ }
+private:
+ class TerminateListener : public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XTerminateListener >
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xComponent;
+ scoped_disposing_ptr<T>& m_rItem;
+ public:
+ TerminateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent,
+ scoped_disposing_ptr<T>& rItem) : m_xComponent(rComponent), m_rItem(rItem)
+ {
+ if (m_xComponent.is())
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->addTerminateListener(this);
+ else
+ m_xComponent->addEventListener(this);
+ }
+ }
+
+ ~TerminateListener()
+ {
+ if ( m_xComponent.is() )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->removeTerminateListener(this);
+ else
+ m_xComponent->removeEventListener(this);
+ }
+ }
+
+ private:
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& rEvt )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ bool shutDown = (rEvt.Source == m_xComponent);
+
+ if (shutDown && m_xComponent.is())
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop> xDesktop(m_xComponent, ::com::sun::star::uno::UNO_QUERY);
+ if (xDesktop.is())
+ xDesktop->removeTerminateListener(this);
+ else
+ m_xComponent->removeEventListener(this);
+ m_xComponent.clear();
+ }
+
+ if (shutDown)
+ m_rItem.reset();
+ }
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& )
+ throw(::com::sun::star::frame::TerminationVetoException,
+ ::com::sun::star::uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& rEvt )
+ throw (::com::sun::star::uno::RuntimeException)
+ {
+ disposing(rEvt);
+ }
+ };
+};
+
+//Something like an OutputDevice requires the SolarMutex to be taken before use
+//for threadsafety. The user can ensure this, except in the case of its dtor
+//being called from reset due to a terminate on the XComponent being called
+//from an aribitrary thread
+template<class T> class scoped_disposing_solar_mutex_reset_ptr
+ : public scoped_disposing_ptr<T>
+{
+public:
+ scoped_disposing_solar_mutex_reset_ptr( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > &rComponent, T * p = 0 )
+ : scoped_disposing_ptr<T>(rComponent, p)
+ {
+ }
+
+ virtual void reset(T * p = 0)
+ {
+ SolarMutexGuard aGuard;
+ scoped_disposing_ptr<T>::reset(p);
+ }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/scopeguard.hxx b/include/comphelper/scopeguard.hxx
new file mode 100644
index 000000000000..5bc2aafaa781
--- /dev/null
+++ b/include/comphelper/scopeguard.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_SCOPEGUARD_HXX
+#define INCLUDED_COMPHELPER_SCOPEGUARD_HXX
+
+#include "comphelper/comphelperdllapi.h"
+#include "boost/function.hpp"
+#include "boost/noncopyable.hpp"
+#include "boost/bind.hpp"
+
+namespace comphelper {
+
+/** ScopeGuard to ease writing exception-safe code.
+ */
+class COMPHELPER_DLLPUBLIC ScopeGuard : private ::boost::noncopyable
+ // noncopyable until we have
+ // good reasons...
+{
+public:
+ enum exc_handling { IGNORE_EXCEPTIONS, ALLOW_EXCEPTIONS };
+
+ /** @param func function object to be executed in dtor
+ @param excHandling switches whether thrown exceptions in dtor will be
+ silently ignored (but OSL_ asserted)
+ */
+ template <typename func_type>
+ explicit ScopeGuard( func_type const & func,
+ exc_handling excHandling = IGNORE_EXCEPTIONS )
+ : m_func( func ), m_excHandling( excHandling ) {}
+
+ ~ScopeGuard();
+
+ /** Dismisses the scope guard, i.e. the function won't
+ be executed.
+ */
+ void dismiss();
+
+private:
+ ::boost::function0<void> m_func; // preferring portable syntax
+ exc_handling const m_excHandling;
+};
+
+} // namespace comphelper
+
+#endif // ! defined(INCLUDED_COMPHELPER_SCOPEGUARD_HXX)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seekableinput.hxx b/include/comphelper/seekableinput.hxx
new file mode 100644
index 000000000000..02c4997a2cb6
--- /dev/null
+++ b/include/comphelper/seekableinput.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_STREAM_SEEKABLEINPUT_HXX_
+#define _COMPHELPER_STREAM_SEEKABLEINPUT_HXX_
+
+#include <osl/mutex.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+class COMPHELPER_DLLPUBLIC OSeekableInputWrapper : public ::cppu::WeakImplHelper2< ::com::sun::star::io::XInputStream,
+ ::com::sun::star::io::XSeekable >
+{
+ ::osl::Mutex m_aMutex;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xOriginalStream;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xCopyInput;
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XSeekable > m_xCopySeek;
+
+private:
+ COMPHELPER_DLLPRIVATE void PrepareCopy_Impl();
+
+public:
+ OSeekableInputWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ virtual ~OSeekableInputWrapper();
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > CheckSeekableCanWrap(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+// XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence< sal_Int8 >& aData, sal_Int32 nMaxBytesToRead ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL available() throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL closeInput() throw (::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+// XSeekable
+ virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength() throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+};
+
+} // namespace comphelper
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/seqstream.hxx b/include/comphelper/seqstream.hxx
new file mode 100644
index 000000000000..4f9c9380bfa1
--- /dev/null
+++ b/include/comphelper/seqstream.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_SEQSTREAM_HXX
+#define _COMPHELPER_SEQSTREAM_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+ typedef ::com::sun::star::uno::Sequence<sal_Int8> ByteSequence;
+
+//==================================================================
+// SequenceInputStream
+// stream for reading data from a sequence of bytes
+//==================================================================
+
+
+class COMPHELPER_DLLPUBLIC SequenceInputStream
+: public ::cppu::WeakImplHelper2< ::com::sun::star::io::XInputStream, ::com::sun::star::io::XSeekable >
+{
+ ::osl::Mutex m_aMutex;
+ ByteSequence m_aData;
+ sal_Int32 m_nPos;
+
+public:
+ SequenceInputStream(const ByteSequence& rData);
+
+// com::sun::star::io::XInputStream
+ virtual sal_Int32 SAL_CALL readBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nBytesToRead )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL readSomeBytes( ::com::sun::star::uno::Sequence<sal_Int8>& aData, sal_Int32 nMaxBytesToRead )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException,
+ ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int32 SAL_CALL available( )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL closeInput( )
+ throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL seek( sal_Int64 location ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getPosition( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int64 SAL_CALL getLength( ) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ inline sal_Int32 avail();
+};
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::io::XOutputStream > OSequenceOutputStream_Base;
+
+class OSequenceOutputStream : public OSequenceOutputStream_Base
+{
+protected:
+ ::com::sun::star::uno::Sequence< sal_Int8 >& m_rSequence;
+ double m_nResizeFactor;
+ sal_Int32 m_nMinimumResize;
+ sal_Int32 m_nMaximumResize;
+ sal_Int32 m_nSize;
+ // the size of the virtual stream. This is not the size of the sequence, but the number of bytes written
+ // into the stream at a given moment.
+
+ sal_Bool m_bConnected;
+ // closeOutput has been called ?
+
+ ::osl::Mutex m_aMutex;
+
+protected:
+ ~OSequenceOutputStream() { if (m_bConnected) closeOutput(); }
+
+public:
+ /** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded
+ to the sequence, reallocating it if neccessary. Writing will start at offset 0 within the sequence.
+ @param _rSeq a reference to the sequence which will be used for output.
+ The caller is responsible for taking care of the lifetime of the stream
+ object and the sequence. If you're in doubt about this, use <code>closeOutput</code>
+ before destroying the sequence
+ @param _nResizeFactor the factor which is used for resizing the sequence when neccessary. In every
+ resize step, the new sequence size will be calculated by multiplying the current
+ size with this factor, rounded off to the next multiple of 4.
+ @param _nMinimumResize the minmal number of bytes which is additionally allocated on resizing
+ @param _nMaximumResize as the growth of the stream size is exponential, you may want to specify a
+ maxmimum amount of memory which the sequence will grow by. If -1 is used,
+ no limit is applied
+ @see closeOutput
+ */
+ OSequenceOutputStream(
+ ::com::sun::star::uno::Sequence< sal_Int8 >& _rSeq,
+ double _nResizeFactor = 1.3,
+ sal_Int32 _nMinimumResize = 128,
+ sal_Int32 _nMaximumResize = -1
+ );
+
+ /// same as XOutputStream::writeBytes (as expected :)
+ virtual void SAL_CALL writeBytes( const ::com::sun::star::uno::Sequence< sal_Int8 >& aData ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ /// this is a dummy in this implementation, no buffering is used
+ virtual void SAL_CALL flush( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+ /** closes the output stream. In the case of this class, this means that the sequence used for writing is
+ resized to the really used size and not used any further, every subsequent call to one of the XOutputStream
+ methods will throw a <code>NotConnectedException</code>.
+ */
+ virtual void SAL_CALL closeOutput( ) throw(::com::sun::star::io::NotConnectedException, ::com::sun::star::io::BufferSizeExceededException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace comphelper
+
+#endif //_COMPHELPER_SEQSTREAM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
new file mode 100644
index 000000000000..ad1e8943b952
--- /dev/null
+++ b/include/comphelper/sequence.hxx
@@ -0,0 +1,369 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#define _COMPHELPER_SEQUENCE_HXX_
+
+#include <algorithm> // copy algorithm
+#include <com/sun/star/uno/Sequence.hxx>
+#include <osl/diagnose.h>
+#include "comphelper/comphelperdllapi.h"
+
+#include <vector>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+
+ //-------------------------------------------------------------------------
+ /** search the given string within the given sequence, return the positions where it was found.
+ if _bOnlyFirst is sal_True, only the first occurrence will be returned.
+ */
+ COMPHELPER_DLLPUBLIC staruno::Sequence<sal_Int16> findValue(const staruno::Sequence< OUString >& _rList, const OUString& _rValue, sal_Bool _bOnlyFirst = sal_False);
+
+ /** Checks if the name exists
+ *
+ * \param Value The value to search for.
+ * \param _aList The list in which to search for the value.
+ * \return <TRUE/> if the value can be found, otherwise <FALSE/>.
+ */
+ COMPHELPER_DLLPUBLIC sal_Bool existsValue(const OUString& Value,const ::com::sun::star::uno::Sequence< OUString >& _aList);
+
+
+ //-------------------------------------------------------------------------
+ namespace internal
+ {
+ template <class T>
+ void implCopySequence(const T* _pSource, T*& _pDest, sal_Int32 _nSourceLen)
+ {
+ for (sal_Int32 i=0; i<_nSourceLen; ++i, ++_pSource, ++_pDest)
+ *_pDest = *_pSource;
+ }
+ }
+ //-------------------------------------------------------------------------
+ /// concat two sequences
+ template <class T>
+ staruno::Sequence<T> concatSequences(const staruno::Sequence<T>& _rLeft, const staruno::Sequence<T>& _rRight)
+ {
+ sal_Int32 nLeft(_rLeft.getLength()), nRight(_rRight.getLength());
+ const T* pLeft = _rLeft.getConstArray();
+ const T* pRight = _rRight.getConstArray();
+
+ sal_Int32 nReturnLen(nLeft + nRight);
+ staruno::Sequence<T> aReturn(nReturnLen);
+ T* pReturn = aReturn.getArray();
+
+ internal::implCopySequence(pLeft, pReturn, nLeft);
+ internal::implCopySequence(pRight, pReturn, nRight);
+
+ return aReturn;
+ }
+
+ //-------------------------------------------------------------------------
+ /// concat three sequences
+ template <class T>
+ staruno::Sequence<T> concatSequences(const staruno::Sequence<T>& _rLeft, const staruno::Sequence<T>& _rMiddle, const staruno::Sequence<T>& _rRight)
+ {
+ sal_Int32 nLeft(_rLeft.getLength()), nMiddle(_rMiddle.getLength()), nRight(_rRight.getLength());
+ const T* pLeft = _rLeft.getConstArray();
+ const T* pMiddle = _rMiddle.getConstArray();
+ const T* pRight = _rRight.getConstArray();
+
+ sal_Int32 nReturnLen(nLeft + nMiddle + nRight);
+ staruno::Sequence<T> aReturn(nReturnLen);
+ T* pReturn = aReturn.getArray();
+
+ internal::implCopySequence(pLeft, pReturn, nLeft);
+ internal::implCopySequence(pMiddle, pReturn, nMiddle);
+ internal::implCopySequence(pRight, pReturn, nRight);
+
+ return aReturn;
+ }
+
+ //-------------------------------------------------------------------------
+ /// remove a specified element from a sequences
+ template<class T>
+ void removeElementAt(staruno::Sequence<T>& _rSeq, sal_Int32 _nPos)
+ {
+ sal_uInt32 nLength = _rSeq.getLength();
+
+ OSL_ENSURE(0 <= _nPos && (sal_uInt32)_nPos < nLength, "invalid index");
+
+ for (sal_uInt32 i = (sal_uInt32)_nPos + 1; i < nLength; ++i)
+ {
+ _rSeq[i-1] = _rSeq[i];
+ }
+
+ _rSeq.realloc(nLength-1);
+ }
+
+ //=====================================================================
+ //= iterating through sequences
+ //=====================================================================
+ /** a helper class for iterating through a sequence
+ */
+ template <class TYPE>
+ class OSequenceIterator
+ {
+ const TYPE* m_pElements;
+ sal_Int32 m_nLen;
+ const TYPE* m_pCurrent;
+
+ public:
+ /** contrcuct a sequence iterator from a sequence
+ */
+ OSequenceIterator(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq);
+ /** contrcuct a sequence iterator from a Any containing a sequence
+ */
+ OSequenceIterator(const ::com::sun::star::uno::Any& _rSequenceAny);
+
+ sal_Bool hasMoreElements() const;
+ ::com::sun::star::uno::Any nextElement();
+
+ private:
+ void construct(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq);
+ };
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ OSequenceIterator<TYPE>::OSequenceIterator(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq)
+ :m_pElements(NULL)
+ ,m_nLen(0)
+ ,m_pCurrent(NULL)
+ {
+ construct(_rSeq);
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ OSequenceIterator<TYPE>::OSequenceIterator(const ::com::sun::star::uno::Any& _rSequenceAny)
+ :m_pElements(NULL)
+ ,m_nLen(0)
+ ,m_pCurrent(NULL)
+ {
+ ::com::sun::star::uno::Sequence< TYPE > aContainer;
+ sal_Bool bSuccess = _rSequenceAny >>= aContainer;
+ OSL_ENSURE(bSuccess, "OSequenceIterator::OSequenceIterator: invalid Any!");
+ (void)bSuccess;
+ construct(aContainer);
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ void OSequenceIterator<TYPE>::construct(const ::com::sun::star::uno::Sequence< TYPE >& _rSeq)
+ {
+ m_pElements = _rSeq.getConstArray();
+ m_nLen = _rSeq.getLength();
+ m_pCurrent = m_pElements;
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ sal_Bool OSequenceIterator<TYPE>::hasMoreElements() const
+ {
+ return m_pCurrent - m_pElements < m_nLen;
+ }
+
+ //---------------------------------------------------------------------
+ template <class TYPE>
+ ::com::sun::star::uno::Any OSequenceIterator<TYPE>::nextElement()
+ {
+ return ::com::sun::star::uno::makeAny(*m_pCurrent++);
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a plain C/C++ array into a Sequence.
+
+ @tpl SrcType
+ Array element type. Must be assignable to DstType
+
+ @tpl DstType
+ Sequence element type. Must be assignable from SrcType
+
+ @param i_pArray
+ Valid pointer to at least num elements of type SrcType
+
+ @param nNum
+ Number of array elements to copy
+
+ @return the resulting Sequence
+
+ @attention when copying from e.g. a double array to a
+ Sequence<int>, no proper rounding will be performed, but the
+ values will be truncated. There's currently no measure to
+ prevent or detect precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ ::com::sun::star::uno::Sequence< DstType > arrayToSequence( const SrcType* i_pArray, sal_Int32 nNum )
+ {
+ ::com::sun::star::uno::Sequence< DstType > result( nNum );
+ ::std::copy( i_pArray, i_pArray+nNum, result.getArray() );
+ return result;
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a Sequence into a plain C/C++ array
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to DstType
+
+ @tpl DstType
+ Array element type. Must be assignable from SrcType
+
+ @param io_pArray
+ Valid pointer to at least i_Sequence.getLength() elements of
+ type DstType
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return a pointer to the array
+
+ @attention when copying from e.g. a Sequence<double> to an int
+ array, no proper rounding will be performed, but the values
+ will be truncated. There's currently no measure to prevent or
+ detect precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ DstType* sequenceToArray( DstType* io_pArray, const ::com::sun::star::uno::Sequence< SrcType >& i_Sequence )
+ {
+ ::std::copy( i_Sequence.getConstArray(), i_Sequence.getConstArray()+i_Sequence.getLength(), io_pArray );
+ return io_pArray;
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a container into a Sequence
+
+ @tpl SrcType
+ Container type. This type must fulfill the STL container
+ concept, in particular, the size(), begin() and end() methods
+ must be available and have the usual semantics.
+
+ @tpl DstType
+ Sequence element type. Must be assignable from SrcType's
+ elements
+
+ @param i_Container
+ Reference to the input contain with elements of type SrcType
+
+ @return the generated Sequence
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a vector<double> to a Sequence<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ ::com::sun::star::uno::Sequence< DstType > containerToSequence( const SrcType& i_Container )
+ {
+ ::com::sun::star::uno::Sequence< DstType > result( i_Container.size() );
+ ::std::copy( i_Container.begin(), i_Container.end(), result.getArray() );
+ return result;
+ }
+
+ template <typename T>
+ inline ::com::sun::star::uno::Sequence<T> containerToSequence(
+ ::std::vector<T> const& v )
+ {
+ return ::com::sun::star::uno::Sequence<T>(
+ v.empty() ? 0 : &v[0], static_cast<sal_Int32>(v.size()) );
+ }
+
+ //-------------------------------------------------------------------------
+ /** Copy from a Sequence into a container
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to SrcType's
+ elements
+
+ @tpl DstType
+ Container type. This type must fulfill the STL container and
+ sequence concepts, in particular, the begin(), end() and the
+ unary constructor DstType(int) methods must be available and
+ have the usual semantics.
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return the generated container
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a Sequence<double> to a vector<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ DstType sequenceToContainer( const ::com::sun::star::uno::Sequence< SrcType >& i_Sequence )
+ {
+ DstType result( i_Sequence.getLength() );
+ ::std::copy( i_Sequence.getConstArray(), i_Sequence.getConstArray()+i_Sequence.getLength(), result.begin() );
+ return result;
+ }
+ //-------------------------------------------------------------------------
+ /** Copy from a Sequence into an existing container
+
+ This potentially saves a needless extra copy operation over
+ the whole container, as it passes the target object by
+ reference.
+
+ @tpl SrcType
+ Sequence element type. Must be assignable to SrcType's
+ elements
+
+ @tpl DstType
+ Container type. This type must fulfill the STL container and
+ sequence concepts, in particular, the begin(), end() and
+ resize(int) methods must be available and have the usual
+ semantics.
+
+ @param o_Output
+ Reference to the target container
+
+ @param i_Sequence
+ Reference to a Sequence of SrcType elements
+
+ @return a non-const reference to the given container
+
+ @attention this function always performs a copy. Furthermore,
+ when copying from e.g. a Sequence<double> to a vector<int>, no
+ proper rounding will be performed, but the values will be
+ truncated. There's currently no measure to prevent or detect
+ precision loss, overflow or truncation.
+ */
+ template < typename DstType, typename SrcType >
+ DstType& sequenceToContainer( DstType& o_Output, const ::com::sun::star::uno::Sequence< SrcType >& i_Sequence )
+ {
+ o_Output.resize( i_Sequence.getLength() );
+ ::std::copy( i_Sequence.getConstArray(), i_Sequence.getConstArray()+i_Sequence.getLength(), o_Output.begin() );
+ return o_Output;
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+
+#endif // _COMPHELPER_SEQUENCE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequenceashashmap.hxx b/include/comphelper/sequenceashashmap.hxx
new file mode 100644
index 000000000000..0c8353776931
--- /dev/null
+++ b/include/comphelper/sequenceashashmap.hxx
@@ -0,0 +1,313 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SEQUENCEASHASHMAP_HXX_
+#define _COMPHELPER_SEQUENCEASHASHMAP_HXX_
+
+#include <boost/unordered_map.hpp>
+
+#include <algorithm>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <com/sun/star/beans/IllegalTypeException.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+
+namespace comphelper{
+
+
+/** @short Implements a stl hash map on top of some
+ specialized sequence from type PropertyValue
+ or NamedValue.
+
+ @descr That provides the possibility to modify
+ such name sequences very easy ...
+ */
+
+struct SequenceAsHashMapBase : public ::boost::unordered_map<
+ OUString ,
+ ::com::sun::star::uno::Any ,
+ OUStringHash ,
+ ::std::equal_to< OUString > >
+{
+};
+
+class COMPHELPER_DLLPUBLIC SequenceAsHashMap : public SequenceAsHashMapBase
+{
+ //-------------------------------------------
+ public:
+
+ //---------------------------------------
+ /** @short creates an empty hash map.
+ */
+ SequenceAsHashMap();
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Any&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Any& aSource);
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lSource);
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lSource);
+
+ //---------------------------------------
+ /** @see operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >&)
+ */
+ SequenceAsHashMap(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lSource);
+
+ //---------------------------------------
+ /** @short not realy used but maybe useful :-)
+ */
+ ~SequenceAsHashMap();
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ any, which of course must contain
+ a suitable sequence of element types
+ "css.beans.PropertyValue" or "css.beans.NamedValue".
+
+ @attention If the given Any is an empty one
+ (if its set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ contains the new items for this map.
+
+ @throw An <type scope="com::sun::star::beans">IllegalTypeException</type>
+ is thrown, if the given any does not contain a suitable sequence ...
+ but not if its a VOID Any!
+ */
+ void operator<<(const ::com::sun::star::uno::Any& aSource);
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ sequence, where every Any must contain
+ an item from type "css.beans.PropertyValue"
+ "css.beans.NamedValue".
+
+ @param lSource
+ contains the new items for this map.
+
+ @throw An <type scope="com::sun::star::beans">IllegalTypeException</type>
+ is thrown, if the given any sequence
+ uses wrong types for its items. VOID Any will be ignored!
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& lSource);
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ PropertyValue sequence.
+
+ @param lSource
+ contains the new items for this map.
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lSource);
+
+ //---------------------------------------
+ /** @short fill this map from the given
+ NamedValue sequence.
+
+ @param lSource
+ contains the new items for this map.
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lSource);
+
+ //---------------------------------------
+ /** @short converts this map instance to an
+ PropertyValue sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lDestination) const;
+
+ //---------------------------------------
+ /** @short converts this map instance to an
+ NamedValue sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& lDestination) const;
+
+ //---------------------------------------
+ /** @short return this map instance as an
+ Any, which can be
+ used in const environments only.
+
+ @descr Its made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsAnyList());
+
+ @param bAsPropertyValue
+ switch between using of PropertyValue or NamedValue as
+ value type.
+
+ @return A const Any, which
+ contains all items of this map.
+ */
+ const ::com::sun::star::uno::Any getAsConstAny(::sal_Bool bAsPropertyValue) const;
+
+ //---------------------------------------
+ /** @short return this map instance to as a
+ NamedValue sequence, which can be
+ used in const environments only.
+
+ @descr Its made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsNamedValueList());
+
+ @return A const sequence of type NamedValue, which
+ contains all items of this map.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getAsConstNamedValueList() const;
+
+ //---------------------------------------
+ /** @short return this map instance to as a
+ PropertyValue sequence, which can be
+ used in const environments only.
+
+ @descr Its made const to prevent using of the
+ return value directly as an in/out parameter!
+ usage: myMethod(stlDequeAdapter.getAsPropertyValueList());
+
+ @return A const sequence of type PropertyValue, which
+ contains all items of this map.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getAsConstPropertyValueList() const;
+
+ //---------------------------------------
+ /** @short check if the specified item exists
+ and return its (unpacked!) value or it returns the
+ specified default value otherwise.
+
+ @descr If a value should be extracted only in case
+ the requsted property exists realy (without creating
+ of new items as it the index operator of a
+ has_map does!) this method can be used.
+
+ @param sKey
+ key name of the item.
+
+ @param aDefault
+ the default value, which is returned
+ if the specified item could not
+ be found.
+
+ @return The (unpacked!) value of the specified property or
+ the given default value otherwise.
+
+ @attention "unpacked" means the Any content of every iterator->second!
+ */
+ template< class TValueType >
+ TValueType getUnpackedValueOrDefault(const OUString& sKey ,
+ const TValueType& aDefault) const
+ {
+ const_iterator pIt = find(sKey);
+ if (pIt == end())
+ return aDefault;
+
+ TValueType aValue = TValueType();
+ if (!(pIt->second >>= aValue))
+ return aDefault;
+
+ return aValue;
+ }
+
+ //---------------------------------------
+ /** @short creates a new item with the specified
+ name and value only in case such item name
+ does not already exist.
+
+ @descr To check if the property already exists only
+ her name is used for compare. Its value isnt
+ checked!
+
+ @param sKey
+ key name of the property.
+
+ @param aValue
+ the new (unpacked!) value.
+ Note: This value will be transformed to an Any
+ internaly, because only Any values can be
+ part of a PropertyValue or NamedValue structure.
+
+ @return TRUE if this property was added as new item;
+ FALSE if it already exists.
+ */
+ template< class TValueType >
+ sal_Bool createItemIfMissing(const OUString& sKey ,
+ const TValueType& aValue)
+ {
+ if (find(sKey) == end())
+ {
+ (*this)[sKey] = ::com::sun::star::uno::makeAny(aValue);
+ return sal_True;
+ }
+
+ return sal_False;
+ }
+
+ //---------------------------------------
+ /** @short check if all items of given map
+ exists in these called map also.
+
+ @descr Every item of the given map must exists
+ with same name and value inside these map.
+ But these map can contain additional items
+ which are not part of the search-map.
+
+ @param rCheck
+ the map containing all items for checking.
+
+ @return
+ TRUE if all items of Rcheck could be found
+ in these map; FALSE otherwise.
+ */
+ sal_Bool match(const SequenceAsHashMap& rCheck) const;
+
+ //---------------------------------------
+ /** @short merge all values from the given map into
+ this one.
+
+ @descr Existing items will be overwritten ...
+ missing items will be created new ...
+ but non specified items will stay alive !
+
+ @param rSource
+ the map containing all items for the update.
+ */
+ void update(const SequenceAsHashMap& rSource);
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_SEQUENCEASHASHMAP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sequenceasvector.hxx b/include/comphelper/sequenceasvector.hxx
new file mode 100644
index 000000000000..305eba9245ff
--- /dev/null
+++ b/include/comphelper/sequenceasvector.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SEQUENCEASVECTOR_HXX_
+#define _COMPHELPER_SEQUENCEASVECTOR_HXX_
+
+#include <vector>
+#include <algorithm>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <com/sun/star/beans/IllegalTypeException.hpp>
+
+
+namespace comphelper{
+
+
+/** @short Implements a stl vector on top of any
+ uno sequence.
+
+ @descr That provides the possibility to modify
+ sequences very easy ...
+ Of course this can be useful only, if
+ count of modifications is high, so copying
+ of the sequence make sense!
+ */
+template< class TElementType >
+class SequenceAsVector : public ::std::vector< TElementType >
+{
+ //-------------------------------------------
+ // types
+
+ public:
+
+ //---------------------------------------
+ /** @short When inheriting from a template using typename is generally required when using
+ types from the base! */
+ typedef typename ::std::vector< TElementType >::const_iterator const_iterator;
+
+ //---------------------------------------
+ /** @short When inheriting from a template using typename is generally required when using
+ types from the base! */
+ typedef typename ::std::vector< TElementType >::iterator iterator;
+
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short default ctor, to create an empty list.
+ */
+ SequenceAsVector()
+ {}
+
+ //---------------------------------------
+ /** @short default dtor
+ */
+ ~SequenceAsVector()
+ {}
+
+ //---------------------------------------
+ /** @short creates a new vector with the given length.
+
+ @param nLength
+ the number of elements for the new vector.
+ */
+ explicit SequenceAsVector(sal_Int32 nLength) :
+ ::std::vector< TElementType >( static_cast< size_t >( nLength ) )
+ {
+ }
+
+ //---------------------------------------
+ /** @short creates a new deque from the given uno sequence.
+
+ @param lSource
+ contains the new items for this deque.
+ */
+ SequenceAsVector(const ::com::sun::star::uno::Sequence< TElementType >& lSource)
+ {
+ (*this) << lSource;
+ }
+
+ //---------------------------------------
+ /** @short creates a new instance from the given Any, which
+ of course must contain a valid sequence using the
+ right element type for every item.
+
+ @attention If the given Any is an empty one
+ (if its set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ this any must contain a suitable sequence. :-)
+
+ @throw A <type scope="com::sun::star::beans">IllegalTypeException</type>
+ if an unsupported element inside this Any
+ is given. An empty Any reset this instance!
+ */
+ SequenceAsVector(const ::com::sun::star::uno::Any& aSource)
+ {
+ (*this) << aSource;
+ }
+
+ //---------------------------------------
+ /** @short fill this instance from the given uno sequence.
+
+ @param lSource
+ contains the new items for this deque.
+ */
+ void operator<<(const ::com::sun::star::uno::Sequence< TElementType >& lSource)
+ {
+ this->clear();
+
+ sal_Int32 c = lSource.getLength();
+ const TElementType* pSource = lSource.getConstArray();
+
+ for (sal_Int32 i=0; i<c; ++i)
+ this->push_back(pSource[i]);
+ }
+
+ //---------------------------------------
+ /** @short fill this instance from the given Any, which
+ of course must contain a valid sequence using the
+ right element type for every item.
+
+ @attention If the given Any is an empty one
+ (if its set to VOID), no exception
+ is thrown. In such case this instance will
+ be created as an empty one too!
+
+ @param aSource
+ this any must contain a suitable sequence. :-)
+
+ @throw A <type scope="com::sun::star::beans">IllegalTypeException</type>
+ if an unsupported element inside this Any
+ is given. An empty Any reset this instance!
+ */
+ void operator<<(const ::com::sun::star::uno::Any& aSource)
+ {
+ // An empty Any reset this instance!
+ if (!aSource.hasValue())
+ {
+ this->clear();
+ return;
+ }
+
+ ::com::sun::star::uno::Sequence< TElementType > lSource;
+ if (!(aSource >>= lSource))
+ throw ::com::sun::star::beans::IllegalTypeException(
+ OUString("SequenceAsVector operator<<(Any) was called with an unsupported Any type."),
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >());
+
+ (*this) << lSource;
+ }
+
+ //---------------------------------------
+ /** @short converts this instance to an uno sequence.
+
+ @param lDestination
+ target sequence for converting.
+ */
+ void operator>>(::com::sun::star::uno::Sequence< TElementType >& lDestination) const
+ {
+ sal_Int32 c = (sal_Int32)this->size();
+ lDestination.realloc(c);
+ TElementType* pDestination = lDestination.getArray();
+
+ sal_Int32 i = 0;
+ for (typename std::vector<TElementType>::const_iterator pThis = this->begin();
+ pThis != this->end() ;
+ ++pThis )
+ {
+ pDestination[i] = *pThis;
+ ++i;
+ }
+ }
+
+ //---------------------------------------
+ /** @short converts this instance to an uno any
+ which contains a suitable sequence
+ of items of this stl struct.
+
+ @param aDestination
+ target any for converting.
+ */
+ void operator>>(::com::sun::star::uno::Any& aDestination) const
+ {
+ sal_Int32 c = (sal_Int32)this->size();
+ ::com::sun::star::uno::Sequence< TElementType > lDestination(c);
+ TElementType* pDestination = lDestination.getArray();
+
+ sal_Int32 i = 0;
+ for (typename std::vector<TElementType>::const_iterator pThis = this->begin();
+ pThis != this->end() ;
+ ++pThis )
+ {
+ pDestination[i] = *pThis;
+ ++i;
+ }
+
+ aDestination <<= lDestination;
+ }
+
+ //---------------------------------------
+ /** @short converts this deque to a suitable uno
+ sequence which contains all items.
+
+ @attention It return a const sequence to prevent
+ the outside code against using of this
+ return value as [in/]out parameter for
+ direct function calls!
+ Of course it can be casted to non const
+ ... but then its a problem of the outside
+ code :-)
+
+ @return A (const!) sequence, which contains all items of
+ this deque.
+ */
+ const ::com::sun::star::uno::Sequence< TElementType > getAsConstList() const
+ {
+ ::com::sun::star::uno::Sequence< TElementType > lDestination;
+ (*this) >> lDestination;
+ return lDestination;
+ }
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_SEQUENCEASVECTOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/servicedecl.hxx b/include/comphelper/servicedecl.hxx
new file mode 100644
index 000000000000..be3b275cf215
--- /dev/null
+++ b/include/comphelper/servicedecl.hxx
@@ -0,0 +1,409 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_SERVICEDECL_HXX_INCLUDED
+#define COMPHELPER_SERVICEDECL_HXX_INCLUDED
+
+#include <comphelper/comphelperdllapi.h>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#include <uno/environment.h>
+#include <boost/utility.hpp>
+#include <boost/function.hpp>
+#include <boost/preprocessor/cat.hpp>
+#include <boost/preprocessor/repetition.hpp>
+#include <boost/preprocessor/seq/enum.hpp>
+
+namespace comphelper {
+namespace service_decl {
+
+class ServiceDecl;
+
+namespace detail {
+typedef ::boost::function3<
+ css::uno::Reference<css::uno::XInterface> /* return */,
+ ServiceDecl const&,
+ css::uno::Sequence<css::uno::Any> const&,
+ css::uno::Reference<css::uno::XComponentContext> const&> CreateFuncF;
+}
+
+/** Class to declare a service implementation. There is no need to implement
+ lang::XServiceInfo nor lang::XInitialization anymore.
+ The declaration can be done in various ways, the (simplest) form is
+
+ <pre>
+ class MyClass : public cppu::WeakImplHelper2<XInterface1, XInterface2> {
+ public:
+ MyClass( uno::Reference<uno::XComponentContext> const& xContext )
+ [...]
+ };
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass>(),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ If the service demands initialization by arguments, the implementation
+ class has to define a constructor taking both arguments and component
+ context:
+
+ <pre>
+ class MyClass : public cppu::WeakImplHelper2<XInterface1, XInterface2> {
+ public:
+ MyClass( uno::Sequence<uno::Any> const& args,
+ uno::Reference<uno:XComponentContext> const& xContext )
+ [...]
+ };
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass, sdecl::with_args<true> >(),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ Additionally, there is the possibility to process some code after creation,
+ e.g. to add the newly created object as a listener or perform aggregation
+ (C++-UNO only):
+
+ <pre>
+ uno::Reference<uno::XInterface> somePostProcCode( MyClass * p );
+ [...]
+ namespace sdecl = comphelper::service_decl;
+ sdecl::ServiceDecl const myDecl(
+ sdecl::class_<MyClass, ... >(&somePostProcCode),
+ "my.unique.implementation.name",
+ "MyServiceSpec1;MyServiceSpec2" );
+ </pre>
+
+ In the latter case, somePostProcCode gets the yet unacquired "raw" pointer.
+*/
+class COMPHELPER_DLLPUBLIC ServiceDecl : private ::boost::noncopyable
+{
+public:
+ /** Ctor for multiple supported service names.
+
+ @param implClass implementation class description
+ @param pImplName implementation name
+ @param pSupportedServiceNames supported service names
+ @param cDelim delimiter for supported service names
+ */
+ template <typename ImplClassT>
+ ServiceDecl( ImplClassT const& implClass,
+ char const* pImplName,
+ char const* pSupportedServiceNames, char cDelim = ';' )
+ : m_createFunc(implClass.m_createFunc),
+ m_pImplName(pImplName),
+ m_pServiceNames(pSupportedServiceNames),
+ m_cDelim(cDelim) {}
+
+ /// @internal gets called by component_getFactoryHelper()
+ void * getFactory( sal_Char const* pImplName ) const;
+
+ /// @return supported service names
+ ::com::sun::star::uno::Sequence< OUString>
+ getSupportedServiceNames() const;
+
+ /// @return whether name is in set of supported service names
+ bool supportsService( OUString const& name ) const;
+
+ /// @return implementation name
+ OUString getImplementationName() const;
+
+private:
+ class Factory;
+ friend class Factory;
+
+ detail::CreateFuncF const m_createFunc;
+ char const* const m_pImplName;
+ char const* const m_pServiceNames;
+ char const m_cDelim;
+};
+
+/** To specify whether the implementation class expects arguments
+ (uno::Sequence<uno::Any>).
+*/
+template <bool> struct with_args;
+
+/// @internal
+namespace detail {
+template <typename ImplT>
+class OwnServiceImpl
+ : public ImplT,
+ private ::boost::noncopyable
+{
+ typedef ImplT BaseT;
+
+public:
+ OwnServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ :BaseT(args, xContext), m_rServiceDecl(rServiceDecl) {}
+ OwnServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ : BaseT(xContext), m_rServiceDecl(rServiceDecl) {}
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw (css::uno::RuntimeException) {
+ return m_rServiceDecl.getImplementationName();
+ }
+ virtual sal_Bool SAL_CALL supportsService( OUString const& name )
+ throw (css::uno::RuntimeException) {
+ return m_rServiceDecl.supportsService(name);
+ }
+ virtual css::uno::Sequence< OUString>
+ SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException) {
+ return m_rServiceDecl.getSupportedServiceNames();
+ }
+
+private:
+ ServiceDecl const& m_rServiceDecl;
+};
+
+template <typename ImplT>
+class ServiceImpl : public OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> >
+{
+typedef OwnServiceImpl< ::cppu::ImplInheritanceHelper1<ImplT,css::lang::XServiceInfo> > ServiceImpl_BASE;
+public:
+ ServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ : ServiceImpl_BASE(rServiceDecl, args, xContext) {}
+ ServiceImpl(
+ ServiceDecl const& rServiceDecl,
+ css::uno::Reference<css::uno::XComponentContext> const& xContext )
+ : ServiceImpl_BASE(rServiceDecl, xContext) {}
+};
+
+template <typename ServiceImplT>
+struct PostProcessDefault {
+ css::uno::Reference<css::uno::XInterface>
+ operator()( ServiceImplT * p ) const {
+ return static_cast<css::lang::XServiceInfo *>(p);
+ }
+};
+
+template <typename ImplT, typename PostProcessFuncT, typename WithArgsT>
+struct CreateFunc;
+
+template <typename ImplT, typename PostProcessFuncT>
+struct CreateFunc<ImplT, PostProcessFuncT, with_args<false> > {
+ PostProcessFuncT const m_postProcessFunc;
+ explicit CreateFunc( PostProcessFuncT const& postProcessFunc )
+ : m_postProcessFunc(postProcessFunc) {}
+
+ css::uno::Reference<css::uno::XInterface>
+ operator()( ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const&,
+ css::uno::Reference<css::uno::XComponentContext>
+ const& xContext ) const
+ {
+ return m_postProcessFunc(
+ new ImplT( rServiceDecl, xContext ) );
+ }
+};
+
+template <typename ImplT, typename PostProcessFuncT>
+struct CreateFunc<ImplT, PostProcessFuncT, with_args<true> > {
+ PostProcessFuncT const m_postProcessFunc;
+ explicit CreateFunc( PostProcessFuncT const& postProcessFunc )
+ : m_postProcessFunc(postProcessFunc) {}
+
+ css::uno::Reference<css::uno::XInterface>
+ operator()( ServiceDecl const& rServiceDecl,
+ css::uno::Sequence<css::uno::Any> const& args,
+ css::uno::Reference<css::uno::XComponentContext>
+ const& xContext ) const
+ {
+ return m_postProcessFunc(
+ new ImplT( rServiceDecl, args, xContext ) );
+ }
+};
+
+} // namespace detail
+
+/** Defines a service implementation class.
+
+ @tpl ImplT_ service implementation class
+ @WithArgsT whether the implementation class ctor expects arguments
+ (uno::Sequence<uno::Any>, uno::Reference<uno::XComponentContext>)
+ or just (uno::Reference<uno::XComponentContext>)
+*/
+template <typename ImplT_, typename WithArgsT = with_args<false> >
+struct serviceimpl_base {
+ typedef ImplT_ ImplT;
+
+ detail::CreateFuncF const m_createFunc;
+
+ typedef detail::PostProcessDefault<ImplT> PostProcessDefaultT;
+
+ /** Default ctor. Implementation class without args, expecting
+ component context as single argument.
+ */
+ serviceimpl_base() : m_createFunc(
+ detail::CreateFunc<ImplT, PostProcessDefaultT, WithArgsT>(
+ PostProcessDefaultT() ) ) {}
+
+ /** Ctor to pass a post processing function/functor.
+
+ @tpl PostProcessDefaultT let your compiler deduce this
+ @param postProcessFunc function/functor that gets the yet unacquired
+ ImplT_ pointer returning a
+ uno::Reference<uno::XInterface>
+ */
+ template <typename PostProcessFuncT>
+ explicit serviceimpl_base( PostProcessFuncT const& postProcessFunc )
+ : m_createFunc( detail::CreateFunc<ImplT, PostProcessFuncT, WithArgsT>(
+ postProcessFunc ) ) {}
+};
+
+template <typename ImplT_, typename WithArgsT = with_args<false> >
+struct class_ : public serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT >
+{
+ typedef serviceimpl_base< detail::ServiceImpl<ImplT_>, WithArgsT > baseT;
+ /** Default ctor. Implementation class without args, expecting
+ component context as single argument.
+ */
+ class_() : baseT() {}
+ template <typename PostProcessFuncT>
+ /** Ctor to pass a post processing function/functor.
+
+ @tpl PostProcessDefaultT let your compiler deduce this
+ @param postProcessFunc function/functor that gets the yet unacquired
+ ImplT_ pointer returning a
+ uno::Reference<uno::XInterface>
+ */
+ explicit class_( PostProcessFuncT const& postProcessFunc ) : baseT( postProcessFunc ) {}
+};
+
+//
+// component_... helpers with arbitrary service declarations:
+//
+
+#define COMPHELPER_SERVICEDECL_getFactory(z_, n_, unused_) \
+ if (pRet == 0) \
+ pRet = BOOST_PP_CAT(s, n_).getFactory(pImplName);
+
+/** The following preprocessor repetitions generate functions like
+
+ <pre>
+ inline void * component_getFactoryHelper(
+ sal_Char const* pImplName,
+ ::com::sun::star::lang::XMultiServiceFactory *,
+ ::com::sun::star::registry::XRegistryKey * xRegistryKey,
+ ServiceDecl const& s0, ServiceDecl const& s1, ... );
+ </pre>
+
+ which call on the passed service declarations.
+
+ The maximum number of service declarations can be set by defining
+ COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS; its default is 8.
+*/
+#define COMPHELPER_SERVICEDECL_make(z_, n_, unused_) \
+inline void * component_getFactoryHelper( \
+ sal_Char const* pImplName, \
+ ::com::sun::star::lang::XMultiServiceFactory *, \
+ ::com::sun::star::registry::XRegistryKey *, \
+ BOOST_PP_ENUM_PARAMS(n_, ServiceDecl const& s) ) \
+{ \
+ void * pRet = 0; \
+ BOOST_PP_REPEAT(n_, COMPHELPER_SERVICEDECL_getFactory, ~) \
+ return pRet; \
+}
+
+#ifndef COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS
+#define COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS 8
+#endif
+
+BOOST_PP_REPEAT_FROM_TO(1, COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS,
+ COMPHELPER_SERVICEDECL_make, ~)
+
+#undef COMPHELPER_SERVICEDECL_COMPONENT_HELPER_MAX_ARGS
+#undef COMPHELPER_SERVICEDECL_make
+#undef COMPHELPER_SERVICEDECL_getFactory
+
+} // namespace service_decl
+} // namespace comphelper
+
+/** The following preprocessor macro generates the C access functions,
+ that are used to initialize and register the components of a
+ shared library object.
+
+ If you have, say, written a lib that contains three distinct
+ components, each with its own ServiceDecl object, you might want
+ to employ the following code:
+
+ <pre>
+ // must reside outside _any_ namespace
+ COMPHELPER_SERVICEDECL_EXPORTS3(yourServiceDecl1,
+ yourServiceDecl2,
+ yourServiceDecl3);
+ </pre>
+
+ For your convenience, the COMPHELPER_SERVICEDECL_EXPORTS<N> macro
+ comes pre-defined up to N=8, if you should need more arguments,
+ call COMPHELPER_SERVICEDECL_make_exports directly, like this:
+
+ <pre>
+ // must reside outside _any_ namespace
+ COMPHELPER_SERVICEDECL_make_exports((yourServiceDecl1)(yourServiceDecl2)...(yourServiceDeclN));
+ </pre>
+
+ Note the missing colons between the bracketed arguments.
+ */
+#define COMPHELPER_SERVICEDECL_make_exports(compName, varargs_ ) \
+extern "C" \
+{ \
+ SAL_DLLPUBLIC_EXPORT void* SAL_CALL compName##_component_getFactory( sal_Char const* pImplName, \
+ ::com::sun::star::lang::XMultiServiceFactory* pServiceManager, \
+ ::com::sun::star::registry::XRegistryKey* pRegistryKey ) \
+ { \
+ return component_getFactoryHelper( pImplName, pServiceManager, \
+ pRegistryKey, \
+ BOOST_PP_SEQ_ENUM(varargs_) ); \
+ } \
+}
+
+#define COMPHELPER_SERVICEDECL_EXPORTS1(compName,comp0_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_))
+#define COMPHELPER_SERVICEDECL_EXPORTS2(compName,comp0_,comp1_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_))
+#define COMPHELPER_SERVICEDECL_EXPORTS3(compName,comp0_,comp1_,comp2_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_))
+#define COMPHELPER_SERVICEDECL_EXPORTS4(compName,comp0_,comp1_,comp2_,comp3_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_))
+#define COMPHELPER_SERVICEDECL_EXPORTS5(compName,comp0_,comp1_,comp2_,comp3_,comp4_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_))
+#define COMPHELPER_SERVICEDECL_EXPORTS6(compName,comp0_,comp1_,comp2_,comp3_,comp4_,comp5_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_)(comp5_))
+#define COMPHELPER_SERVICEDECL_EXPORTS7(compName,comp0_,comp1_,comp2_,comp3_,comp4_,comp5_,comp6_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_)(comp5_)(comp6_))
+#define COMPHELPER_SERVICEDECL_EXPORTS8(compName,comp0_,comp1_,comp2_,comp3_,comp4_,comp5_,comp6_,comp7_) \
+ COMPHELPER_SERVICEDECL_make_exports(compName,(comp0_)(comp1_)(comp2_)(comp3_)(comp4_)(comp5_)(comp6_)(comp7_))
+
+#endif // ! defined(COMPHELPER_SERVICEDECL_HXX_INCLUDED)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/servicehelper.hxx b/include/comphelper/servicehelper.hxx
new file mode 100644
index 000000000000..a861e88db2d7
--- /dev/null
+++ b/include/comphelper/servicehelper.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SERVICEHELPER_HXX_
+#define _COMPHELPER_SERVICEHELPER_HXX_
+
+#include <rtl/uuid.h>
+#include <rtl/instance.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+class UnoTunnelIdInit
+{
+private:
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aSeq;
+public:
+ UnoTunnelIdInit() : m_aSeq(16)
+ {
+ rtl_createUuid( (sal_uInt8*)m_aSeq.getArray(), 0, sal_True );
+ }
+ const ::com::sun::star::uno::Sequence< sal_Int8 >& getSeq() const { return m_aSeq; }
+};
+
+/** the UNO3_GETIMPLEMENTATION_* macros implement a static helper function
+ that gives access to your implementation for a given interface reference,
+ if possible.
+
+ Example:
+ MyClass* pClass = MyClass::getImplementation( xRef );
+
+ Usage:
+ Put a UNO3_GETIMPLEMENTATION_DECL( classname ) inside your class
+ definitian and UNO3_GETIMPLEMENTATION_IMPL( classname ) inside
+ your cxx file. Your class must inherit ::com::sun::star::uno::XUnoTunnel
+ and export it with queryInterface. Implementation of XUnoTunnel is
+ done by this macro.
+*/
+#define UNO3_GETIMPLEMENTATION_DECL( classname ) \
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); \
+ static classname* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xInt ); \
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+#define UNO3_GETIMPLEMENTATION_BASE_IMPL( classname ) \
+namespace \
+{ \
+ class the##classname##UnoTunnelId : public rtl::Static< UnoTunnelIdInit, the##classname##UnoTunnelId> {}; \
+} \
+const ::com::sun::star::uno::Sequence< sal_Int8 > & classname::getUnoTunnelId() throw() \
+{ \
+ return the##classname##UnoTunnelId::get().getSeq(); \
+} \
+\
+classname* classname::getImplementation( const uno::Reference< uno::XInterface >& xInt ) \
+{ \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > xUT( xInt, ::com::sun::star::uno::UNO_QUERY ); \
+ if( xUT.is() ) \
+ return reinterpret_cast<classname*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething( classname::getUnoTunnelId() ))); \
+ else \
+ return NULL; \
+}
+
+#define UNO3_GETIMPLEMENTATION_IMPL( classname )\
+UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
+sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \
+ rId.getConstArray(), 16 ) ) \
+ { \
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
+ } \
+ return 0; \
+}
+
+#define UNO3_GETIMPLEMENTATION2_IMPL( classname, baseclass )\
+UNO3_GETIMPLEMENTATION_BASE_IMPL(classname)\
+sal_Int64 SAL_CALL classname::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException) \
+{ \
+ if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), \
+ rId.getConstArray(), 16 ) ) \
+ { \
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this)); \
+ } \
+ else \
+ { \
+ return baseclass::getSomething( rId ); \
+ } \
+}
+
+
+#endif // _COMPHELPER_SERVICEHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/serviceinfohelper.hxx b/include/comphelper/serviceinfohelper.hxx
new file mode 100644
index 000000000000..25169d1043a0
--- /dev/null
+++ b/include/comphelper/serviceinfohelper.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_SERVICEINFOHELPER_HXX
+#define COMPHELPER_SERVICEINFOHELPER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper {
+
+/** this class provides a basic helper for classes suporting the XServiceInfo Interface.
+ *
+ * you can overload the <code>getSupprotedServiceNames</code> to implement a XServiceInfo.
+ * you can use the static helper methods to combine your services with that of parent
+ * or aggregatet classes.
+ */
+class COMPHELPER_DLLPUBLIC ServiceInfoHelper : public ::com::sun::star::lang::XServiceInfo
+{
+public:
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // helper
+ static void addToSequence( ::com::sun::star::uno::Sequence< OUString >& rSeq, sal_uInt16 nServices, /* sal_Char* */... ) throw();
+ static sal_Bool SAL_CALL supportsService( const OUString& ServiceName, const ::com::sun::star::uno::Sequence< OUString >& SupportedServices ) throw();
+
+protected:
+ ~ServiceInfoHelper() {}
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/sharedmutex.hxx b/include/comphelper/sharedmutex.hxx
new file mode 100644
index 000000000000..8013e7f404aa
--- /dev/null
+++ b/include/comphelper/sharedmutex.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_SHAREDMUTEX_HXX
+#define COMPHELPER_SHAREDMUTEX_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <osl/mutex.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //============================================================
+ //= SharedMutex
+ //============================================================
+ class COMPHELPER_DLLPUBLIC SharedMutex
+ {
+ public:
+ SharedMutex();
+ SharedMutex( const SharedMutex& );
+ SharedMutex& operator=( const SharedMutex& );
+ ~SharedMutex()
+ {
+ }
+
+ inline ::osl::Mutex& getMutex() { return *m_pMutexImpl; }
+ inline operator ::osl::Mutex& () { return *m_pMutexImpl; }
+
+ private:
+ ::boost::shared_ptr< ::osl::Mutex > m_pMutexImpl;
+ };
+
+ //============================================================
+ //= SharedMutexBase
+ //============================================================
+ /** sometimes, it's necessary to have an initialized ::osl::Mutex to pass
+ to some ctor call of your base class. In this case, you can't hold the
+ SharedMutex as member, but you need to move it into another base class,
+ which is initialized before the mutex-requiring class is.
+ */
+ class COMPHELPER_DLLPUBLIC SharedMutexBase
+ {
+ protected:
+ SharedMutexBase()
+ {
+ }
+ ~SharedMutexBase()
+ {
+ }
+
+ protected:
+ ::osl::Mutex& getMutex() const { return m_aMutex; }
+ SharedMutex& getSharedMutex() const { return m_aMutex; }
+
+ private:
+ mutable SharedMutex m_aMutex;
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // COMPHELPER_SHAREDMUTEX_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stillreadwriteinteraction.hxx b/include/comphelper/stillreadwriteinteraction.hxx
new file mode 100644
index 000000000000..c6d62e8da9e2
--- /dev/null
+++ b/include/comphelper/stillreadwriteinteraction.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_STILLREADWRITEINTERACTION_HXX_
+#define _COMPHELPER_STRILLREADWRITEINTERACTION_HXX_
+
+#include <ucbhelper/interceptedinteraction.hxx>
+
+#include <com/sun/star/task/XInteractionHandler.hpp>
+
+#include "comphelper/comphelperdllapi.h"
+
+
+namespace comphelper{
+class COMPHELPER_DLLPUBLIC StillReadWriteInteraction : public ::ucbhelper::InterceptedInteraction
+{
+private:
+ static const sal_Int32 HANDLE_INTERACTIVEIOEXCEPTION = 0;
+ static const sal_Int32 HANDLE_UNSUPPORTEDDATASINKEXCEPTION = 1;
+
+ sal_Bool m_bUsed;
+ sal_Bool m_bHandledByMySelf;
+ sal_Bool m_bHandledByInternalHandler;
+
+public:
+ StillReadWriteInteraction(const com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >& xHandler);
+
+ void resetInterceptions();
+ void resetErrorStates();
+ sal_Bool wasWriteError();
+
+private:
+ virtual ucbhelper::InterceptedInteraction::EInterceptionState intercepted(const ::ucbhelper::InterceptedInteraction::InterceptedRequest& aRequest,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest);
+
+};
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stl_types.hxx b/include/comphelper/stl_types.hxx
new file mode 100644
index 000000000000..cef5afdff3f2
--- /dev/null
+++ b/include/comphelper/stl_types.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_STLTYPES_HXX_
+#define _COMPHELPER_STLTYPES_HXX_
+
+#include "sal/config.h"
+
+#include <vector>
+#include <map>
+
+#include <stack>
+#include <set>
+
+#include <math.h> // prevent conflict between exception and std::exception
+#include <functional>
+
+
+#include <rtl/ustring.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+//... namespace comphelper ................................................
+namespace comphelper
+{
+//.........................................................................
+
+//========================================================================
+// comparisation functions
+
+//------------------------------------------------------------------------
+ struct UStringLess : public ::std::binary_function< OUString, OUString, bool>
+{
+ bool operator() (const OUString& x, const OUString& y) const { return x < y ? true : false;} // construct prevents a MSVC6 warning
+};
+//------------------------------------------------------------------------
+struct UStringMixLess : public ::std::binary_function< OUString, OUString, bool>
+{
+ bool m_bCaseSensitive;
+public:
+ UStringMixLess(bool bCaseSensitive = true):m_bCaseSensitive(bCaseSensitive){}
+ bool operator() (const OUString& x, const OUString& y) const
+ {
+ if (m_bCaseSensitive)
+ return rtl_ustr_compare(x.getStr(), y.getStr()) < 0 ? true : false;
+ else
+ return rtl_ustr_compareIgnoreAsciiCase(x.getStr(), y.getStr()) < 0 ? true : false;
+ }
+
+ bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+//------------------------------------------------------------------------
+struct UStringEqual
+{
+ sal_Bool operator() (const OUString& lhs, const OUString& rhs) const { return lhs.equals( rhs );}
+};
+
+//------------------------------------------------------------------------
+struct UStringIEqual
+{
+ sal_Bool operator() (const OUString& lhs, const OUString& rhs) const { return lhs.equalsIgnoreAsciiCase( rhs );}
+};
+
+//------------------------------------------------------------------------
+class UStringMixEqual
+{
+ sal_Bool m_bCaseSensitive;
+
+public:
+ UStringMixEqual(sal_Bool bCaseSensitive = sal_True):m_bCaseSensitive(bCaseSensitive){}
+ sal_Bool operator() (const OUString& lhs, const OUString& rhs) const
+ {
+ return m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs );
+ }
+ sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+//------------------------------------------------------------------------
+class TStringMixEqualFunctor : public ::std::binary_function< OUString,OUString,bool>
+{
+ sal_Bool m_bCaseSensitive;
+
+public:
+ TStringMixEqualFunctor(sal_Bool bCaseSensitive = sal_True)
+ :m_bCaseSensitive(bCaseSensitive)
+ {}
+ bool operator() (const OUString& lhs, const OUString& rhs) const
+ {
+ return !!(m_bCaseSensitive ? lhs.equals( rhs ) : lhs.equalsIgnoreAsciiCase( rhs ));
+ }
+ sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+//------------------------------------------------------------------------
+class TPropertyValueEqualFunctor : public ::std::binary_function< ::com::sun::star::beans::PropertyValue,OUString,bool>
+{
+public:
+ TPropertyValueEqualFunctor()
+ {}
+ bool operator() (const ::com::sun::star::beans::PropertyValue& lhs, const OUString& rhs) const
+ {
+ return !!(lhs.Name == rhs);
+ }
+};
+//------------------------------------------------------------------------
+class TNamedValueEqualFunctor : public ::std::binary_function< ::com::sun::star::beans::NamedValue,OUString,bool>
+{
+public:
+ TNamedValueEqualFunctor()
+ {}
+ bool operator() (const ::com::sun::star::beans::NamedValue& lhs, const OUString& rhs) const
+ {
+ return !!(lhs.Name == rhs);
+ }
+};
+//------------------------------------------------------------------------
+class UStringMixHash
+{
+ sal_Bool m_bCaseSensitive;
+
+public:
+ UStringMixHash(sal_Bool bCaseSensitive = sal_True):m_bCaseSensitive(bCaseSensitive){}
+ size_t operator() (const OUString& rStr) const
+ {
+ return m_bCaseSensitive ? rStr.hashCode() : rStr.toAsciiUpperCase().hashCode();
+ }
+ sal_Bool isCaseSensitive() const {return m_bCaseSensitive;}
+};
+
+//=====================================================================
+//= OInterfaceCompare
+//=====================================================================
+/** is stl-compliant structure for comparing Reference&lt; &lt;iface&gt; &gt; instances
+*/
+template < class IAFCE >
+struct OInterfaceCompare
+ :public ::std::binary_function < ::com::sun::star::uno::Reference< IAFCE >
+ , ::com::sun::star::uno::Reference< IAFCE >
+ , bool
+ >
+{
+ bool operator() (const ::com::sun::star::uno::Reference< IAFCE >& lhs, const ::com::sun::star::uno::Reference< IAFCE >& rhs) const
+ {
+ return lhs.get() < rhs.get();
+ // this does not make any sense if you see the semantics of the pointer returned by get:
+ // It's a pointer to a point in memory where an interface implementation lies.
+ // But for our purpose (provide a reliable less-operator which can be used with the STL), this is
+ // sufficient ....
+ }
+};
+
+template <class _Tp, class _Arg>
+class mem_fun1_t : public ::std::binary_function<_Tp*,_Arg,void>
+{
+ typedef void (_Tp::*_fun_type)(_Arg);
+public:
+ explicit mem_fun1_t(_fun_type __pf) : _M_f(__pf) {}
+ void operator()(_Tp* __p, _Arg __x) const { (__p->*_M_f)(__x); }
+private:
+ _fun_type _M_f;
+};
+
+template <class _Tp, class _Arg>
+inline mem_fun1_t<_Tp,_Arg> mem_fun(void (_Tp::*__f)(_Arg))
+{
+ return mem_fun1_t<_Tp,_Arg>(__f);
+}
+
+//.........................................................................
+/** output iterator that appends OUStrings into an OUStringBuffer.
+ */
+class OUStringBufferAppender :
+ public ::std::iterator< ::std::output_iterator_tag, void, void, void, void>
+{
+public:
+ typedef OUStringBufferAppender Self;
+ typedef ::std::output_iterator_tag iterator_category;
+ typedef void value_type;
+ typedef void reference;
+ typedef void pointer;
+ typedef size_t difference_type;
+
+ OUStringBufferAppender(OUStringBuffer & i_rBuffer)
+ : m_rBuffer(i_rBuffer) { }
+ Self & operator=(OUString const & i_rStr)
+ {
+ m_rBuffer.append( i_rStr );
+ return *this;
+ }
+ Self & operator*() { return *this; } // so operator= works
+ Self & operator++() { return *this; }
+ Self & operator++(int) { return *this; }
+
+private:
+ OUStringBuffer & m_rBuffer;
+};
+
+//.........................................................................
+/** algorithm similar to std::copy, but inserts a separator between elements.
+ */
+template< typename ForwardIter, typename OutputIter, typename T >
+OutputIter intersperse(
+ ForwardIter start, ForwardIter end, OutputIter out, T const & separator)
+{
+ if (start != end) {
+ *out = *start;
+ ++start;
+ ++out;
+ }
+
+ while (start != end) {
+ *out = separator;
+ ++out;
+ *out = *start;
+ ++start;
+ ++out;
+ }
+
+ return out;
+}
+
+//.........................................................................
+}
+//... namespace comphelper ................................................
+
+//==================================================================
+// consistently defining stl-types
+//==================================================================
+
+#define DECLARE_STL_ITERATORS(classname) \
+ typedef classname::iterator classname##Iterator; \
+ typedef classname::const_iterator Const##classname##Iterator \
+
+#define DECLARE_STL_MAP(keytype, valuetype, comparefct, classname) \
+ typedef std::map< keytype, valuetype, comparefct > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#define DECLARE_STL_STDKEY_MAP(keytype, valuetype, classname) \
+ DECLARE_STL_MAP(keytype, valuetype, std::less< keytype >, classname) \
+
+#define DECLARE_STL_VECTOR(valuetyp, classname) \
+ typedef std::vector< valuetyp > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#define DECLARE_STL_USTRINGACCESS_MAP(valuetype, classname) \
+ DECLARE_STL_MAP(OUString, valuetype, ::comphelper::UStringLess, classname) \
+
+#define DECLARE_STL_STDKEY_SET(valuetype, classname) \
+ typedef ::std::set< valuetype > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#define DECLARE_STL_SET(valuetype, comparefct, classname) \
+ typedef ::std::set< valuetype, comparefct > classname; \
+ DECLARE_STL_ITERATORS(classname) \
+
+#endif // _COMPHELPER_STLTYPES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/stlunosequence.hxx b/include/comphelper/stlunosequence.hxx
new file mode 100644
index 000000000000..c7b776f78d6e
--- /dev/null
+++ b/include/comphelper/stlunosequence.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_STLUNOITERATOR_HXX
+#define _COMPHELPER_STLUNOITERATOR_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <sal/types.h>
+
+
+namespace comphelper
+{
+ /**
+ @short stl-container-like access to an existing ::com::sun::star::uno::Sequence
+ @descr These template functions allows using an existing
+ ::com::sun::star::uno::Sequence using stl algorithms. They provides
+ standard-compliant mutable random access iterators. Because random access
+ iterators are the most generic iterators defined by the stl, any stl algorithm
+ can be applied to the Sequence (excluding algorithms requiring output
+ iterators).
+ <p>
+ Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence)
+ <code>
+ ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10);
+ ::std::list stl_list(stl_begin(aSeq), stl_end(aSeq));
+ </code>
+ <p>
+ Example: (sorting ::com::sun::star::uno::Sequence inplace)
+ <code>
+ ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10);
+ ::std::sort(stl_begin(aSeq), stl_seq.end(aSeq));
+ </code>
+ <p>
+ Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence)
+ <code>
+ ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10);
+ sal_Int32 count = 0;
+ ::std::count(stl_begin(aSeq), stl_end(aSeq), 4711, count);
+ </code>
+ <p>
+
+ @see http://www.sgi.com/tech/stl/Container.html
+ @see http://www.sgi.com/tech/stl/Sequence.html
+ @see http://www.sgi.com/tech/stl/RandomAccessIterator.html
+ */
+
+ template <typename V>
+ V* stl_begin(::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getArray(); }
+
+ template <typename V>
+ V* stl_end(::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getArray() + rSeq.getLength(); }
+
+ template <typename V>
+ const V* stl_begin(const ::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getConstArray(); }
+
+ template <typename V>
+ const V* stl_end(const ::com::sun::star::uno::Sequence<V>& rSeq)
+ { return rSeq.getConstArray() + rSeq.getLength(); }
+}
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/storagehelper.hxx b/include/comphelper/storagehelper.hxx
new file mode 100644
index 000000000000..093038e6e5ed
--- /dev/null
+++ b/include/comphelper/storagehelper.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef COMPHELPER_STORAGEHELPER_HXX
+#define COMPHELPER_STORAGEHELPER_HXX
+
+#include <boost/scoped_ptr.hpp>
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/embed/ElementModes.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+
+#define PACKAGE_STORAGE_FORMAT_STRING OUString( "PackageFormat" )
+#define ZIP_STORAGE_FORMAT_STRING OUString( "ZipFormat" )
+#define OFOPXML_STORAGE_FORMAT_STRING OUString( "OFOPXMLFormat" )
+
+#define PACKAGE_ENCRYPTIONDATA_SHA256UTF8 OUString( "PackageSHA256UTF8EncryptionKey" )
+#define PACKAGE_ENCRYPTIONDATA_SHA1UTF8 OUString( "PackageSHA1UTF8EncryptionKey" )
+#define PACKAGE_ENCRYPTIONDATA_SHA1MS1252 OUString( "PackageSHA1MS1252EncryptionKey" )
+
+namespace com { namespace sun { namespace star {
+ namespace beans { struct NamedValue; }
+ namespace embed { class XStorage; }
+ namespace io {
+ class XInputStream;
+ class XOutputStream;
+ class XStream;
+ }
+ namespace lang { class XSingleServiceFactory; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+
+// Unfortunately - the impl.s of XStorage like to invalidate all
+// their sub streams and storages when you release references, so
+// it is necessary to keep references to all storages down the
+// path - this is 'beautiful' (TM). So we need this ugly hack:
+class COMPHELPER_DLLPUBLIC LifecycleProxy
+{
+private:
+ class Impl;
+public:
+ ::boost::scoped_ptr<Impl> m_pBadness;
+ LifecycleProxy();
+ ~LifecycleProxy();
+ // commit the storages: necessary for writes to streams to take effect!
+ void commitStorages();
+};
+
+class COMPHELPER_DLLPUBLIC OStorageHelper
+{
+public:
+ static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
+ GetStorageFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory >
+ GetFileSystemStorageFactory(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetTemporaryStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ /// this one will only return Storage
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromURL(
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ /// this one will return either Storage or FileSystemStorage
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromURL2(
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromInputStream(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageFromStream(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
+ sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >() )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static void CopyInputToOutput(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ GetInputStreamFromURL(
+ const OUString& aURL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& context )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static void SetCommonStorageEncryptionData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aEncryptionData )
+ throw ( ::com::sun::star::uno::Exception );
+
+ // the following method supports only storages of OOo formats
+ static sal_Int32 GetXStorageFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageOfFormatFromURL(
+ const OUString& aFormat,
+ const OUString& aURL,
+ sal_Int32 nStorageMode,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
+ sal_Bool bRepairStorage = sal_False )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageOfFormatFromInputStream(
+ const OUString& aFormat,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XInputStream >& xStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
+ sal_Bool bRepairStorage = sal_False )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >
+ GetStorageOfFormatFromStream(
+ const OUString& aFormat,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::io::XStream >& xStream,
+ sal_Int32 nStorageMode = ::com::sun::star::embed::ElementModes::READWRITE,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext
+ = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >(),
+ sal_Bool bRepairStorage = sal_False )
+ throw ( ::com::sun::star::uno::Exception );
+
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >
+ CreatePackageEncryptionData(
+ const OUString& aPassword );
+
+ static sal_Bool IsValidZipEntryFileName( const OUString& aName, sal_Bool bSlashAllowed );
+ static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
+
+ static sal_Bool PathHasSegment( const OUString& aPath, const OUString& aSegment );
+
+ // Methods to allow easy use of hierachical names inside storages
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > GetStorageAtPath(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPath(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const OUString& aPath, sal_uInt32 nOpenMode, LifecycleProxy &rNastiness );
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetStreamAtPackageURL(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > &xStorage,
+ const OUString& rURL, sal_uInt32 const nOpenMode,
+ LifecycleProxy & rNastiness );
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/streamsection.hxx b/include/comphelper/streamsection.hxx
new file mode 100644
index 000000000000..40ea508f888b
--- /dev/null
+++ b/include/comphelper/streamsection.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_STREAMSECTION_HXX_
+#define _COMPHELPER_STREAMSECTION_HXX_
+
+#include <com/sun/star/io/XMarkableStream.hpp>
+#include <com/sun/star/io/XDataInputStream.hpp>
+#include <com/sun/star/io/XDataOutputStream.hpp>
+#include "comphelper/comphelperdllapi.h"
+
+namespace comphelper
+{
+
+ namespace stario = ::com::sun::star::io;
+ namespace staruno = ::com::sun::star::uno;
+
+/** implements handling for compatibly reading/writing data from/into an input/output stream.
+ data written in a block secured by this class should be readable by older versions which
+ use the same mechanism.
+
+ @author Frank Schoenheit
+ @since 00/26/05
+*/
+
+class COMPHELPER_DLLPUBLIC OStreamSection
+{
+ staruno::Reference< stario::XMarkableStream > m_xMarkStream;
+ staruno::Reference< stario::XDataInputStream > m_xInStream;
+ staruno::Reference< stario::XDataOutputStream > m_xOutStream;
+
+ sal_Int32 m_nBlockStart;
+ sal_Int32 m_nBlockLen;
+
+public:
+ /** starts reading of a "skippable" section of data within the given input stream<BR>
+ @param _rxInput the stream to read from. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ */
+ OStreamSection(const staruno::Reference< stario::XDataInputStream >& _rxInput);
+
+ /** starts writing of a "skippable" section of data into the given output stream
+ @param _rxOutput the stream the stream to write to. Must support the
+ <type scope="com::sun::star::io">XMarkableStream</type> interface
+ @param _nPresumedLength estimation for the length of the upcoming section. If greater 0, this
+ value will be written as section length and corrected (in the dtor) only if
+ needed. If you know how much bytes you are about to write, you may
+ want to use this param, saving some stream operations this way.
+ */
+ OStreamSection(const staruno::Reference< stario::XDataOutputStream >& _rxOutput, sal_Int32 _nPresumedLength = 0);
+
+ /** dtor. <BR>If constructed for writing, the section "opened" by this object will be "closed".<BR>
+ If constructed for reading, any remaining bytes 'til the end of the section will be skipped.
+ */
+ ~OStreamSection();
+};
+
+} // namespace comphelper
+
+#endif // _COMPHELPER_STREAMSECTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/string.hxx b/include/comphelper/string.hxx
new file mode 100644
index 000000000000..85b0816b895e
--- /dev/null
+++ b/include/comphelper/string.hxx
@@ -0,0 +1,466 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_STRING_HXX
+#define INCLUDED_COMPHELPER_STRING_HXX
+
+#include "sal/config.h"
+
+#include <cstddef>
+#include "comphelper/comphelperdllapi.h"
+#include <sal/types.h>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/i18n/XCollator.hpp>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+
+// OUString helper functions that are not widespread or mature enough to
+// go into the stable URE API:
+namespace comphelper { namespace string {
+
+/** Compare an OString to a single char
+
+ @param rIn The input OString
+ @param c The character to compare againsg
+
+ @return true if rIn has one char and its equal to c
+ */
+inline bool equals(const OString& rIn, sal_Char c)
+{ return rIn.getLength() == 1 && rIn[0] == c; }
+
+/** Compare an OUString to a single char
+
+ @param rIn The input OUString
+ @param c The character to compare againsg
+
+ @return true if rIn has one char and its equal to c
+ */
+inline bool equals(const OUString& rIn, sal_Unicode c)
+{ return rIn.getLength() == 1 && rIn[0] == c; }
+
+/** Removes all occurrences of a character from within the source string
+
+ @deprecated Use OString::replaceAll(OString(c), OString())
+ instead.
+
+ @param rIn The input OString
+ @param c The character to be removed
+
+ @return The resulting OString
+ */
+inline OString remove(const OString &rIn,
+ sal_Char c)
+{ return rIn.replaceAll(OString(c), OString()); }
+
+/** Removes all occurrences of a character from within the source string
+
+ @deprecated Use
+ OUString::replaceAll(OUString(c), OUString()) instead.
+
+ @param rIn The input OUString
+ @param c The character to be removed
+
+ @return The resulting OUString
+ */
+inline OUString remove(const OUString &rIn,
+ sal_Unicode c)
+{ return rIn.replaceAll(OUString(c), OUString()); }
+
+/** Strips occurrences of a character from the start of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the start
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString stripStart(const OString &rIn,
+ sal_Char c);
+
+/** Strips occurrences of a character from the start of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the start
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString stripStart(const OUString &rIn,
+ sal_Unicode c);
+
+/** Strips occurrences of a character from the end of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the end
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString stripEnd(const OString &rIn,
+ sal_Char c);
+
+/** Strips occurrences of a character from the end of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the end
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString stripEnd(const OUString &rIn,
+ sal_Unicode c);
+
+/** Strips occurrences of a character from the start and end of the source string
+
+ @param rIn The input OString
+ @param c The character to be stripped from the start and end
+
+ @return The resulting OString
+ */
+COMPHELPER_DLLPUBLIC OString strip(const OString &rIn,
+ sal_Char c);
+
+/** Strips occurrences of a character from the start and end of the source string
+
+ @param rIn The input OUString
+ @param c The character to be stripped from the start and end
+
+ @return The resulting OUString
+ */
+COMPHELPER_DLLPUBLIC OUString strip(const OUString &rIn,
+ sal_Unicode c);
+
+/** Returns a token in an OString
+
+ @deprecated Use OString::getToken(nToken, cTok) instead.
+
+ @param rIn the input OString
+ @param nToken the number of the token to return
+ @param cTok the character which seperate the tokens.
+ @return the token if token is negative or doesn't exist an empty token
+ is returned
+*/
+inline OString getToken(const OString &rIn,
+ sal_Int32 nToken, sal_Char cTok) SAL_THROW(())
+{
+ return rIn.getToken(nToken, cTok);
+}
+
+/** Returns a token in an OUString
+
+ @deprecated Use OUString::getToken(nToken, cTok) instead.
+
+ @param rIn the input OUString
+ @param nToken the number of the token to return
+ @param cTok the character which seperate the tokens.
+ @return the token if token is negative or doesn't exist an empty token
+ is returned
+*/
+inline OUString getToken(const OUString &rIn,
+ sal_Int32 nToken, sal_Unicode cTok) SAL_THROW(())
+{
+ return rIn.getToken(nToken, cTok);
+}
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OString
+ @param cTok the character which seperate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OString &rIn, sal_Char cTok);
+
+/** Returns number of tokens in an OUString
+
+ @param rIn the input OUString
+ @param cTok the character which seperate the tokens.
+ @return the number of tokens
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 getTokenCount(const OUString &rIn, sal_Unicode cTok);
+
+/** Reverse an OUString
+
+ @param rIn the input OUString
+ @return the reversed input
+*/
+COMPHELPER_DLLPUBLIC OUString reverseString(const OUString &rStr);
+
+/** Reverse an OString
+
+ @param rIn the input OString
+ @return the reversed input
+*/
+COMPHELPER_DLLPUBLIC OString reverseString(const OString &rStr);
+
+
+namespace detail
+{
+ template<typename B> B& truncateToLength(B& rBuffer, sal_Int32 nLen)
+ {
+ if (nLen < rBuffer.getLength())
+ rBuffer.remove(nLen, rBuffer.getLength()-nLen);
+ return rBuffer;
+ }
+}
+
+/** Truncate a buffer to a given length.
+
+ If the StringBuffer has more characters than nLength it will be truncated
+ on the right to nLength characters.
+
+ Has no effect if the StringBuffer is <= nLength
+
+ @param rBuf StringBuffer to operate on
+ @param nLength Length to truncate the buffer to
+
+ @return rBuf;
+ */
+COMPHELPER_DLLPUBLIC inline OStringBuffer& truncateToLength(
+ OStringBuffer& rBuffer, sal_Int32 nLength) SAL_THROW(())
+{
+ return detail::truncateToLength(rBuffer, nLength);
+}
+
+COMPHELPER_DLLPUBLIC inline OUStringBuffer& truncateToLength(
+ OUStringBuffer& rBuffer, sal_Int32 nLength) SAL_THROW(())
+{
+ return detail::truncateToLength(rBuffer, nLength);
+}
+
+namespace detail
+{
+ template<typename B, typename U> B& padToLength(B& rBuffer, sal_Int32 nLen,
+ U cFill = '\0')
+ {
+ sal_Int32 nOrigLen = rBuffer.getLength();
+ if (nLen > nOrigLen)
+ {
+ rBuffer.setLength(nLen);
+ for (sal_Int32 i = nOrigLen; i < nLen; ++i)
+ rBuffer[i] = cFill;
+ }
+ return rBuffer;
+ }
+}
+
+/** Pad a buffer to a given length using a given char.
+
+ If the StringBuffer has less characters than nLength it will be expanded on
+ the right to nLength characters, with the expansion filled using cFill.
+
+ Has no effect if the StringBuffer is >= nLength
+
+ @param rBuf StringBuffer to operate on
+ @param nLength Length to pad the buffer to
+ @param cFill character to fill expansion with
+
+ @return rBuf;
+ */
+COMPHELPER_DLLPUBLIC inline OStringBuffer& padToLength(
+ OStringBuffer& rBuffer, sal_Int32 nLength,
+ sal_Char cFill = '\0') SAL_THROW(())
+{
+ return detail::padToLength(rBuffer, nLength, cFill);
+}
+
+COMPHELPER_DLLPUBLIC inline OUStringBuffer& padToLength(
+ OUStringBuffer& rBuffer, sal_Int32 nLength,
+ sal_Unicode cFill = '\0') SAL_THROW(())
+{
+ return detail::padToLength(rBuffer, nLength, cFill);
+}
+
+/** Find any of a list of code units in the string.
+ @param rIn OUString to search
+ @param pChars 0-terminated array of sal_Unicode code units to search for
+ @param nPos start position
+
+ @return position of first occurrence of any of the elements of pChars
+ or -1 if none of the code units occur in the string
+ */
+COMPHELPER_DLLPUBLIC sal_Int32 indexOfAny(OUString const& rIn,
+ sal_Unicode const*const pChars, sal_Int32 const nPos = 0);
+
+/** Convert a sequence of strings to a single comma separated string.
+
+ Note that no escaping of commas or anything fancy is done.
+
+ @param i_rSeq A list of strings to be concatenated.
+
+ @return A single string containing the concatenation of the given
+ list, interspersed with the string ", ".
+ */
+COMPHELPER_DLLPUBLIC OUString convertCommaSeparated(
+ ::com::sun::star::uno::Sequence< OUString > const & i_rSeq);
+
+/** Convert a decimal string to a number.
+
+ The string must be base-10, no sign but can contain any
+ codepoint listed in the "Number, Decimal Digit" Unicode
+ category.
+
+ No verification is made about the validity of the string,
+ passing string not containing decimal digit code points
+ gives unspecified results
+
+ If your string is guaranteed to contain only ASCII digit
+ use OUString::toInt32 instead.
+
+ @param str The string to convert containing only decimal
+ digit codepoints.
+
+ @return The value of the string as an int32.
+ */
+COMPHELPER_DLLPUBLIC sal_uInt32 decimalStringToNumber(
+ OUString const & str );
+
+/** Convert a single comma separated string to a sequence of strings.
+
+ Note that no escaping of commas or anything fancy is done.
+
+ @param i_rString A string containing comma-separated words.
+
+ @return A sequence of strings resulting from splitting the given
+ string at ',' tokens and stripping whitespace.
+ */
+COMPHELPER_DLLPUBLIC ::com::sun::star::uno::Sequence< OUString >
+ convertCommaSeparated( OUString const & i_rString );
+
+/**
+ Compares two strings using natural order.
+
+ For non digit characters, the comparison use the same algorithm as
+ rtl_str_compare. When a number is encountered during the comparison,
+ natural order is used. Thus, Heading 10 will be considered as greater
+ than Heading 2. Numerical comparison is done using decimal representation.
+
+ Beware that "MyString 001" and "MyString 1" will be considered as equal
+ since leading 0 are meaningless.
+
+ @param str the object to be compared.
+ @return 0 - if both strings are equal
+ < 0 - if this string is less than the string argument
+ > 0 - if this string is greater than the string argument
+*/
+COMPHELPER_DLLPUBLIC sal_Int32 compareNatural( const OUString &rLHS, const OUString &rRHS,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > &rCollator,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > &rBI,
+ const ::com::sun::star::lang::Locale &rLocale );
+
+class COMPHELPER_DLLPUBLIC NaturalStringSorter
+{
+private:
+ ::com::sun::star::lang::Locale m_aLocale;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCollator > m_xCollator;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > m_xBI;
+public:
+ NaturalStringSorter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rContext,
+ const ::com::sun::star::lang::Locale &rLocale);
+ sal_Int32 compare(const OUString &rLHS, const OUString &rRHS) const
+ {
+ return compareNatural(rLHS, rRHS, m_xCollator, m_xBI, m_aLocale);
+ }
+ const ::com::sun::star::lang::Locale& getLocale() const { return m_aLocale; }
+};
+
+/** Determine if an OString contains solely ASCII numeric digits
+
+ @param rString An OString
+
+ @return false if string contains any characters outside
+ the ASCII '0'-'9' range
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OString &rString);
+
+/** Determine if an OUString contains solely ASCII numeric digits
+
+ @param rString An OUString
+
+ @return false if string contains any characters outside
+ the ASCII '0'-'9' range
+ true otherwise, including for empty string
+ */
+COMPHELPER_DLLPUBLIC bool isdigitAsciiString(const OUString &rString);
+
+COMPHELPER_DLLPUBLIC inline bool isdigitAscii(sal_Unicode c)
+{
+ return ((c >= '0') && (c <= '9'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isxdigitAscii(sal_Unicode c)
+{
+ return isdigitAscii(c) || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
+}
+
+COMPHELPER_DLLPUBLIC inline bool islowerAscii(sal_Unicode c)
+{
+ return ((c >= 'a') && (c <= 'z'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isupperAscii(sal_Unicode c)
+{
+ return ((c >= 'A') && (c <= 'Z'));
+}
+
+COMPHELPER_DLLPUBLIC inline bool isalphaAscii(sal_Unicode c)
+{
+ return islowerAscii(c) || isupperAscii(c);
+}
+
+COMPHELPER_DLLPUBLIC inline bool isalnumAscii(sal_Unicode c)
+{
+ return isalphaAscii(c) || isdigitAscii(c);
+}
+
+//============================================================
+//= a helper for static ascii pseudo-unicode strings
+//============================================================
+struct COMPHELPER_DLLPUBLIC ConstAsciiString
+{
+ const sal_Char* ascii;
+ sal_Int32 length;
+
+ operator OUString() const
+ {
+ return OUString(ascii, length, RTL_TEXTENCODING_ASCII_US);
+ }
+};
+
+} }
+
+#ifdef RTL_FAST_STRING
+// TODO The whole ConstAsciiString class should probably be dumped
+// and replaced with plain 'const char[]'.
+namespace rtl
+{
+template<>
+struct ToStringHelper< comphelper::string::ConstAsciiString >
+ {
+ static int length( const comphelper::string::ConstAsciiString& str ) { return str.length; }
+ static sal_Unicode* addData( sal_Unicode* buffer, const comphelper::string::ConstAsciiString& str ) { return addDataLiteral( buffer, str.ascii, str.length ); }
+ static const bool allowOStringConcat = false;
+ static const bool allowOUStringConcat = true;
+ };
+}
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/synchronousdispatch.hxx b/include/comphelper/synchronousdispatch.hxx
new file mode 100644
index 000000000000..efeffea6b4eb
--- /dev/null
+++ b/include/comphelper/synchronousdispatch.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+#define _COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+
+#include "comphelper/comphelperdllapi.h"
+
+#include "com/sun/star/uno/Reference.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+
+#include "com/sun/star/beans/PropertyValue.hpp"
+
+namespace com { namespace sun { namespace star {
+ namespace uno {
+ class XInterface; }
+ namespace lang {
+ class XComponent; }
+} } }
+
+
+//........................................................................
+namespace comphelper
+{
+//........................................................................
+
+ //====================================================================
+ //= SynchronousDispatch
+ //====================================================================
+ /** a helper class for working with the dispatch interface replacing
+ loadComponentFromURL
+ */
+ class SynchronousDispatch
+ {
+ public:
+ static COMPHELPER_DLLPUBLIC com::sun::star::uno::Reference< com::sun::star::lang::XComponent > dispatch(
+ const com::sun::star::uno::Reference< com::sun::star::uno::XInterface > &xStartPoint,
+ const OUString &sURL,
+ const OUString &sTarget,
+ const sal_Int32 nFlags,
+ const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > &lArguments );
+ };
+
+//........................................................................
+} // namespace comphelper
+//........................................................................
+
+#endif // _COMPHELPER_SYNCHRONOUSDISPATCH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/syntaxhighlight.hxx b/include/comphelper/syntaxhighlight.hxx
new file mode 100644
index 000000000000..ef1a9486a6bf
--- /dev/null
+++ b/include/comphelper/syntaxhighlight.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_SYNTAXHIGHLIGHT_HXX
+#define _COMPHELPER_SYNTAXHIGHLIGHT_HXX
+
+#include <vector>
+#include <rtl/ustring.hxx>
+
+#include <comphelper/comphelperdllapi.h>
+
+
+#if defined CDECL
+#undef CDECL
+#endif
+
+// for the bsearch
+#ifdef WNT
+#define CDECL _cdecl
+#endif
+#if defined(UNX)
+#define CDECL
+#endif
+#ifdef UNX
+#include <sys/resource.h>
+#endif
+
+
+// Token-Typen TT_...
+enum TokenTypes
+{
+ TT_UNKNOWN,
+ TT_IDENTIFIER,
+ TT_WHITESPACE,
+ TT_NUMBER,
+ TT_STRING,
+ TT_EOL,
+ TT_COMMENT,
+ TT_ERROR,
+ TT_OPERATOR,
+ TT_KEYWORDS,
+ TT_PARAMETER
+};
+
+struct HighlightPortion { sal_uInt16 nBegin; sal_uInt16 nEnd; TokenTypes tokenType; };
+
+
+typedef std::vector<HighlightPortion> HighlightPortions;
+
+/////////////////////////////////////////////////////////////////////////
+// Auxiliary class to support JavaScript modules, next to find functions which
+// will later will be used for syntax highlighting
+
+// Flags for character properties
+#define CHAR_START_IDENTIFIER 0x0001
+#define CHAR_IN_IDENTIFIER 0x0002
+#define CHAR_START_NUMBER 0x0004
+#define CHAR_IN_NUMBER 0x0008
+#define CHAR_IN_HEX_NUMBER 0x0010
+#define CHAR_IN_OCT_NUMBER 0x0020
+#define CHAR_START_STRING 0x0040
+#define CHAR_OPERATOR 0x0080
+#define CHAR_SPACE 0x0100
+#define CHAR_EOL 0x0200
+
+#define CHAR_EOF 0x00
+
+
+// Language mode of the Highlighter (possibly to be refined later with keyword
+// lists, C comment flags)
+enum HighlighterLanguage
+{
+ HIGHLIGHT_BASIC,
+ HIGHLIGHT_SQL
+};
+
+class SimpleTokenizer_Impl
+{
+ HighlighterLanguage aLanguage;
+ // Character information tables
+ sal_uInt16 aCharTypeTab[256];
+
+ const sal_Unicode* mpStringBegin;
+ const sal_Unicode* mpActualPos;
+
+ // Lines and columns
+ sal_uInt32 nLine;
+ sal_uInt32 nCol;
+
+ sal_Unicode peekChar( void ) { return *mpActualPos; }
+ sal_Unicode getChar( void ) { nCol++; return *mpActualPos++; }
+
+ // Auxiliary function: testing of the character flags
+ sal_Bool testCharFlags( sal_Unicode c, sal_uInt16 nTestFlags );
+
+ // Get new token, EmptyString == nothing more over there
+ sal_Bool getNextToken( /*out*/TokenTypes& reType,
+ /*out*/const sal_Unicode*& rpStartPos, /*out*/const sal_Unicode*& rpEndPos );
+
+ const char** ppListKeyWords;
+ sal_uInt16 nKeyWordCount;
+
+public:
+ SimpleTokenizer_Impl( HighlighterLanguage aLang = HIGHLIGHT_BASIC );
+ ~SimpleTokenizer_Impl( void );
+
+ sal_uInt16 parseLine( sal_uInt32 nLine, const OUString* aSource );
+ void getHighlightPortions( sal_uInt32 nParseLine, const OUString& rLine,
+ /*out*/HighlightPortions& portions );
+ void setKeyWords( const char** ppKeyWords, sal_uInt16 nCount );
+};
+
+
+//*** SyntaxHighlighter Class ***
+// Concept: the Highlighter will be notified of all changes in the source
+// (notifyChange) and returns the caller the range of lines, which based on the
+// changes, need to be highlighted again. For this the Highlighter marks all
+// lines internally whether or not C comments begin or end.
+class COMPHELPER_DLLPUBLIC SyntaxHighlighter
+{
+ HighlighterLanguage eLanguage;
+ SimpleTokenizer_Impl* m_pSimpleTokenizer;
+ char* m_pKeyWords;
+ sal_uInt16 m_nKeyWordCount;
+
+// void initializeKeyWords( HighlighterLanguage eLanguage );
+
+public:
+ SyntaxHighlighter( void );
+ ~SyntaxHighlighter( void );
+
+ // (Re-)initialize Highlighter. The line-table will be completely erased,
+ // meaning that on completion an empty Source is assumed.
+ // notifyChange() can only be given line 0
+ void initialize( HighlighterLanguage eLanguage_ );
+
+ void notifyChange( sal_uInt32 nLine, sal_Int32 nLineCountDifference,
+ const OUString* pChangedLines, sal_uInt32 nArrayLength);
+
+ void getHighlightPortions( sal_uInt32 nLine, const OUString& rLine,
+ HighlightPortions& pPortions );
+
+ HighlighterLanguage GetLanguage() { return eLanguage;}
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/types.hxx b/include/comphelper/types.hxx
new file mode 100644
index 000000000000..66c6a9e0bcfb
--- /dev/null
+++ b/include/comphelper/types.hxx
@@ -0,0 +1,174 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_TYPES_HXX_
+#define _COMPHELPER_TYPES_HXX_
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include "comphelper/comphelperdllapi.h"
+#include "cppu/unotype.hxx"
+
+namespace com { namespace sun { namespace star { namespace awt {
+ struct FontDescriptor;
+} } } }
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ namespace staruno = ::com::sun::star::uno;
+ namespace starawt = ::com::sun::star::awt;
+ namespace starlang = ::com::sun::star::lang;
+
+ typedef staruno::Reference< staruno::XInterface > InterfaceRef;
+ typedef staruno::Sequence< OUString > StringSequence;
+
+ //-------------------------------------------------------------------------
+ /** compare the two given Anys
+ The comparison is deep, means if one of the Any's contains an Any which contains an Any ..., this is resolved <br/>
+ Other types recognized currently : FontDescriptor, ::com::sun::star::util::Date/Tim/DateTime, staruno::Sequence<sal_Int8>
+ */
+ COMPHELPER_DLLPUBLIC sal_Bool compare(const staruno::Any& rLeft, const staruno::Any& rRight);
+
+ //-------------------------------------------------------------------------
+ /** compare two FontDescriptor's
+ */
+ COMPHELPER_DLLPUBLIC sal_Bool operator ==(const starawt::FontDescriptor& _rLeft, const starawt::FontDescriptor& _rRight);
+ inline sal_Bool operator !=(const starawt::FontDescriptor& _rLeft, const starawt::FontDescriptor& _rRight)
+ {
+ return !(_rLeft == _rRight);
+ }
+
+ //-------------------------------------------------------------------------
+ /// returns sal_True if objects of the types given are "compatible"
+ COMPHELPER_DLLPUBLIC sal_Bool isAssignableFrom(const staruno::Type& _rAssignable, const staruno::Type& _rFrom);
+
+ //-------------------------------------------------------------------------
+ /** just a small shortcut ...
+ check if a type you have at hand at runtime is equal to another type you have at compile time
+ if all our compiler would accept function calls with explicit template arguments (like
+ isA<classFoo>(runtimeType)), we wouldn't need the second parameter. But unfortunally at
+ least the current solaris compiler doesn't allow this ....
+ So this function is nearly senseless ....
+ */
+ template <class TYPE>
+ sal_Bool isA(const staruno::Type& _rType, TYPE* pDummy)
+ {
+ return _rType.equals(cppu::getTypeFavourUnsigned(pDummy));
+ }
+
+ //-------------------------------------------------------------------------
+ /** check if a type you have at hand at runtime is equal to another type you have at compile time
+ same comment as for the other isA ....
+ */
+ template <class TYPE>
+ sal_Bool isA(const staruno::Any& _rVal, TYPE* pDummy)
+ {
+ return _rVal.getValueType().equals(
+ cppu::getTypeFavourUnsigned(pDummy));
+ }
+
+ //-------------------------------------------------------------------------
+ /** check if a type you have at hand at runtime is equal to another type you have at compile time
+ */
+ template <class TYPE>
+ sal_Bool isAReference(const staruno::Any& _rVal, TYPE*)
+ {
+ return _rVal.getValueType().equals(
+ cppu::getTypeFavourUnsigned(
+ static_cast<staruno::Reference<TYPE>*>(NULL)));
+ }
+
+ //-------------------------------------------------------------------------
+ /** ask the given object for an XComponent interface and dispose on it
+ */
+ template <class TYPE>
+ void disposeComponent(staruno::Reference<TYPE>& _rxComp)
+ {
+ staruno::Reference<starlang::XComponent> xComp(_rxComp, staruno::UNO_QUERY);
+ if (xComp.is())
+ {
+ xComp->dispose();
+ _rxComp = NULL;
+ }
+ }
+ //-------------------------------------------------------------------------
+ template <class TYPE>
+ sal_Bool getImplementation(TYPE*& _pObject, const staruno::Reference< staruno::XInterface >& _rxIFace)
+ {
+ _pObject = NULL;
+ staruno::Reference< starlang::XUnoTunnel > xTunnel(_rxIFace, staruno::UNO_QUERY);
+ if (xTunnel.is())
+ _pObject = reinterpret_cast< TYPE* >(xTunnel->getSomething(TYPE::getUnoTunnelImplementationId()));
+
+ return (_pObject != NULL);
+ }
+
+
+ //-------------------------------------------------------------------------
+ /** get a com::sun::star::awt::FontDescriptor that is fully initialized with
+ the XXX_DONTKNOW enum values (which isn't the case if you instantiate it
+ via the default constructor)
+ */
+ COMPHELPER_DLLPUBLIC starawt::FontDescriptor getDefaultFont();
+
+ /** examine a sequence for the <type scope="com.sun.star.uno">Type</type> of it's elements.
+ */
+ COMPHELPER_DLLPUBLIC staruno::Type getSequenceElementType(const staruno::Type& _rSequenceType);
+
+//=========================================================================
+//= replacement of the former UsrAny.getXXX methods
+
+ // may be used if you need the return value just as temporary, else it's may be too inefficient ....
+
+ // no, we don't use templates here. This would lead to a lot of implicit uses of the conversion methods,
+ // which would be difficult to trace ...
+
+ COMPHELPER_DLLPUBLIC sal_Int64 getINT64(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Int32 getINT32(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Int16 getINT16(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC double getDouble(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC float getFloat(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC OUString getString(const staruno::Any& _rAny);
+ COMPHELPER_DLLPUBLIC sal_Bool getBOOL(const staruno::Any& _rAny);
+
+ COMPHELPER_DLLPUBLIC sal_Int32 getEnumAsINT32(const staruno::Any& _rAny) throw(starlang::IllegalArgumentException);
+
+//= replacement of some former UsrAny.setXXX methods - can be used with rvalues
+ inline void setBOOL(staruno::Any& _rAny, sal_Bool _b)
+ { _rAny.setValue(&_b, ::getBooleanCppuType()); }
+
+//= extension of ::cppu::makeAny()
+ inline staruno::Any makeBoolAny(sal_Bool _b)
+ { return staruno::Any(&_b, ::getBooleanCppuType()); }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_TYPES_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/uno3.hxx b/include/comphelper/uno3.hxx
new file mode 100644
index 000000000000..1b83c73f4f25
--- /dev/null
+++ b/include/comphelper/uno3.hxx
@@ -0,0 +1,275 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _COMPHELPER_UNO3_HXX_
+#define _COMPHELPER_UNO3_HXX_
+
+#include <osl/interlck.h>
+#include <rtl/instance.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <comphelper/sequence.hxx>
+#include <cppuhelper/typeprovider.hxx>
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+//=========================================================================
+
+ /// manipulate ref counts without calling acquire/release
+ inline oslInterlockedCount increment(oslInterlockedCount& _counter) { return osl_atomic_increment(&_counter); }
+ inline oslInterlockedCount decrement(oslInterlockedCount& _counter) { return osl_atomic_decrement(&_counter); }
+
+//=========================================================================
+
+ /** used for declaring UNO3-Defaults, i.e. acquire/release
+ */
+ #define DECLARE_UNO3_DEFAULTS(classname, baseclass) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+ /** used for declaring UNO3-Defaults, i.e. acquire/release if you want to forward all queryInterfaces to the base class,
+ (e.g. if you overload queryAggregation)
+ */
+ #define DECLARE_UNO3_AGG_DEFAULTS(classname, baseclass) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
+ { return baseclass::queryInterface(_rType); } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+ /** Use this macro to forward XComponent methods to base class
+
+ When using the ::cppu::WeakComponentImplHelper base classes to
+ implement a UNO interface, a problem occurs when the interface
+ itself already derives from XComponent (like e.g. awt::XWindow
+ or awt::XControl): ::cppu::WeakComponentImplHelper is then
+ still abstract. Using this macro in the most derived class
+ definition provides overrides for the XComponent methods,
+ forwarding them to the given baseclass.
+
+ @param classname
+ Name of the class this macro is issued within
+
+ @param baseclass
+ Name of the baseclass that should have the XInterface methods
+ forwarded to - that's usually the WeakComponentImplHelperN base
+
+ @param implhelper
+ Name of the baseclass that should have the XComponent methods
+ forwarded to - in the case of the WeakComponentImplHelper,
+ that would be ::cppu::WeakComponentImplHelperBase
+ */
+ #define DECLARE_UNO3_XCOMPONENT_DEFAULTS(classname, baseclass, implhelper) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::dispose(); \
+ } \
+ virtual void SAL_CALL addEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::addEventListener(xListener); \
+ } \
+ virtual void SAL_CALL removeEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::removeEventListener(xListener); \
+ } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+
+ /** Use this macro to forward XComponent methods to base class
+
+ When using the ::cppu::WeakComponentImplHelper base classes to
+ implement a UNO interface, a problem occurs when the interface
+ itself already derives from XComponent (like e.g. awt::XWindow
+ or awt::XControl): ::cppu::WeakComponentImplHelper is then
+ still abstract. Using this macro in the most derived class
+ definition provides overrides for the XComponent methods,
+ forwarding them to the given baseclass.
+
+ @param classname
+ Name of the class this macro is issued within
+
+ @param baseclass
+ Name of the baseclass that should have the XInterface methods
+ forwarded to - that's usually the WeakComponentImplHelperN base
+
+ @param implhelper
+ Name of the baseclass that should have the XComponent methods
+ forwarded to - in the case of the WeakComponentImplHelper,
+ that would be ::cppu::WeakComponentImplHelperBase
+ */
+ #define DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS(classname, baseclass, implhelper) \
+ virtual void SAL_CALL acquire() throw() { baseclass::acquire(); } \
+ virtual void SAL_CALL release() throw() { baseclass::release(); } \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException) \
+ { return baseclass::queryInterface(_rType); } \
+ virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::dispose(); \
+ } \
+ virtual void SAL_CALL addEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::addEventListener(xListener); \
+ } \
+ virtual void SAL_CALL removeEventListener( \
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > const & xListener ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ implhelper::removeEventListener(xListener); \
+ } \
+ void SAL_CALL PUT_SEMICOLON_AT_THE_END()
+
+
+ //=====================================================================
+ //= deriving from multiple XInterface-derived classes
+ //=====================================================================
+ //= forwarding/merging XInterface funtionality
+ //=====================================================================
+ #define DECLARE_XINTERFACE( ) \
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); \
+ virtual void SAL_CALL acquire() throw(); \
+ virtual void SAL_CALL release() throw();
+
+ #define IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ void SAL_CALL classname::acquire() throw() { refcountbase::acquire(); } \
+ void SAL_CALL classname::release() throw() { refcountbase::release(); }
+
+ #define IMPLEMENT_FORWARD_XINTERFACE2( classname, refcountbase, baseclass2 ) \
+ IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aReturn = refcountbase::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass2::queryInterface( _rType ); \
+ return aReturn; \
+ }
+
+ #define IMPLEMENT_FORWARD_XINTERFACE3( classname, refcountbase, baseclass2, baseclass3 ) \
+ IMPLEMENT_FORWARD_REFCOUNT( classname, refcountbase ) \
+ ::com::sun::star::uno::Any SAL_CALL classname::queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Any aReturn = refcountbase::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ { \
+ aReturn = baseclass2::queryInterface( _rType ); \
+ if ( !aReturn.hasValue() ) \
+ aReturn = baseclass3::queryInterface( _rType ); \
+ } \
+ return aReturn; \
+ }
+
+ //=====================================================================
+ //= forwarding/merging XTypeProvider funtionality
+ //=====================================================================
+ #define DECLARE_XTYPEPROVIDER( ) \
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException); \
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+ #define IMPLEMENT_GET_IMPLEMENTATION_ID( classname ) \
+ namespace \
+ { \
+ class the##classname##ImplementationId : public rtl::Static< ::cppu::OImplementationId, the##classname##ImplementationId> {}; \
+ } \
+ ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL classname::getImplementationId( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return the##classname##ImplementationId::get().getImplementationId(); \
+ }
+
+ #define IMPLEMENT_FORWARD_XTYPEPROVIDER2( classname, baseclass1, baseclass2 ) \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return ::comphelper::concatSequences( \
+ baseclass1::getTypes(), \
+ baseclass2::getTypes() \
+ ); \
+ } \
+ \
+ IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
+
+ #define IMPLEMENT_FORWARD_XTYPEPROVIDER3( classname, baseclass1, baseclass2, baseclass3 ) \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL classname::getTypes( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return ::comphelper::concatSequences( \
+ baseclass1::getTypes(), \
+ baseclass2::getTypes(), \
+ baseclass3::getTypes() \
+ ); \
+ } \
+ \
+ IMPLEMENT_GET_IMPLEMENTATION_ID( classname )
+
+//=========================================================================
+
+ /** ask for an iface of an aggregated object
+ usage:<br/>
+ Reference<XFoo> xFoo;<br/>
+ if (query_aggregation(xAggregatedObject, xFoo))<br/>
+ ....
+ */
+ template <class iface>
+ sal_Bool query_aggregation(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxAggregate, ::com::sun::star::uno::Reference<iface>& _rxOut)
+ {
+ _rxOut = static_cast<iface*>(NULL);
+ if (_rxAggregate.is())
+ {
+ ::com::sun::star::uno::Any aCheck = _rxAggregate->queryAggregation(
+ iface::static_type());
+ if (aCheck.hasValue())
+ _rxOut = *(::com::sun::star::uno::Reference<iface>*)aCheck.getValue();
+ }
+ return _rxOut.is();
+ }
+
+ /** ask for an iface of an object
+ usage:<br/>
+ Reference<XFoo> xFoo;<br/>
+ if (query_interface(xAnything, xFoo))<br/>
+ ....
+ */
+ template <class iface>
+ sal_Bool query_interface(const InterfaceRef& _rxObject, ::com::sun::star::uno::Reference<iface>& _rxOut)
+ {
+ _rxOut = static_cast<iface*>(NULL);
+ if (_rxObject.is())
+ {
+ ::com::sun::star::uno::Any aCheck = _rxObject->queryInterface(
+ iface::static_type());
+ if(aCheck.hasValue())
+ {
+ _rxOut = *(::com::sun::star::uno::Reference<iface>*)aCheck.getValue();
+ return _rxOut.is();
+ }
+ }
+ return sal_False;
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif // _COMPHELPER_UNO3_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx
new file mode 100644
index 000000000000..c4885f3883d9
--- /dev/null
+++ b/include/comphelper/unwrapargs.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_UNWRAPARGS_HXX_INCLUDED
+#define COMPHELPER_UNWRAPARGS_HXX_INCLUDED
+
+#include "rtl/ustrbuf.hxx"
+#include "com/sun/star/uno/Sequence.hxx"
+#include "com/sun/star/lang/IllegalArgumentException.hpp"
+#include "boost/optional.hpp"
+#include "boost/preprocessor/cat.hpp"
+#include "boost/preprocessor/repetition.hpp"
+#include "boost/preprocessor/arithmetic/add.hpp"
+#include "cppu/unotype.hxx"
+
+namespace comphelper {
+
+//
+// generating helper functions to unwrap the service's argument sequence:
+//
+
+/// @internal
+namespace detail {
+
+template <typename T>
+inline void extract(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& seq,
+ sal_Int32 nArg, T & v,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
+ const& xErrorContext )
+{
+ if (nArg >= seq.getLength()) {
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ OUString( "No such argument available!"),
+ xErrorContext, static_cast<sal_Int16>(nArg) );
+ }
+ if (! (seq[nArg] >>= v)) {
+ OUStringBuffer buf;
+ buf.append( "Cannot extract ANY { " );
+ buf.append( seq[nArg].getValueType().getTypeName() );
+ buf.append( " } to " );
+ buf.append( ::cppu::UnoType<T>::get().getTypeName() );
+ buf.append( static_cast<sal_Unicode>('!') );
+ throw ::com::sun::star::lang::IllegalArgumentException(
+ buf.makeStringAndClear(), xErrorContext,
+ static_cast<sal_Int16>(nArg) );
+ }
+}
+
+template <typename T>
+inline void extract(
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any> const& seq,
+ sal_Int32 nArg, ::boost::optional<T> & v,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>
+ const& xErrorContext )
+{
+ if (nArg < seq.getLength()) {
+ T t;
+ extract( seq, nArg, t, xErrorContext );
+ v.reset( t );
+ }
+}
+
+} // namespace detail
+
+#define COMPHELPER_UNWRAPARGS_extract(z_, n_, unused_) \
+ detail::extract( seq, n_, BOOST_PP_CAT(v, n_), xErrorContext );
+#define COMPHELPER_UNWRAPARGS_args(z_, n_, unused_) \
+ BOOST_PP_CAT(T, n_) & BOOST_PP_CAT(v, n_)
+
+/** The following preprocessor repetitions generate functions like
+
+ <pre>
+ template <typename T0, typename T1, ...>
+ inline void unwrapArgs(
+ uno::Sequence<uno::Any> const& seq,
+ T0 & v0, T1 & v1, ...,
+ css::uno::Reference<css::uno::XInterface> const& xErrorContext =
+ css::uno::Reference<css::uno::XInterface>() );
+ </pre>
+ (full namespace qualification ::com::sun::star has been omitted
+ for brevity)
+
+ which unwraps the passed sequence's elements, assigning them to the
+ referenced values. Specify optional arguments as boost::optional<T>.
+ If the length of the sequence is greater than the count of arguments,
+ then the latter sequence elements are ignored.
+ If too few arguments are given in the sequence and a missing argument is
+ no boost::optional<T>, then an lang::IllegalArgumentException is thrown
+ with the specified xErrorContext (defaults to null-ref).
+
+ The maximum number of service declarations can be set by defining
+ COMPHELPER_UNWRAPARGS_MAX_ARGS; its default is 12.
+*/
+#define COMPHELPER_UNWRAPARGS_make(z_, n_, unused_) \
+template < BOOST_PP_ENUM_PARAMS( BOOST_PP_ADD(n_, 1), typename T) > \
+inline void unwrapArgs( \
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const& seq, \
+ BOOST_PP_ENUM(BOOST_PP_ADD(n_, 1), COMPHELPER_UNWRAPARGS_args, ~), \
+ ::com::sun::star::uno::Reference< \
+ ::com::sun::star::uno::XInterface> const& xErrorContext = \
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>() ) \
+{ \
+ BOOST_PP_REPEAT(BOOST_PP_ADD(n_, 1), COMPHELPER_UNWRAPARGS_extract, ~) \
+}
+
+#ifndef COMPHELPER_UNWRAPARGS_MAX_ARGS
+#define COMPHELPER_UNWRAPARGS_MAX_ARGS 12
+#endif
+
+BOOST_PP_REPEAT(COMPHELPER_UNWRAPARGS_MAX_ARGS, COMPHELPER_UNWRAPARGS_make, ~)
+
+#undef COMPHELPER_UNWRAPARGS_MAX_ARGS
+#undef COMPHELPER_UNWRAPARGS_make
+#undef COMPHELPER_UNWRAPARGS_args
+#undef COMPHELPER_UNWRAPARGS_extract
+
+} // namespace comphelper
+
+#endif // ! defined(COMPHELPER_UNWRAPARGS_HXX_INCLUDED)
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weak.hxx b/include/comphelper/weak.hxx
new file mode 100644
index 000000000000..126078adbf59
--- /dev/null
+++ b/include/comphelper/weak.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _COMPHELPER_WEAK_HXX_
+#define _COMPHELPER_WEAK_HXX_
+
+#include "comphelper/comphelperdllapi.h"
+
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <cppuhelper/weak.hxx>
+
+namespace comphelper
+{
+/** Base class to implement an UNO object supporting types and weak references, i.e. the object can be held
+ weakly (by a ::com::sun::star::uno::WeakReference).
+ This implementation copes with reference counting. Upon last release(), the virtual dtor
+ is called.
+
+ In addition to the features from cppu::OWeakObject, derivations from this class can
+ also used as a base class for ::cppu::ImplInheritanceHelper?
+*/
+class COMPHELPER_DLLPUBLIC OWeakTypeObject : public ::cppu::OWeakObject, public ::com::sun::star::lang::XTypeProvider
+{
+public:
+ OWeakTypeObject();
+ virtual ~OWeakTypeObject();
+
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw ();
+ virtual void SAL_CALL release() throw ();
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+}
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weakbag.hxx b/include/comphelper/weakbag.hxx
new file mode 100644
index 000000000000..b654baa2bda4
--- /dev/null
+++ b/include/comphelper/weakbag.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_COMPHELPER_WEAKBAG_HXX
+#define INCLUDED_COMPHELPER_WEAKBAG_HXX
+
+#include "sal/config.h"
+
+#include <list>
+#include "com/sun/star/uno/Reference.hxx"
+#include "cppuhelper/weakref.hxx"
+#include "osl/diagnose.h"
+
+namespace comphelper {
+
+/**
+ A bag of UNO weak references.
+*/
+template< typename T > class WeakBag {
+public:
+ /**
+ Add a new weak reference.
+
+ The implementation keeps the amount of memory consumed linear in the
+ number of living references added, not linear in the number of total
+ references added.
+
+ @param e
+ a non-null reference.
+ */
+ void add(com::sun::star::uno::Reference< T > const & e) {
+ OSL_ASSERT(e.is());
+ for (typename WeakReferenceList::iterator i(m_list.begin()); i != m_list.end();) {
+ if (com::sun::star::uno::Reference< T >(*i).is()) {
+ ++i;
+ } else {
+ i = m_list.erase(i);
+ }
+ }
+ m_list.push_back(com::sun::star::uno::WeakReference< T >(e));
+ }
+
+ /**
+ Remove a living reference.
+
+ @return
+ a living reference, or null if there are none.
+ */
+ com::sun::star::uno::Reference< T > remove() {
+ while (!m_list.empty()) {
+ com::sun::star::uno::Reference< T > r(m_list.front());
+ m_list.pop_front();
+ if (r.is()) {
+ return r;
+ }
+ }
+ return com::sun::star::uno::Reference< T >();
+ }
+
+private:
+ typedef std::list< com::sun::star::uno::WeakReference< T > > WeakReferenceList;
+
+ WeakReferenceList m_list;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/weakeventlistener.hxx b/include/comphelper/weakeventlistener.hxx
new file mode 100644
index 000000000000..33defc8a36c9
--- /dev/null
+++ b/include/comphelper/weakeventlistener.hxx
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COMPHELPER_WEAKEVENTLISTENER_HXX
+#define COMPHELPER_WEAKEVENTLISTENER_HXX
+
+#include <cppuhelper/compbase1.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/uno/XWeak.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "comphelper/comphelperdllapi.h"
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OWeakListenerAdapterBase
+ //=====================================================================
+ /** (the base for) an adapter which allows to add as listener to a foreign component, without
+ being held hard.
+
+ <p>The idea is that this adapter is added as listener to a foreign component, which usually
+ holds it's listener hard. The adapter itself knows the real listener as weak reference,
+ thus not affecting it's life time.</p>
+ */
+ class OWeakListenerAdapterBase : public OBaseMutex
+ {
+ private:
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::uno::XInterface >
+ m_aListener;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ m_xBroadcaster;
+
+ protected:
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ getListener( ) const
+ {
+ return m_aListener.get();
+ }
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >&
+ getBroadcaster( ) const
+ {
+ return m_xBroadcaster;
+ }
+
+ inline void resetListener( )
+ {
+ m_aListener.clear();
+ }
+
+
+ protected:
+ inline OWeakListenerAdapterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >& _rxListener,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxBroadcaster
+ )
+ :m_aListener ( _rxListener )
+ ,m_xBroadcaster ( _rxBroadcaster )
+ {
+ }
+
+ protected:
+ virtual ~OWeakListenerAdapterBase();
+ };
+
+
+ //=====================================================================
+ //= OWeakListenerAdapter
+ //=====================================================================
+ template< class BROADCASTER, class LISTENER >
+ /** yet another base for weak listener adapters, this time with some type safety
+
+ <p>Note that derived classes need to overwrite all virtual methods of their interface
+ except XEventListener::disposing, and forward it to their master listener.</p>
+
+ <p>Addtionally, derived classes need to add themself as listener to the broadcaster,
+ as this can't be done in a generic way</p>
+ */
+ class OWeakListenerAdapter
+ :public ::cppu::WeakComponentImplHelper1 < LISTENER >
+ ,public OWeakListenerAdapterBase
+ {
+ protected:
+ /** ctor
+ <p>Note that derived classes still need to add themself as listener to the broadcaster,
+ as this can't be done in a generic way</p>
+ */
+ OWeakListenerAdapter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >& _rxListener,
+ const ::com::sun::star::uno::Reference< BROADCASTER >& _rxBroadcaster
+ );
+
+ protected:
+ inline ::com::sun::star::uno::Reference< LISTENER > getListener( ) const
+ {
+ return ::com::sun::star::uno::Reference< LISTENER >( OWeakListenerAdapterBase::getListener(), ::com::sun::star::uno::UNO_QUERY );
+ }
+
+ // XEventListener overridables
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ // OComponentHelper overridables
+ // to be overridden, again - the derived class should revoke the listener from the broadcaster
+ virtual void SAL_CALL disposing( ) = 0;
+ };
+
+ //=====================================================================
+ //= OWeakEventListenerAdapter
+ //=====================================================================
+ typedef OWeakListenerAdapter < ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XEventListener
+ > OWeakEventListenerAdapter_Base;
+ /** the most simple listener adapter: for XEventListeners at XComponents
+ */
+ class COMPHELPER_DLLPUBLIC OWeakEventListenerAdapter : public OWeakEventListenerAdapter_Base
+ {
+ public:
+ OWeakEventListenerAdapter(
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak > _rxListener,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > _rxBroadcaster
+ );
+
+ // nothing to do except an own ctor - the forwarding of the "disposing" is already done
+ // in the base class
+
+ protected:
+ using OWeakEventListenerAdapter_Base::disposing;
+ virtual void SAL_CALL disposing( );
+ };
+
+ //=====================================================================
+ //= OWeakListenerAdapter
+ //=====================================================================
+ //---------------------------------------------------------------------
+ template< class BROADCASTER, class LISTENER >
+ OWeakListenerAdapter< BROADCASTER, LISTENER >::OWeakListenerAdapter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XWeak >& _rxListener,
+ const ::com::sun::star::uno::Reference< BROADCASTER >& _rxBroadcaster
+ )
+ : ::cppu::WeakComponentImplHelper1< LISTENER >( m_aMutex )
+ , OWeakListenerAdapterBase( _rxListener, _rxBroadcaster )
+ {
+ }
+
+ //---------------------------------------------------------------------
+ template< class BROADCASTER, class LISTENER >
+ void SAL_CALL OWeakListenerAdapter< BROADCASTER, LISTENER >::disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ ::com::sun::star::uno::Reference< LISTENER > xListener( getListener() );
+ if ( xListener.is() )
+ xListener->disposing( _rSource );
+ }
+
+//.........................................................................
+} // namespace comphelper
+//.........................................................................
+
+#endif// COMPHELPER_WEAKEVENTLISTENER_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/xmltools.hxx b/include/comphelper/xmltools.hxx
new file mode 100644
index 000000000000..d8287dd4a89b
--- /dev/null
+++ b/include/comphelper/xmltools.hxx
@@ -0,0 +1,28 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _XMLCHAFF_HXX
+#define _XMLCHAFF_HXX
+
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <comphelper/comphelperdllapi.h>
+
+namespace comphelper
+{
+ namespace xml
+ {
+ COMPHELPER_DLLPUBLIC OString makeXMLChaff();
+ }
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/BlobHelper.hxx b/include/connectivity/BlobHelper.hxx
new file mode 100644
index 000000000000..6788a17b10df
--- /dev/null
+++ b/include/connectivity/BlobHelper.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_BLOBHELPER_HXX_
+#define _CONNECTIVITY_BLOBHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XBlob.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS BlobHelper : public ::cppu::WeakImplHelper1< com::sun::star::sdbc::XBlob >
+ {
+ ::com::sun::star::uno::Sequence< sal_Int8 > m_aValue;
+ public:
+ BlobHelper(const ::com::sun::star::uno::Sequence< sal_Int8 >& _val);
+ private:
+ virtual ::sal_Int64 SAL_CALL length( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::sal_Int8 > SAL_CALL getBytes( ::sal_Int64 pos, ::sal_Int32 length ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > SAL_CALL getBinaryStream( ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL position( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int64 SAL_CALL positionOfBlob( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob >& pattern, ::sal_Int64 start ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ };
+}
+
+#endif //_CONNECTIVITY_BLOBHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx
new file mode 100644
index 000000000000..c13b97dc7050
--- /dev/null
+++ b/include/connectivity/CommonTools.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_COMMONTOOLS_HXX_
+#define _CONNECTIVITY_COMMONTOOLS_HXX_
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#ifndef _VECTOR_
+#include <vector>
+#endif
+#include <cppuhelper/weakref.hxx>
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <osl/interlck.h>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com { namespace sun { namespace star { namespace util {
+ struct Date;
+ struct DateTime;
+ struct Time;
+}
+}}}
+
+#ifdef SOLAR_JAVA
+namespace jvmaccess { class VirtualMachine; }
+#endif
+
+namespace connectivity
+{
+ //------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool match(const sal_Unicode* pWild, const sal_Unicode* pStr, const sal_Unicode cEscape);
+ inline sal_Bool match(const OUString &rWild, const OUString &rStr, const sal_Unicode cEscape)
+ {
+ return match(rWild.getStr(), rStr.getStr(), cEscape);
+ }
+ //------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS OUString toDateString(const ::com::sun::star::util::Date& rDate);
+ OOO_DLLPUBLIC_DBTOOLS OUString toTimeString(const ::com::sun::star::util::Time& rTime);
+ OOO_DLLPUBLIC_DBTOOLS OUString toDateTimeString(const ::com::sun::star::util::DateTime& rDateTime);
+
+ // typedefs
+ typedef std::vector< ::com::sun::star::uno::WeakReferenceHelper > OWeakRefArray;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XColumnsSupplier> OSQLTable;
+
+ DECLARE_STL_MAP(OUString,OSQLTable,comphelper::UStringMixLess, OSQLTables);
+
+ // -------------------------------------------------------------------------
+ // class ORefVector allows reference counting on a std::vector
+ // -------------------------------------------------------------------------
+ template< class VectorVal > class ORefVector
+ {
+ std::vector< VectorVal > m_vector;
+ oslInterlockedCount m_refCount;
+
+ protected:
+ virtual ~ORefVector(){}
+ public:
+ typedef std::vector< VectorVal > Vector;
+
+ ORefVector() : m_refCount(0) {}
+ ORefVector(size_t _st) : m_vector(_st) , m_refCount(0) {}
+ ORefVector(const ORefVector& _rRH) : m_vector(_rRH.m_vector),m_refCount(0)
+ {
+ }
+ ORefVector& operator=(const ORefVector& _rRH)
+ {
+ if ( &_rRH != this )
+ {
+ m_vector = _rRH.m_vector;
+ }
+ return *this;
+ }
+
+ std::vector< VectorVal > & get() { return m_vector; }
+ std::vector< VectorVal > const & get() const { return m_vector; }
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
+ { ::rtl_freeMemory( pMem ); }
+ inline static void * SAL_CALL operator new( size_t, void * pMem ) SAL_THROW(())
+ { return pMem; }
+ inline static void SAL_CALL operator delete( void *, void * ) SAL_THROW(())
+ {}
+
+ void acquire()
+ {
+ osl_atomic_increment( &m_refCount );
+ }
+ void release()
+ {
+ if (! osl_atomic_decrement( &m_refCount ))
+ delete this;
+ }
+
+ };
+ // -------------------------------------------------------------------------
+ // class ORowVector incudes refcounting and initialze himself
+ // with at least one element. This first element is reserved for
+ // the bookmark
+ // -------------------------------------------------------------------------
+ template< class VectorVal > class ORowVector : public ORefVector< VectorVal >
+ {
+ public:
+ ORowVector() : ORefVector< VectorVal >(1){}
+ ORowVector(size_t _st) : ORefVector< VectorVal >(_st+1)
+ {}
+ };
+
+ typedef ORefVector< ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> > OSQLColumns;
+
+ // =======================================================================================
+ // search from __first to __last the column with the name _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+ // =======================================================================================
+ // search from __first to __last the column with the realname _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator findRealName( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ // =======================================================================================
+ // the first two find methods are much faster than the one below
+ // =======================================================================================
+ // search from __first to __last the column with the property _rProp equals the value _rVal
+ // when no such column exist __last is returned
+ OOO_DLLPUBLIC_DBTOOLS
+ OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator __first,
+ OSQLColumns::Vector::const_iterator __last,
+ const OUString& _rProp,
+ const OUString& _rVal,
+ const ::comphelper::UStringMixEqual& _rCase);
+
+ OOO_DLLPUBLIC_DBTOOLS void checkDisposed(sal_Bool _bThrow) throw ( ::com::sun::star::lang::DisposedException );
+
+#ifdef SOLAR_JAVA
+ /** creates a java virtual machine
+ @param _rxContext
+ The ORB.
+ @return
+ The JavaVM.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::rtl::Reference< jvmaccess::VirtualMachine > getJavaVM(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext);
+
+ /** return <TRUE/> if the java class exists, otherwise <FALSE/>.
+ @param _pJVM
+ The JavaVM.
+ @param _sClassName
+ The class name to look for.
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool existsJavaClassByName( const ::rtl::Reference< jvmaccess::VirtualMachine >& _pJVM,const OUString& _sClassName );
+#endif
+}
+
+//==================================================================================
+
+#define DECLARE_SERVICE_INFO() \
+ virtual OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); \
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); \
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \
+
+#define IMPLEMENT_SERVICE_INFO(classname, implasciiname, serviceasciiname) \
+ OUString SAL_CALL classname::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) \
+ { \
+ return OUString::createFromAscii(implasciiname); \
+ } \
+ ::com::sun::star::uno::Sequence< OUString > SAL_CALL classname::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ ::com::sun::star::uno::Sequence< OUString > aSupported(1); \
+ aSupported[0] = OUString::createFromAscii(serviceasciiname); \
+ return aSupported; \
+ } \
+ sal_Bool SAL_CALL classname::supportsService( const OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException) \
+ { \
+ Sequence< OUString > aSupported(getSupportedServiceNames()); \
+ const OUString* pSupported = aSupported.getConstArray(); \
+ const OUString* pEnd = pSupported + aSupported.getLength(); \
+ for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) \
+ ; \
+ \
+ return pSupported != pEnd; \
+ } \
+
+//==================================================================================
+
+#endif // _CONNECTIVITY_COMMONTOOLS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/ConnectionWrapper.hxx b/include/connectivity/ConnectionWrapper.hxx
new file mode 100644
index 000000000000..84a828800a9c
--- /dev/null
+++ b/include/connectivity/ConnectionWrapper.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+#define _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+
+ //==========================================================================
+ //= OConnectionWrapper - wraps all methods to the real connection from the driver
+ //= but when disposed it doesn't dispose the real connection
+ //==========================================================================
+ typedef ::cppu::ImplHelper2< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XUnoTunnel
+ > OConnection_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OConnectionWrapper : public OConnection_BASE
+ {
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxyConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xTypeProvider;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XUnoTunnel > m_xUnoTunnel;
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo > m_xServiceInfo;
+
+ virtual ~OConnectionWrapper();
+ void setDelegation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxProxyConnection,oslInterlockedCount& _rRefCount);
+ void setDelegation(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ ,oslInterlockedCount& _rRefCount);
+ // must be called from derived classes
+ void disposing();
+ public:
+ OConnectionWrapper( );
+
+ // XServiceInfo
+ DECLARE_SERVICE_INFO();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+ /** method to create unique ids
+ @param _rURL
+ The URL.
+ @param _rInfo
+ The info property of the datasource. It will be resorted if needed.
+ @param _pBuffer
+ Here we store the digest. Must not NULL.
+ @param _rUserName
+ The user name.
+ @param _rPassword
+ The password.
+ */
+ static void createUniqueId( const OUString& _rURL
+ ,::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rInfo
+ ,sal_uInt8* _pBuffer
+ ,const OUString& _rUserName = OUString()
+ ,const OUString& _rPassword = OUString());
+ };
+}
+#endif // _CONNECTIVITY_ZCONNECTIONWRAPPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/DriversConfig.hxx b/include/connectivity/DriversConfig.hxx
new file mode 100644
index 000000000000..69c28cacbb02
--- /dev/null
+++ b/include/connectivity/DriversConfig.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+#define CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/uno/Sequence.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <salhelper/singletonref.hxx>
+#include <comphelper/namedvaluecollection.hxx>
+#include <unotools/confignode.hxx>
+
+namespace connectivity
+{
+ typedef struct
+ {
+ ::comphelper::NamedValueCollection aProperties;
+ ::comphelper::NamedValueCollection aFeatures;
+ ::comphelper::NamedValueCollection aMetaData;
+ OUString sDriverFactory;
+ OUString sDriverTypeDisplayName;
+ } TInstalledDriver;
+ DECLARE_STL_USTRINGACCESS_MAP( TInstalledDriver, TInstalledDrivers);
+
+ class DriversConfigImpl
+ {
+ mutable ::utl::OConfigurationTreeRoot m_aInstalled;
+ mutable TInstalledDrivers m_aDrivers;
+ void Load(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const;
+ public:
+ DriversConfigImpl();
+
+ const TInstalledDrivers& getInstalledDrivers(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB) const { Load(_rxORB); return m_aDrivers; }
+ };
+ //
+ // Allows to access all driver which are located in the configuration
+ //
+ class OOO_DLLPUBLIC_DBTOOLS DriversConfig
+ {
+ typedef salhelper::SingletonRef<DriversConfigImpl> OSharedConfigNode;
+
+ const ::comphelper::NamedValueCollection& impl_get(const OUString& _sURL,sal_Int32 _nProps) const;
+ public:
+ DriversConfig(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
+ ~DriversConfig();
+
+ DriversConfig( const DriversConfig& );
+ DriversConfig& operator=( const DriversConfig& );
+
+ OUString getDriverFactoryName(const OUString& _sUrl) const;
+ OUString getDriverTypeDisplayName(const OUString& _sUrl) const;
+ const ::comphelper::NamedValueCollection& getProperties(const OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getFeatures(const OUString& _sURL) const;
+ const ::comphelper::NamedValueCollection& getMetaData(const OUString& _sURL) const;
+ ::com::sun::star::uno::Sequence< OUString > getURLs() const;
+ private:
+ OSharedConfigNode m_aNode;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xORB;
+ };
+}
+#endif // CONNECTIVITY_DRIVERSCONFIG_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx
new file mode 100644
index 000000000000..34e73612bfa1
--- /dev/null
+++ b/include/connectivity/FValue.hxx
@@ -0,0 +1,539 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+#define _CONNECTIVITY_FILE_VALUE_HXX_
+
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <rtl/ustring.hxx>
+#include <salhelper/simplereferenceobject.hxx>
+#include <osl/diagnose.h>
+#include <comphelper/stl_types.hxx>
+#include <rtl/ref.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/Time.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+
+namespace connectivity
+{
+ namespace detail
+ {
+ class IValueSource;
+ }
+
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValue
+ {
+ union
+ {
+ bool m_bBool;
+
+ sal_Int8 m_nInt8;
+ sal_uInt8 m_uInt8;
+
+ sal_Int16 m_nInt16;
+ sal_uInt16 m_uInt16;
+
+ sal_Int32 m_nInt32;
+ sal_uInt32 m_uInt32;
+
+ sal_Int64 m_nInt64;
+ sal_uInt64 m_uInt64;
+
+ float m_nFloat;
+ double m_nDouble;
+
+ rtl_uString* m_pString;
+
+ void* m_pValue; // date/time/timestamp/sequence
+ } m_aValue;
+
+ sal_Int32 m_eTypeKind; // the database type
+ bool m_bNull : 1; // value is null
+ bool m_bBound : 1; // is bound
+ bool m_bModified : 1; // value was changed
+ bool m_bSigned : 1; // value is signed
+
+ void free();
+
+ public:
+ ORowSetValue()
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ }
+
+ ORowSetValue(const ORowSetValue& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const OUString& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::VARCHAR)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const double& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::DOUBLE)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const float& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::FLOAT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const sal_Int8& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TINYINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const sal_uInt8& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TINYINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int16& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::SMALLINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_uInt16& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::SMALLINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int32& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::INTEGER)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_uInt32& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::INTEGER)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_Int64& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIGINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+ ORowSetValue(const sal_uInt64& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIGINT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(false)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const bool& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::BIT)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::Date& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::DATE)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::Time& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TIME)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::util::DateTime& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::TIMESTAMP)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ORowSetValue(const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH)
+ :m_eTypeKind(::com::sun::star::sdbc::DataType::LONGVARBINARY)
+ ,m_bNull(true)
+ ,m_bBound(true)
+ ,m_bModified(false)
+ ,m_bSigned(true)
+ {
+ m_aValue.m_pString = NULL;
+ operator=(_rRH);
+ }
+
+ ~ORowSetValue()
+ {
+ free();
+ }
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW(())
+ { return _pHint; }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
+ { ::rtl_freeMemory( pMem ); }
+ inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW(())
+ { }
+
+ ORowSetValue& operator=(const ORowSetValue& _rRH);
+
+ // simple types
+ ORowSetValue& operator=(const bool _rRH);
+
+ ORowSetValue& operator=(const sal_Int8& _rRH);
+ ORowSetValue& operator=(const sal_uInt8& _rRH);
+
+ ORowSetValue& operator=(const sal_Int16& _rRH);
+ ORowSetValue& operator=(const sal_uInt16& _rRH);
+
+ ORowSetValue& operator=(const sal_Int32& _rRH);
+ ORowSetValue& operator=(const sal_uInt32& _rRH);
+
+ ORowSetValue& operator=(const sal_Int64& _rRH);
+ ORowSetValue& operator=(const sal_uInt64& _rRH);
+
+ ORowSetValue& operator=(const double& _rRH);
+ ORowSetValue& operator=(const float& _rRH);
+
+ // ADT's
+ ORowSetValue& operator=(const ::com::sun::star::util::Date& _rRH);
+ ORowSetValue& operator=(const ::com::sun::star::util::Time& _rRH);
+ ORowSetValue& operator=(const ::com::sun::star::util::DateTime& _rRH);
+
+ ORowSetValue& operator=(const OUString& _rRH);
+ // the type isn't set it will be set to VARCHAR if the type is different change it
+ ORowSetValue& operator=(const ::com::sun::star::uno::Sequence<sal_Int8>& _rRH);
+ // we the possiblity to save a any for bookmarks
+ ORowSetValue& operator=(const ::com::sun::star::uno::Any& _rAny);
+
+ operator bool() const { return isNull() ? false : getBool(); }
+ operator sal_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); }
+ operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); }
+
+ operator sal_Int16() const { return isNull() ? static_cast<sal_Int16>(0) : getInt16(); }
+ operator sal_uInt16() const { return isNull() ? static_cast<sal_uInt16>(0) : getUInt16(); }
+
+ operator sal_Int32() const { return isNull() ? 0 : getInt32(); }
+ operator sal_uInt32() const { return isNull() ? 0 : getUInt32(); }
+
+ operator sal_Int64() const { return isNull() ? 0 : getLong(); }
+ operator sal_uInt64() const { return isNull() ? 0 : getULong(); }
+
+ operator float() const { return isNull() ? (float)0.0: getFloat(); }
+ operator double() const { return isNull() ? 0.0 : getDouble(); }
+
+ operator OUString() const
+ {
+ return isNull() ? OUString() : getString();
+ }
+
+ operator ::com::sun::star::util::Date() const
+ {
+ return isNull() ? ::com::sun::star::util::Date() : getDate();
+ }
+
+ operator ::com::sun::star::util::Time() const
+ {
+ return isNull() ? ::com::sun::star::util::Time() : getTime();
+ }
+
+ operator ::com::sun::star::util::DateTime() const
+ {
+ return isNull() ? ::com::sun::star::util::DateTime() : getDateTime();
+ }
+
+ operator ::com::sun::star::uno::Sequence<sal_Int8>() const
+ {
+ return isNull() ? ::com::sun::star::uno::Sequence<sal_Int8>() : getSequence();
+ }
+
+ bool operator==(const ORowSetValue& _rRH) const;
+ bool operator!=(const ORowSetValue& _rRH) const
+ {
+ return !( *this == _rRH );
+ }
+
+ bool isNull() const
+ {
+ return m_bNull;
+ }
+ void setNull()
+ {
+ free();
+ m_bNull = true;
+ m_aValue.m_pString = NULL;
+ }
+
+ bool isBound() const { return m_bBound; }
+ void setBound(bool _bBound) { m_bBound = _bBound ? 1 : 0; }
+
+ bool isModified() const { return m_bModified; }
+ void setModified(bool _bMod=true) { m_bModified = _bMod ? 1 : 0; }
+
+ bool isSigned() const { return m_bSigned; }
+ void setSigned(bool _bSig=true);
+
+ sal_Int32 getTypeKind() const { return m_eTypeKind; }
+ void setTypeKind(sal_Int32 _eType);
+
+ // before calling one of this methods, be sure that the value is not null
+ void* getValue() const { OSL_ENSURE(m_bBound,"Value is not bound!");return m_aValue.m_pValue; }
+ bool getBool() const;
+
+ sal_Int8 getInt8() const;
+ sal_uInt8 getUInt8() const;
+
+ sal_Int16 getInt16() const;
+ sal_uInt16 getUInt16() const;
+
+ sal_Int32 getInt32() const;
+ sal_uInt32 getUInt32() const;
+
+ sal_Int64 getLong() const;
+ sal_uInt64 getULong() const;
+
+ double getDouble() const;
+ float getFloat() const;
+
+ OUString getString() const; // makes a automatic conversion if type isn't a string
+ ::com::sun::star::util::Date getDate() const;
+ ::com::sun::star::util::Time getTime() const;
+ ::com::sun::star::util::DateTime getDateTime() const;
+ ::com::sun::star::uno::Sequence<sal_Int8> getSequence() const;
+ // only use for anys
+ ::com::sun::star::uno::Any getAny() const { return *(::com::sun::star::uno::Any*)m_aValue.m_pValue; }
+ ::com::sun::star::uno::Any makeAny() const;
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow);
+
+ /**
+ fetches a single value out of the row
+ @param _nPos the current column position
+ @param _nType the type of the current column
+ @param _bNullable if true then it will be checked if the result could be NULL, otherwise not.
+ @param _xRow the row where to fetch the data from
+ */
+ void fill(sal_Int32 _nPos,
+ sal_Int32 _nType,
+ bool _bNullable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow>& _xRow);
+
+ void fill(const ::com::sun::star::uno::Any& _rValue);
+
+ void fill( const sal_Int32 _nType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn );
+
+ private:
+ void impl_fill( const sal_Int32 _nType, bool _bNullable, const detail::IValueSource& _rValueSource );
+ };
+
+ /// ORowSetValueDecorator decorates a ORowSetValue so the value is "refcounted"
+ class OOO_DLLPUBLIC_DBTOOLS ORowSetValueDecorator : public ::salhelper::SimpleReferenceObject
+ {
+ ORowSetValue m_aValue; // my own value
+ public:
+ ORowSetValueDecorator(){m_aValue.setBound(true);}
+ ORowSetValueDecorator(const ORowSetValue& _aValue) : m_aValue(_aValue){m_aValue.setBound(true);}
+ ORowSetValueDecorator& operator=(const ORowSetValue& _aValue);
+
+ inline operator const ORowSetValue&() const { return m_aValue; }
+ inline bool operator ==( const ORowSetValue & _rRH ) { return m_aValue == _rRH; }
+ inline const ORowSetValue& getValue() const { return m_aValue; }
+ inline ORowSetValue& get() { return m_aValue; }
+ inline void setValue(const ORowSetValue& _aValue) { m_aValue = _aValue; }
+ inline void setNull() { m_aValue.setNull(); }
+ inline void setBound(bool _bBound ) { m_aValue.setBound(_bBound);}
+ inline bool isBound( ) const { return m_aValue.isBound();}
+ inline void setTypeKind(sal_Int32 _nType) { m_aValue.setTypeKind(_nType); }
+ inline void setModified(bool _bModified) { m_aValue.setModified(_bModified); }
+
+ };
+ typedef ::rtl::Reference<ORowSetValueDecorator> ORowSetValueDecoratorRef;
+
+ // -------------------------------------------------------------------------
+ /// TSetBound is a unary_function to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetBound : ::std::unary_function<ORowSetValue,void>
+ {
+ bool m_bBound;
+ TSetBound(bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValue& _rValue) const { _rValue.setBound(m_bBound); }
+
+ };
+
+ // -------------------------------------------------------------------------
+ /// TSetBound is a unary_function to set the bound value with e.q. for_each call
+ struct OOO_DLLPUBLIC_DBTOOLS TSetRefBound : ::std::unary_function<ORowSetValueDecoratorRef,void>
+ {
+ bool m_bBound;
+ TSetRefBound(bool _bBound) : m_bBound(_bBound){}
+ void operator()(ORowSetValueDecoratorRef& _rValue) const { _rValue->setBound(m_bBound); }
+
+ };
+
+ // ----------------------------------------------------------------------------
+ // Vector for file based rows
+ // ----------------------------------------------------------------------------
+ template< class VectorVal > class ODeleteVector : public connectivity::ORowVector< VectorVal >
+ {
+ bool m_bDeleted;
+ public:
+ ODeleteVector() : connectivity::ORowVector< VectorVal >() ,m_bDeleted(false) {}
+ ODeleteVector(size_t _st) : connectivity::ORowVector< VectorVal >(_st) ,m_bDeleted(false) {}
+
+ bool isDeleted() const { return m_bDeleted; }
+ void setDeleted(bool _bDeleted) { m_bDeleted = _bDeleted; }
+ };
+
+ typedef ODeleteVector< ORowSetValue > OValueVector;
+
+ class OOO_DLLPUBLIC_DBTOOLS OValueRefVector : public ODeleteVector< ORowSetValueDecoratorRef >
+ {
+ public:
+ OValueRefVector(){}
+ OValueRefVector(size_t _st) : ODeleteVector< ORowSetValueDecoratorRef >(_st)
+ {
+ for(OValueRefVector::Vector::iterator aIter = get().begin() ; aIter != get().end() ;++aIter)
+ *aIter = new ORowSetValueDecorator;
+ }
+ };
+
+#define SQL_NO_PARAMETER (SAL_MAX_UINT32)
+ class OAssignValues : public OValueRefVector
+ {
+ ::std::vector<sal_Int32> m_nParameterIndexes;
+ public:
+ OAssignValues() : m_nParameterIndexes(1,SQL_NO_PARAMETER){}
+ OAssignValues(Vector::size_type n) : OValueRefVector(n),m_nParameterIndexes(n+1,SQL_NO_PARAMETER){}
+
+ void setParameterIndex(sal_Int32 _nId,sal_Int32 _nParameterIndex) { m_nParameterIndexes[_nId] = _nParameterIndex;}
+ sal_Int32 getParameterIndex(sal_Int32 _nId) const { return m_nParameterIndexes[_nId]; }
+ };
+
+ typedef ::rtl::Reference< OAssignValues > ORefAssignValues;
+
+
+
+ typedef ::rtl::Reference< OValueVector > OValueRow;
+ typedef ::rtl::Reference< OValueRefVector > OValueRefRow;
+}
+
+#endif // #ifndef _CONNECTIVITY_FILE_VALUE_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/IParseContext.hxx b/include/connectivity/IParseContext.hxx
new file mode 100644
index 000000000000..0352ed8ec39f
--- /dev/null
+++ b/include/connectivity/IParseContext.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_IPARSECONTEXT_HXX
+#define CONNECTIVITY_IPARSECONTEXT_HXX
+
+namespace connectivity { class OSQLParseNode; }
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ //==========================================================================
+ //= IParseContext
+ //==========================================================================
+ class IParseContext
+ {
+ public:
+ enum ErrorCode
+ {
+ ERROR_NONE = 0,
+ ERROR_GENERAL, // "Syntax error in SQL expression"
+ ERROR_VALUE_NO_LIKE, // "The value #1 can not be used with LIKE."
+ ERROR_FIELD_NO_LIKE, // "LIKE can not be used with this field."
+ ERROR_INVALID_COMPARE, // "The entered criterion can not be compared with this field."
+ ERROR_INVALID_INT_COMPARE, // "The field can not be compared with a number."
+ ERROR_INVALID_DATE_COMPARE, // "The field can not be compared with a date."
+ ERROR_INVALID_REAL_COMPARE, // "The field can not be compared with a floating point number."
+ ERROR_INVALID_TABLE, // "The database does not contain a table named \"#\"."
+ ERROR_INVALID_TABLE_OR_QUERY, // "The database does contain neither a table nor a query named \"#\"."
+ ERROR_INVALID_COLUMN, // "The column \"#1\" is unknown in the table \"#2\"."
+ ERROR_INVALID_TABLE_EXIST, // "The database already contains a table or view with name \"#\"."
+ ERROR_INVALID_QUERY_EXIST // "The database already contains a query with name \"#\".";
+ };
+
+ enum InternationalKeyCode
+ {
+ KEY_NONE = 0,
+ KEY_LIKE,
+ KEY_NOT,
+ KEY_NULL,
+ KEY_TRUE,
+ KEY_FALSE,
+ KEY_IS,
+ KEY_BETWEEN,
+ KEY_OR,
+ KEY_AND,
+ KEY_AVG,
+ KEY_COUNT,
+ KEY_MAX,
+ KEY_MIN,
+ KEY_SUM,
+ KEY_EVERY,
+ KEY_ANY,
+ KEY_SOME,
+ KEY_STDDEV_POP,
+ KEY_STDDEV_SAMP,
+ KEY_VAR_SAMP,
+ KEY_VAR_POP,
+ KEY_COLLECT,
+ KEY_FUSION,
+ KEY_INTERSECTION
+ };
+
+ public:
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const = 0;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const = 0;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const = 0;
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const = 0;
+
+ protected:
+ ~IParseContext() {}
+ };
+}
+
+#endif // CONNECTIVITY_IPARSECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/OSubComponent.hxx b/include/connectivity/OSubComponent.hxx
new file mode 100644
index 000000000000..2a55aa35c374
--- /dev/null
+++ b/include/connectivity/OSubComponent.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_OSUBCOMPONENT_HXX_
+#define _CONNECTIVITY_OSUBCOMPONENT_HXX_
+
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ class XComponent;
+ }
+ }
+ }
+}
+namespace connectivity
+{
+ OOO_DLLPUBLIC_DBTOOLS
+ void release(oslInterlockedCount& _refCount,
+ ::cppu::OBroadcastHelper& rBHelper,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
+ ::com::sun::star::lang::XComponent* _pObject);
+ //************************************************************
+ // OSubComponent
+ //************************************************************
+ template <class SELF, class WEAK> class OSubComponent
+ {
+ protected:
+ // the parent must support the tunnel implementation
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
+ SELF* m_pDerivedImplementation;
+
+ public:
+ OSubComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent,
+ SELF* _pDerivedImplementation)
+ :m_xParent(_xParent)
+ ,m_pDerivedImplementation(_pDerivedImplementation)
+ {
+ }
+
+ protected:
+ void dispose_ChildImpl()
+ {
+ // avoid ambiguity
+ ::osl::MutexGuard aGuard( m_pDerivedImplementation->WEAK::rBHelper.rMutex );
+ m_xParent.clear();
+ }
+ void relase_ChildImpl()
+ {
+ ::connectivity::release(m_pDerivedImplementation->m_refCount,
+ m_pDerivedImplementation->WEAK::rBHelper,
+ m_xParent,
+ m_pDerivedImplementation);
+
+ m_pDerivedImplementation->WEAK::release();
+ }
+ };
+}
+#endif // _CONNECTIVITY_OSUBCOMPONENT_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/PColumn.hxx b/include/connectivity/PColumn.hxx
new file mode 100644
index 000000000000..a54cb809ca29
--- /dev/null
+++ b/include/connectivity/PColumn.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_PCOLUMN_HXX_
+#define _CONNECTIVITY_PCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+#include "connectivity/CommonTools.hxx"
+#include <rtl/ref.hxx>
+#include <com/sun/star/sdbc/XResultSetMetaData.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <comphelper/proparrhlp.hxx>
+
+namespace connectivity
+{
+ namespace parse
+ {
+ class OParseColumn;
+
+ typedef sdbcx::OColumn OParseColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OParseColumn> OParseColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OParseColumn :
+ public OParseColumn_BASE, public OParseColumn_PROP
+ {
+ OUString m_aRealName;
+ OUString m_sLabel;
+ sal_Bool m_bFunction;
+ sal_Bool m_bDbasePrecisionChanged;
+ sal_Bool m_bAggregateFunction;
+ sal_Bool m_bIsSearchable;
+
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual ~OParseColumn();
+ public:
+ OParseColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,sal_Bool _bCase);
+ OParseColumn(const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ const OUString& _Description,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+
+ virtual void construct();
+
+ void setRealName(const OUString& _rName) { m_aRealName = _rName; }
+ void setLabel(const OUString& i_sLabel) { m_sLabel = i_sLabel; }
+ void setTableName(const OUString& _rName) { m_TableName = _rName; }
+ void setFunction(sal_Bool _bFunction) { m_bFunction = _bFunction; }
+ void setAggregateFunction(sal_Bool _bFunction) { m_bAggregateFunction = _bFunction; }
+ void setIsSearchable( sal_Bool _bIsSearchable ) { m_bIsSearchable = _bIsSearchable; }
+ void setDbasePrecisionChanged(sal_Bool _bDbasePrecisionChanged) { m_bDbasePrecisionChanged = _bDbasePrecisionChanged; }
+
+ const OUString& getRealName() const { return m_aRealName; }
+ const OUString& getLabel() const { return m_sLabel; }
+ const OUString& getTableName() const { return m_TableName; }
+ sal_Bool getFunction() const { return m_bFunction; }
+ sal_Bool getDbasePrecisionChanged() const { return m_bDbasePrecisionChanged; }
+
+ public:
+ /** creates a collection of OParseColumn, as described by a result set meta data instance.
+ */
+ static ::rtl::Reference< OSQLColumns >
+ createColumnsForResultSet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& i_xQueryColumns
+ );
+
+ DECLARE_STL_USTRINGACCESS_MAP(int,StringMap);
+ /** creates a single OParseColumn, as described by a result set meta data instance.
+ The column names are unique.
+ */
+ static OParseColumn*
+ createColumnForResultSet(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >& _rxResMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxDBMetaData,
+ sal_Int32 _nColumnPos,
+ StringMap& _rColumns
+ );
+
+ private:
+ using OParseColumn_BASE::createArrayHelper;
+ };
+
+ class OOrderColumn;
+
+ typedef sdbcx::OColumn OOrderColumn_BASE;
+ typedef ::comphelper::OPropertyArrayUsageHelper<OOrderColumn> OOrderColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OOrderColumn :
+ public OOrderColumn_BASE, public OOrderColumn_PROP
+ {
+ const sal_Bool m_bAscending;
+
+ protected:
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ virtual ~OOrderColumn();
+ public:
+ OOrderColumn(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ const OUString& i_rOriginatingTableName,
+ sal_Bool _bCase,
+ sal_Bool _bAscending
+ );
+
+ OOrderColumn(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ sal_Bool _bCase,
+ sal_Bool _bAscending
+ );
+
+ virtual void construct();
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ using OOrderColumn_BASE::createArrayHelper;
+ };
+ }
+}
+
+#endif //_CONNECTIVITY_PCOLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/ParameterCont.hxx b/include/connectivity/ParameterCont.hxx
new file mode 100644
index 000000000000..0c9c92ee4468
--- /dev/null
+++ b/include/connectivity/ParameterCont.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+#define CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+
+#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp>
+#include <comphelper/interaction.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace dbtools
+{
+//====================================================================
+ //= OParameterContinuation
+ //====================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OParameterContinuation : public comphelper::OInteraction< ::com::sun::star::sdb::XInteractionSupplyParameters >
+ {
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aValues;
+
+ public:
+ OParameterContinuation() { }
+
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getValues() const { return m_aValues; }
+
+ // XInteractionSupplyParameters
+ virtual void SAL_CALL setParameters( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues ) throw(::com::sun::star::uno::RuntimeException);
+
+ protected:
+ virtual ~OParameterContinuation() { }
+ private:
+ OParameterContinuation(const OParameterContinuation&);
+ void operator =(const OParameterContinuation&);
+ };
+} // dbtools
+#endif //CONNECTIVITY_PARAMETERCONTINUATION_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/SQLStatementHelper.hxx b/include/connectivity/SQLStatementHelper.hxx
new file mode 100644
index 000000000000..8302dae6b5c5
--- /dev/null
+++ b/include/connectivity/SQLStatementHelper.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+#define _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+//.........................................................................
+namespace dbtools
+{
+ class OOO_DLLPUBLIC_DBTOOLS ISQLStatementHelper
+ {
+ public:
+ virtual void addComment(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,OUStringBuffer& _rOut) = 0;
+
+ protected:
+ ~ISQLStatementHelper() {}
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_SQLSTATEMENTHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/StdTypeDefs.hxx b/include/connectivity/StdTypeDefs.hxx
new file mode 100644
index 000000000000..8751a656d2c0
--- /dev/null
+++ b/include/connectivity/StdTypeDefs.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_STDTYPEDEFS_HXX
+#define CONNECTIVITY_STDTYPEDEFS_HXX
+
+#include "sal/config.h"
+
+#include <map>
+#include <vector>
+#include "sal/types.h"
+
+
+namespace connectivity
+{
+ typedef ::std::vector< OUString> TStringVector;
+ typedef ::std::vector< sal_Int32> TIntVector;
+ typedef ::std::map<sal_Int32,sal_Int32> TInt2IntMap;
+ typedef ::std::map< OUString,sal_Int32> TString2IntMap;
+ typedef ::std::map< sal_Int32,OUString> TInt2StringMap;
+}
+
+#endif // CONNECTIVITY_STDTYPEDEFS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TColumnsHelper.hxx b/include/connectivity/TColumnsHelper.hxx
new file mode 100644
index 000000000000..5fe1dd0eb845
--- /dev/null
+++ b/include/connectivity/TColumnsHelper.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_COLUMNSHELPER_HXX
+#define CONNECTIVITY_COLUMNSHELPER_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OColumnsHelperImpl;
+ /** contains generell column handling to creat default columns and default sql statements.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OColumnsHelper : public sdbcx::OCollection
+ {
+ OColumnsHelperImpl* m_pImpl;
+ protected:
+ OTableHelper* m_pTable;
+
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+ public:
+ OColumnsHelper( ::cppu::OWeakObject& _rParent
+ ,sal_Bool _bCase
+ ,::osl::Mutex& _rMutex
+ ,const TStringVector &_rVector
+ ,sal_Bool _bUseHardRef = sal_True
+ );
+ virtual ~OColumnsHelper();
+
+ /** set the parent of the columns. Can also be <NULL/>.
+ @param _pTable
+ The parent.
+ */
+ inline void setParent(OTableHelper* _pTable) { m_pTable = _pTable;}
+ };
+}
+#endif // CONNECTIVITY_COLUMNSHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndex.hxx b/include/connectivity/TIndex.hxx
new file mode 100644
index 000000000000..b8502af9c5ec
--- /dev/null
+++ b/include/connectivity/TIndex.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INDEXHELPER_HXX_
+#define CONNECTIVITY_INDEXHELPER_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VIndex.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexHelper : public connectivity::sdbcx::OIndex
+ {
+ OTableHelper* m_pTable;
+ public:
+ virtual void refreshColumns();
+ public:
+ OIndexHelper( OTableHelper* _pTable);
+ OIndexHelper( OTableHelper* _pTable,
+ const OUString& _Name,
+ const OUString& _Catalog,
+ sal_Bool _isUnique,
+ sal_Bool _isPrimaryKeyIndex,
+ sal_Bool _isClustered
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+ };
+}
+#endif // CONNECTIVITY_INDEXHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndexColumns.hxx b/include/connectivity/TIndexColumns.hxx
new file mode 100644
index 000000000000..31b0ecfe3ca5
--- /dev/null
+++ b/include/connectivity/TIndexColumns.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+#define CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OIndexHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexColumns : public sdbcx::OCollection
+ {
+ OIndexHelper* m_pIndex;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ public:
+ OIndexColumns( OIndexHelper* _pIndex,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector);
+ };
+}
+#endif // CONNECTIVITY_INDEXCOLUMNSHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TIndexes.hxx b/include/connectivity/TIndexes.hxx
new file mode 100644
index 000000000000..c558c709c8e8
--- /dev/null
+++ b/include/connectivity/TIndexes.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INDEXESHELPER_HXX
+#define CONNECTIVITY_INDEXESHELPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OIndexesHelper : public sdbcx::OCollection
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+ public:
+ OIndexesHelper(OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector
+ );
+
+ };
+}
+
+#endif // CONNECTIVITY_INDEXESHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKey.hxx b/include/connectivity/TKey.hxx
new file mode 100644
index 000000000000..9b24e41c3126
--- /dev/null
+++ b/include/connectivity/TKey.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TKEY_HXX
+#define CONNECTIVITY_TKEY_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <connectivity/sdbcx/VKey.hxx>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ class OTableHelper;
+ class OOO_DLLPUBLIC_DBTOOLS OTableKeyHelper : public connectivity::sdbcx::OKey
+ {
+ OTableHelper* m_pTable;
+ public:
+ virtual void refreshColumns();
+ public:
+ OTableKeyHelper( OTableHelper* _pTable);
+ OTableKeyHelper( OTableHelper* _pTable
+ ,const OUString& _Name
+ ,const sdbcx::TKeyProperties& _rProps
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+ };
+}
+#endif // CONNECTIVITY_TKEY_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKeyColumns.hxx b/include/connectivity/TKeyColumns.hxx
new file mode 100644
index 000000000000..6dbb041805b4
--- /dev/null
+++ b/include/connectivity/TKeyColumns.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TKEYCOLUMNS_HXX
+#define CONNECTIVITY_TKEYCOLUMNS_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include "connectivity/TKey.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ class OOO_DLLPUBLIC_DBTOOLS OKeyColumnsHelper : public connectivity::sdbcx::OCollection
+ {
+ OTableKeyHelper* m_pKey;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ public:
+ OKeyColumnsHelper( OTableKeyHelper* _pKey,
+ ::osl::Mutex& _rMutex,
+ const ::std::vector< OUString> &_rVector);
+ };
+}
+#endif // CONNECTIVITY_TKEYCOLUMNS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TKeys.hxx b/include/connectivity/TKeys.hxx
new file mode 100644
index 000000000000..817b24da3a42
--- /dev/null
+++ b/include/connectivity/TKeys.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TKEYS_HXX
+#define CONNECTIVITY_TKEYS_HXX
+
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include "connectivity/TTableHelper.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ typedef sdbcx::OCollection OKeys_BASE;
+ class OOO_DLLPUBLIC_DBTOOLS OKeysHelper : public OKeys_BASE
+ {
+ OTableHelper* m_pTable;
+ protected:
+ virtual sdbcx::ObjectType createObject(const OUString& _rName);
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+ virtual sdbcx::ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+
+ virtual OUString getDropForeignKey() const;
+
+ public:
+ OKeysHelper( OTableHelper* _pTable,
+ ::osl::Mutex& _rMutex,
+ const TStringVector& _rVector
+ );
+ inline OTableHelper* getTable() const { return m_pTable; }
+
+ static void cloneDescriptorColumns(
+ const sdbcx::ObjectType& _rSourceDescriptor,
+ const sdbcx::ObjectType& _rDestDescriptor
+ );
+ };
+}
+
+#endif // CONNECTIVITY_TKEYS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/TTableHelper.hxx b/include/connectivity/TTableHelper.hxx
new file mode 100644
index 000000000000..aeb58cb4dd0c
--- /dev/null
+++ b/include/connectivity/TTableHelper.hxx
@@ -0,0 +1,166 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_TABLEHELPER_HXX
+#define CONNECTIVITY_TABLEHELPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VTable.hxx"
+#include "connectivity/sdbcx/VKey.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+#include <comphelper/stl_types.hxx>
+#include <com/sun/star/sdb/tools/XTableRename.hpp>
+#include <com/sun/star/sdb/tools/XTableAlteration.hpp>
+#include <com/sun/star/sdb/tools/XKeyAlteration.hpp>
+#include <com/sun/star/sdb/tools/XIndexAlteration.hpp>
+
+namespace connectivity
+{
+ typedef sal_Int32 OrdinalPosition;
+ struct ColumnDesc
+ {
+ OUString sName;
+ OUString aField6;
+ OUString sField12; // REMARKS
+ OUString sField13;
+ sal_Int32 nField5
+ , nField7
+ , nField9
+ , nField11;
+
+ OrdinalPosition nOrdinalPosition;
+
+ ColumnDesc() {}
+ ColumnDesc( const OUString& _rName
+ , sal_Int32 _nField5
+ , const OUString& _aField6
+ , sal_Int32 _nField7
+ , sal_Int32 _nField9
+ , sal_Int32 _nField11
+ , const OUString& _sField12
+ , const OUString& _sField13
+ ,OrdinalPosition _nPosition )
+ :sName( _rName )
+ ,aField6(_aField6)
+ ,sField12(_sField12)
+ ,sField13(_sField13)
+ ,nField5(_nField5)
+ ,nField7(_nField7)
+ ,nField9(_nField9)
+ ,nField11(_nField11)
+ ,nOrdinalPosition( _nPosition )
+ {
+ }
+ };
+ typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
+
+ OOO_DLLPUBLIC_DBTOOLS OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
+
+ DECLARE_STL_USTRINGACCESS_MAP( sdbcx::TKeyProperties , TKeyMap);
+
+ struct OTableHelperImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OTableHelper : public OTable_TYPEDEF
+ {
+ ::std::auto_ptr<OTableHelperImpl> m_pImpl;
+
+ void refreshPrimaryKeys(TStringVector& _rKeys);
+ void refreshForeignKeys(TStringVector& _rKeys);
+
+ protected:
+ /** creates the column collection for the table
+ @param _rNames
+ The column names.
+ */
+ virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames) = 0;
+
+ /** creates the key collection for the table
+ @param _rNames
+ The key names.
+ */
+ virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames) = 0;
+
+ /** creates the index collection for the table
+ @param _rNames
+ The index names.
+ */
+ virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames) = 0;
+
+ /** this function is called upon disposing the component
+ */
+ virtual void SAL_CALL disposing();
+
+ /** The default returns "RENAME TABLE " or "RENAME VIEW " depending on the type.
+ *
+ * \return The start of the rename statement.
+ */
+ virtual OUString getRenameStart() const;
+
+ virtual ~OTableHelper();
+
+ public:
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+
+ const ColumnDesc* getColumnDescription(const OUString& _sName) const;
+
+ public:
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ sal_Bool _bCase);
+ OTableHelper( sdbcx::OCollection* _pTables,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
+ sal_Bool _bCase,
+ const OUString& _Name,
+ const OUString& _Type,
+ const OUString& _Description = OUString(),
+ const OUString& _SchemaName = OUString(),
+ const OUString& _CatalogName = OUString()
+ );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
+
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+
+ // helper method to get key properties
+ sdbcx::TKeyProperties getKeyProperties(const OUString& _sName) const;
+ void addKey(const OUString& _sName,const sdbcx::TKeyProperties& _aKeyProperties);
+
+ virtual OUString getTypeCreatePattern() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableRename> getRenameService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableAlteration> getAlterService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XKeyAlteration> getKeyService() const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XIndexAlteration> getIndexService() const;
+ };
+}
+#endif // CONNECTIVITY_TABLEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/conncleanup.hxx b/include/connectivity/conncleanup.hxx
new file mode 100644
index 000000000000..1eec5ac50f98
--- /dev/null
+++ b/include/connectivity/conncleanup.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_CONNCLEANUP_HXX_
+#define _CONNECTIVITY_CONNCLEANUP_HXX_
+
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OAutoConnectionDisposer
+ //=====================================================================
+ typedef ::cppu::WeakImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::sdbc::XRowSetListener
+ > OAutoConnectionDisposer_Base;
+
+ class OOO_DLLPUBLIC_DBTOOLS OAutoConnectionDisposer : public OAutoConnectionDisposer_Base
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xOriginalConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; // needed to add as listener
+ sal_Bool m_bRSListening : 1; // true when we're listening on rowset
+ sal_Bool m_bPropertyListening : 1; // true when we're listening for property changes
+
+ public:
+ /** constructs an object
+ <p>The connection given will be set on the rowset (as ActiveConnection), and the object adds itself as property
+ change listener for the connection. Once somebody sets a new ActiveConnection, the old one (the one given
+ here) will be disposed.</p>
+ */
+ OAutoConnectionDisposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
+ );
+
+ protected:
+ // XPropertyChangeListener
+ virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XRowSetListener
+ virtual void SAL_CALL cursorMoved( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowChanged( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL rowSetChanged( const ::com::sun::star::lang::EventObject& event ) throw (::com::sun::star::uno::RuntimeException);
+
+ private:
+ void clearConnection();
+
+ void startRowSetListening();
+ void stopRowSetListening();
+ sal_Bool isRowSetListening() const { return m_bRSListening; }
+
+ void startPropertyListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps );
+ void stopPropertyListening( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxEventSource );
+ sal_Bool isPropertyListening() const { return m_bPropertyListening; }
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_CONNCLEANUP_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbcharset.hxx b/include/connectivity/dbcharset.hxx
new file mode 100644
index 000000000000..712c44abddb4
--- /dev/null
+++ b/include/connectivity/dbcharset.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DBHELPER_DBCHARSET_HXX_
+#define _DBHELPER_DBCHARSET_HXX_
+
+#include "sal/config.h"
+
+#include <cstddef>
+
+#include <comphelper/stl_types.hxx>
+#include <rtl/textenc.h>
+#include <rtl/tencinfo.h>
+#include <rtl/ustring.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=========================================================================
+ //= OCharsetMap
+ //=========================================================================
+ /** is a class which translates between different charset representations.
+
+ <p>The set of recognized charsets is very limited: only the ones which are database relevant are
+ implemented at the moment</p>
+
+ <p>Possible representations are:
+ <ul>
+ <li><b>IANA names.</b>
+ Have a look at <A href="http://www.iana.org/assignments/character-sets">this document</A> for
+ more details</li>
+ <li><b>rtl_TextEncoding</b></li>
+ </ul>
+ </p>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap
+ {
+ protected:
+ DECLARE_STL_STDKEY_SET( rtl_TextEncoding, TextEncBag );
+
+ TextEncBag m_aEncodings;
+
+ public:
+ class CharsetIterator;
+ friend class OCharsetMap::CharsetIterator;
+ typedef CharsetIterator iterator;
+ typedef CharsetIterator const_iterator;
+
+ OCharsetMap();
+ virtual ~OCharsetMap();
+
+ struct IANA { };
+
+ /** find the given text encoding in the map.
+ @return the <em>end</em> iterator if the encoding could not be found.
+ */
+ CharsetIterator find(const rtl_TextEncoding _eEncoding) const;
+ /** find the given IANA name in the map.
+ @return the <em>end</em> iterator if the IANA name could not be found.
+ */
+ CharsetIterator find(const OUString& _rIanaName, const IANA&) const;
+
+ std::size_t size() const { ensureConstructed( ); return m_aEncodings.size(); }
+
+ /// get access to the first element of the charset collection
+ CharsetIterator begin() const;
+ /// get access to the (last + 1st) element of the charset collection
+ CharsetIterator end() const;
+
+ protected:
+ // needed because we want to call a virtual method during construction
+ void lateConstruct();
+ inline void ensureConstructed( ) const { if ( m_aEncodings.empty() ) const_cast< OCharsetMap* >( this )->lateConstruct(); }
+
+ virtual sal_Bool approveEncoding( const rtl_TextEncoding _eEncoding, const rtl_TextEncodingInfo& _rInfo ) const;
+ };
+
+ //-------------------------------------------------------------------------
+ //- CharsetIteratorDerefHelper
+ //-------------------------------------------------------------------------
+ class OOO_DLLPUBLIC_DBTOOLS CharsetIteratorDerefHelper
+ {
+ friend class OCharsetMap::CharsetIterator;
+
+ rtl_TextEncoding m_eEncoding;
+ OUString m_aIanaName;
+
+ public:
+ CharsetIteratorDerefHelper(const CharsetIteratorDerefHelper& _rSource);
+
+ rtl_TextEncoding getEncoding() const { return m_eEncoding; }
+ OUString getIanaName() const { return m_aIanaName; }
+
+ protected:
+ CharsetIteratorDerefHelper( const rtl_TextEncoding _eEncoding, const OUString& _rIanaName );
+
+ };
+
+
+ //-------------------------------------------------------------------------
+ //- OCharsetMap::CharsetIterator
+ //-------------------------------------------------------------------------
+ class OOO_DLLPUBLIC_DBTOOLS OCharsetMap::CharsetIterator
+ {
+ friend class OCharsetMap;
+
+ friend OOO_DLLPUBLIC_DBTOOLS bool operator==(const CharsetIterator& lhs, const CharsetIterator& rhs);
+ friend bool operator!=(const CharsetIterator& lhs, const CharsetIterator& rhs) { return !(lhs == rhs); }
+
+// friend sal_Int32 operator-(const CharsetIterator& lhs, const CharsetIterator& rhs);
+
+ protected:
+ const OCharsetMap* m_pContainer;
+ OCharsetMap::TextEncBag::const_iterator m_aPos;
+
+ public:
+ CharsetIterator(const CharsetIterator& _rSource);
+ ~CharsetIterator();
+
+ CharsetIteratorDerefHelper operator*() const;
+ // no -> operator
+ // this would require us to a) store CharsetIteratorDerefHelper instances ourself so that we
+ // can return a pointer or b) introduce a -> operator on the CharsetIteratorDerefHelper, too.
+
+ /// prefix increment
+ const CharsetIterator& operator++();
+ /// postfix increment
+ const CharsetIterator operator++(int) { CharsetIterator hold(*this); ++*this; return hold; }
+
+ /// prefix decrement
+ const CharsetIterator& operator--();
+ /// postfix decrement
+ const CharsetIterator operator--(int) { CharsetIterator hold(*this); --*this; return hold; }
+
+ protected:
+ CharsetIterator(const OCharsetMap* _pContainer, OCharsetMap::TextEncBag::const_iterator _aPos );
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBCHARSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbconversion.hxx b/include/connectivity/dbconversion.hxx
new file mode 100644
index 000000000000..9536c799ec81
--- /dev/null
+++ b/include/connectivity/dbconversion.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DBHELPER_DBCONVERSION_HXX_
+#define _DBHELPER_DBCONVERSION_HXX_
+
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace lang
+ {
+ struct Locale;
+ }
+ namespace sdb
+ {
+ class XColumn;
+ class XColumnUpdate;
+ }
+ namespace sdbc
+ {
+ class SQLException;
+ }
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ class XNumberFormatsSupplier;
+ struct Time;
+ struct DateTime;
+ }
+ namespace script
+ {
+ class XTypeConverter;
+ }
+ }
+ }
+}
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ class OOO_DLLPUBLIC_DBTOOLS DBTypeConversion
+ {
+ public:
+ static ::com::sun::star::util::Date getStandardDate();
+ static void setValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& xVariant,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::util::Date& rNullDate,
+ const OUString& rString,
+ sal_Int32 nKey,
+ sal_Int16 nFieldType,
+ sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ static void setValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate>& xVariant,
+ const ::com::sun::star::util::Date& rNullDate,
+ const double& rValue,
+ sal_Int16 nKeyType) throw(::com::sun::star::lang::IllegalArgumentException);
+
+ static double getValue( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& xVariant, const ::com::sun::star::util::Date& rNullDate );
+
+ // get the columnvalue as string with a default format given by the column or a default format
+ // for the type
+ static OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& rNullDate);
+
+ static OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& xFormatter,
+ const ::com::sun::star::util::Date& rNullDate,
+ sal_Int32 nKey,
+ sal_Int16 nKeyType);
+
+ static ::com::sun::star::util::Date toDate(double dVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static ::com::sun::star::util::Date toDate(const OUString& _sSQLDate);
+ static ::com::sun::star::util::Time toTime(double dVal);
+ static ::com::sun::star::util::Time toTime(const OUString& _sSQLDate);
+ static ::com::sun::star::util::DateTime toDateTime(double dVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static ::com::sun::star::util::DateTime toDateTime(const OUString& _sSQLDate);
+
+
+ // TODO: consider removing getMsFromTime
+ static sal_Int32 getMsFromTime(const ::com::sun::star::util::Time& rVal);
+ static sal_Int64 getNsFromTime(const ::com::sun::star::util::Time& rVal);
+
+ static sal_Int32 toDays(const ::com::sun::star::util::Date& _rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+
+ static double toDouble(const ::com::sun::star::util::Date& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+ static double toDouble(const ::com::sun::star::util::Time& rVal);
+ static double toDouble(const ::com::sun::star::util::DateTime& rVal, const ::com::sun::star::util::Date& _rNullDate = getStandardDate());
+
+ static sal_Int32 toINT32(const ::com::sun::star::util::Date& rVal);
+ static sal_Int64 toINT64(const ::com::sun::star::util::Time& rVal);
+
+ static ::com::sun::star::util::Date toDate(sal_Int32 _nVal);
+ static ::com::sun::star::util::Time toTime(sal_Int64 _nVal);
+
+ /** convert a double which is a date value relative to a given fixed date into a date value relative
+ to the standard db null date.
+ */
+ static double toStandardDbDate(const ::com::sun::star::util::Date& _rNullDate, double _rVal) { return _rVal + toDays(_rNullDate); }
+ /** convert a double which is a date value relative to the standard db null date into a date value relative
+ to a given fixed date.
+ */
+ static double toNullDate(const ::com::sun::star::util::Date& _rNullDate, double _rVal) { return _rVal - toDays(_rNullDate); }
+
+ // return the date from the numberformatsupplier or the STANDARD_DATE (1900,1,1)
+ static ::com::sun::star::util::Date getNULLDate(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > &xSupplier);
+
+ // return the date in the format %04d-%02d-%02d
+ static OUString toDateString(const ::com::sun::star::util::Date& rDate);
+ // return the time in the format %02d:%02d:%02d.%09d
+ static OUString toTimeString(const ::com::sun::star::util::Time& rTime);
+ // return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d.%09d
+ static OUString toDateTimeString(const ::com::sun::star::util::DateTime& _rDateTime);
+ // return the any in an sql standard format
+ static OUString toSQLString(sal_Int32 eType, const ::com::sun::star::uno::Any& _rVal, sal_Bool bQuote,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter >& _rxTypeConverter);
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+ @param _rDest
+ the destination string
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws com::sun::star::sdbc::SQLException
+ if the given string contains characters which are not convertible using the given encoding
+ The SQLState of the exception will be set to 22018 ("Invalid character value for cast specification")
+
+ @return
+ the length of the converted string
+ */
+ static sal_Int32 convertUnicodeString(
+ const OUString& _rSource,
+ OString& _rDest,
+ rtl_TextEncoding _eEncoding
+ )
+ SAL_THROW((::com::sun::star::sdbc::SQLException));
+
+ /** converts a Unicode string into a 8-bit string, using the given encoding
+
+ @param _rSource
+ the source string to convert
+
+ @param _rDest
+ the destination string
+
+ @param _nMaxLen
+ the maximum length of the destination string
+
+ @param _eEncoding
+ the encoding to use for the conversion
+
+ @throws com::sun::star::sdbc::SQLException
+ if convertUnicodeString, which is called internally, throws such an exception
+
+ @throws com::sun::star::sdbc::SQLException
+ if the conversion results in a string which is longer than _nMaxLen
+
+ @return
+ the length of the converted string
+ */
+ static sal_Int32 convertUnicodeStringToLength(
+ const OUString& _rSource,
+ OString& _rDest,
+ sal_Int32 _nMaxLen,
+ rtl_TextEncoding _eEncoding
+ )
+ SAL_THROW((::com::sun::star::sdbc::SQLException));
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBCONVERSION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbexception.hxx b/include/connectivity/dbexception.hxx
new file mode 100644
index 000000000000..a84450b607d8
--- /dev/null
+++ b/include/connectivity/dbexception.hxx
@@ -0,0 +1,353 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DBHELPER_DBEXCEPTION_HXX_
+#define _DBHELPER_DBEXCEPTION_HXX_
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include "connectivity/standardsqlstate.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace sdb
+ {
+ class SQLContext;
+ struct SQLErrorEvent;
+ }
+ namespace sdbc
+ {
+ class SQLWarning;
+ }
+ }
+ }
+}
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+//==============================================================================
+//= Special exception if cancel is pressed in DBA UI
+//==============================================================================
+enum OOoBaseErrorCode
+{
+ ParameterInteractionCancelled = 1
+};
+
+//==============================================================================
+//= SQLExceptionInfo - encapsulating the type info of an SQLException-derived class
+//==============================================================================
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionInfo
+{
+public:
+ enum TYPE { SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, UNDEFINED };
+
+private:
+ ::com::sun::star::uno::Any m_aContent;
+ TYPE m_eType; // redundant (could be derived from m_aContent.getValueType())
+
+public:
+ SQLExceptionInfo();
+ SQLExceptionInfo(const ::com::sun::star::sdbc::SQLException& _rError);
+ SQLExceptionInfo(const ::com::sun::star::sdbc::SQLWarning& _rError);
+ SQLExceptionInfo(const ::com::sun::star::sdb::SQLContext& _rError);
+
+ /** convenience constructor
+
+ If your error processing relies on SQLExceptions, and SQLExceptionInfos, you still may
+ need to display an error which consists of a simple message string only.
+ In those cases, you can use this constructor, which behaves as if you would have used
+ an SQLException containing exactly the given error message.
+ */
+ SQLExceptionInfo( const OUString& _rSimpleErrorMessage );
+
+ SQLExceptionInfo(const SQLExceptionInfo& _rCopySource);
+
+ // use for events got via XSQLErrorListener::errorOccured
+ SQLExceptionInfo(const ::com::sun::star::uno::Any& _rError);
+ // use with the Reason member of an SQLErrorEvent or with NextElement of an SQLException
+
+ /** prepends a plain error message to the chain of exceptions
+ @param _rSimpleErrorMessage
+ the error message to prepend
+ @param _pAsciiSQLState
+ the SQLState of the to-be-constructed SQLException, or NULL if this should be defaulted to HY000
+ @param _nErrorCode
+ the ErrorCode of the to-be-constructed SQLException
+ */
+ void prepend( const OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState = NULL, const sal_Int32 _nErrorCode = 0 );
+
+ /** appends a plain message to the chain of exceptions
+ @param _eType
+ the type of exception to append. Must be SQL_EXCEPTION, SQL_WARNING, SQL_CONTEXT, for all other
+ values, the behavior is undefined.
+ @param _rErrorMessage
+ the message to append
+ @param _pAsciiSQLState
+ the SQLState of the exception to append
+ @param _nErrorCode
+ the error code of the exception to append
+ */
+ void append( TYPE _eType, const OUString& _rErrorMessage, const sal_Char* _pAsciiSQLState = NULL, const sal_Int32 _nErrorCode = 0 );
+
+ /** throws (properly typed) the exception contained in the object
+ @precond
+ isValid() returns <TRUE/>
+ @throws SQLException
+ @throws RuntimeException
+ if the instance does not contain an SQLException
+ */
+ void doThrow();
+
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdbc::SQLException& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdbc::SQLWarning& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdb::SQLContext& _rError);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::sdb::SQLErrorEvent& _rErrorEvent);
+ const SQLExceptionInfo& operator=(const ::com::sun::star::uno::Any& _rCaughtSQLException);
+
+ sal_Bool isKindOf(TYPE _eType) const;
+ // not just a simple comparisation ! e.g. getType() == SQL_CONTEXT implies isKindOf(SQL_EXCEPTION) == sal_True !
+ sal_Bool isValid() const { return m_eType != UNDEFINED; }
+ TYPE getType() const { return m_eType; }
+
+ operator const ::com::sun::star::sdbc::SQLException* () const;
+ operator const ::com::sun::star::sdbc::SQLWarning* () const;
+ operator const ::com::sun::star::sdb::SQLContext* () const;
+
+ const ::com::sun::star::uno::Any& get() const { return m_aContent; }
+
+ void clear()
+ {
+ m_aContent.clear();
+ m_eType = UNDEFINED;
+ }
+
+protected:
+ void implDetermineType();
+};
+
+//==============================================================================
+//= SQLExceptionIteratorHelper - iterating through an SQLException chain
+//==============================================================================
+
+class OOO_DLLPUBLIC_DBTOOLS SQLExceptionIteratorHelper
+{
+protected:
+ const ::com::sun::star::sdbc::SQLException* m_pCurrent;
+ SQLExceptionInfo::TYPE m_eCurrentType;
+
+public:
+ /** constructs an iterator instance from an SQLException
+
+ @param _rChainStart
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const ::com::sun::star::sdbc::SQLException& _rChainStart );
+
+ /** constructs an iterator instance from an SQLExceptionInfo
+
+ @param _rErrorInfo
+ the start of the exception chain to iterate. Must live as long as the iterator
+ instances lives, at least.
+ */
+ SQLExceptionIteratorHelper( const SQLExceptionInfo& _rErrorInfo );
+
+ /** determines whether there are more elements in the exception chain
+ */
+ sal_Bool hasMoreElements() const { return ( m_pCurrent != NULL ); }
+
+ /** returns the type of the current element in the exception chain
+ */
+ SQLExceptionInfo::TYPE currentType() const { return m_eCurrentType; }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+ */
+ const ::com::sun::star::sdbc::SQLException* current() const { return m_pCurrent; }
+
+ /** retrieves the current element in the chain, or <NULL/> if the chain has been completely
+ traveled.
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void current( SQLExceptionInfo& _out_rInfo ) const;
+
+ /** proceeds to the next element in the chain
+
+ @return the current element in the chain, as <b>before</em> the chain move.
+ */
+ const ::com::sun::star::sdbc::SQLException* next();
+
+ /** proceeds to the next element in the chain
+
+ In opposite to the second <member>current</member>, this version allows typed access to
+ the respective SQLException.
+ */
+ void next( SQLExceptionInfo& _out_rInfo );
+};
+
+//==================================================================================
+//= StandardExceptions
+//==================================================================================
+//----------------------------------------------------------------------------------
+/** returns a standard error string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @raises RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS OUString getStandardSQLState( StandardSQLState _eState );
+
+//----------------------------------------------------------------------------------
+/** returns a standard ASCII string for a given SQLState
+
+ @param _eState
+ describes the state whose description is to retrieve. Must not be SQL_ERROR_UNSPECIFIED.
+ @return
+ a non-<NULL/> pointer to an ASCII character string denoting the requested SQLState
+ @raises RuntimeException
+ in case of an internal error
+*/
+OOO_DLLPUBLIC_DBTOOLS const sal_Char* getStandardSQLStateAscii( StandardSQLState _eState );
+
+//----------------------------------------------------------------------------------
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedException(
+ const OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throws an exception with SQL state IM001, saying that a certain function is not supported
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionNotSupportedException(
+ const sal_Char* _pAsciiFunctionName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throws a function sequence (HY010) exception
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFunctionSequenceException(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throw a invalid index sqlexception
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwInvalidIndexException(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _Context,
+ const ::com::sun::star::uno::Any& _Next = ::com::sun::star::uno::Any()
+ )
+ throw ( ::com::sun::star::sdbc::SQLException );
+
+//----------------------------------------------------------------------------------
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throw a generic SQLException, i.e. one with an SQLState of HY000, an ErrorCode of 0 and no NextException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwGenericSQLException(
+ const OUString& _rMsg,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSource,
+ const ::com::sun::star::uno::Any& _rNextException
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throw a SQLException with SQLState HYC00 (Optional feature not implemented)
+ @param _pAsciiFeatureName
+ an ASCII description of the feature which is not implemented. It's recommended that the feature
+ name is built from the name of the interface plus its method, for instance "XParameters::updateBinaryStream"
+ @param _rxContext
+ the context of the exception
+ @param _pNextException
+ the next exception to chain into the thrown exception, if any
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwFeatureNotImplementedException(
+ const sal_Char* _pAsciiFeatureName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const sal_Char* _pAsciiMessage,
+ const sal_Char* _pAsciiState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const sal_Char* _pAsciiMessage,
+ StandardSQLState _eSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//----------------------------------------------------------------------------------
+/** throws an SQLException
+*/
+OOO_DLLPUBLIC_DBTOOLS void throwSQLException(
+ const OUString& _rMessage,
+ StandardSQLState _eSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const sal_Int32 _nErrorCode = 0,
+ const ::com::sun::star::uno::Any* _pNextException = NULL
+ )
+ throw (::com::sun::star::sdbc::SQLException);
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _DBHELPER_DBEXCEPTION_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbmetadata.hxx b/include/connectivity/dbmetadata.hxx
new file mode 100644
index 000000000000..565854ba7ed8
--- /dev/null
+++ b/include/connectivity/dbmetadata.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+#define CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace comphelper
+{
+ class ComponentContext;
+}
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= DatabaseMetaData
+ //====================================================================
+ struct DatabaseMetaData_Impl;
+ /** encapsulates meta data about a database/connection which cannot be obtained
+ from the usual XDatabaseMetaData result set.
+
+ Meta data perhaps isn't really the right term ... Some of the methods
+ in this class involved heuristics, some are just a convenient wrapper
+ around more complex ways to obtain the same information.
+
+ @todo
+ Once CWS dba30 is integrated, we could easily add all the meta data
+ which is part of the "Info" property of a data source.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS DatabaseMetaData
+ {
+ private:
+ ::std::auto_ptr< DatabaseMetaData_Impl > m_pImpl;
+
+ public:
+ DatabaseMetaData();
+ /** constructs a DatabaseMetaData instance
+ @param _rxConnection
+ is the connection whose meta data you're interested in.
+ Note that some of the information provided by this class can only be obtained
+ if this connection denotes an application-level connection, i.e. supports
+ the com.sun.star.sdb.Connection service.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if the given connection is not <NULL/>, but the XDatabaseMetaData provided by it
+ are <NULL/>
+ @throws ::com::sun::star::sdbc::SQLException
+ if obtaining the meta data from the connection throws an SQLException
+ @throws ::com::sun::star::uno::RuntimeException
+ if obtaining the meta data from the connection throws an RuntimeException
+ */
+ DatabaseMetaData(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection );
+ DatabaseMetaData( const DatabaseMetaData& _copyFrom );
+ DatabaseMetaData& operator=( const DatabaseMetaData& _copyFrom );
+
+ ~DatabaseMetaData();
+
+ public:
+ /** determines whether or not the instances is based on a valid connection
+
+ As long as this method returns true<TRUE/>, you should expect all other
+ methods throwing an SQLException when called.
+ */
+ bool isConnected() const;
+
+ /** resets the instance so that it's based on a new connection
+ */
+ inline void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection )
+ {
+ *this = DatabaseMetaData( _connection );
+ }
+
+ /// wraps XDatabaseMetaData::getIdentifierQuoteString
+ const OUString& getIdentifierQuoteString() const;
+
+ /// wraps XDatabaseMetaData::getCatalogSeparator
+ const OUString& getCatalogSeparator() const;
+
+ /** determines whether the database supports sub queries in the FROM part
+ of a SELECT clause are supported.
+ @throws ::com::sun::star::sdbc::SQLException
+ with SQLState 08003 (connection does not exist) if the instances was
+ default-constructed and does not have a connection, yet.
+ */
+ bool supportsSubqueriesInFrom() const;
+
+ /** checks whether the database supports primary keys
+
+ Since there's no dedicated API to ask a database for this, a heuristics needs to be applied.
+ First, the <code>PrimaryKeySupport<code> settings of the data source is examined. If it is <TRUE/>
+ or <FALSE/>, then value is returned. If it is <NULL/>, then the database meta data are examined
+ for support of core SQL grammar, and the result is returned. The assumption is that a database/driver
+ which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience
+ shows this is true most of the time.
+ */
+ bool supportsPrimaryKeys() const;
+
+ /** determines whether names in the database should be restricted to SQL-92 identifiers
+
+ Effectively, this method checks the EnableSQL92Check property of the data source settings,
+ if present.
+ */
+ bool restrictIdentifiersToSQL92() const;
+
+ /** determines whether when generating SQL statements, an AS keyword should be generated
+ before a correlation name.
+
+ E.g., it determines whether <code>SELECT * FROM table AS correlation_name</code> or
+ <code>SELECT * FROM table correlation_name</code> is generated.
+ */
+ bool generateASBeforeCorrelationName() const;
+
+ /** should date time be escaped like '2001-01-01' => {D '2001-01-01' }
+ */
+ bool shouldEscapeDateTime() const;
+
+ /** auto increment columns should be automaticly used as primary key.
+ */
+ bool isAutoIncrementPrimaryKey() const;
+
+ /** determines the syntax to use for boolean comparison predicates
+
+ @see ::com::sun::star::sdb::BooleanComparisonMode
+ */
+ sal_Int32
+ getBooleanComparisonMode() const;
+
+ /** determines in relations are supported.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsRelations() const;
+
+ /** determines if column alias names can be used in the order by clause.
+ *
+ * \return <TRUE/> when relations are supported, otherwise <FALSE/>
+ */
+ bool supportsColumnAliasInOrderBy() const;
+
+ /** determines whether user administration is supported for the database
+
+ User administration support is controlled by the availability of the XUsersSupplier
+ interface, and it returning a non-NULL users container.
+
+ @param _rContext
+ the component context we operate in. Might be needed to create the
+ css.sdbc.DriverManager instance.
+ */
+ bool supportsUserAdministration( const ::comphelper::ComponentContext& _rContext ) const;
+
+ /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
+ */
+ bool displayEmptyTableFolders() const;
+
+ /** determines that threads are supported.
+ *
+ * \return <TRUE/> when threads are supported, otherwise <FALSE/>
+ */
+ bool supportsThreads() const;
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx
new file mode 100644
index 000000000000..9706af6ccb1c
--- /dev/null
+++ b/include/connectivity/dbtools.hxx
@@ -0,0 +1,787 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_DBTOOLS_HXX_
+#define _CONNECTIVITY_DBTOOLS_HXX_
+
+#include <connectivity/dbexception.hxx>
+#include <comphelper/types.hxx>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <comphelper/stl_types.hxx>
+#include <unotools/sharedunocomponent.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/FValue.hxx"
+
+namespace com { namespace sun { namespace star {
+
+namespace sdb {
+ class XSingleSelectQueryComposer;
+ class SQLContext;
+}
+namespace sdbcx {
+ class XTablesSupplier;
+}
+namespace sdbc {
+ class XConnection;
+ class XDatabaseMetaData;
+ class XRowSet;
+ class XDataSource;
+ class SQLException;
+ class XParameters;
+ class XRowUpdate;
+}
+namespace beans {
+ class XPropertySet;
+}
+namespace awt {
+ class XWindow;
+}
+namespace lang {
+ struct Locale;
+ class XMultiServiceFactory;
+ class WrappedTargetException;
+}
+namespace container {
+ class XNameAccess;
+}
+namespace uno {
+ class XComponentContext;
+}
+namespace util {
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+}
+namespace task {
+ class XInteractionHandler;
+}
+
+} } }
+
+
+//.........................................................................
+namespace dbtools
+{
+ class ISQLStatementHelper;
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdbc::XConnection > SharedConnection;
+
+ enum EComposeRule
+ {
+ eInTableDefinitions,
+ eInIndexDefinitions,
+ eInDataManipulation,
+ eInProcedureCalls,
+ eInPrivilegeDefinitions,
+ eComplete
+ };
+//=========================================================================
+ // date conversion
+
+ // calculates the default numberformat for a given datatype and a give language
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale);
+
+ // calculates the default numberformat for a given datatype and a give language
+ // @param _nDataType @see com.sun.star.sdbc.DataType
+ // @param _nScale can be zero
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getDefaultNumberFormat(sal_Int32 _nDataType,
+ sal_Int32 _nScale,
+ sal_Bool _bIsCurrency,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _xTypes,
+ const ::com::sun::star::lang::Locale& _rLocale);
+
+//=========================================================================
+
+ /** creates a connection which can be used for the rowset given
+
+ The function tries to obtain a connection for the row set with the following
+ steps (in this order):
+ <nl>
+ <li>If the rowset already has an ActiveConnection (means a non-<NULL/> value vor this property),
+ this one is used.</li>
+ <li>If row set is part of a database form document (see ->isEmbeddedInDatabase),
+ a connection for the respective database is used.</li>
+ <li>If in the parent hierarchy of the row set, there is an object supporting
+ the XConnection interface, this one is returned.</li>
+ <li>If the DataSourceName property of the row set is not empty, a connection for this
+ data source is retrieved.</li>
+ <li>If the URL property of the row set is not empty, an connection for this URL is
+ retrieved from the driver manager.
+ </nl>
+
+ @param _rxRowSet
+ the row set
+
+ @param _rxFactory
+ a service factory, which can be used to create data sources, interaction handler etc (the usual stuff)
+
+ @param _bSetAsActiveConnection
+ If <TRUE/>, the calculated connection is set as ActiveConnection property on the rowset.
+
+ If the connection was newly created by the method, and this parameter is <TRUE/>, then
+ the ownership of the connection is delivered to a temporary object, which observes the
+ row set: As soon as a connection-relevant property of the row set changes, or as soon
+ as somebody else sets another ActiveConnection at the row set, the original
+ connection (the one which this function calculated) is disposed and discarded. At this
+ very moment, also the temporary observer object dies. This way, it is ensured that
+ there's no resource leak from an un-owned connection object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
+ sal_Bool _bSetAsActiveConnection
+ ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) );
+
+ /** ensures that a row set has a valid ActiveConnection, if possible
+
+ This function does nearly the same as ->connectRowset. In fact, it is to be preferred over
+ ->connectRowset, if possible.
+
+ There are a few differences:
+ <ul><li>If a connection could be determined for the given RowSet, it is always
+ set as ActiveConnection.</li>
+ <li>Definition of the ownership of the created connection allows for more scenarios:
+ <ul><li>If the connection was not newly created, the returned ->SharedConnection
+ instance will not have the ownership, since in this case it's assumed
+ that there already is an instance which has the ownership.</li>
+ <li>If the connection was newly created, and ->_bUseAutoConnectionDisposer
+ is <TRUE/>, then the returned SharedConnection instance will <em>not</em>
+ be the owner of the connection. Instead, the ownership will be delivered
+ to a temporary object as described for connectRowset.</li>
+ <li>If the connection was newly created, and ->_bUseAutoConnectionDisposer
+ is <FALSE/>, then the returned SharedConnection instance will have the
+ ownership of the XConnection.</li>
+ </ul>
+ </li>
+ </ul>
+ */
+ OOO_DLLPUBLIC_DBTOOLS SharedConnection ensureRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
+ bool _bUseAutoConnectionDisposer
+ ) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) );
+
+ /** returns the connection the RowSet is currently working with (which is the ActiveConnection property)
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet) throw (::com::sun::star::uno::RuntimeException);
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const OUString& _rDataSourceName,
+ const OUString& _rUser,
+ const OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext)
+ SAL_THROW ( (::com::sun::star::sdbc::SQLException) );
+
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ );
+
+ /** returns the columns of the named table of the given connection
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getTableFields(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ const OUString& _rName
+ );
+
+ /** returns the primary key columns of the table
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const ::com::sun::star::uno::Any& i_aTable
+ );
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getPrimaryKeyColumns_throw(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_xTable
+ );
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _rxCollectionOner
+ If (and only if) <arg>CommandType</arg> is CommandType.COMMAND, the fields collection which is returned
+ by this function here is a temporary object. It is kept alive by another object, which is to be
+ created temporarily, too. To ensure that the fields you get are valid as long as you need them,
+ the owner which controls their life time is transfered to this parameter upon return.<br/>
+
+ Your fields live as long as this component lives.<br/>
+
+ Additionally, you are encouraged to dispose this component as soon as you don't need the fields anymore.
+ It depends on the connection's implementation if this is necessary, but the is no guarantee, so to
+ be on the safe side with respect to resource leaks, you should dispose the component.
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ the container of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+
+ /** get fields for a result set given by a "command descriptor"
+
+ <p>A command descriptor here means:
+ <ul><li>a SDB-level connection (<type scope="com.sun.star.sdb">Connection</type></li>
+ <li>a string specifying the name of an object relative to the connection</li>
+ <li>a <type scope="com.sun.star.sdb">CommandType</type> value specifying the type
+ of the object</type></li>
+ </ul>
+ </p>
+
+ @param _rxConnection
+ the connection relative to which the to-be-examined object exists
+
+ @param _nCommandType
+ the type of the object
+
+ @param _rCommand
+ the object. This may be a table name, a query name, or an SQL statement, depending on the value
+ of <arg>_nCommandType</arg>
+
+ @param _pErrorInfo
+ If not <NULL/>, then upon return from the function the instance pointed to by this argument will
+ contain any available error information in case something went wrong.
+
+ @return
+ an array of strings containing the names of the columns (aka fields) of the object
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Sequence< OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) );
+
+
+ /** create a new ::com::sun::star::sdbc::SQLContext, fill it with the given descriptions and the given source,
+ and <i>append</i> _rException (i.e. put it into the NextException member of the SQLContext).
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::sdb::SQLContext prependContextInfo(const ::com::sun::star::sdbc::SQLException& _rException, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext, const OUString& _rContextDescription, const OUString& _rContextDetails );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::sdbc::SQLException prependErrorInfo(
+ const ::com::sun::star::sdbc::SQLException& _rChainedException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const OUString& _rAdditionalError,
+ const StandardSQLState _eSQLState = SQL_ERROR_UNSPECIFIED,
+ const sal_Int32 _nErrorCode = 0);
+
+ /** search the parent hierachy for a data source.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> findDataSource(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParent);
+
+ /** determines the value of a booolean data source setting, given by ASCII name
+
+ @param _rxConnection
+ the connection belonging to the data source whose setting is to be retrieved
+ @param _pAsciiSettingName
+ the ASCII name of the setting
+ */
+ OOO_DLLPUBLIC_DBTOOLS bool getBooleanDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Char* _pAsciiSettingName
+ );
+
+ /** check if a specific property is enabled in the info sequence
+ @deprecated
+ Use getBooleanDataSourceSetting instead, which cares for the default of the property itself,
+ instead of spreading this knowledge through all callers.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool isDataSourcePropertyEnabled(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xProp
+ ,const OUString& _sProperty,
+ sal_Bool _bDefault = sal_False);
+
+ /** retrieves a particular indirect data source setting
+
+ @param _rxDataSource
+ a data source component
+ @param _pAsciiSettingsName
+ the ASCII name of the setting to obtain
+ @param _rSettingsValue
+ the value of the setting, upon successful return
+
+ @return
+ <FALSE/> if the setting is not present in the <member scope="com::sun::star::sdb">DataSource::Info</member>
+ member of the data source
+ <TRUE/> otherwise
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource,
+ const sal_Char* _pAsciiSettingsName,
+ ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
+ );
+ OOO_DLLPUBLIC_DBTOOLS
+ bool getDataSourceSetting(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDataSource,
+ const OUString& _sSettingsName,
+ ::com::sun::star::uno::Any& /* [out] */ _rSettingsValue
+ );
+
+ OOO_DLLPUBLIC_DBTOOLS OUString getDefaultReportEngineServiceName(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxFactory);
+
+ /** quote the given name with the given quote string.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString quoteName(const OUString& _rQuote, const OUString& _rName);
+
+ /** quote the given table name (which may contain a catalog and a schema) according to the rules provided by the meta data
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString quoteTableName(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _rxMeta
+ , const OUString& _rName
+ ,EComposeRule _eComposeRule);
+
+ /** split a fully qualified table name (including catalog and schema, if appliable) into it's component parts.
+ @param _rxConnMetaData meta data describing the connection where you got the table name from
+ @param _rQualifiedName fully qualified table name
+ @param _rCatalog (out parameter) upon return, contains the catalog name
+ @param _rSchema (out parameter) upon return, contains the schema name
+ @param _rName (out parameter) upon return, contains the table name
+ @param _eComposeRule where do you need the name for
+ */
+ OOO_DLLPUBLIC_DBTOOLS void qualifiedNameComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxConnMetaData,
+ const OUString& _rQualifiedName, OUString& _rCatalog, OUString& _rSchema, OUString& _rName,EComposeRule _eComposeRule);
+
+ /** calculate a NumberFormatsSupplier for use with an given connection
+ @param _rxConn the connection for which the formatter is requested
+ @param _bAllowDefault if the connection (and related components, such as it's parent) cannot supply
+ a formatter, we can ask the DatabaseEnvironment for a default one. This parameter
+ states if this is allowed.
+ @param _rxFactory required (only of _bAllowDefault is sal_True) for creating the DatabaseEnvironment.
+ @return the formatter all object related to the given connection should work with.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault = sal_False,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext = ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>()
+ );
+
+ /** create an <type scope="com::sun::star::sdb">XSingleSelectQueryComposer</type> which represents
+ the current settings (Command/CommandType/Filter/Order) of the given rowset.
+
+ As such an instance can be obtained from a <type scope="com::sun::star::sdb">Connection</type>
+ only the function searches for the connection the RowSet is using via connectRowset.
+ This implies that a connection will be set on the RowSet if needed.
+ (need to changes this sometimes ...)
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer > getCurrentSettingsComposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxRowSetProps,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ );
+
+ /** transfer and translate properties between two FormComponents
+ @param _rxOld the source property set
+ @param _rxNew the destination property set
+ @param _rLocale the locale for converting number related properties
+ */
+ OOO_DLLPUBLIC_DBTOOLS void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ );
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet);
+
+ //----------------------------------------------------------------------------------
+ /** compose a complete table name from it's up to three parts, regarding to the database meta data composing rules
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _rxMetaData,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName,
+ sal_Bool _bQuote,
+ EComposeRule _eComposeRule);
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName );
+
+ /** composes a table name for usage in a SELECT statement
+
+ This includes quoting of the table as indicated by the connection's meta data, plus respecting
+ the settings "UseCatalogInSelect" and "UseSchemaInSelect", which might be present
+ in the data source which the connection belongs to.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable );
+ //----------------------------------------------------------------------------------
+ /** compose the table name out of the property set which must support the properties from the service <member scope= "com::sun::star::sdbcx">table</member>
+ @param _xMetaData
+ The metadata from the connection.
+ @param _xTable
+ The table.
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString composeTableName(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,
+ EComposeRule _eComposeRule,
+ bool _bSuppressCatalogName,
+ bool _bSuppressSchemaName,
+ bool _bQuote);
+
+ //----------------------------------------------------------------------------------
+ OOO_DLLPUBLIC_DBTOOLS sal_Int32 getSearchColumnFlag( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Int32 _nDataType);
+ // return the datasource for the given datasource name
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource> getDataSource(const OUString& _rsDataSourceName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
+
+ /** search for a name that is NOT in the NameAcces
+ @param _rxContainer
+ the NameAccess container to search in
+ @param _rBaseName
+ the base name that should be used to create the new name
+ @param _bStartWithNumber
+ When <TRUE/> the name ends with number even when the name itself doesn't occur in the collection.
+ @return
+ A name which doesn't exist in the collection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createUniqueName(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>& _rxContainer,
+ const OUString& _rBaseName,
+ sal_Bool _bStartWithNumber = sal_True);
+
+ /** creates a unique name which is not already used in the given name array
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString createUniqueName(
+ const ::com::sun::star::uno::Sequence< OUString >& _rNames,
+ const OUString& _rBaseName,
+ sal_Bool _bStartWithNumber = sal_True
+ );
+
+ /** create a name which is a valid SQL 92 identifier name
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see isValidSQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS OUString convertName2SQLName(const OUString& _rName,const OUString& _rSpecials);
+
+ /** checks whether the given name is a valid SQL name
+
+ @param _rName the string which should be converted
+ @param _rSpecials @see com.sun.star.sdbc.XDatabaseMetaData.getExtraNameCharacters
+
+ @see convertName2SQLName
+ */
+ OOO_DLLPUBLIC_DBTOOLS sal_Bool isValidSQLName( const OUString& _rName, const OUString& _rSpecials );
+
+ OOO_DLLPUBLIC_DBTOOLS
+ void showError( const SQLExceptionInfo& _rInfo,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _pParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
+
+ /** implements <method scope="com.sun.star.sdb">XRowUpdate::updateObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another updateXXX method, this other method is used.</p>
+ @param _rxUpdatedObject
+ the interface to forward all updateXXX calls to (except updateObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool implUpdateObject( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowUpdate >& _rxUpdatedObject,
+ const sal_Int32 _nColumnIndex,
+ const ::com::sun::star::uno::Any& _rValue) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) );
+
+
+
+ /** ask the user for parameters if the prepared statement needs some and sets them in the prepared statement
+ @param _xConnection the connection must be able to create <type scope="com::sun::star::sdb">SingleSelectQueryComposer</type>s
+ @param _xPreparedStmt the prepared statement where the parameters could be set when needed
+ @param _aParametersSet contains which parameters have to asked for and which already have set.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void askForParameters( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >& _xComposer,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxHandler,
+ const ::std::vector<bool, std::allocator<bool> >& _aParametersSet = ::std::vector<bool, std::allocator<bool> >());
+
+ /** call the appropriate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::com::sun::star::uno::Any& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ /** call the appropriate set method for the specific sql type @see com::sun::star::sdbc::DataType
+ @param _xParams the parameters where to set the value
+ @param parameterIndex the index of the parameter, 1 based
+ @param x the value to set
+ @param sqlType the corresponding sql type @see com::sun::star::sdbc::DataType
+ @param scale the scale of the sql type can be 0
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void setObjectWithInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _xParameters,
+ sal_Int32 parameterIndex,
+ const ::connectivity::ORowSetValue& x,
+ sal_Int32 sqlType,
+ sal_Int32 scale=0) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+
+ /** implements <method scope="com.sun.star.sdb">XParameters::setObject</method>
+ <p>The object which is to be set is analyzed, and in case it is a simlpe scalar type for which there
+ is another setXXX method, this other method is used.</p>
+ @param _rxParameters
+ the interface to forward all setXXX calls to (except setObject)
+ @param _nColumnIndex
+ the column index to update
+ @param _rValue
+ the value to update
+ @return
+ <TRUE/> if the update request was successfully re-routed to one of the other updateXXX methods
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Bool implSetObject( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters>& _rxParameters,
+ const sal_Int32 _nColumnIndex,
+ const ::com::sun::star::uno::Any& _rValue) SAL_THROW ( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
+
+ /** creates the standard sql create table statement without the key part.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _bAddScale
+ The scale will also be added when the value is 0.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardCreateStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ ISQLStatementHelper* _pHelper,
+ const OUString& _sCreatePattern = OUString());
+
+ /** creates the standard sql statement for the key part of a create table statement.
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardKeyStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection);
+
+ /** creates the standard sql statement for the column part of a create table statement.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param descriptor
+ The descriptor of the column.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createStandardColumnPart( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = NULL
+ ,const OUString& _sCreatePattern = OUString());
+
+ /** creates a SQL CREATE TABLE statement
+
+ @param descriptor
+ The descriptor of the new table.
+ @param _xConnection
+ The connection.
+ @param _pHelper
+ Allow to add special SQL constructs.
+ @param _sCreatePattern
+
+ @return
+ The CREATE TABLE statement.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ OUString createSqlCreateTableStatement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection
+ ,ISQLStatementHelper* _pHelper = NULL
+ ,const OUString& _sCreatePattern = OUString());
+
+ /** creates a SDBC column with the help of getColumns.
+ @param _xTable
+ The table.
+ @param _rName
+ The name of the column.
+ @param _bCase
+ Is the column case sensitive.
+ @param _bQueryForInfo
+ If <TRUE/> the autoincrement and currency field will be read from the meta data, otherwise the following parameters will be used instead
+ @param _bIsAutoIncrement
+ <TRUE/> if the column is an autoincrement.
+ @param _bIsCurrency
+ <TRUE/> if the column is a currency field.
+ @param _nDataType
+ The data type of the column.
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>
+ createSDBCXColumn( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const OUString& _rName,
+ sal_Bool _bCase,
+ sal_Bool _bQueryForInfo = sal_True,
+ sal_Bool _bIsAutoIncrement = sal_False,
+ sal_Bool _bIsCurrency = sal_False,
+ sal_Int32 _nDataType = com::sun::star::sdbc::DataType::OTHER);
+
+ /** tries to locate the corresponding DataDefinitionSupplier for the given url and connection
+ @param _rsUrl
+ The URL used to connect to the database.
+ @param _xConnection
+ The connection used to find the correct driver.
+ @param _rxContext
+ Used to create the drivermanager.
+ @return
+ The datadefintion object.
+ */
+ OOO_DLLPUBLIC_DBTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::sdbcx::XTablesSupplier> getDataDefinitionByURLAndConnection(
+ const OUString& _rsUrl,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext);
+
+ /** returns the table privileges to the given parameters
+ @param _xMetaData
+ The meta data.
+ @param _sCatalog
+ contains the catalog name
+ @param _sSchema
+ contains the schema name
+ @param _sTable
+ contains the table name
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ sal_Int32 getTablePrivileges(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData>& _xMetaData,
+ const OUString& _sCatalog,
+ const OUString& _sSchema,
+ const OUString& _sTable);
+
+ typedef ::std::pair<sal_Bool,sal_Bool> TBoolPair;
+ typedef ::std::pair< TBoolPair,sal_Int32 > ColumnInformation;
+ typedef ::std::multimap< OUString, ColumnInformation, ::comphelper::UStringMixLess> ColumnInformationMap;
+ /** collects the information about auto increment, currency and data type for the given column name.
+ The column must be quoted, * is also valid.
+ @param _xConnection
+ The connection.
+ @param _sComposedTableName
+ The quoted table name. ccc.sss.ttt
+ @param _sName
+ The name of the column, or *
+ @param _rInfo
+ The information about the column(s).
+ */
+ OOO_DLLPUBLIC_DBTOOLS
+ void collectColumnInformation( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
+ const OUString& _sComposedTableName,
+ const OUString& _rName,
+ ColumnInformationMap& _rInfo);
+
+
+ /** adds a boolean comparison clause to the given SQL predicate
+
+ @param _rExpression
+ the expression which is to be compared with a boolean value
+ @param _bValue
+ the boolean value which the expression is to be compared with
+ @param _nBooleanComparisonMode
+ the boolean comparison mode to be used. Usually obtained from
+ a css.sdb.DataSource's Settings member.
+ @param _out_rSQLPredicate
+ the buffer to which the comparison predicate will be appended
+ */
+ OOO_DLLPUBLIC_DBTOOLS void getBoleanComparisonPredicate(
+ const OUString& _rExpression,
+ const sal_Bool _bValue,
+ const sal_Int32 _nBooleanComparisonMode,
+ OUStringBuffer& _out_rSQLPredicate
+ );
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // _CONNECTIVITY_DBTOOLS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/dbtoolsdllapi.hxx b/include/connectivity/dbtoolsdllapi.hxx
new file mode 100644
index 000000000000..51210a633092
--- /dev/null
+++ b/include/connectivity/dbtoolsdllapi.hxx
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+#define INCLUDED_CONNECTIVITY_DBTOOLSDLLAPI_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+#if defined OOO_DLLIMPLEMENTATION_DBTOOLS
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_EXPORT
+#else
+#define OOO_DLLPUBLIC_DBTOOLS SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/filtermanager.hxx b/include/connectivity/filtermanager.hxx
new file mode 100644
index 000000000000..c489a91e5033
--- /dev/null
+++ b/include/connectivity/filtermanager.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_FILTERMANAGER_HXX
+#define CONNECTIVITY_FILTERMANAGER_HXX
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <vector>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= FilterManager
+ //====================================================================
+ /** manages the filter of a database component with filter properties
+
+ The idea is that the filter which a database component actually really uses is composed of several single
+ filter components (which all are conjunctive).
+
+ First, there is a component which is visible to the clients of the database component itself - if they ask
+ the database component for the Filter property, they will get this public filter.
+
+ Second, there is an implicit filter, which is (to be) created from the MasterFields and DetailFields
+ property of the database component, if the latter denote columns.<br/>
+ For instance, if there is a link-pair CustomerID->cid, where |CustomerID| is a column of the master
+ database component, and |cid| is a column of the detail database component (the database component we're responsible for), then there will
+ be an implicit filter "cid = :param_cid_link" (or something like this), which is never visible
+ to the clients of the database component, but nevertheless needs to be propagated to the aggregated RowSet.<br/>
+ Actually, this implicit filter is maintained by the FormParameterManager.
+
+ Potentially, there could be more filter components (for instance, you could imagine database component
+ controls which act as live filter, which could be implemented with a third component), but
+ at the moment there are only these two.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FilterManager
+ {
+ public:
+ enum FilterComponent
+ {
+ fcPublicFilter = 0, // the filter which is to be published as "Filter" property of the database component
+ fcLinkFilter, // the filter part which is implicitly created for a database component when connecting
+ // master and detail database components via column names
+
+ FC_COMPONENT_COUNT // boundary delimiter, not to be used from outside
+ };
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
+ m_xORB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xComponentAggregate;
+ ::std::vector< OUString > m_aFilterComponents;
+ sal_Bool m_bApplyPublicFilter;
+
+ public:
+ /// ctor
+ explicit FilterManager(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB
+ );
+
+ /// late ctor
+ void initialize(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponentAggregate );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ const OUString& getFilterComponent( FilterComponent _eWhich ) const;
+ void setFilterComponent( FilterComponent _eWhich, const OUString& _rComponent );
+
+ inline sal_Bool isApplyPublicFilter( ) const { return m_bApplyPublicFilter; }
+ void setApplyPublicFilter( sal_Bool _bApply );
+
+ private:
+ /** retrieves a filter which is a conjunction of all single filter components
+ */
+ OUString getComposedFilter( ) const;
+
+ /** appends one filter component to the statement in our composer
+ */
+ void appendFilterComponent( OUStringBuffer& io_appendTo, const OUString& i_component ) const;
+
+ /// checks whether there is only one (or even no) non-empty filter component
+ bool isThereAtMostOneComponent( OUStringBuffer& o_singleComponent ) const;
+
+ /// returns the index of the first filter component which should be considered when building the composed filter
+ inline sal_Int32 getFirstApplicableFilterIndex() const
+ {
+ return m_bApplyPublicFilter ? fcPublicFilter : fcPublicFilter + 1;
+ }
+ };
+
+//........................................................................
+} // namespacefrm
+//........................................................................
+
+#endif // CONNECTIVITY_FORMFILTERMANAGER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/formattedcolumnvalue.hxx b/include/connectivity/formattedcolumnvalue.hxx
new file mode 100644
index 000000000000..fe5c4dbfff52
--- /dev/null
+++ b/include/connectivity/formattedcolumnvalue.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+#define CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+#include <com/sun/star/sdbc/XRowSet.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XColumn.hpp>
+#include <com/sun/star/sdb/XColumnUpdate.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace comphelper { class ComponentContext; }
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ struct FormattedColumnValue_Data;
+ //====================================================================
+ //= FormattedColumnValue
+ //====================================================================
+ /** a class which helps retrieving and setting the value of a database column
+ as formatted string.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS FormattedColumnValue : public ::boost::noncopyable
+ {
+ public:
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+
+ The number formats supplier is determined from the given <code>RowSet</code>, by
+ examining its <code>ActiveConnection</code>.
+ */
+ FormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+
+ /** constructs an instance
+
+ The format key for the string value exchange is taken from the given column object.
+ If it has a non-<NULL/> property value <code>FormatKey</code>, this key is taken.
+ Otherwise, a default format matching the column type is determined.
+
+ The locale of this fallback format is the current system locale.
+ */
+ FormattedColumnValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& i_rNumberFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& i_rColumn
+ );
+
+ // note that all methods of this class need to be virtual, since it's
+ // used in a load-on-demand context in module SVX
+
+ virtual ~FormattedColumnValue();
+
+ virtual void clear();
+
+ // access to the details of the formatting we determined
+ virtual sal_Int32 getFormatKey() const;
+ virtual sal_Int32 getFieldType() const;
+ virtual sal_Int16 getKeyType() const;
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >&
+ getColumn() const;
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate >&
+ getColumnUpdate() const;
+
+ virtual bool setFormattedValue( const OUString& _rFormattedStringValue ) const;
+ virtual OUString getFormattedValue() const;
+
+ private:
+ ::std::auto_ptr< FormattedColumnValue_Data > m_pData;
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_FORMATTEDCOLUMNVALUE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/parameters.hxx b/include/connectivity/parameters.hxx
new file mode 100644
index 000000000000..9bdbe0e5c3fb
--- /dev/null
+++ b/include/connectivity/parameters.hxx
@@ -0,0 +1,417 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef CONNECTIVITY_PARAMETERS_HXX
+#define CONNECTIVITY_PARAMETERS_HXX
+
+#include <map>
+#include <vector>
+
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/form/XDatabaseParameterListener.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/paramwrapper.hxx"
+#include <unotools/sharedunocomponent.hxx>
+#include <comphelper/implementationreference.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ typedef ::utl::SharedUNOComponent< ::com::sun::star::sdb::XSingleSelectQueryComposer, ::utl::DisposableComponent >
+ SharedQueryComposer;
+
+ //====================================================================
+ //= ParameterManager
+ //====================================================================
+ class FilterManager;
+ class OOO_DLLPUBLIC_DBTOOLS ParameterManager
+ {
+ public:
+ /// classifies the origin of the data to fill a parameter
+ enum ParameterClassification
+ {
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is an explicit parameter name
+ */
+ eLinkedByParamName,
+ /** parameters which are filled from the master-detail relationship, where the detail
+ name is a column name, so an implicit parameter had to be generated for it
+ */
+ eLinkedByColumnName,
+ /** parameters which are filled externally (i.e. by XParameters::setXXX, or by the parameter listeners)
+ */
+ eFilledExternally
+ };
+ /** meta data about an inner parameter
+ */
+ private:
+ struct ParameterMetaData
+ {
+ /// the type of the parameter
+ ParameterClassification eType;
+ /// the column object for this parameter, as returned by the query composer
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ xComposerColumn;
+ /// the indicies of inner parameters which need to be filled when this concrete parameter is set
+ ::std::vector< sal_Int32 > aInnerIndexes;
+
+ /// default ctor
+ ParameterMetaData()
+ :eType( eFilledExternally )
+ {
+ }
+
+ /// ctor with composer column
+ ParameterMetaData( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn )
+ :eType ( eFilledExternally )
+ ,xComposerColumn ( _rxColumn )
+ {
+ }
+ };
+
+ typedef ::std::map< OUString, ParameterMetaData > ParameterInformation;
+
+ private:
+ ::osl::Mutex& m_rMutex;
+ ::cppu::OInterfaceContainerHelper m_aParameterListeners;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::beans::XPropertySet >
+ m_xComponent; // the database component whose parameters we're handling
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >
+ m_xAggregatedRowSet; // the aggregated row set - necessary for unwrapped access to some interfaces
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >
+ m_xInnerParamUpdate; // write access to the inner parameters
+ SharedQueryComposer m_xComposer; // query composer wrapping the statement which the *aggregate* is based on
+ SharedQueryComposer m_xParentComposer; // query composer wrapping the statement of our parent database component
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >
+ m_xInnerParamColumns; // index access to the parameter columns, as got from the query composer
+
+ ::dbtools::param::ParametersContainerRef
+ m_pOuterParameters; // the container of parameters which still need to be filled in by
+ // external instances
+ sal_Int32 m_nInnerCount; // overall number of parameters as required by the database component's aggregate
+
+ ParameterInformation m_aParameterInformation;
+
+ ::com::sun::star::uno::Sequence< OUString > m_aMasterFields;
+ ::com::sun::star::uno::Sequence< OUString > m_aDetailFields;
+
+ OUString m_sIdentifierQuoteString;
+ OUString m_sSpecialCharacters;
+
+ ::std::vector< bool > m_aParametersVisited;
+
+ bool m_bUpToDate;
+
+ public:
+ /** ctor
+ */
+ explicit ParameterManager(
+ ::osl::Mutex& _rMutex,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
+ );
+
+ /// late ctor
+ void initialize(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation >& _rxComponentAggregate
+ );
+
+ /// makes the object forgetting the references to the database component
+ void dispose( );
+
+ /// clears the instance data
+ void clearAllParameterInformation();
+
+ /// checks whether the parameter information are up-to-date
+ inline bool isUpToDate() const { return m_bUpToDate; }
+
+ /** updates all parameter information represented by the instance
+ */
+ void updateParameterInfo( FilterManager& _rFilterManager );
+
+ /** fills parameter values, as extensive as possible
+
+ <p>In particular, all values which can be filled from the master-detail relationship of
+ between our database component and it's parent are filled in.</p>
+
+ @param _rxCompletionHandler
+ an interaction handler which should be used to fill all parameters which
+ cannot be filled by other means. May be <NULL/>
+ @param _rClearForNotifies
+ the mutex guard to be (temporarily) cleared for notifications
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool fillParameterValues(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler,
+ ::osl::ResettableMutexGuard& _rClearForNotifies
+ );
+
+ /** sets all parameter values to null (via <member>XParameters::setNull</member>)
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void setAllParametersNull() SAL_THROW( ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException ) );
+
+ /** resets all detail columns which are, via a parameter, linked to a master column, to
+ the value of this master column.
+
+ For instance, if the database component is bound to a statement <code>SELECT * from invoice where inv_id = :cid</code>,
+ and there is <em>one</em> master-detail link from
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void resetParameterValues() SAL_THROW(());
+
+ /** tells the object that it's database component is being disposed
+
+ The object then fires the <member>XEventListener::disposing</member> notification to
+ the parameter listeners
+ */
+ void disposing( const ::com::sun::star::lang::EventObject& _rDisposingEvent );
+
+ /** adds the given listener to the list of parameter listeners
+ */
+ void addParameterListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ /** removes the given listener from the list of parameter listeners
+ */
+ void removeParameterListener(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener >& _rxListener
+ );
+
+ // XParameters equivalents
+ void setNull ( sal_Int32 _nIndex, sal_Int32 sqlType);
+ void setObjectNull ( sal_Int32 _nIndex, sal_Int32 sqlType, const OUString& typeName);
+ void setBoolean ( sal_Int32 _nIndex, sal_Bool x);
+ void setByte ( sal_Int32 _nIndex, sal_Int8 x);
+ void setShort ( sal_Int32 _nIndex, sal_Int16 x);
+ void setInt ( sal_Int32 _nIndex, sal_Int32 x);
+ void setLong ( sal_Int32 _nIndex, sal_Int64 x);
+ void setFloat ( sal_Int32 _nIndex, float x);
+ void setDouble ( sal_Int32 _nIndex, double x);
+ void setString ( sal_Int32 _nIndex, const OUString& x);
+ void setBytes ( sal_Int32 _nIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x);
+ void setDate ( sal_Int32 _nIndex, const ::com::sun::star::util::Date& x);
+ void setTime ( sal_Int32 _nIndex, const ::com::sun::star::util::Time& x);
+ void setTimestamp ( sal_Int32 _nIndex, const ::com::sun::star::util::DateTime& x);
+ void setBinaryStream ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length);
+ void setCharacterStream ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length);
+ void setObject ( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x);
+ void setObjectWithInfo ( sal_Int32 _nIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale);
+ void setRef ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef>& x);
+ void setBlob ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob>& x);
+ void setClob ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob>& x);
+ void setArray ( sal_Int32 _nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray>& x);
+ void clearParameters();
+
+ private:
+ /// checkes whether the object is already initialized, and not yet disposed
+ inline bool isAlive() const { return m_xComponent.get().is() && m_xInnerParamUpdate.is(); }
+
+ /** creates a filter expression from a master-detail link where the detail denotes a column name
+ */
+ OUString
+ createFilterConditionFromColumnLink(
+ const OUString& /* [in] */ _rMasterColumn,
+ const OUString& /* [in] */ _rDetailColumn,
+ OUString& /* [out] */ _rNewParamName
+ );
+
+ /** initializes our query composer, and the collection of inner parameter columns
+
+ @param _rxComponent
+ the database component to initialize from. Must not be <NULL/>
+ @return
+ <TRUE/> if and only if the initialization was successful
+
+ @postcond
+ if and only if <TRUE/> is returned, then <member>m_xInnerParamColumns</member> contains the collection of
+ inner parameters
+ */
+ bool initializeComposerByComponent(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxComponent
+ );
+
+ /** collects initial meta information about inner parameters (i.e. it initially fills
+ <member>m_aParameterInformation</member>).
+
+ @param _bSecondRun
+ if <TRUE/>, this is the second run, because we ourself previously extended the filter of
+ the RowSet
+
+ @precond
+ <member>m_xInnerParamColumns</member> is not <NULL/>
+ */
+ void collectInnerParameters( bool _bSecondRun );
+
+ /** analyzes the master-detail links for our database component, and initializes m_aMasterFields and m_aDetailFields
+
+ @param _rFilterManager
+ the filter manager of the database component
+ @param _rColumnsInLinkDetails
+ will be set to <TRUE/> if and only if there were link pairs where the detail field denoted
+ a column name of our database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void analyzeFieldLinks( FilterManager& _rFilterManager, bool& /* [out] */ _rColumnsInLinkDetails );
+
+ /** classifies the link pairs
+
+ @param _rxParentColumns
+ the columns of the parent database component
+
+ @param _rxColumns
+ the columns of our own database component
+
+ @param _out_rAdditionalFilterComponents
+ the additional filter components which are required for master-detail relationships where
+ the detail part denotes a column name. In such a case, an additional filter needs to be created,
+ containing a new parameter.
+
+ @precond
+ <member>m_aMasterFields</member> and <member>m_aDetailFields</member> have the same length
+ */
+ void classifyLinks(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentColumns,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxColumns,
+ ::std::vector< OUString >& _out_rAdditionalFilterComponents
+ ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ /** finalizes our <member>m_pOuterParameters</member> so that it can be used for
+ external parameter listeners
+
+ @precond
+ <member>m_pOuterParameters</member> is <NULL/>
+ @precond
+ <member>m_xInnerParamUpdate</member> is not <NULL/>
+ */
+ void createOuterParameters();
+
+ /** fills in the parameters values which result from the master-detail relationship
+ between the database component and it's parent
+
+ @param _rxParentColumns
+ the columns of the parameter database component. Must not be <NULL/>
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ */
+ void fillLinkedParameters(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxParentColumns
+ );
+
+ /** completes all missing parameters via an interaction handler
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool completeParameters(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > _rxConnection
+ );
+
+ /** asks the parameter listeners to fill in final values
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+
+ @return
+ <TRUE/> if and only if the parameter filling has <em>not</em> been cancelled by the user
+ */
+ bool consultParameterListeners( ::osl::ResettableMutexGuard& _rClearForNotifies );
+
+ /** mark an externally filled parameter asvisited
+ */
+ void externalParameterVisited( sal_Int32 _nIndex );
+
+ private:
+ /** retrieves the columns of the parent database component
+
+ @precond
+ the instance is alive, i.e. <member>isAlive</member> returns <TRUE/>
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getParentColumns(
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /* [out] */ _out_rxParentColumns,
+ bool _bFromComposer
+ );
+
+ /** retrieves the columns of our database component
+
+ @param _bFromComposer
+ if <TRUE/>, the columns are obtained from the composer, else from the living database component itself
+ @return
+ <TRUE/> if and only if the columns could be successfully retrieved
+ */
+ bool getColumns(
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& /* [out] */ _rxColumns,
+ bool _bFromComposer
+ ) SAL_THROW(( ::com::sun::star::uno::Exception ));
+
+ /** retrieves the active connection of the database component
+ */
+ bool getConnection(
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& /* [out] */ _rxConnection
+ );
+
+ /** caches some info about the connection of our database component
+ */
+ void cacheConnectionInfo() SAL_THROW(( ));
+
+ private:
+ ParameterManager(); // never implemented
+ ParameterManager( const ParameterManager& ); // never implemented
+ ParameterManager& operator=( const ParameterManager& ); // never implemented
+ };
+
+//........................................................................
+} // namespacefrm
+//........................................................................
+
+#endif // CONNECTIVITY_PARAMETERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/paramwrapper.hxx b/include/connectivity/paramwrapper.hxx
new file mode 100644
index 000000000000..69347e9c4e6d
--- /dev/null
+++ b/include/connectivity/paramwrapper.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_PARAMWRAPPER_HXX
+#define CONNECTIVITY_PARAMWRAPPER_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <connectivity/FValue.hxx>
+
+#include <com/sun/star/sdbc/XParameters.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryAnalyzer.hpp>
+
+#include <comphelper/uno3.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/compbase2.hxx>
+
+#include <memory>
+#include <vector>
+
+//........................................................................
+namespace dbtools
+{
+namespace param
+{
+//........................................................................
+
+ //====================================================================
+ //= ParameterWrapper
+ //====================================================================
+ /** wraps a parameter column as got from an SQLQueryComposer, so that it has an additional
+ property "Value", which is forwarded to an XParameters interface
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapper :public ::cppu::OWeakObject
+ ,public ::comphelper::OMutexAndBroadcastHelper
+ ,public ::cppu::OPropertySetHelper
+ {
+ private:
+ typedef ::cppu::OWeakObject UnoBase;
+ typedef ::cppu::OPropertySetHelper PropertyBase;
+
+ private:
+ /// the most recently set value of the parameter
+ ::connectivity::ORowSetValue m_aValue;
+ /// the positions (in our m_xValueDestination) at which the value should be set (0-based!)
+ ::std::vector< sal_Int32 > m_aIndexes;
+
+ /// the "delegator" column to which standard property requests are forwarded
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xDelegator;
+ /// the property set info for our delegator
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xDelegatorPSI;
+ /// the component taking the value
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters > m_xValueDestination;
+ /// helper for implementing XPropertySetInfo
+ ::std::auto_ptr< ::cppu::OPropertyArrayHelper > m_pInfoHelper;
+
+
+ public:
+ const ::connectivity::ORowSetValue& Value() const { return m_aValue; }
+ ::connectivity::ORowSetValue& Value() { return m_aValue; }
+
+ public:
+ ParameterWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ );
+
+ ParameterWrapper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XParameters >& _rxAllParameters,
+ const ::std::vector< sal_Int32 >& _rIndexes
+ );
+
+ DECLARE_XINTERFACE()
+ DECLARE_XTYPEPROVIDER()
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // OPropertySetHelper
+ virtual sal_Bool SAL_CALL convertFastPropertyValue( ::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw( ::com::sun::star::lang::IllegalArgumentException );
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw( ::com::sun::star::uno::Exception );
+ virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const;
+
+ // pseudo-XComponent
+ virtual void SAL_CALL dispose();
+
+ protected:
+ virtual ~ParameterWrapper();
+
+ // disambiguations
+ using ::cppu::OPropertySetHelper::getFastPropertyValue;
+
+ private:
+ OUString impl_getPseudoAggregatePropertyName( sal_Int32 _nHandle ) const;
+
+ private:
+ ParameterWrapper(); // not implemented
+ };
+
+ //====================================================================
+ //= ParameterWrapperContainer
+ //====================================================================
+ typedef ::std::vector< ::rtl::Reference< ParameterWrapper > > Parameters;
+
+ //====================================================================
+ //= ParameterWrapperContainer
+ //====================================================================
+ typedef ::cppu::WeakComponentImplHelper2 < ::com::sun::star::container::XIndexAccess
+ , ::com::sun::star::container::XEnumerationAccess
+ > ParameterWrapperContainer_Base;
+
+ /// class for the parameter event @see approveParameter
+ class OOO_DLLPUBLIC_DBTOOLS ParameterWrapperContainer :
+ public ParameterWrapperContainer_Base
+ {
+ private:
+ ::osl::Mutex m_aMutex;
+ Parameters m_aParameters;
+
+ protected:
+ virtual ~ParameterWrapperContainer();
+
+ public:
+ /** creates an empty container
+ */
+ ParameterWrapperContainer();
+
+ /** creates a container from a SingleSelectQuerAnalyzer's parameter columns
+
+ Note that here, the simple constructor of the ParameterWrapper will be used, which does not
+ use a XParameters instance to forward values to, but only remembers the values itself.
+ */
+ ParameterWrapperContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryAnalyzer >& _rxComposer );
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL hasElements() throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration() throw( ::com::sun::star::uno::RuntimeException );
+
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException );
+
+ public:
+ const Parameters& getParameters() { return m_aParameters; }
+
+ const ::connectivity::ORowSetValue& operator[]( size_t _index ) const { return m_aParameters[ _index ]->Value(); }
+ ::connectivity::ORowSetValue& operator[]( size_t _index ) { return m_aParameters[ _index ]->Value(); }
+
+ /** adds an ParameterWrapper to the end of the array
+ */
+ void push_back( ParameterWrapper* _pParameter )
+ {
+ m_aParameters.push_back( _pParameter );
+ }
+
+ size_t size() const { return m_aParameters.size(); }
+
+ protected:
+ // XComponent
+ virtual void SAL_CALL disposing();
+
+ private:
+ void impl_checkDisposed_throw();
+ };
+
+ //====================================================================
+ //= ParametersContainer
+ //====================================================================
+ typedef ::rtl::Reference< ParameterWrapperContainer > ParametersContainerRef;
+
+//........................................................................
+} } // namespace dbtools::param
+//........................................................................
+
+#endif // CONNECTIVITY_PARAMWRAPPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/predicateinput.hxx b/include/connectivity/predicateinput.hxx
new file mode 100644
index 000000000000..629419c9719d
--- /dev/null
+++ b/include/connectivity/predicateinput.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_PREDICATEINPUT_HXX
+#define CONNECTIVITY_PREDICATEINPUT_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
+#include <connectivity/sqlparse.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= OPredicateInputController
+ //=====================================================================
+ /** A class which allows input of an SQL predicate for a row set column
+ into a edit field.
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OPredicateInputController
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
+ m_xConnection;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 >
+ m_xLocaleData;
+
+ ::connectivity::OSQLParser
+ m_aParser;
+
+ public:
+ OPredicateInputController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::connectivity::IParseContext* _pParseContext = NULL
+ );
+
+ /** transforms a "raw" predicate value (usually obtained from a user input) into a valid predicate for the given column
+ @param _rPredicateValue
+ The text to normalize.
+ @param _rxField
+ The field for which the text should be a predicate value.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ */
+ sal_Bool normalizePredicateString(
+ OUString& _rPredicateValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ OUString* _pErrorMessage = NULL
+ ) const;
+
+ /** get's a value of the predicate which can be used in a WHERE clause.
+ @param _rPredicateValue
+ the value which has been normalized using normalizePredicateString
+ @param _rxField
+ is the field for which a predicate is to be entered
+ @param _bForStatementUse
+ If <TRUE/>, the returned value can be used in an SQL statement. If <FALSE/>, it can be used
+ for instance for setting parameter values.
+ @param _pErrorMessage
+ If not <NULL/>, and a parsing error occurs, the error message will be copied to the string the argument
+ points to.
+ @see normalizePredicateString
+ */
+ OUString getPredicateValue(
+ const OUString& _rPredicateValue,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField,
+ sal_Bool _bForStatementUse,
+ OUString* _pErrorMessage = NULL
+ ) const;
+
+ OUString getPredicateValue(
+ const OUString& _sField
+ , const OUString& _rPredicateValue
+ , sal_Bool _bForStatementUse
+ , OUString* _pErrorMessage = NULL) const;
+
+ private:
+ ::connectivity::OSQLParseNode* implPredicateTree(
+ OUString& _rErrorMessage,
+ const OUString& _rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _rxField
+ ) const;
+
+ sal_Bool getSeparatorChars(
+ const ::com::sun::star::lang::Locale& _rLocale,
+ sal_Unicode& _rDecSep,
+ sal_Unicode& _rThdSep
+ ) const;
+
+ OUString implParseNode(::connectivity::OSQLParseNode* pParseNode,sal_Bool _bForStatementUse) const;
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_PREDICATEINPUT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/IRefreshable.hxx b/include/connectivity/sdbcx/IRefreshable.hxx
new file mode 100644
index 000000000000..629b2b3137b5
--- /dev/null
+++ b/include/connectivity/sdbcx/IRefreshable.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+#define _CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableGroups
+ {
+ public:
+ virtual void refreshGroups() = 0;
+
+ protected:
+ ~IRefreshableGroups() {}
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableUsers
+ {
+ public:
+ virtual void refreshUsers() = 0;
+
+ protected:
+ ~IRefreshableUsers() {}
+ };
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IRefreshableColumns
+ {
+ public:
+ virtual void refreshColumns() = 0;
+
+ protected:
+ ~IRefreshableColumns() {}
+ };
+ }
+}
+#endif //_CONNECTIVITY_SDBCX_IREFRESHABLE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VCatalog.hxx b/include/connectivity/sdbcx/VCatalog.hxx
new file mode 100644
index 000000000000..14840400b385
--- /dev/null
+++ b/include/connectivity/sdbcx/VCatalog.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_CATALOG_HXX_
+#define _CONNECTIVITY_SDBCX_CATALOG_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
+#include <com/sun/star/sdbcx/XViewsSupplier.hpp>
+#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
+#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdbc/XRow.hpp>
+#include <cppuhelper/compbase5.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/OSubComponent.hxx"
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/StdTypeDefs.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ class OCollection;
+ // OCatalog is a general catalog class
+ // other drivers can be derived their catalog from this class when they want to support sdbcx
+ // it holds already tables, views, groups and users
+
+ typedef ::cppu::WeakComponentImplHelper5< ::com::sun::star::sdbcx::XTablesSupplier,
+ ::com::sun::star::sdbcx::XViewsSupplier,
+ ::com::sun::star::sdbcx::XUsersSupplier,
+ ::com::sun::star::sdbcx::XGroupsSupplier,
+ ::com::sun::star::lang::XServiceInfo> OCatalog_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCatalog :
+ public OCatalog_BASE,
+ public IRefreshableGroups,
+ public IRefreshableUsers,
+ public connectivity::OSubComponent<OCatalog, OCatalog_BASE>
+ {
+ friend class connectivity::OSubComponent<OCatalog, OCatalog_BASE>;
+ protected:
+
+ ::osl::Mutex m_aMutex;
+
+ // this members are deleted when the dtor is called
+ // they are hold weak
+ OCollection* m_pTables;
+ OCollection* m_pViews;
+ OCollection* m_pGroups;
+ OCollection* m_pUsers;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; // just to make things easier
+
+ /** builds the name which should be used to access the object later on in the collection.
+ Will only be called in fillNames.
+ @param _xRow
+ The current row from the resultset given to fillNames.
+ */
+ virtual OUString buildName( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRow >& _xRow);
+
+ /** fills a vector with the necessary names which can be used in combination with the collections.
+ For each row buildName will be called.
+ @param _xResult
+ The resultset which should be used to fill the names. Will be disposed after return and set to NULL.
+ @param _rNames
+ The vector who will be filled.
+ */
+ void fillNames(::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >& _xResult,TStringVector& _rNames);
+
+ public:
+ OCatalog(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> &_xConnection);
+ virtual ~OCatalog();
+
+ DECLARE_SERVICE_INFO();
+
+ // refreshTables is called when the method getTables had been called
+ // the member m_pTables has to be created
+ virtual void refreshTables() = 0;
+ // refreshViews is called when the method getViews had been called
+ virtual void refreshViews() = 0;
+
+ // the other refresh methods come from base classes IRefreshableGroups and IRefreshableUsers
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XInterface
+ void SAL_CALL acquire() throw();
+ void SAL_CALL release() throw();
+ // XTablesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getTables( ) throw(::com::sun::star::uno::RuntimeException);
+ // XViewsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getViews( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUsersSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException);
+ // XGroupsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException);
+
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_CATALOG_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VCollection.hxx b/include/connectivity/sdbcx/VCollection.hxx
new file mode 100644
index 000000000000..e30075f009e9
--- /dev/null
+++ b/include/connectivity/sdbcx/VCollection.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+#define _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+
+#include <cppuhelper/implbase10.hxx>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XAppend.hpp>
+#include <com/sun/star/sdbcx/XDrop.hpp>
+#include <com/sun/star/sdbc/XColumnLocate.hpp>
+#include <comphelper/stl_types.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include "connectivity/CommonTools.hxx"
+#include <com/sun/star/container/XContainer.hpp>
+#include "connectivity/StdTypeDefs.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <memory>
+
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ // the class OCollection is base class for collections :-)
+ typedef ::cppu::ImplHelper10< ::com::sun::star::container::XNameAccess,
+ ::com::sun::star::container::XIndexAccess,
+ ::com::sun::star::container::XEnumerationAccess,
+ ::com::sun::star::container::XContainer,
+ ::com::sun::star::sdbc::XColumnLocate,
+ ::com::sun::star::util::XRefreshable,
+ ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::sdbcx::XAppend,
+ ::com::sun::star::sdbcx::XDrop,
+ ::com::sun::star::lang::XServiceInfo> OCollectionBase;
+
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > ObjectType;
+
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE IObjectCollection
+ {
+ public:
+ virtual ~IObjectCollection();
+ virtual void reserve(size_t nLength) = 0;
+ virtual bool exists(const OUString& _sName ) = 0;
+ virtual bool empty() = 0;
+ virtual void swapAll() = 0;
+ virtual void swap() = 0;
+ virtual void clear() = 0;
+ virtual void reFill(const TStringVector &_rVector) = 0;
+ virtual void insert(const OUString& _sName,const ObjectType& _xObject) = 0;
+ virtual bool rename(const OUString _sOldName,const OUString _sNewName) = 0;
+ virtual sal_Int32 size() = 0;
+ virtual ::com::sun::star::uno::Sequence< OUString > getElementNames() = 0;
+ virtual OUString getName(sal_Int32 _nIndex) = 0;
+ virtual void disposeAndErase(sal_Int32 _nIndex) = 0;
+ virtual void disposeElements() = 0;
+ virtual sal_Int32 findColumn( const OUString& columnName ) = 0;
+ virtual OUString findColumnAtIndex( sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(sal_Int32 _nIndex) = 0;
+ virtual ObjectType getObject(const OUString& columnName) = 0;
+ virtual void setObject(sal_Int32 _nIndex,const ObjectType& _xObject) = 0;
+ virtual sal_Bool isCaseSensitive() const = 0;
+ };
+ //************************************************************
+ // OCollection
+ //************************************************************
+ class OOO_DLLPUBLIC_DBTOOLS SAL_NO_VTABLE OCollection :
+ public OCollectionBase
+ {
+ protected:
+ ::std::auto_ptr<IObjectCollection> m_pElements;
+
+ ::cppu::OInterfaceContainerHelper m_aContainerListeners;
+ ::cppu::OInterfaceContainerHelper m_aRefreshListeners;
+
+ protected:
+ ::cppu::OWeakObject& m_rParent; // parent of the collection
+ ::osl::Mutex& m_rMutex; // mutex of the parent
+ sal_Bool m_bUseIndexOnly; // is only TRUE when only an indexaccess is needed
+
+ // the implementing class should refresh their elements
+ virtual void impl_refresh() throw(::com::sun::star::uno::RuntimeException) = 0;
+
+ // will be called when a object was requested by one of the accessing methods like getByIndex
+ virtual ObjectType createObject(const OUString& _rName) = 0;
+
+ // will be called when a new object should be generated by a call of createDataDescriptor
+ // the returned object is empty will be filled outside and added to the collection
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createDescriptor();
+
+ /** appends an object described by a descriptor, under a given name
+ @param _rForName
+ is the name under which the object should be appended. Guaranteed to not be empty.
+ This is passed for convenience only, since it's the result of a call of
+ getNameForObject for the given descriptor
+ @param descriptor
+ describes the object to append
+ @return
+ the new object which is to be inserted into the collection. This might be the result
+ of a call of <code>createObject( _rForName )</code>, or a clone of the descriptor.
+ */
+ virtual ObjectType appendObject( const OUString& _rForName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor );
+
+ // called when XDrop was called
+ virtual void dropObject(sal_Int32 _nPos,const OUString _sElementName);
+
+ /** returns the name for the object. The default implementation ask for the property NAME. If this doesn't satisfy, it has to be overloaded.
+ @param _xObject The object where the name should be extracted.
+ @return The name of the object.
+ */
+ virtual OUString getNameForObject(const ObjectType& _xObject);
+
+ /** clones the given descriptor
+
+ The method calls createDescriptor to create a new, empty descriptor, and then copies all properties from
+ _descriptor to the new object, which is returned.
+
+ This method might come handy in derived classes for implementing appendObject, when the object
+ is not actually appended to any backend (e.g. for the columns collection of a descriptor object itself,
+ where there is not yet a database backend to append the column to).
+ */
+ ObjectType cloneDescriptor( const ObjectType& _descriptor );
+
+ OCollection(::cppu::OWeakObject& _rParent,
+ sal_Bool _bCase,
+ ::osl::Mutex& _rMutex,
+ const TStringVector &_rVector,
+ sal_Bool _bUseIndexOnly = sal_False,
+ sal_Bool _bUseHardRef = sal_True);
+
+ /** clear the name map
+ <p>Does <em>not</em> dispose the objects hold by the collection.</p>
+ */
+ void clear_NoDispose();
+
+ /** insert a new element into the collection
+ */
+ void insertElement(const OUString& _sElementName,const ObjectType& _xElement);
+
+ /** return the name of element at index _nIndex
+ */
+ inline OUString getElementName(sal_Int32 _nIndex)
+ {
+ return m_pElements->findColumnAtIndex(_nIndex);
+ }
+
+
+ /** return the object, if not existent it creates it.
+ @param _nIndex
+ The index of the object to create.
+ @return ObjectType
+ */
+ ObjectType getObject(sal_Int32 _nIndex);
+
+ public:
+ virtual ~OCollection();
+ DECLARE_SERVICE_INFO();
+
+ void reFill(const TStringVector &_rVector);
+ inline sal_Bool isCaseSensitive() const { return m_pElements->isCaseSensitive(); }
+ void renameObject(const OUString _sOldName,const OUString _sNewName);
+
+ // only the name is identical to ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // dispatch the refcounting to the parent
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::container::XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XNameAccess
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::util::XRefreshable
+ virtual void SAL_CALL refresh( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener >& l ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ // XAppend
+ virtual void SAL_CALL appendByDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XDrop
+ virtual void SAL_CALL dropByName( const OUString& elementName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL dropByIndex( sal_Int32 index ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ // XColumnLocate
+ virtual sal_Int32 SAL_CALL findColumn( const OUString& columnName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // ::com::sun::star::container::XContainer
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ private:
+ void notifyElementRemoved(const OUString& _sName);
+ void disposeElements();
+ void dropImpl(sal_Int32 _nIndex,sal_Bool _bReallyDrop = sal_True);
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_COLLECTION_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VColumn.hxx b/include/connectivity/sdbcx/VColumn.hxx
new file mode 100644
index 000000000000..42cddc51c041
--- /dev/null
+++ b/include/connectivity/sdbcx/VColumn.hxx
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SDBCX_COLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_COLUMN_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OColumn> OColumn_PROP;
+
+ typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OColumnDescriptor_BASE;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OColumn_BASE;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OColumn :
+ public comphelper::OBaseMutex,
+ public OColumn_BASE,
+ public OColumnDescriptor_BASE,
+ public OColumn_PROP,
+ public ODescriptor
+ {
+ protected:
+ OUString m_TypeName;
+ OUString m_Description;
+ OUString m_DefaultValue;
+
+ sal_Int32 m_IsNullable;
+ sal_Int32 m_Precision;
+ sal_Int32 m_Scale;
+ sal_Int32 m_Type;
+
+ sal_Bool m_IsAutoIncrement;
+ sal_Bool m_IsRowVersion;
+ sal_Bool m_IsCurrency;
+
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_TableName;
+
+ using OColumnDescriptor_BASE::rBHelper;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ virtual ~OColumn();
+ public:
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ OColumn( sal_Bool _bCase);
+ OColumn( const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ const OUString& _Description,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // ODescriptor
+ virtual void construct();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_COLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VDescriptor.hxx b/include/connectivity/sdbcx/VDescriptor.hxx
new file mode 100644
index 000000000000..aa04b5229ac9
--- /dev/null
+++ b/include/connectivity/sdbcx/VDescriptor.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+#define _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <comphelper/stl_types.hxx>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ // =========================================================================
+ // = ODescriptor
+ // =========================================================================
+ typedef ::comphelper::OPropertyContainer ODescriptor_PBASE;
+ class OOO_DLLPUBLIC_DBTOOLS ODescriptor
+ :public ODescriptor_PBASE
+ ,public ::com::sun::star::lang::XUnoTunnel
+ {
+ protected:
+ OUString m_Name;
+
+ /** helper for derived classes to implement OPropertyArrayUsageHelper::createArrayHelper
+
+ This method just calls describeProperties, and flags all properties as READONLY if and
+ only if we do *not* act as descriptor, but as final object.
+
+ @seealso isNew
+ */
+ ::cppu::IPropertyArrayHelper* doCreateArrayHelper() const;
+
+ private:
+ comphelper::UStringMixEqual m_aCase;
+ sal_Bool m_bNew;
+
+ public:
+ ODescriptor(::cppu::OBroadcastHelper& _rBHelper,sal_Bool _bCase, sal_Bool _bNew = sal_False);
+
+ virtual ~ODescriptor();
+
+ sal_Bool isNew() const { return m_bNew; }
+ sal_Bool getNew() const { return m_bNew; }
+ virtual void setNew(sal_Bool _bNew);
+
+ sal_Bool isCaseSensitive() const { return m_aCase.isCaseSensitive(); }
+
+ virtual void construct();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // compare
+ inline sal_Bool operator == ( const OUString & _rRH )
+ {
+ return m_aCase(m_Name,_rRH);
+ }
+
+ // com::sun::star::lang::XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+
+ static ODescriptor* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxSomeComp );
+ // retrieves the ODescriptor implementation of a given UNO component, and returns its ->isNew flag
+ static sal_Bool isNew( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxDescriptor );
+ };
+ }
+
+}
+#endif // _CONNECTIVITY_SDBCX_DESCRIPTOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VGroup.hxx b/include/connectivity/sdbcx/VGroup.hxx
new file mode 100644
index 000000000000..6e4ba2355d62
--- /dev/null
+++ b/include/connectivity/sdbcx/VGroup.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_GROUP_HXX_
+#define _CONNECTIVITY_SDBCX_GROUP_HXX_
+
+#include <osl/diagnose.h>
+
+
+#include <com/sun/star/sdbcx/XUsersSupplier.hpp>
+#include <com/sun/star/sdbcx/XAuthorizable.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <comphelper/propertycontainer.hxx>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef OCollection OUsers;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUsersSupplier,
+ ::com::sun::star::sdbcx::XAuthorizable,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OGroup_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OGroup :
+ public comphelper::OBaseMutex,
+ public OGroup_BASE,
+ public IRefreshableUsers,
+ public ::comphelper::OPropertyArrayUsageHelper<OGroup>,
+ public ODescriptor
+ {
+ protected:
+ OUsers* m_pUsers;
+
+ using OGroup_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OGroup(sal_Bool _bCase);
+ OGroup( const OUString& _Name,sal_Bool _bCase);
+ virtual ~OGroup();
+ DECLARE_SERVICE_INFO();
+
+ // XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUsersSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getUsers( ) throw(::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_GROUP_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VIndex.hxx b/include/connectivity/sdbcx/VIndex.hxx
new file mode 100644
index 000000000000..3e50ddf9459c
--- /dev/null
+++ b/include/connectivity/sdbcx/VIndex.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_
+#define _CONNECTIVITY_SDBCX_INDEX_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase2.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VTypeDef.hxx"
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/implbase1.hxx>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OCollection;
+ class OIndex;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OIndex_BASE;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndex> OIndex_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OIndex :
+ public comphelper::OBaseMutex,
+ public ODescriptor_BASE,
+ public IRefreshableColumns,
+ public OIndex_PROP,
+ public ODescriptor,
+ public OIndex_BASE
+ {
+ protected:
+ OUString m_Catalog;
+ sal_Bool m_IsUnique;
+ sal_Bool m_IsPrimaryKeyIndex;
+ sal_Bool m_IsClustered;
+
+ OCollection* m_pColumns;
+
+ using ODescriptor_BASE::rBHelper;
+ virtual void refreshColumns();
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OIndex(sal_Bool _bCase);
+ OIndex( const OUString& _Name,
+ const OUString& _Catalog,
+ sal_Bool _isUnique,
+ sal_Bool _isPrimaryKeyIndex,
+ sal_Bool _isClustered,
+ sal_Bool _bCase);
+
+ virtual ~OIndex( );
+
+ DECLARE_SERVICE_INFO();
+
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // ODescriptor
+ virtual void construct();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_INDEX_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VIndexColumn.hxx b/include/connectivity/sdbcx/VIndexColumn.hxx
new file mode 100644
index 000000000000..a4de9e6bf5bd
--- /dev/null
+++ b/include/connectivity/sdbcx/VIndexColumn.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OIndexColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OIndexColumn> OIndexColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OIndexColumn :
+ public OColumn, public OIndexColumn_PROP
+ {
+ protected:
+ sal_Bool m_IsAscending;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OIndexColumn( sal_Bool _bCase);
+ OIndexColumn( sal_Bool _IsAscending,
+ const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+
+ virtual void construct();
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_INDEXCOLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VKey.hxx b/include/connectivity/sdbcx/VKey.hxx
new file mode 100644
index 000000000000..24d85dfb2614
--- /dev/null
+++ b/include/connectivity/sdbcx/VKey.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_KEY_HXX_
+#define _CONNECTIVITY_SDBCX_KEY_HXX_
+
+
+#include <comphelper/IdPropArrayHelper.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VTypeDef.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ struct OOO_DLLPUBLIC_DBTOOLS KeyProperties
+ {
+ ::std::vector< OUString> m_aKeyColumnNames;
+ OUString m_ReferencedTable;
+ sal_Int32 m_Type;
+ sal_Int32 m_UpdateRule;
+ sal_Int32 m_DeleteRule;
+ KeyProperties(const OUString& _ReferencedTable,
+ sal_Int32 _Type,
+ sal_Int32 _UpdateRule,
+ sal_Int32 _DeleteRule)
+ :m_ReferencedTable(_ReferencedTable),
+ m_Type(_Type),
+ m_UpdateRule(_UpdateRule),
+ m_DeleteRule(_DeleteRule)
+ {}
+ KeyProperties():m_Type(0),m_UpdateRule(0),m_DeleteRule(0){}
+ };
+ typedef ::boost::shared_ptr< KeyProperties > TKeyProperties;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XDataDescriptorFactory > OKey_BASE;
+ class OCollection;
+
+ class OOO_DLLPUBLIC_DBTOOLS OKey :
+ public comphelper::OBaseMutex,
+ public ODescriptor_BASE,
+ public IRefreshableColumns,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OKey>,
+ public ODescriptor,
+ public OKey_BASE
+ {
+ protected:
+ TKeyProperties m_aProps;
+ OCollection* m_pColumns;
+
+ using ODescriptor_BASE::rBHelper;
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OKey(sal_Bool _bCase);
+ OKey(const OUString& _Name,const TKeyProperties& _rProps,sal_Bool _bCase);
+ /*OKey( const OUString& _Name,
+ const OUString& _ReferencedTable,
+ sal_Int32 _Type,
+ sal_Int32 _UpdateRule,
+ sal_Int32 _DeleteRule,
+ sal_Bool _bCase);*/
+
+ virtual ~OKey( );
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // ODescriptor
+ virtual void construct();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing();
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_KEY_HXX_
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VKeyColumn.hxx b/include/connectivity/sdbcx/VKeyColumn.hxx
new file mode 100644
index 000000000000..b22ea3247941
--- /dev/null
+++ b/include/connectivity/sdbcx/VKeyColumn.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+#define _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sdbcx/VColumn.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ class OKeyColumn;
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OKeyColumn> OKeyColumn_PROP;
+
+ class OOO_DLLPUBLIC_DBTOOLS OKeyColumn :
+ public OColumn, public OKeyColumn_PROP
+ {
+ protected:
+ OUString m_ReferencedColumn;
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ public:
+ OKeyColumn(sal_Bool _bCase);
+ OKeyColumn( const OUString& _ReferencedColumn,
+ const OUString& _Name,
+ const OUString& _TypeName,
+ const OUString& _DefaultValue,
+ sal_Int32 _IsNullable,
+ sal_Int32 _Precision,
+ sal_Int32 _Scale,
+ sal_Int32 _Type,
+ sal_Bool _IsAutoIncrement,
+ sal_Bool _IsRowVersion,
+ sal_Bool _IsCurrency,
+ sal_Bool _bCase,
+ const OUString& _CatalogName,
+ const OUString& _SchemaName,
+ const OUString& _TableName);
+ // just to make it not inline
+ virtual ~OKeyColumn();
+
+ virtual void construct();
+ DECLARE_SERVICE_INFO();
+ };
+ }
+}
+#endif // _CONNECTIVITY_SDBCX_KEYCOLUMN_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VTable.hxx b/include/connectivity/sdbcx/VTable.hxx
new file mode 100644
index 000000000000..0be41a9cd22f
--- /dev/null
+++ b/include/connectivity/sdbcx/VTable.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_TABLE_HXX_
+#define _CONNECTIVITY_SDBCX_TABLE_HXX_
+
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbcx/XIndexesSupplier.hpp>
+#include <com/sun/star/sdbcx/XRename.hpp>
+#include <com/sun/star/sdbcx/XAlterTable.hpp>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/CommonTools.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ class OTable;
+ class OCollection;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XColumnsSupplier,
+ ::com::sun::star::sdbcx::XKeysSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OTableDescriptor_BASE;
+
+ typedef ::cppu::ImplHelper4< ::com::sun::star::sdbcx::XDataDescriptorFactory,
+ ::com::sun::star::sdbcx::XIndexesSupplier,
+ ::com::sun::star::sdbcx::XRename,
+ ::com::sun::star::sdbcx::XAlterTable > OTable_BASE;
+
+ typedef ::comphelper::OIdPropertyArrayUsageHelper<OTable> OTable_PROP;
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OTable :
+ public comphelper::OBaseMutex,
+ public OTable_BASE,
+ public OTableDescriptor_BASE,
+ public IRefreshableColumns,
+ public OTable_PROP,
+ public ODescriptor
+ {
+ protected:
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_Description;
+ OUString m_Type;
+
+ OCollection* m_pKeys;
+ OCollection* m_pColumns;
+ OCollection* m_pIndexes;
+ OCollection* m_pTables; // must hold his own container to notify him when renaming
+
+ using OTableDescriptor_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 _nId ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OTable( OCollection* _pTables,
+ sal_Bool _bCase);
+ OTable( OCollection* _pTables,
+ sal_Bool _bCase,
+ const OUString& _Name,
+ const OUString& _Type,
+ const OUString& _Description = OUString(),
+ const OUString& _SchemaName = OUString(),
+ const OUString& _CatalogName = OUString());
+
+ virtual ~OTable();
+
+ DECLARE_SERVICE_INFO();
+ //XInterface
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ODescriptor
+ virtual void construct();
+ virtual void refreshColumns();
+ virtual void refreshKeys();
+ virtual void refreshIndexes();
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XColumnsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw(::com::sun::star::uno::RuntimeException);
+ // XKeysSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getKeys( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ // XDataDescriptorFactory
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( void ) throw(::com::sun::star::uno::RuntimeException);
+ // XIndexesSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getIndexes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XRename
+ virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
+ // XAlterTable
+ virtual void SAL_CALL alterColumnByName( const OUString& colName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // helper method
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const;
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_TABLE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VTypeDef.hxx b/include/connectivity/sdbcx/VTypeDef.hxx
new file mode 100644
index 000000000000..08019f9174da
--- /dev/null
+++ b/include/connectivity/sdbcx/VTypeDef.hxx
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+#define _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <cppuhelper/compbase3.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::sdbcx::XColumnsSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> ODescriptor_BASE;
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_TYPEDEF_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VUser.hxx b/include/connectivity/sdbcx/VUser.hxx
new file mode 100644
index 000000000000..01bafc0d177c
--- /dev/null
+++ b/include/connectivity/sdbcx/VUser.hxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_USER_HXX_
+#define _CONNECTIVITY_SDBCX_USER_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XUser.hpp>
+#include <com/sun/star/sdbcx/XGroupsSupplier.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <comphelper/broadcasthelper.hxx>
+#include "connectivity/sdbcx/VCollection.hxx"
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/IRefreshable.hxx"
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+ typedef OCollection OGroups;
+
+ typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::sdbcx::XUser,
+ ::com::sun::star::sdbcx::XGroupsSupplier,
+ ::com::sun::star::container::XNamed,
+ ::com::sun::star::lang::XServiceInfo> OUser_BASE;
+
+ class OOO_DLLPUBLIC_DBTOOLS OUser :
+ public comphelper::OBaseMutex,
+ public OUser_BASE,
+ public IRefreshableGroups,
+ public ::comphelper::OPropertyArrayUsageHelper<OUser>,
+ public ODescriptor
+ {
+ protected:
+ OGroups* m_pGroups;
+
+ using OUser_BASE::rBHelper;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+ public:
+ OUser(sal_Bool _bCase);
+ OUser(const OUString& _Name,sal_Bool _bCase);
+
+ virtual ~OUser( );
+
+ DECLARE_SERVICE_INFO();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+ //XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XUser
+ virtual void SAL_CALL changePassword( const OUString& objPassword, const OUString& newPassword ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XAuthorizable
+ virtual sal_Int32 SAL_CALL getPrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getGrantablePrivileges( const OUString& objName, sal_Int32 objType ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grantPrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL revokePrivileges( const OUString& objName, sal_Int32 objType, sal_Int32 objPrivileges ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
+ // XGroupsSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getGroups( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& aName ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_USER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sdbcx/VView.hxx b/include/connectivity/sdbcx/VView.hxx
new file mode 100644
index 000000000000..6134ddc4bb69
--- /dev/null
+++ b/include/connectivity/sdbcx/VView.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CONNECTIVITY_SDBCX_VIEW_HXX_
+#define _CONNECTIVITY_SDBCX_VIEW_HXX_
+
+#include <osl/diagnose.h>
+#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
+#include <com/sun/star/sdbc/XDatabaseMetaData.hpp>
+#include <comphelper/proparrhlp.hxx>
+#include <cppuhelper/compbase1.hxx>
+#include "connectivity/CommonTools.hxx"
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/container/XNamed.hpp>
+#include "connectivity/sdbcx/VDescriptor.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include <comphelper/IdPropArrayHelper.hxx>
+#include <cppuhelper/implbase2.hxx>
+
+namespace connectivity
+{
+ namespace sdbcx
+ {
+
+ typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::container::XNamed> OView_BASE;
+
+
+
+ class OOO_DLLPUBLIC_DBTOOLS OView :
+ public ::comphelper::OMutexAndBroadcastHelper,
+ public OView_BASE,
+ public ::comphelper::OIdPropertyArrayUsageHelper<OView>,
+ public ODescriptor
+ {
+ protected:
+ OUString m_CatalogName;
+ OUString m_SchemaName;
+ OUString m_Command;
+ sal_Int32 m_CheckOption;
+ // need for the getName method
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData;
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( sal_Int32 _nId) const;
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
+
+ public:
+ DECLARE_SERVICE_INFO();
+
+ OView(sal_Bool _bCase,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
+ OView( sal_Bool _bCase,
+ const OUString& _rName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData,
+ sal_Int32 _nCheckOption = 0,
+ const OUString& _rCommand = OUString(),
+ const OUString& _rSchemaName = OUString(),
+ const OUString& _rCatalogName = OUString());
+ virtual ~OView();
+
+ // ODescriptor
+ virtual void construct();
+
+ // ::cppu::OComponentHelper
+ virtual void SAL_CALL disposing(void);
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+ //XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ // XNamed
+ virtual OUString SAL_CALL getName( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setName( const OUString& ) throw(::com::sun::star::uno::RuntimeException);
+ };
+ }
+}
+
+#endif // _CONNECTIVITY_SDBCX_VIEW_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlerror.hxx b/include/connectivity/sqlerror.hxx
new file mode 100644
index 000000000000..ccad18a88d0f
--- /dev/null
+++ b/include/connectivity/sqlerror.hxx
@@ -0,0 +1,317 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_SQLERROR_HXX
+#define CONNECTIVITY_SQLERROR_HXX
+
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ //====================================================================
+ //= ErrorCondition
+ //====================================================================
+ /** the type of error codes to be used in SQLExceptions
+
+ @see com::sun::star::sdbc::SQLException::ErrorCode
+ */
+ typedef ::sal_Int32 ErrorCode;
+
+ /** error condition values as defined in <type scope="com::sun::star::sdb">ErrorCondition</type>
+ */
+ typedef ::sal_Int32 ErrorCondition;
+
+ //====================================================================
+ //= SQLError
+ //====================================================================
+ class SQLError_Impl;
+
+ /** a class which provides helpers for working with SQLErrors
+
+ In particular, this class provides vendor-specific error codes (where
+ the vendor is OpenOffice.org Base), which can be used in OOo's various
+ database drivers, and checked in application-level code, to properly
+ recognize highly specific error conditions.
+
+ @see ::com::sun::star::sdb::ErrorCondition
+ */
+ class OOO_DLLPUBLIC_DBTOOLS SQLError
+ {
+ public:
+ // --------------------------------------------------------------------
+ // - optional
+ // --------------------------------------------------------------------
+ /** convenience wrapper around boost::optional, allowing implicit construction
+ */
+ class ParamValue : public ::boost::optional< OUString >
+ {
+ typedef ::boost::optional< OUString > base_type;
+
+ public:
+ ParamValue( ) : base_type( ) { }
+ ParamValue( OUString const& val ) : base_type( val ) { }
+ ParamValue( ParamValue const& rhs ) : base_type( (base_type const&)rhs ) { }
+
+ bool is() const { return !base_type::operator!(); }
+ };
+
+
+ public:
+ explicit SQLError( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _rxContext );
+ ~SQLError();
+
+ /** returns the message associated with a given error condition, after (optionally) replacing
+ a placeholder with a given string
+
+ Some error messages need to contain references to runtime-dependent data (say, the
+ name of a concrete table in the database), which in the resource file's strings are
+ represented by a placeholder, namely $1$, $2, and so on. This method allows to
+ retrieve such an error message, and replace upo to 3 placeholders with their concrete
+ values.
+
+ In a non-product build, assertions will fire if the number of placeholders in the
+ message's resource string does not match the number of passed parameter values.
+
+ As specified in the <type scope="com::sun::star::sdb">ErrorCondition</type> type,
+ error messages thrown by core components of OpenOffice.org Base will contain
+ a standardized prefix &quot;[OOoBase]&quot; in every message.
+
+ @param _rParamValue1
+ the value which the placeholder $1$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen, and <code>_rParamValue2</code> and <code>_rParamValue3</code> will be
+ ignored.
+
+ @param _rParamValue2
+ the value which the placeholder $2$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen, and <code>_rParamValue3</code> will be ignored.
+
+ @param _rParamValue1
+ the value which the placeholder $1$ should be replaced with. If this value is
+ not present (see <code>::boost::optional::operator !</code>), then no replacement
+ will happen.
+
+ @see ::com::sun::star::sdb::ErrorCondition
+ */
+ OUString getErrorMessage(
+ const ErrorCondition _eCondition,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** returns the error code associated with a given error condition
+
+ @see getErrorMessage
+ @see ::com::sun::star::sdb::ErrorCondition
+ @see ::com::sun::star::sdbc::SQLException::ErrorCode
+ */
+ static ErrorCode
+ getErrorCode( const ErrorCondition _eCondition );
+
+ /** returns the prefix which is used for OpenOffice.org Base's error messages
+
+ As specified in the <type scope="com::sun::star::sdb">ErrorCondition</type> type,
+ error messages thrown by core components of OpenOffice.org Base will
+ contain a standardized prefix in every message. <code>getBaseErrorMessagePrefix</code>
+ returns this prefix, so clients of such error messages might decide to strip this
+ prefix before presenting the message to the user, or use it to determine
+ whether a concrete error has been raised by a OpenOffice.org core component.
+ */
+ static const OUString&
+ getMessagePrefix();
+
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** throws an SQLException describing the given error condition
+
+ The thrown SQLException will contain the OOo-specific error code which derives
+ from the given error condition, and the error message associated with that condition.
+
+ Note: You should prefer the version of <type>raiseException</type> which takes
+ an additional <type>Context</type> parameter, since this allows clients of your
+ exception to examine where the error occurred.
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseException(
+ const ErrorCondition _eCondition,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** raises a typed exception, that is, a UNO exception which is derived from
+ <type scope="com::sun::star::sdbc">SQLException</type>
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rExceptionType
+ the type of the exception to throw. This type <em>must</em> specify
+ an exception class derived from <type scope="com::sun::star::sdbc">SQLException</type>.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @throws ::std::bad_cast
+ if <arg>_rExceptionType</arg> does not specify an exception class derived from
+ <type scope="com::sun::star::sdbc">SQLException</type>.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ void raiseTypedException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ::com::sun::star::uno::Type& _rExceptionType,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ /** retrieves an <code>SQLException</code> object which contains information about
+ the given error condition
+
+ @param _eCondition
+ the ErrorCondition which hit you
+
+ @param _rxContext
+ the context in which the error occurred. This will be filled in as
+ <member scope="com::sun::star::uno">Exception::Context</member> member.
+
+ @param _rParamValue1
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the first placeholder
+ in this message.
+
+ @param _rParamValue2
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the second placeholder
+ in this message.
+
+ @param _rParamValue3
+ a runtime-dependent value which should be filled into the error message
+ which is associated with <arg>_eCondition</arg>, replacing the third placeholder
+ in this message.
+
+ @see getErrorMessage
+ @see getErrorCode
+ */
+ ::com::sun::star::sdbc::SQLException
+ getSQLException(
+ const ErrorCondition _eCondition,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const ParamValue& _rParamValue1 = ParamValue(),
+ const ParamValue& _rParamValue2 = ParamValue(),
+ const ParamValue& _rParamValue3 = ParamValue()
+ ) const;
+
+ private:
+ ::boost::shared_ptr< SQLError_Impl > m_pImpl;
+ };
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+
+#endif // CONNECTIVITY_SQLERROR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqliterator.hxx b/include/connectivity/sqliterator.hxx
new file mode 100644
index 000000000000..ee967dd7d7a3
--- /dev/null
+++ b/include/connectivity/sqliterator.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+#define _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sqlnode.hxx"
+#include <connectivity/IParseContext.hxx>
+#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
+#include <com/sun/star/sdbc/DataType.hpp>
+#include <com/sun/star/sdbc/SQLWarning.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "connectivity/CommonTools.hxx"
+#include <rtl/ref.hxx>
+#include <cppuhelper/weak.hxx>
+
+#include <map>
+#include <memory>
+#include <vector>
+
+namespace connectivity
+{
+
+ class OSQLParseNode;
+ class OSQLParser;
+
+ typedef ::std::pair<const OSQLParseNode*,const OSQLParseNode* > TNodePair;
+
+ enum OSQLStatementType {
+ SQL_STATEMENT_UNKNOWN,
+ SQL_STATEMENT_SELECT,
+ SQL_STATEMENT_INSERT,
+ SQL_STATEMENT_UPDATE,
+ SQL_STATEMENT_DELETE,
+ SQL_STATEMENT_ODBC_CALL,
+ SQL_STATEMENT_CREATE_TABLE
+ };
+
+ struct OSQLParseTreeIteratorImpl;
+
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseTreeIterator
+ {
+ private:
+ ::com::sun::star::sdbc::SQLException m_aErrors; // conatins the error while iterating through the statement
+ const OSQLParseNode* m_pParseTree; // current ParseTree
+ const OSQLParser& m_rParser; // if set used for general error messages from the context
+ OSQLStatementType m_eStatementType;
+ ::rtl::Reference<OSQLColumns> m_aSelectColumns; // all columns from the Select clause
+ ::rtl::Reference<OSQLColumns> m_aParameters; // all parameters
+ ::rtl::Reference<OSQLColumns> m_aGroupColumns; // the group by columns
+ ::rtl::Reference<OSQLColumns> m_aOrderColumns; // the order by columns
+ ::rtl::Reference<OSQLColumns> m_aCreateColumns; // the columns for Create table clause
+
+ ::std::auto_ptr< OSQLParseTreeIteratorImpl > m_pImpl;
+
+ void traverseParameter(const OSQLParseNode* _pParseNode,const OSQLParseNode* _pColumnRef,const OUString& _aColumnName, OUString& _aTableRange, const OUString& _rColumnAlias);
+ // inserts a table into the map
+ void traverseOneTableName( OSQLTables& _rTables,const OSQLParseNode * pTableName, const OUString & rTableRange );
+ void traverseSearchCondition(OSQLParseNode * pSearchCondition);
+ void traverseOnePredicate(
+ OSQLParseNode * pColumnRef,
+ OUString& aValue,
+ OSQLParseNode * pParameter);
+ void traverseByColumnNames(const OSQLParseNode* pSelectNode,sal_Bool _bOrder);
+ void traverseParameters(const OSQLParseNode* pSelectNode);
+
+ const OSQLParseNode* getTableNode( OSQLTables& _rTables, const OSQLParseNode* pTableRef, OUString& aTableRange );
+ void getQualified_join( OSQLTables& _rTables, const OSQLParseNode *pTableRef, OUString& aTableRange );
+ void getSelect_statement(OSQLTables& _rTables,const OSQLParseNode* pSelect);
+ OUString getUniqueColumnName(const OUString & rColumnName) const;
+
+ /** finds the column with a given name, belonging to a given table, in a given tables collection
+ @param _rTables
+ the tables collection to look in
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name; if empty, look in all tables
+ @return
+ the desired column object, or <NULL/> if no such column could be found
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
+ const OSQLTables& _rTables, const OUString & rColumnName, OUString & rTableRange );
+
+ /** finds a column with a given name, belonging to a given table
+ @param rColumnName
+ the column name to look for
+ @param rTableRange
+ the table alias name; if empty, look in all tables
+ @param _bLookInSubTables
+ <TRUE/> if and only if not only our direct tables, but also our sub tables (from sub selects)
+ should be searched
+ @return
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > findColumn(
+ const OUString & rColumnName, OUString & rTableRange, bool _bLookInSubTables );
+
+ protected:
+ void setSelectColumnName(::rtl::Reference<OSQLColumns>& _rColumns,const OUString & rColumnName,const OUString & rColumnAlias, const OUString & rTableRange,sal_Bool bFkt=sal_False,sal_Int32 _nType = com::sun::star::sdbc::DataType::VARCHAR,sal_Bool bAggFkt=sal_False);
+ void appendColumns(::rtl::Reference<OSQLColumns>& _rColumns,const OUString& _rTableAlias,const OSQLTable& _rTable);
+ // Other member variables that should be available in the "set" functions
+ // can be defined in the derived class. They can be initialized
+ // in its constructor and, after the "traverse" routines have been used,
+ // they can be queried using other functions.
+
+
+ private:
+ OSQLParseTreeIterator(); // never implemented
+ OSQLParseTreeIterator(const OSQLParseTreeIterator & rIter); // never implemented
+
+ public:
+ OSQLParseTreeIterator(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _rxTables,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot = NULL );
+ ~OSQLParseTreeIterator();
+
+ inline static void * SAL_CALL operator new( size_t nSize ) SAL_THROW(())
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void * SAL_CALL operator new( size_t,void* _pHint ) SAL_THROW(())
+ { return _pHint; }
+ inline static void SAL_CALL operator delete( void * pMem ) SAL_THROW(())
+ { ::rtl_freeMemory( pMem ); }
+ inline static void SAL_CALL operator delete( void *,void* ) SAL_THROW(())
+ { }
+
+ void dispose();
+ bool isCaseSensitive() const;
+ // The parse tree to be analysed/traversed:
+ // If NULL is passed, the current parse tree will be deleted and the error status cleared.
+ void setParseTree(const OSQLParseNode * pNewParseTree);
+// void setParser(const OSQLParser* _pParser) { m_pParser = _pParser; }
+ const OSQLParseNode * getParseTree() const { return m_pParseTree; };
+
+ // subtrees in case of a select statement
+ const OSQLParseNode* getWhereTree() const;
+ const OSQLParseNode* getOrderTree() const;
+ const OSQLParseNode* getGroupByTree() const;
+ const OSQLParseNode* getHavingTree() const;
+
+ const OSQLParseNode* getSimpleWhereTree() const;
+ const OSQLParseNode* getSimpleOrderTree() const;
+ const OSQLParseNode* getSimpleGroupByTree() const;
+ const OSQLParseNode* getSimpleHavingTree() const;
+
+ /** returns the errors which occurred during parsing.
+
+ The returned object contains a chain (via SQLException::NextException) of SQLExceptions.
+ */
+ inline const ::com::sun::star::sdbc::SQLException& getErrors() const { return m_aErrors; }
+ inline bool hasErrors() const { return !m_aErrors.Message.isEmpty(); }
+
+ // statement type (already set in setParseTree):
+ OSQLStatementType getStatementType() const { return m_eStatementType; }
+
+ /** traverses the complete statement tree, and fills all our data with
+ the information obatined during traversal.
+
+ Implemented by calling the single traverse* methods in the proper
+ order (depending on the statement type).
+ */
+ void traverseAll();
+
+ enum TraversalParts
+ {
+ Parameters = 0x0001,
+ TableNames = 0x0002,
+ SelectColumns = 0x0006, // note that this includes TableNames. No SelectColumns without TableNames
+
+ // Those are not implemented currently
+ // GroupColumns = 0x0008,
+ // OrderColumns = 0x0010,
+ // SelectColumns = 0x0020,
+ // CreateColumns = 0x0040,
+
+ All = 0xFFFF
+ };
+ /** traverses selected parts of the statement tree, and fills our data with
+ the information obtained during traversal
+
+ @param _nIncludeMask
+ set of TraversalParts bits, specifying which information is to be collected.
+ Note TraversalParts is currently not
+ */
+ void traverseSome( sal_uInt32 _nIncludeMask );
+
+ // The TableRangeMap contains all tables associated with the range name found first.
+ const OSQLTables& getTables() const;
+
+ ::rtl::Reference<OSQLColumns> getSelectColumns() const { return m_aSelectColumns;}
+ ::rtl::Reference<OSQLColumns> getGroupColumns() const { return m_aGroupColumns;}
+ ::rtl::Reference<OSQLColumns> getOrderColumns() const { return m_aOrderColumns;}
+ ::rtl::Reference<OSQLColumns> getParameters() const { return m_aParameters; }
+ ::rtl::Reference<OSQLColumns> getCreateColumns() const { return m_aCreateColumns;}
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ OUString &_rColumnName,
+ OUString& _rTableRange) const;
+
+ /** retrieves a column's name, table range, and alias
+
+ @param _pColumnRef
+ The column_ref parse node.
+ @param _out_rColumnName
+ The column name to be set.
+ @param _out_rTableRange
+ The table range to be set.
+ @param _out_rColumnAliasIfPresent
+ If the column specified by _pColumnRef is part of the select columns, and contains a column alias there,
+ this alias is returned here.
+ */
+ void getColumnRange( const OSQLParseNode* _pColumnRef,
+ OUString& _out_rColumnName,
+ OUString& _out_rTableRange,
+ OUString& _out_rColumnAliasIfPresent
+ ) const;
+
+ /** return the alias name of a column
+ @param _pDerivedColumn
+ The parse node where SQL_ISRULE(_pDerivedColumn,derived_column) must be true
+ @return
+ The alias name of the column or an empty string.
+ */
+ static OUString getColumnAlias(const OSQLParseNode* _pDerivedColumn);
+
+ /** return the columname and the table range
+ @param _pColumnRef
+ The column ref parse node.
+ @param _xMetaData
+ The database meta data.
+ @param _rColumnName
+ The column name to be set.
+ @param _rTableRange
+ The table range to be set.
+ */
+ static void getColumnRange( const OSQLParseNode* _pColumnRef,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ OUString &_rColumnName,
+ OUString& _rTableRange);
+
+ // empty if ambiguous
+ sal_Bool getColumnTableRange(const OSQLParseNode* pNode, OUString &rTableRange) const;
+
+ // return true when the tableNode is a rule like catalog_name, schema_name or table_name
+ sal_Bool isTableNode(const OSQLParseNode* _pTableNode) const;
+
+ // tries to find the correct type of the function
+ sal_Int32 getFunctionReturnType(const OSQLParseNode* _pNode );
+
+ // returns a lis of all joined columns
+ ::std::vector< TNodePair >& getJoinConditions() const;
+
+ private:
+ /** traverses the list of table names, and filles _rTables
+ */
+ bool traverseTableNames( OSQLTables& _rTables );
+
+ /// traverses columns in a SELECT statement
+ bool traverseSelectColumnNames(const OSQLParseNode* pSelectNode);
+ /// traverses columns in a CREATE TABLE statement
+ void traverseCreateColumns(const OSQLParseNode* pSelectNode);
+
+ bool traverseOrderByColumnNames(const OSQLParseNode* pSelectNode);
+ bool traverseGroupByColumnNames(const OSQLParseNode* pSelectNode);
+
+ bool traverseSelectionCriteria(const OSQLParseNode* pSelectNode);
+
+ private:
+ /** constructs a new iterator, which inherits some of the settings from a parent iterator
+ */
+ OSQLParseTreeIterator(
+ const OSQLParseTreeIterator& _rParentIterator,
+ const OSQLParser& _rParser,
+ const OSQLParseNode* pRoot );
+
+ /** creates a table object and inserts it into our tables collection
+
+ only used when we're iterating through a CREATE TABLE statement
+ */
+ OSQLTable impl_createTableObject(
+ const OUString& rTableName, const OUString& rCatalogName, const OUString& rSchemaName );
+
+ /** locates a record source (a table or query) with the given name
+ */
+ OSQLTable impl_locateRecordSource(
+ const OUString& _rComposedName
+ );
+
+ /** implementation for both traverseAll and traverseSome
+ */
+ void impl_traverse( sal_uInt32 _nIncludeMask );
+
+ /** retrieves the parameter columns of the given query
+ */
+ void impl_getQueryParameterColumns( const OSQLTable& _rQuery );
+
+ void setOrderByColumnName(const OUString & rColumnName, OUString & rTableRange, sal_Bool bAscending);
+ void setGroupByColumnName(const OUString & rColumnName, OUString & rTableRange);
+
+ private:
+ /** appends an SQLException corresponding to the given error code to our error collection
+
+ @param _eError
+ the code of the error which occurred
+ @param _pReplaceToken1
+ if not <NULL/>, the first occurrence of '#' in the error message will be replaced
+ with the given token
+ @param _pReplaceToken2
+ if not <NULL/>, and if _rReplaceToken1 is not <NULL/>, the second occurrence of '#'
+ in the error message will be replaced with _rReplaceToken2
+ */
+ void impl_appendError( IParseContext::ErrorCode _eError,
+ const OUString* _pReplaceToken1 = NULL, const OUString* _pReplaceToken2 = NULL );
+
+ /** appends an SQLException corresponding to the given error code to our error collection
+ */
+ void impl_appendError( const ::com::sun::star::sdbc::SQLException& _rError );
+
+ /** resets our errors
+ */
+ inline void impl_resetErrors()
+ {
+ m_aErrors = ::com::sun::star::sdbc::SQLException();
+ }
+ void impl_fillJoinConditions(const OSQLParseNode* i_pJoinCondition);
+ };
+}
+
+#endif // _CONNECTIVITY_PARSE_SQLITERATOR_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlnode.hxx b/include/connectivity/sqlnode.hxx
new file mode 100644
index 000000000000..f988f78e7e14
--- /dev/null
+++ b/include/connectivity/sqlnode.hxx
@@ -0,0 +1,466 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SQLNODE_HXX
+#define _CONNECTIVITY_SQLNODE_HXX
+
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/dbmetadata.hxx"
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vector>
+#include <functional>
+#include <set>
+#include <boost/shared_ptr.hpp>
+#include <rtl/ustrbuf.hxx>
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace container
+ {
+ class XNameAccess;
+ }
+ }
+ }
+}
+
+#define ORDER_BY_CHILD_POS 5
+#define TABLE_EXPRESSION_CHILD_COUNT 9
+
+namespace connectivity
+{
+ class OSQLParser;
+ class OSQLParseNode;
+ class IParseContext;
+
+ typedef ::std::vector< OSQLParseNode* > OSQLParseNodes;
+
+ enum SQLNodeType {SQL_NODE_RULE, SQL_NODE_LISTRULE, SQL_NODE_COMMALISTRULE,
+ SQL_NODE_KEYWORD, SQL_NODE_COMPARISON, SQL_NODE_NAME,
+ SQL_NODE_STRING, SQL_NODE_INTNUM, SQL_NODE_APPROXNUM,
+ SQL_NODE_EQUAL,SQL_NODE_LESS,SQL_NODE_GREAT,SQL_NODE_LESSEQ,SQL_NODE_GREATEQ,SQL_NODE_NOTEQUAL,
+ SQL_NODE_PUNCTUATION, SQL_NODE_AMMSC, SQL_NODE_ACCESS_DATE,SQL_NODE_DATE,SQL_NODE_CONCAT};
+
+ typedef ::std::set< OUString > QueryNameSet;
+ //==================================================================
+ //= SQLParseNodeParameter
+ //==================================================================
+ struct OOO_DLLPUBLIC_DBTOOLS SQLParseNodeParameter
+ {
+ const ::com::sun::star::lang::Locale& rLocale;
+ ::dbtools::DatabaseMetaData aMetaData;
+ OSQLParser* pParser;
+ ::boost::shared_ptr< QueryNameSet > pSubQueryHistory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > xFormatter;
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField;
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xQueries; // see bParseToSDBCLevel
+ const IParseContext& m_rContext;
+ sal_Char cDecSep;
+ bool bQuote : 1; /// should we quote identifiers?
+ bool bInternational : 1; /// should we internationalize keywords and placeholders?
+ bool bPredicate : 1; /// are we going to parse a mere predicate?
+ bool bParseToSDBCLevel : 1; /// should we create an SDBC-level statement (e.g. with substituted sub queries)?
+
+ SQLParseNodeParameter(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xField,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const IParseContext* _pContext,
+ bool _bIntl,
+ bool _bQuote,
+ sal_Char _cDecSep,
+ bool _bPredicate,
+ bool _bParseToSDBC
+ );
+ ~SQLParseNodeParameter();
+ };
+
+ //==========================================================================
+ //= OSQLParseNode
+ //==========================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParseNode
+ {
+ friend class OSQLParser;
+
+ OSQLParseNodes m_aChildren;
+ OSQLParseNode* m_pParent; // pParent for reverse linkage in the tree
+ OUString m_aNodeValue; // token name, or empty in case of rules,
+ // or OUString in case of
+ // OUString, INT, etc.
+ SQLNodeType m_eNodeType; // see above
+ sal_uInt32 m_nNodeID; // ::com::sun::star::chaos::Rule ID (if IsRule())
+ // or Token ID (if !IsRule())
+ // ::com::sun::star::chaos::Rule IDs and Token IDs can't
+ // be distinguished by their values,
+ // IsRule has to be used for that!
+ public:
+ enum Rule
+ {
+ UNKNOWN_RULE = 0, // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
+ // we make sure it is 0 so that it is the default-constructor value of this enum
+ // and std::map<foo,Rule>::operator[](bar) default-inserts UNKNOWN_RULE rather than select_statement (!)
+ select_statement,
+ table_exp,
+ table_ref_commalist,
+ table_ref,
+ catalog_name,
+ schema_name,
+ table_name,
+ opt_column_commalist,
+ column_commalist,
+ column_ref_commalist,
+ column_ref,
+ opt_order_by_clause,
+ ordering_spec_commalist,
+ ordering_spec,
+ opt_asc_desc,
+ where_clause,
+ opt_where_clause,
+ search_condition,
+ comparison_predicate,
+ between_predicate,
+ like_predicate,
+ opt_escape,
+ test_for_null,
+ scalar_exp_commalist,
+ scalar_exp,
+ parameter_ref,
+ parameter,
+ general_set_fct,
+ range_variable,
+ column,
+ delete_statement_positioned,
+ delete_statement_searched,
+ update_statement_positioned,
+ update_statement_searched,
+ assignment_commalist,
+ assignment,
+ values_or_query_spec,
+ insert_statement,
+ insert_atom_commalist,
+ insert_atom,
+ predicate_check,
+ from_clause,
+ qualified_join,
+ cross_union,
+ select_sublist,
+ derived_column,
+ column_val,
+ set_fct_spec,
+ boolean_term,
+ boolean_primary,
+ num_value_exp,
+ join_type,
+ position_exp,
+ extract_exp,
+ length_exp,
+ char_value_fct,
+ odbc_call_spec,
+ in_predicate,
+ existence_test,
+ unique_test,
+ all_or_any_predicate,
+ named_columns_join,
+ join_condition,
+ joined_table,
+ boolean_factor,
+ sql_not,
+ boolean_test,
+ manipulative_statement,
+ subquery,
+ value_exp_commalist,
+ odbc_fct_spec,
+ union_statement,
+ outer_join_type,
+ char_value_exp,
+ term,
+ value_exp_primary,
+ value_exp,
+ selection,
+ fold,
+ char_substring_fct,
+ factor,
+ base_table_def,
+ base_table_element_commalist,
+ data_type,
+ column_def,
+ table_node,
+ as_clause,
+ opt_as,
+ op_column_commalist,
+ table_primary_as_range_column,
+ datetime_primary,
+ concatenation,
+ char_factor,
+ bit_value_fct,
+ comparison_predicate_part_2,
+ parenthesized_boolean_value_expression,
+ character_string_type,
+ other_like_predicate_part_2,
+ between_predicate_part_2,
+ cast_spec,
+ rule_count // last value
+ };
+
+ // must be ascii encoding for the value
+ OSQLParseNode(const sal_Char* _pValueStr,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ OSQLParseNode(const OString& _rValue,
+ SQLNodeType eNewNodeType,
+ sal_uInt32 nNewNodeID=0);
+
+ OSQLParseNode(const OUString& _rValue,
+ SQLNodeType _eNodeType,
+ sal_uInt32 _nNodeID = 0);
+
+ // copies the respective ParseNode
+ OSQLParseNode(const OSQLParseNode& rParseNode);
+ OSQLParseNode& operator=(const OSQLParseNode& rParseNode);
+
+ sal_Bool operator==(OSQLParseNode& rParseNode) const;
+
+ // destructor destructs the tree recursively
+ virtual ~OSQLParseNode();
+
+ OSQLParseNode* getParent() const {return m_pParent;};
+
+ void setParent(OSQLParseNode* pParseNode) {m_pParent = pParseNode;};
+
+ size_t count() const {return m_aChildren.size();};
+ inline OSQLParseNode* getChild(sal_uInt32 nPos) const;
+
+ void append(OSQLParseNode* pNewSubTree);
+ void insert(sal_uInt32 nPos, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* replace(OSQLParseNode* pOldSubTree, OSQLParseNode* pNewSubTree);
+
+ OSQLParseNode* removeAt(sal_uInt32 nPos);
+
+ void replaceNodeValue(const OUString& rTableAlias,const OUString& rColumnName);
+
+ /** parses the node to a string which can be passed to a driver's connection for execution
+
+ Any particles of the parse tree which represent application-level features - such
+ as queries appearing in the FROM part - are substituted, so that the resulting statement can
+ be executed at an SDBC-level connection.
+
+ @param _out_rString
+ is an output parameter taking the resulting SQL statement
+
+ @param _rxConnection
+ the connection relative to which to parse. This must be an SDB-level connection (e.g.
+ support the XQueriesSupplier interface) for the method to be able to do all necessary
+ substitutions.
+
+ @param _rParser
+ the SQLParser used to create the node. This is needed in case we need to parse
+ sub queries which are present in the SQL statement - those sub queries need to be parsed,
+ too, to check whether they contain nested sub queries.
+
+ @param _pErrorHolder
+ takes the error which occurred while generating the statement, if any. Might be <NULL/>,
+ in this case the error is not reported back, and can only be recognized by examing the
+ return value.
+
+ @return
+ <TRUE/> if and only if the parsing was successful.<br/>
+
+ Currently, there's only one condition how this method can fail: If it contains a nested
+ query which causes a cycle. E.g., consider a statement <code>SELECT * from "foo"</code>,
+ where <code>foo</code> is a query defined as <code>SELECT * FROM "bar"</code>, where
+ <code>bar</code> is defined as <code>SELECT * FROM "foo"</code>. This statement obviously
+ cannot be parsed to an executable statement.
+
+ If this method returns <FALSE/>, you're encouraged to check and handle the error in
+ <arg>_pErrorHolder</arg>.
+ */
+ bool parseNodeToExecutableStatement( OUString& _out_rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ OSQLParser& _rParser,
+ ::com::sun::star::sdbc::SQLException* _pErrorHolder ) const;
+
+ void parseNodeToStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const IParseContext* pContext = NULL,
+ sal_Bool _bIntl = sal_False,
+ sal_Bool _bQuote= sal_True) const;
+
+ // quoted and internationalised
+ void parseNodeToPredicateStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::lang::Locale& rIntl,
+ sal_Char _cDec,
+ const IParseContext* pContext = NULL ) const;
+
+ void parseNodeToPredicateStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField,
+ const ::com::sun::star::lang::Locale& rIntl,
+ sal_Char _cDec,
+ const IParseContext* pContext = NULL ) const;
+
+ OSQLParseNode* getByRule(OSQLParseNode::Rule eRule) const;
+
+#if OSL_DEBUG_LEVEL > 1
+ // shows the ParseTree with tabs and linefeeds
+ void showParseTree( OUString& rString ) const;
+ void showParseTree( OUStringBuffer& _inout_rBuf, sal_uInt32 nLevel ) const;
+#endif
+
+ SQLNodeType getNodeType() const {return m_eNodeType;};
+
+ // RuleId returns the RuleID of the node's rule (only if IsRule())
+ sal_uInt32 getRuleID() const {return m_nNodeID;}
+
+ /** returns the ID of the rule represented by the node
+ If the node does not represent a rule, UNKNOWN_RULE is returned
+ */
+ Rule getKnownRuleID() const;
+
+ // returns the TokenId of the node's token (only if !isRule())
+ sal_uInt32 getTokenID() const {return m_nNodeID;}
+
+ // IsRule tests whether a node is a rule (NonTerminal)
+ // ATTENTION: rules can be leaves, for example empty lists
+ sal_Bool isRule() const
+ { return (m_eNodeType == SQL_NODE_RULE) || (m_eNodeType == SQL_NODE_LISTRULE)
+ || (m_eNodeType == SQL_NODE_COMMALISTRULE);}
+
+ // IsToken tests whether a Node is a Token (Terminal but not a rule)
+ sal_Bool isToken() const {return !isRule();}
+
+ const OUString& getTokenValue() const {return m_aNodeValue;}
+
+ void setTokenValue(const OUString& rString) { if (isToken()) m_aNodeValue = rString;}
+
+ sal_Bool isLeaf() const {return m_aChildren.empty();}
+
+ // negate only a searchcondition, any other rule could cause a gpf
+ static void negateSearchCondition(OSQLParseNode*& pSearchCondition,sal_Bool bNegate=sal_False);
+
+ // normalize a logic form
+ // e.q. (a or b) and (c or d) <=> a and c or a and d or b and c or b and d
+ static void disjunctiveNormalForm(OSQLParseNode*& pSearchCondition);
+
+ // Simplifies logic expressions
+ // a and a = a
+ // a or a = a
+ // a and ( a + b) = a
+ // a or a and b = a
+ static void absorptions(OSQLParseNode*& pSearchCondition);
+
+ // erase unnecessary braces
+ static void eraseBraces(OSQLParseNode*& pSearchCondition);
+
+ // makes the logic formula a little smaller
+ static void compress(OSQLParseNode*& pSearchCondition);
+ // return the catalog, schema and tablename form this node
+ // _pTableNode must be a rule of that above or a SQL_TOKEN_NAME
+ static sal_Bool getTableComponents(const OSQLParseNode* _pTableNode,
+ ::com::sun::star::uno::Any &_rCatalog,
+ OUString &_rSchema,
+ OUString &_rTable
+ ,const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData >& _xMetaData);
+
+ // substitute all occurrences of :var or [name] into the dynamic parameter ?
+ // _pNode will be modified if parameters exists
+ static void substituteParameterNames(OSQLParseNode* _pNode);
+
+ /** return a table range when it exists.
+ */
+ static OUString getTableRange(const OSQLParseNode* _pTableRef);
+
+ protected:
+ // ParseNodeToStr concatenates all Tokens (leaves) of the ParseNodes.
+ void parseNodeToStr(OUString& rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & _xField,
+ const ::com::sun::star::lang::Locale& rIntl,
+ const IParseContext* pContext,
+ bool _bIntl,
+ bool _bQuote,
+ sal_Char _cDecSep,
+ bool _bPredicate,
+ bool _bSubstitute) const;
+
+ private:
+ void impl_parseNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ void impl_parseLikeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+ void impl_parseTableRangeNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ /** parses a table_name node into a SQL statement particle.
+ @return
+ <TRUE/> if and only if parsing was successful, <FALSE/> if default handling should
+ be applied.
+ */
+ bool impl_parseTableNameNodeToString_throw( OUStringBuffer& rString, const SQLParseNodeParameter& rParam ) const;
+
+ sal_Bool addDateValue(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ OUString convertDateTimeString(const SQLParseNodeParameter& rParam, const OUString& rString) const;
+ OUString convertDateString(const SQLParseNodeParameter& rParam, const OUString& rString) const;
+ OUString convertTimeString(const SQLParseNodeParameter& rParam, const OUString& rString) const;
+ void parseLeaf(OUStringBuffer& rString, const SQLParseNodeParameter& rParam) const;
+ };
+
+ //-----------------------------------------------------------------------------
+ inline OSQLParseNode* OSQLParseNode::getChild(sal_uInt32 nPos) const
+ {
+ OSL_ENSURE(nPos < m_aChildren.size(), "Invalid Position");
+
+ // return m_aChildren[nPos];
+ return m_aChildren.at(nPos);
+ }
+
+ // utilities to query for a specific rule, token or punctuation
+ #define SQL_ISRULE(pParseNode, eRule) ((pParseNode)->isRule() && (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::eRule))
+ #define SQL_ISRULEOR2(pParseNode, e1, e2) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2)))
+ #define SQL_ISRULEOR3(pParseNode, e1, e2, e3) ((pParseNode)->isRule() && ( \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e1) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e2) || \
+ (pParseNode)->getRuleID() == OSQLParser::RuleID(OSQLParseNode::e3)))
+ #define SQL_ISTOKEN(pParseNode, token) ((pParseNode)->isToken() && (pParseNode)->getTokenID() == SQL_TOKEN_##token)
+ #define SQL_ISTOKENOR2(pParseNode, tok0, tok1) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 ))
+ #define SQL_ISTOKENOR3(pParseNode, tok0, tok1, tok2) ((pParseNode)->isToken() && ( (pParseNode)->getTokenID() == SQL_TOKEN_##tok0 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok1 || (pParseNode)->getTokenID() == SQL_TOKEN_##tok2 ))
+ #define SQL_ISPUNCTUATION(pParseNode, aString) ((pParseNode)->getNodeType() == SQL_NODE_PUNCTUATION && !(pParseNode)->getTokenValue().compareToAscii(aString))
+}
+
+#endif //_CONNECTIVITY_SQLNODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx
new file mode 100644
index 000000000000..892d3ecb8db5
--- /dev/null
+++ b/include/connectivity/sqlparse.hxx
@@ -0,0 +1,253 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _CONNECTIVITY_SQLPARSE_HXX
+#define _CONNECTIVITY_SQLPARSE_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include <osl/mutex.hxx>
+#include <connectivity/sqlnode.hxx>
+#ifndef DISABLE_DBCONNECTIVITY
+#ifndef YYBISON
+#ifndef FLEX_SCANNER
+#include "sqlbison.hxx"
+#endif
+#endif
+#endif
+#include <com/sun/star/i18n/XCharacterClassification.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/i18n/XLocaleData4.hpp>
+#include "connectivity/IParseContext.hxx"
+#include "connectivity/dbtoolsdllapi.hxx"
+#include "connectivity/sqlerror.hxx"
+#include <salhelper/singletonref.hxx>
+
+#include <map>
+
+// forward declarations
+namespace com
+{
+ namespace sun
+ {
+ namespace star
+ {
+ namespace beans
+ {
+ class XPropertySet;
+ }
+ namespace util
+ {
+ class XNumberFormatter;
+ }
+ namespace lang
+ {
+ struct Locale;
+ }
+ }
+ }
+}
+namespace connectivity
+{
+ class OSQLScanner;
+ class SQLError;
+
+ //==========================================================================
+ //= OParseContext
+ //==========================================================================
+ class OOO_DLLPUBLIC_DBTOOLS OParseContext : public IParseContext
+ {
+ public:
+ OParseContext();
+
+ virtual ~OParseContext();
+ // retrieves language specific error messages
+ virtual OUString getErrorMessage(ErrorCode _eCodes) const;
+
+ // retrieves language specific keyword strings (only ASCII allowed)
+ virtual OString getIntlKeywordAscii(InternationalKeyCode _eKey) const;
+
+ // finds out, if we have an international keyword (only ASCII allowed)
+ virtual InternationalKeyCode getIntlKeyCode(const OString& rToken) const;
+
+ // determines the default international setting
+ static const ::com::sun::star::lang::Locale& getDefaultLocale();
+
+ /** get's a locale instance which should be used when parsing in the context specified by this instance
+ <p>if this is not overridden by derived classes, it returns the static default locale.</p>
+ */
+ virtual ::com::sun::star::lang::Locale getPreferredLocale( ) const;
+ };
+
+ //==========================================================================
+ // OSQLParseNodesContainer
+ // grabage collection of nodes
+ //==========================================================================
+ class OSQLParseNodesContainer
+ {
+ ::osl::Mutex m_aMutex;
+ ::std::vector< OSQLParseNode* > m_aNodes;
+ public:
+ OSQLParseNodesContainer();
+ ~OSQLParseNodesContainer();
+
+ void push_back(OSQLParseNode* _pNode);
+ void erase(OSQLParseNode* _pNode);
+ void clear();
+ void clearAndDelete();
+ };
+
+ typedef salhelper::SingletonRef<OSQLParseNodesContainer> OSQLParseNodesGarbageCollector;
+
+ //==========================================================================
+ //= OSQLParser
+ //==========================================================================
+ struct OSQLParser_Data
+ {
+ ::com::sun::star::lang::Locale aLocale;
+ ::connectivity::SQLError aErrors;
+
+ OSQLParser_Data( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext )
+ :aErrors( _rxContext )
+ {
+ }
+ };
+
+ /** Parser for SQL92
+ */
+ class OOO_DLLPUBLIC_DBTOOLS OSQLParser
+ {
+ friend class OSQLParseNode;
+ friend class OSQLInternalNode;
+ friend struct SQLParseNodeParameter;
+
+ private:
+ typedef ::std::map< sal_uInt32, OSQLParseNode::Rule > RuleIDMap;
+ // static parts for parsers
+ static sal_uInt32 s_nRuleIDs[OSQLParseNode::rule_count + 1];
+ static RuleIDMap s_aReverseRuleIDLookup;
+ static OParseContext s_aDefaultContext;
+
+ static OSQLScanner* s_pScanner;
+ static OSQLParseNodesGarbageCollector* s_pGarbageCollector;
+ static sal_Int32 s_nRefCount;
+
+ // information on the current parse action
+ const IParseContext* m_pContext;
+ OSQLParseNode* m_pParseTree; // result from parsing
+ ::std::auto_ptr< OSQLParser_Data >
+ m_pData;
+ OUString m_sFieldName; // current field name for a predicate
+ OUString m_sErrorMessage;// current error msg
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ m_xField; // current field
+ ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >
+ m_xFormatter; // current number formatter
+ sal_Int32 m_nFormatKey; // numberformat, which should be used
+ sal_Int32 m_nDateFormatKey;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XCharacterClassification> m_xCharClass;
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4> s_xLocaleData;
+ ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData> xDummy; // can be deleted after 627
+
+ // convert a string into double trim it to scale of _nscale and than transform it back to string
+ OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale);
+ OSQLParseNode* buildDate(sal_Int32 _nType,OSQLParseNode*& pLiteral);
+ bool extractDate(OSQLParseNode* pLiteral,double& _rfValue);
+ void killThousandSeparator(OSQLParseNode* pLiteral);
+ OSQLParseNode* convertNode(sal_Int32 nType,OSQLParseNode*& pLiteral);
+ // makes a string out of a number, pLiteral will be deleted
+ OSQLParseNode* buildNode_STR_NUM(OSQLParseNode*& pLiteral);
+ OSQLParseNode* buildNode_Date(const double& fValue, sal_Int32 nType);
+
+ static ::osl::Mutex& getMutex();
+
+ public:
+ // if NULL, a default context will be used
+ // the context must live as long as the parser
+ OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const IParseContext* _pContext = NULL);
+ ~OSQLParser();
+
+ // Parsing an SQLStatement
+ OSQLParseNode* parseTree(OUString& rErrorMessage,
+ const OUString& rStatement,
+ sal_Bool bInternational = sal_False);
+
+ // Check a Predicate
+ OSQLParseNode* predicateTree(OUString& rErrorMessage, const OUString& rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > & xFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xField);
+
+ // Access to the context
+ const IParseContext& getContext() const {return *m_pContext;}
+
+ /// access to the SQLError instance owned by this parser
+ const SQLError& getErrorHelper() const;
+
+ // TokenIDToStr: token name belonging to a token number.
+ static OString TokenIDToStr(sal_uInt32 nTokenID, const IParseContext* pContext = NULL);
+
+#if OSL_DEBUG_LEVEL > 1
+ // (empty string if not found)
+ static OUString RuleIDToStr(sal_uInt32 nRuleID);
+#endif
+
+ // StrToRuleID calculates the RuleID for a OUString (that is, ::com::sun::star::sdbcx::Index in yytname)
+ // (0 if not found). The search for an ID based on a String is
+ // extremely inefficient (sequential search for OUString)!
+ static sal_uInt32 StrToRuleID(const OString & rValue);
+
+ static OSQLParseNode::Rule RuleIDToRule( sal_uInt32 _nRule );
+
+ // RuleId with enum, far more efficient
+ static sal_uInt32 RuleID(OSQLParseNode::Rule eRule);
+ // compares the _sFunctionName with all known function names and return the DataType of the return value
+ static sal_Int32 getFunctionReturnType(const OUString& _sFunctionName, const IParseContext* pContext = NULL);
+
+ // returns the type for a parameter in a given function name
+ static sal_Int32 getFunctionParameterType(sal_uInt32 _nTokenId,sal_uInt32 _nPos);
+
+ void error(const sal_Char *fmt);
+ int SQLlex();
+#ifdef YYBISON
+ void setParseTree(OSQLParseNode * pNewParseTree);
+
+ // Is the parse in a special mode?
+ // Predicate chack is used to check a condition for a field
+ sal_Bool inPredicateCheck() const {return m_xField.is();}
+ const OUString& getFieldName() const {return m_sFieldName;}
+
+ void reduceLiteral(OSQLParseNode*& pLiteral, sal_Bool bAppendBlank);
+ // does not change the pLiteral argument
+ sal_Int16 buildNode(OSQLParseNode*& pAppend,OSQLParseNode* pCompare,OSQLParseNode* pLiteral,OSQLParseNode* pLiteral2);
+
+ sal_Int16 buildComparsionRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral);
+ // pCompre will be deleted if it is not used
+ sal_Int16 buildPredicateRule(OSQLParseNode*& pAppend,OSQLParseNode* pLiteral,OSQLParseNode*& pCompare,OSQLParseNode* pLiteral2 = NULL);
+
+ sal_Int16 buildLikeRule(OSQLParseNode*& pAppend,OSQLParseNode*& pLiteral,const OSQLParseNode* pEscape);
+ sal_Int16 buildStringNodes(OSQLParseNode*& pLiteral);
+#else
+#endif
+ };
+}
+
+
+#endif //_CONNECTIVITY_SQLPARSE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/standardsqlstate.hxx b/include/connectivity/standardsqlstate.hxx
new file mode 100644
index 000000000000..fb896d1a8af8
--- /dev/null
+++ b/include/connectivity/standardsqlstate.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_STANDARD_SQL_STATE_HXX
+#define CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //----------------------------------------------------------------------------------
+ /** standard SQLStates to be used with an SQLException
+
+ Extend this list whenever you need a new state ...
+
+ @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_error_codes.asp
+ */
+ enum StandardSQLState
+ {
+ SQL_WRONG_PARAMETER_NUMBER, // 07001
+ SQL_INVALID_DESCRIPTOR_INDEX, // 07009
+ SQL_UNABLE_TO_CONNECT, // 08001
+ SQL_NUMERIC_OUT_OF_RANGE, // 22003
+ SQL_INVALID_DATE_TIME, // 22007
+ SQL_INVALID_CURSOR_STATE, // 24000
+ SQL_TABLE_OR_VIEW_EXISTS, // 42S01
+ SQL_TABLE_OR_VIEW_NOT_FOUND, // 42S02
+ SQL_INDEX_ESISTS, // 42S11
+ SQL_INDEX_NOT_FOUND, // 42S12
+ SQL_COLUMN_EXISTS, // 42S21
+ SQL_COLUMN_NOT_FOUND, // 42S22
+ SQL_GENERAL_ERROR, // HY000
+ SQL_INVALID_SQL_DATA_TYPE, // HY004
+ SQL_OPERATION_CANCELED, // HY008
+ SQL_FUNCTION_SEQUENCE_ERROR, // HY010
+ SQL_INVALID_CURSOR_POSITION, // HY109
+ SQL_INVALID_BOOKMARK_VALUE, // HY111
+ SQL_FEATURE_NOT_IMPLEMENTED, // HYC00
+ SQL_FUNCTION_NOT_SUPPORTED, // IM001
+ SQL_CONNECTION_DOES_NOT_EXIST, // 08003
+
+ SQL_ERROR_UNSPECIFIED = SAL_MAX_ENUM // special value indicating that an SQLState is not to be specified
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // CONNECTIVITY_STANDARD_SQL_STATE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/statementcomposer.hxx b/include/connectivity/statementcomposer.hxx
new file mode 100644
index 000000000000..56b10ebd0d11
--- /dev/null
+++ b/include/connectivity/statementcomposer.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_STATEMENTCOMPOSER_HXX
+#define CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+#include <com/sun/star/sdbc/XConnection.hpp>
+#include <com/sun/star/sdb/XSingleSelectQueryComposer.hpp>
+
+#include <boost/noncopyable.hpp>
+
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//........................................................................
+namespace dbtools
+{
+//........................................................................
+
+ //====================================================================
+ //= StatementComposer
+ //====================================================================
+ struct StatementComposer_Data;
+ /** a class which is able to compose queries (SELECT statements) from a command and a command type
+ */
+ class OOO_DLLPUBLIC_DBTOOLS StatementComposer : public ::boost::noncopyable
+ {
+ ::std::auto_ptr< StatementComposer_Data > m_pData;
+
+ public:
+ /** constructs an instance
+
+ @param _rxConnection
+ the connection to work with. Must not be <NULL/>.
+ */
+ StatementComposer(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCommand,
+ const sal_Int32 _nCommandType,
+ const sal_Bool _bEscapeProcessing
+ );
+
+ ~StatementComposer();
+
+ /** controls whether or not the instance disposes its XSingleSelectQueryComposer upon
+ destruction
+
+ Unless you explicitly call this method with the parameter being <TRUE/>,
+ the XSingleSelectQueryComposer will be disposed when the StatementComposer
+ instance is destroyed.
+ */
+ void setDisposeComposer( bool _bDoDispose );
+
+ void setFilter( const OUString& _rFilter );
+ void setOrder( const OUString& _rOrder );
+
+ /** returns the composer which has been fed with the current settings
+
+ @throws ::com::sun::star::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSingleSelectQueryComposer >
+ getComposer();
+
+ /** returns the composer statement
+
+ Effectively, this is equivalent to calling getComposer, and asking the composer
+ for its Query attribute.
+
+ @throws ::com::sun::star::sdbc::SQLException
+ if such an exception occurs while creating the composer
+ */
+ OUString
+ getQuery();
+
+ private:
+ StatementComposer(); // not implemented
+ };
+
+//........................................................................
+} // namespace dbtools
+//........................................................................
+
+#endif // CONNECTIVITY_STATEMENTCOMPOSER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/virtualdbtools.hxx b/include/connectivity/virtualdbtools.hxx
new file mode 100644
index 000000000000..352c98d7a8c4
--- /dev/null
+++ b/include/connectivity/virtualdbtools.hxx
@@ -0,0 +1,371 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+#define CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+
+#include <rtl/ref.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/sdbc/SQLException.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vector>
+#include <memory>
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//========================================================================
+//= forward declarations
+//========================================================================
+namespace com {
+ namespace sun {
+ namespace star {
+ namespace util {
+ class XNumberFormatter;
+ class XNumberFormatTypes;
+ class XNumberFormatsSupplier;
+ }
+ namespace beans {
+ class XPropertySet;
+ }
+ namespace lang {
+ class XMultiServiceFactory;
+ class XComponent;
+ class WrappedTargetException;
+ struct Locale;
+ }
+ namespace sdbc {
+ class XDatabaseMetaData;
+ class XConnection;
+ class XRowSet;
+ class XDataSource;
+ }
+ namespace sdb {
+ class XColumn;
+ class SQLContext;
+ }
+ namespace uno {
+ class XComponentContext;
+ }
+ namespace container {
+ class XNameAccess;
+ }
+ }
+ }
+}
+
+namespace dbtools {
+ class SQLExceptionInfo;
+ class FormattedColumnValue;
+}
+
+namespace comphelper {
+ class ComponentContext;
+}
+
+//========================================================================
+//= entry into this library
+//========================================================================
+/** this is the entry point for the load-on-call usage of the DBTOOLS
+ library.
+ <p>When you need one of the simple objects in this library, load the lib
+ and call this method. The returned pointer is a pointer to an IDataAccessToolsFactory
+ instance, which is acquired <em>once</em>.</p>
+ @return
+ a pointer to an object implementing the IDataAccessToolsFactory interface,
+ aquired exactly <em>once</em>.
+*/
+extern "C" OOO_DLLPUBLIC_DBTOOLS void* SAL_CALL createDataAccessToolsFactory();
+
+//========================================================================
+//=
+//========================================================================
+//........................................................................
+namespace connectivity
+{
+//........................................................................
+
+ class IParseContext;
+ //....................................................................
+ namespace simple
+ {
+ //....................................................................
+
+ typedef void* (SAL_CALL * createDataAccessToolsFactoryFunction)( );
+
+ //================================================================
+ //= IDataAccessTools
+ //================================================================
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessTools : public ::rtl::IReference
+ {
+ public:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
+ const OUString& _rDataSourceName,
+ const OUString& _rUser,
+ const OUString& _rPwd,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext,
+ sal_Bool _bSetAsActiveConnection
+ ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
+ , ::com::sun::star::lang::WrappedTargetException
+ , ::com::sun::star::uno::RuntimeException ) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
+ const SAL_THROW ( (::com::sun::star::uno::RuntimeException) ) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
+ sal_Bool _bAllowDefault
+ ) const = 0;
+
+ virtual sal_Int32 getDefaultNumberFormat(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _rxTypes,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const = 0;
+
+ virtual void TransferFormComponentProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
+ const ::com::sun::star::lang::Locale& _rLocale
+ ) const = 0;
+
+ virtual OUString quoteName(
+ const OUString& _rQuote,
+ const OUString& _rName
+ ) const = 0;
+
+ virtual OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const OUString& _rCatalog,
+ const OUString& _rSchema,
+ const OUString& _rName
+ ) const = 0;
+
+ virtual OUString composeTableNameForSelect(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
+ ) const = 0;
+
+ virtual ::com::sun::star::sdb::SQLContext prependContextInfo(
+ ::com::sun::star::sdbc::SQLException& _rException,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
+ const OUString& _rContextDescription,
+ const OUString& _rContextDetails
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
+ const OUString& _rsRegisteredName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& _rxContext
+ ) const = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
+ getFieldsByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) ) = 0;
+
+ virtual ::com::sun::star::uno::Sequence< OUString >
+ getFieldNamesByCommandDescriptor(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const sal_Int32 _nCommandType,
+ const OUString& _rCommand,
+ ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
+ ) SAL_THROW( ( ) ) = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
+ @param _rxCursorSet the property set
+ */
+ virtual sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
+
+ /** determines whether the given component is part of a document which is an embedded database
+ document (such as a form)
+ */
+ virtual bool isEmbeddedInDatabase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
+ ) = 0;
+
+ protected:
+ ~IDataAccessTools() {}
+ };
+
+ //================================================================
+ //= IDataAccessCharSet
+ //================================================================
+ /** simple wrapper for the <type>OCharsetMap</type>
+ */
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessCharSet :
+ public ::rtl::IReference
+ {
+ // to be extended if necessary ....
+ public:
+ /** enumerates all supported char sets
+ @return the number of charsets supported
+ */
+ virtual sal_Int32 getSupportedTextEncodings(
+ ::std::vector< rtl_TextEncoding >& /* [out] */ _rEncs
+ ) const = 0;
+
+ protected:
+ ~IDataAccessCharSet() {}
+ };
+
+ //================================================================
+ //= IDataAccessTypeConversion
+ //================================================================
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessTypeConversion :
+ public ::rtl::IReference
+ {
+ public:
+ virtual ::com::sun::star::util::Date getStandardDate() const = 0;
+
+ virtual double getValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant,
+ const ::com::sun::star::util::Date& rNullDate ) const = 0;
+
+ virtual OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::util::Date& _rNullDate,
+ sal_Int32 _nKey,
+ sal_Int16 _nKeyType) const = 0;
+
+ virtual OUString getFormattedValue(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter,
+ const ::com::sun::star::lang::Locale& _rLocale,
+ const ::com::sun::star::util::Date& _rNullDate
+ ) const = 0;
+
+ protected:
+ ~IDataAccessTypeConversion() {}
+ };
+
+ //================================================================
+ //= ISQLParseNode
+ //================================================================
+ /** a simple version of the OSQLParseNode, with all methods beeing virtual
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ISQLParseNode : public ::rtl::IReference
+ {
+ public:
+ virtual void parseNodeToStr(OUString& _rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ virtual void parseNodeToPredicateStr(OUString& _rString,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
+ const ::com::sun::star::lang::Locale& _rIntl,
+ const sal_Char _cDecSeparator,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ protected:
+ ~ISQLParseNode() {}
+ };
+
+ //================================================================
+ //= ISQLParser
+ //================================================================
+ /** a simple version of the OSQLParser, with all methods beeing virtual
+ */
+ class OOO_DLLPUBLIC_DBTOOLS ISQLParser : public ::rtl::IReference
+ {
+ public:
+ virtual ::rtl::Reference< ISQLParseNode > predicateTree(
+ OUString& rErrorMessage,
+ const OUString& rStatement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
+ ) const = 0;
+
+ virtual const IParseContext& getContext() const = 0;
+
+ protected:
+ ~ISQLParser() {}
+ };
+
+ //================================================================
+ //= IDataAccessToolsFactory
+ //================================================================
+ /** the main factory for runtime-loadable tools in the DBTOOLS library
+ */
+ class OOO_DLLPUBLIC_DBTOOLS IDataAccessToolsFactory :
+ public ::rtl::IReference
+ {
+ public:
+ /// creates a simple version of the class OSQLParser
+ virtual ::rtl::Reference< ISQLParser > createSQLParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const IParseContext* _pContext
+ ) const = 0;
+
+ /// creates a helper for charset related functionality (<type>OCharsetMap</type>)
+ virtual ::rtl::Reference< IDataAccessCharSet > createCharsetHelper( ) const = 0;
+
+ /// creates a simple version of the DBTypeConversion helper
+ virtual ::rtl::Reference< IDataAccessTypeConversion > getTypeConversionHelper() = 0;
+
+ /// creates a helper which can be used to access the static methods in dbtools.hxx
+ virtual ::rtl::Reference< IDataAccessTools > getDataAccessTools() = 0;
+
+ virtual ::std::auto_ptr< ::dbtools::FormattedColumnValue > createFormattedColumnValue(
+ const ::comphelper::ComponentContext& _rContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
+ ) = 0;
+
+ protected:
+ ~IDataAccessToolsFactory() {}
+ };
+
+ //....................................................................
+ } // namespace simple
+ //....................................................................
+
+//........................................................................
+} // namespace connectivity
+//........................................................................
+
+#endif // CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/connectivity/warningscontainer.hxx b/include/connectivity/warningscontainer.hxx
new file mode 100644
index 000000000000..5a013f9a5145
--- /dev/null
+++ b/include/connectivity/warningscontainer.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef DBTOOLS_WARNINGSCONTAINER_HXX
+#define DBTOOLS_WARNINGSCONTAINER_HXX
+
+#include <com/sun/star/sdbc/XWarningsSupplier.hpp>
+#include <com/sun/star/sdb/SQLContext.hpp>
+
+#include "connectivity/dbtoolsdllapi.hxx"
+
+//.........................................................................
+namespace dbtools
+{
+//.........................................................................
+
+ //=====================================================================
+ //= IWarningsContainer
+ //=====================================================================
+ class SAL_NO_VTABLE IWarningsContainer
+ {
+ public:
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning) = 0;
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning) = 0;
+ virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext) = 0;
+
+ protected:
+ ~IWarningsContainer() {}
+ };
+
+ //====================================================================
+ //= WarningsContainer
+ //====================================================================
+ /** helper class for implementing XWarningsSupplier, which mixes own warnings with
+ warnings obtained from an external instance
+ */
+ class OOO_DLLPUBLIC_DBTOOLS WarningsContainer : public IWarningsContainer
+ {
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier > m_xExternalWarnings;
+ ::com::sun::star::uno::Any m_aOwnWarnings;
+
+ public:
+ WarningsContainer() { }
+ WarningsContainer( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ :m_xExternalWarnings( _rxExternalWarnings )
+ {
+ }
+ virtual ~WarningsContainer();
+
+ void setExternalWarnings( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XWarningsSupplier >& _rxExternalWarnings )
+ {
+ m_xExternalWarnings = _rxExternalWarnings;
+ }
+
+ // convenience
+ /** appends an SQLWarning instance to the chain
+ @param _rWarning
+ the warning message
+ @param _pAsciiSQLState
+ the SQLState of the warning
+ @param _rxContext
+ the context of the warning
+ */
+ void appendWarning(
+ const OUString& _rWarning,
+ const sal_Char* _pAsciiSQLState,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext );
+
+ // IWarningsContainer
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLException& _rWarning);
+ virtual void appendWarning(const ::com::sun::star::sdbc::SQLWarning& _rWarning);
+ virtual void appendWarning(const ::com::sun::star::sdb::SQLContext& _rContext);
+
+ // XWarningsSupplier equivalents
+ ::com::sun::star::uno::Any SAL_CALL getWarnings( ) const;
+ void SAL_CALL clearWarnings( );
+ };
+
+//.........................................................................
+} // namespace dbtools
+//.........................................................................
+
+#endif // DBTOOLS_WARNINGSCONTAINER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/bstream.hxx b/include/cosv/bstream.hxx
new file mode 100644
index 000000000000..2d943bc02ce6
--- /dev/null
+++ b/include/cosv/bstream.hxx
@@ -0,0 +1,143 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_BSTREAM_HXX
+#define CSV_BSTREAM_HXX
+
+#include <string.h>
+#include <cosv/string.hxx>
+
+
+namespace csv
+{
+
+
+enum seek_dir
+{
+ beg = 0,
+ cur = 1,
+ end = 2
+};
+
+
+class bistream
+{
+ public:
+ // LIFECYCLE
+ virtual ~bistream() {}
+
+ // OPERATIONS
+ /// @return Number of actually read bytes.
+ uintt read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ // INQUIRY
+ /** @return True, if already one try to read had failed.
+ There is no guarantee, that it returns true, if end of data
+ is just reached.
+ Though it will return false, if there is still somemething
+ to read.
+ */
+ bool eod() const;
+
+ private:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes) = 0;
+ virtual bool inq_eod() const = 0;
+};
+
+
+class bostream
+{
+ public:
+ // LIFECYCLE
+ virtual ~bostream() {}
+
+ // OPERATIONS
+ /// @return Number of actually written bytes.
+ uintt write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ /// @return Number of actually written bytes.
+ uintt write(
+ const char * i_pSrc );
+ /// @return Number of actually written bytes.
+ uintt write(
+ const String & i_pSrc );
+ private:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes) = 0;
+};
+
+
+class bstream : public bistream,
+ public bostream
+{
+ public:
+ uintt seek(
+ intt i_nDistanceFromBegin,
+ seek_dir i_eStartPoint = ::csv::beg );
+ uintt position() const;
+
+ private:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg ) = 0;
+ virtual uintt inq_position() const = 0;
+};
+
+
+// IMPLEMENTATION
+inline uintt
+bistream::read( void * o_pDest,
+ uintt i_nNrofBytes)
+ { return do_read(o_pDest, i_nNrofBytes); }
+inline bool
+bistream::eod() const
+ { return inq_eod(); }
+
+inline uintt
+bostream::write( const void * i_pSrc,
+ uintt i_nNrofBytes)
+ { return do_write( i_pSrc, i_nNrofBytes ); }
+inline uintt
+bostream::write( const char * i_sSrc )
+ { return write( i_sSrc, strlen(i_sSrc) ); }
+inline uintt
+bostream::write( const String & i_sSrc )
+ { return write( i_sSrc.c_str(), i_sSrc.length() ); }
+
+inline uintt
+bstream::seek( intt i_nDistance,
+ seek_dir i_eStartPoint )
+ { return do_seek( i_nDistance, i_eStartPoint ); }
+inline uintt
+bstream::position() const
+ { return inq_position(); }
+
+
+
+} // namespace csv
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/comdline.hxx b/include/cosv/comdline.hxx
new file mode 100644
index 000000000000..80ebc763b9d9
--- /dev/null
+++ b/include/cosv/comdline.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_COMDLINE_HXX
+#define CSV_COMDLINE_HXX
+// KORR_DEPRECATED_3.0
+// Replace by cosv/commandline.hxx.
+
+
+namespace csv
+{
+
+class CommandLine_Ifc
+{
+ public:
+ virtual ~CommandLine_Ifc() {}
+
+ void Init(
+ int argc,
+ char * argv[] );
+ void PrintUse() const;
+ bool CheckParameters() const;
+
+ private:
+ virtual void do_Init(
+ int argc,
+ char * argv[] ) = 0;
+
+ virtual void do_PrintUse() const = 0;
+ virtual bool inq_CheckParameters() const = 0;
+};
+
+inline void
+CommandLine_Ifc::Init( int argc,
+ char * argv[] )
+ { do_Init( argc, argv ); }
+inline void
+CommandLine_Ifc::PrintUse() const
+ { do_PrintUse(); }
+
+} // namespace csv
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/comfunc.hxx b/include/cosv/comfunc.hxx
new file mode 100644
index 000000000000..a294d81f2aae
--- /dev/null
+++ b/include/cosv/comfunc.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_COMFUNC_HXX
+#define CSV_COMFUNC_HXX
+
+#include <stdlib.h>
+
+
+
+
+namespace csv
+{
+ class String;
+
+
+// min, max and range functions
+template <class E>
+inline E max(E in1, E in2);
+template <class E>
+inline E min(E in1, E in2);
+template <class E>
+inline bool in_range(E low, E val, E high); // return low <= val < high;
+
+
+// string functions
+inline const char * valid_str(const char * str);
+inline bool no_str(const char * str); // return !str || !strlen(str)
+
+
+// IMPLEMENTATION
+template <class E>
+inline E
+max(E in1, E in2) { return in1 < in2 ? in2 : in1; }
+template <class E>
+inline E
+min(E in1, E in2) { return in1 < in2 ? in1 : in2; }
+template <class E>
+inline bool
+in_range(E low, E val, E high) { return low <= val AND val < high; }
+
+inline const char *
+valid_str(const char * str) { return str != 0 ? str : ""; }
+inline bool
+no_str(const char * str) { return str != 0 ? *str == '\0' : true; }
+
+} // namespace csv
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/csv_env.hxx b/include/cosv/csv_env.hxx
new file mode 100644
index 000000000000..f49ed54ea464
--- /dev/null
+++ b/include/cosv/csv_env.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_CSV_ENV_HXX
+#define CSV_CSV_ENV_HXX
+
+
+
+//******* Include c-language-types ************//
+// size_t, wchar_t
+#include <stdlib.h>
+
+
+
+//******* Builtin types of exact length ************//
+
+// Exact length builtin types
+typedef signed char INT8;
+typedef unsigned char UINT8;
+typedef short INT16;
+typedef unsigned short UINT16;
+typedef long INT32;
+typedef unsigned long UINT32;
+typedef float REAL32;
+typedef double REAL64;
+
+
+// Additional builtin types
+typedef INT32 intt; // standard sized integer.
+typedef UINT32 uintt; // standard sized unsigned integer.
+typedef REAL64 real; // standard sized real.
+
+// Constants
+// ---------
+// Zero-pointer for use in ellipsed (...) parameter lists which expect a
+// pointer which may have another size than an int.
+// Must be a define to be used in precompiled headers:
+#define NIL ((void*)0)
+// char '\0'
+#define NULCH '\0'
+
+
+
+// Boolesche Operatoren
+#define AND &&
+#define OR ||
+#define NOT !
+
+// Macro for distinguishing dynamic allocated pointers from
+// referencing pointers
+#define DYN // Exact specification: DYN has to be used if and only if:
+ // 1. DYN specifies a class member pointer or reference variable and
+ // the class must free the referenced memory.
+ // 2. DYN specifies a pointer or reference (return-) parameter of a function
+ // and for in-parameters the function or its class
+ // must free the referenced memory, the parameter is then called
+ // a let-parameter.
+ // For out- and inout-parameters
+ // or return values the caller of the function hast to
+ // free the referenced memory.
+ //
+ // It is irrelevant who allocated the memory!
+ //
+ // DYN - variables use the prefixes "dp" or "dr" instead of "p" or "r".
+
+
+//****** Assertions ******//
+
+namespace csv
+{
+void PerformAssertion(
+ const char * condition,
+ const char * file,
+ unsigned line );
+}
+
+// Programming by contract
+#ifndef CSV_NO_ASSERTIONS
+
+#ifdef CSV_USE_CSV_ASSERTIONS
+#define csv_assert(x) ( (x) ? (void)(0) : ::csv::PerformAssertion( #x, __FILE__, __LINE__) )
+#else
+
+// Save NDEBUG state
+#ifdef NDEBUG
+#define CSV_CSV_ENV_HXX_HAD_NDEBUG
+#undef NDEBUG
+#endif
+
+#if OSL_DEBUG_LEVEL == 0
+#define NDEBUG
+#endif
+#include <assert.h>
+
+#define csv_assert(x) assert(x);
+
+// Restore NDEBUG state
+#ifdef CSV_CSV_ENV_HXX_HAD_NDEBUG
+#define NDEBUG
+#else
+#undef NDEBUG
+#endif
+
+#endif
+
+#else // #ifndef CSV_NO_ASSERTIONS else
+
+#define csv_assert(x)
+
+#endif // end ifndef CSV_NO_ASSERTIONS else
+
+
+
+/* Additional Programming Conventions
+
+1. see above at "#define DYN"
+2. function parameters get one of these prefixes:
+ - i_ := Function uses only the value, but must not change a referenced variable.
+ - o_ := Parameter is undefined until function has set it.
+ Parametere must be set by the function.
+ - io_ := Function may use and change the referenced variable.
+ - pass_ := Funktion may use and change the referenced variable and HAS TO free the
+ associated memory.
+3. Global constants get the prefix 'C_', global variables the prefix 'G_'.
+4. Static members end with an underscore '_'.
+
+*/
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/csv_ostream.hxx b/include/cosv/csv_ostream.hxx
new file mode 100644
index 000000000000..911fcb8c799e
--- /dev/null
+++ b/include/cosv/csv_ostream.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_CSV_OSTREAM_HXX
+#define CSV_CSV_OSTREAM_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+ // PARAMETERS
+
+
+
+#ifndef CSV_NO_IOSTREAMS
+
+#include <iostream>
+
+
+namespace csv
+{
+
+typedef std::ios ios;
+typedef std::ostream ostream;
+
+} // namespace csv
+
+
+#else
+
+#include <cosv/tpl/dyn.hxx>
+
+namespace csv
+{
+
+class StreamStr;
+
+class ios
+{
+ public:
+ enum seek_dir
+ {
+ beg=0,
+ cur=1,
+ end=2
+ };
+};
+
+class ostream : public ios
+{
+ public:
+ typedef ostream self;
+
+ virtual ~ostream();
+
+ self & operator<<(
+ const char * i_s );
+ self & operator<<(
+ char i_c );
+ self & operator<<(
+ unsigned char i_c );
+ self & operator<<(
+ signed char i_c );
+
+ self & operator<<(
+ short i_n );
+ self & operator<<(
+ unsigned short i_n );
+ self & operator<<(
+ int i_n );
+ self & operator<<(
+ unsigned int i_n );
+ self & operator<<(
+ long i_n );
+ self & operator<<(
+ unsigned long i_n );
+
+ self & operator<<(
+ float i_n );
+ self & operator<<(
+ double i_n );
+
+ self & seekp(
+ intt i_nOffset,
+ seek_dir i_eStart = ios::beg );
+ protected:
+ ostream(
+ uintt i_nStartSize );
+ const StreamStr & Data() const;
+
+ private:
+ Dyn<StreamStr> pData;
+};
+
+
+
+inline const StreamStr &
+ostream::Data() const
+ { return *pData; }
+
+
+} // namespace csv
+
+
+#endif
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/csv_precomp.h b/include/cosv/csv_precomp.h
new file mode 100644
index 000000000000..78f1378cda61
--- /dev/null
+++ b/include/cosv/csv_precomp.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __CSV_PRECOMP_H_06071998__
+#define __CSV_PRECOMP_H_06071998__
+
+
+
+
+#define CSV_USE_CSV_ASSERTIONS
+#include <cosv/csv_env.hxx>
+
+#include <cosv/comfunc.hxx>
+#include <cosv/string.hxx>
+#include <cosv/streamstr.hxx>
+#include <cosv/std_outp.hxx>
+#include <cosv/tpl/dyn.hxx>
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/dirchain.hxx b/include/cosv/dirchain.hxx
new file mode 100644
index 000000000000..980937212690
--- /dev/null
+++ b/include/cosv/dirchain.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_DIRCHAIN_HXX
+#define CSV_DIRCHAIN_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+#include <cosv/persist.hxx>
+#include <cosv/tpl/tpltools.hxx>
+
+
+
+namespace csv
+{
+ class bostream;
+
+namespace ploc
+{
+
+
+class DirectoryChain
+{
+ public:
+ DirectoryChain();
+ DirectoryChain(
+ const DirectoryChain &
+ i_rDC );
+ ~DirectoryChain();
+
+ // OPERATORS
+ DirectoryChain & operator=(
+ const DirectoryChain &
+ i_rDC );
+ DirectoryChain & operator+=(
+ const String & i_sName );
+ DirectoryChain & operator+=(
+ const DirectoryChain &
+ i_rDC );
+ DirectoryChain & operator-=(
+ uintt i_nLevelsUp );
+
+ // OPERATIONS
+ void Set(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ void PushBack(
+ const String & i_sName );
+ void PushBack(
+ const DirectoryChain &
+ i_sPath );
+ void PopBack(
+ uintt i_nCount = 1 );
+
+ // INQUIRY
+ uintt Size() const;
+
+ StringVector::const_iterator
+ Begin() const;
+ StringVector::const_iterator
+ End() const;
+
+ const String & Front() const;
+ const String & Back() const;
+
+ void Get(
+ bostream & o_rPath,
+ const char * i_sDelimiter ) const;
+ private:
+ StringVector aPath;
+};
+
+
+// IMPLEMENTATION
+inline
+DirectoryChain::DirectoryChain( const DirectoryChain & i_rDC )
+ { PushBack(i_rDC); }
+
+ // OPERATORS
+inline DirectoryChain &
+DirectoryChain::operator=( const DirectoryChain & i_rDC )
+ { csv::erase_container(aPath); PushBack(i_rDC); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator+=( const String & i_sName )
+ { PushBack(i_sName); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator+=( const DirectoryChain & i_rDC )
+ { PushBack(i_rDC); return *this; }
+inline DirectoryChain &
+DirectoryChain::operator-=( uintt i_nLevelsUp )
+ { PopBack(i_nLevelsUp); return *this; }
+inline uintt
+DirectoryChain::Size() const
+ { return aPath.size(); }
+
+inline StringVector::const_iterator
+DirectoryChain::Begin() const
+ { return aPath.begin(); }
+inline StringVector::const_iterator
+DirectoryChain::End() const
+ { return aPath.end(); }
+inline const String &
+DirectoryChain::Front() const
+ { return aPath.empty() ? String::Null_() : aPath.front(); }
+inline const String &
+DirectoryChain::Back() const
+ { return aPath.empty() ? String::Null_() : aPath.back(); }
+
+
+} // namespace ploc
+} // namespace csv
+
+inline csv::bostream &
+operator<<( csv::bostream & o_rOut,
+ const csv::ploc::DirectoryChain & i_rSubPath )
+{
+ i_rSubPath.Get(o_rOut, csv::ploc::Delimiter());
+ return o_rOut;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/file.hxx b/include/cosv/file.hxx
new file mode 100644
index 000000000000..86c880e73184
--- /dev/null
+++ b/include/cosv/file.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_FILE_HXX
+#define CSV_FILE_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/bstream.hxx>
+#include <cosv/openclose.hxx>
+ // COMPONENTS
+#include <stdio.h>
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/persist.hxx>
+#include <cosv/ploc.hxx>
+
+
+namespace csv
+{
+
+
+/** @task
+ File is a class representing a file.
+*/
+class File : public bstream,
+ public OpenClose,
+ public ploc::Persistent
+{
+ public:
+ // LIFECYCLE
+ File(
+ const char * i_sLocation,
+ uintt in_nMode = CFM_RW );
+ File(
+ const String & i_sLocation,
+ uintt in_nMode = CFM_RW );
+ virtual ~File();
+
+ // INQUIRY
+ uintt Mode() const;
+
+ private:
+ enum E_LastIO
+ {
+ io_none = 0,
+ io_read,
+ io_write
+ };
+
+ // Interface bistream:
+ virtual uintt do_read(
+ void * out_pDest,
+ uintt i_nNrofBytes);
+ virtual bool inq_eod() const;
+ // Interface bostream:
+ virtual uintt do_write(
+ const void * i_pSrc,
+ uintt i_nNrofBytes);
+ // Interface bstream:
+ virtual uintt do_seek(
+ intt i_nDistance,
+ seek_dir i_eStartPoint = ::csv::beg );
+ virtual uintt inq_position() const;
+ // Interface OpenClose:
+ virtual bool do_open(
+ uintt in_nOpenModeInfo );
+ virtual void do_close();
+ virtual bool inq_is_open() const;
+ // Interface Persistent:
+ virtual const ploc::Path &
+ inq_MyPath() const;
+ // DATA
+ ploc::Path aPath;
+ FILE * pStream;
+
+ uintt nMode; /// RWMode, OpenMode and ShareMode.
+ E_LastIO eLastIO;
+};
+
+
+
+// IMPLEMENTATION
+
+inline uintt
+File::Mode() const
+ { return nMode; }
+
+
+} // namespace csv
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/openclose.hxx b/include/cosv/openclose.hxx
new file mode 100644
index 000000000000..c65ce5b753e2
--- /dev/null
+++ b/include/cosv/openclose.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_OPENCLOSE_HXX
+#define CSV_OPENCLOSE_HXX
+
+
+namespace csv
+{
+
+// Open modes for storages:
+enum E_RWMode
+{
+ rwDefault = 0x0000, // Keep old settings. If there are none, set default.
+ rwRead = 0x0001, // Reads only
+ rwWrite = 0x0002, // Writes only
+ rwReadWrite = 0x0003 // Reads and writes.
+};
+
+enum E_OpenMode
+{
+ omCreateIfNecessary = 0x0000, // Creates a new file only, if file does not exist.
+ omCreateNot = 0x0010, // Open fails, if file does not exist.
+ omCreate = 0x0020 // Existing file will be deleted.
+};
+enum E_ShareMode
+{
+ shmShareNot = 0x0000, // Allow others nothing
+ shmShareRead = 0x0004, // Allow others to read
+ shmShareAll = 0x000C // Allow others to read and write
+};
+
+/** Constants for filemode combinations
+ These combinations are the only ones, guaranteed to be supported.
+*/
+const UINT32 CFM_RW = rwReadWrite;
+const UINT32 CFM_CREATE =
+ static_cast< UINT32 >(rwReadWrite) | static_cast< UINT32 >(omCreate);
+const UINT32 CFM_READ =
+ static_cast< UINT32 >(rwRead) | static_cast< UINT32 >(omCreateNot) |
+ static_cast< UINT32 >(shmShareRead);
+
+
+
+class OpenClose
+{
+ public:
+ virtual ~OpenClose() {}
+
+ bool open(
+ UINT32 in_nOpenModeInfo = 0 ); /// Combination of values of E_RWMode and E_ShareMode und E_OpenMode. 0 := Keep existing mode.
+ void close();
+
+ bool is_open() const;
+
+ private:
+ virtual bool do_open(
+ UINT32 in_nOpenModeInfo ) = 0;
+ virtual void do_close() = 0;
+ virtual bool inq_is_open() const = 0;
+};
+
+
+
+class OpenCloseGuard
+{
+ public:
+ OpenCloseGuard(
+ OpenClose & i_rOpenClose,
+ UINT32 i_nOpenModeInfo = 0 );
+ ~OpenCloseGuard();
+ operator bool() const;
+
+ private:
+ // Forbidden:
+ OpenCloseGuard(OpenCloseGuard&);
+ OpenCloseGuard & operator=(OpenCloseGuard&);
+
+ // DATA
+ OpenClose & rOpenClose;
+};
+
+
+// IMPLEMENTATION
+
+inline bool
+OpenClose::open( UINT32 i_nOpenModeInfo )
+ { return do_open(i_nOpenModeInfo); }
+inline void
+OpenClose::close()
+ { do_close(); }
+inline bool
+OpenClose::is_open() const
+ { return inq_is_open(); }
+
+inline
+OpenCloseGuard::OpenCloseGuard( OpenClose & i_rOpenClose,
+ UINT32 i_nOpenModeInfo )
+ : rOpenClose(i_rOpenClose)
+ { rOpenClose.open(i_nOpenModeInfo); }
+inline
+OpenCloseGuard::~OpenCloseGuard()
+ { if (rOpenClose.is_open()) rOpenClose.close(); }
+inline
+OpenCloseGuard::operator bool() const
+ { return rOpenClose.is_open(); }
+
+
+
+
+} // namespace csv
+
+
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/persist.hxx b/include/cosv/persist.hxx
new file mode 100644
index 000000000000..13ac4b5dab68
--- /dev/null
+++ b/include/cosv/persist.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PERSIST_HXX
+#define CSV_PERSIST_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+
+
+namespace csv
+{
+namespace ploc
+{
+
+class Path;
+
+
+inline const char *
+Delimiter()
+{
+#ifdef WNT
+ return "\\";
+#elif defined(UNX)
+ return "/";
+#else
+#error For using csv::ploc there has to be defined: WNT or UNX.
+#endif
+}
+
+
+
+class Persistent
+{
+ public:
+ virtual ~Persistent() {}
+
+ const Path & MyPath() const;
+ /// @return all paths without completing delimiter, even directories.
+ const char * StrPath() const;
+ bool Exists() const;
+
+ protected:
+ Persistent();
+ void InvalidatePath();
+
+ private:
+ virtual const Path &
+ inq_MyPath() const = 0;
+ // DATA
+ mutable StreamStr sPath;
+};
+
+
+
+// IMPLEMENTATION
+
+inline
+Persistent::Persistent()
+ : sPath(30) { }
+inline const Path &
+Persistent::MyPath() const
+ { return inq_MyPath(); }
+inline void
+Persistent::InvalidatePath()
+ { sPath.clear(); }
+
+
+
+} // namespace csv
+} // namespace ploc
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/ploc.hxx b/include/cosv/ploc.hxx
new file mode 100644
index 000000000000..81f952de5223
--- /dev/null
+++ b/include/cosv/ploc.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PLOC_HXX
+#define CSV_PLOC_HXX
+
+// USED SERVICES
+#include <cosv/string.hxx>
+#include <cosv/plocroot.hxx>
+#include <cosv/dirchain.hxx>
+#include <cosv/tpl/dyn.hxx>
+#include <cosv/csv_ostream.hxx>
+
+
+
+
+namespace csv
+{
+ class bostream;
+
+namespace ploc
+{
+ class Root;
+
+
+/** Represents a path in the file system.
+
+ The path can be relative or absolute and in Unix- or Windows-syntax.
+*/
+class Path
+{
+ public:
+
+ // LIFECYCLE
+ explicit Path(
+ const char * i_sPath = ".", /// Dirs have to be ended with a '\\ or '/'.
+ bool i_bPathIsAlwaysDir = false, /// This overrides a missing Delimiter at the end of the i_sPath, if true.
+ const char * i_sDelimiter = Delimiter() );
+ Path(
+ const Path & i_rPath );
+ ~Path();
+ // OPERATORS
+ Path & operator=(
+ const Path & i_rPath );
+ // OPERATIONS
+ void Set(
+ const char * i_sPath,
+ bool i_bPathIsAlwaysDir = false,
+ const char * i_sDelimiter = Delimiter() );
+ void SetFile( // If there is already a file, that is exchanged.
+ const String & i_sName );
+ // INQUIRY
+ const Root & RootDir() const { return *pRoot; }
+ const DirectoryChain &
+ DirChain() const { return aPath; }
+ const String & File() const { return sFile; }
+ bool IsValid() const;
+ bool IsDirectory() const { return sFile.length() == 0; }
+ bool IsFile() const { return sFile.length() > 0; }
+
+ /// Directories have a delimiter at the end, files not.
+ void Get(
+ bostream & o_rPath ) const;
+ // ACCESS
+ DirectoryChain & DirChain() { return aPath; }
+
+ private:
+ Dyn<Root> pRoot;
+ DirectoryChain aPath;
+ String sFile;
+};
+
+
+
+
+} // namespace ploc
+} // namespace csv
+
+/// Directories produce a delimiter at the end, files not.
+inline csv::bostream &
+operator<<( csv::bostream & o_rOut,
+ const csv::ploc::Path & i_rPath )
+{
+ i_rPath.Get(o_rOut);
+ return o_rOut;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/ploc_dir.hxx b/include/cosv/ploc_dir.hxx
new file mode 100644
index 000000000000..e6c8f04538f2
--- /dev/null
+++ b/include/cosv/ploc_dir.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PLOCDIR_HXX
+#define CSV_PLOCDIR_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+#include <cosv/persist.hxx>
+ // COMPONENTS
+#include <cosv/ploc.hxx>
+ // PARAMETERS
+
+namespace csv
+{
+namespace ploc
+{
+
+class DirectoryChain;
+
+enum E_Recursivity
+{
+ flat,
+ recursive
+};
+
+class Directory : public Persistent
+{
+ public:
+ // LIFECYCLE
+ Directory();
+ Directory(
+ const Path & i_rLocation );
+ Directory(
+ const char * i_rLocation );
+ Directory(
+ const Directory & i_rDir );
+ virtual ~Directory();
+
+ // OPERATORS
+ Directory & operator+=(
+ const String & i_sName );
+ Directory & operator+=(
+ const DirectoryChain &
+ i_sDirChain );
+ Directory & operator-=(
+ uintt i_nLevels );
+
+ // OPERATIONS
+ bool PhysicalCreate(
+ bool i_bCreateParentsIfNecessary = true ) const;
+
+ // INQUIRY
+ void GetContainedDirectories(
+ StringVector & o_rResult ) const;
+ /** @param i_sFilter
+ Currently only filters of the form "*.ending" or "*.*"
+ (the default) are processed correctly under UNIX. Under WNT this
+ restriction does not apply.
+ */
+ void GetContainedFiles(
+ StringVector & o_rResult,
+ const char * i_sFilter = "*.*",
+ E_Recursivity i_eRecursivity = flat ) const;
+ private:
+ // Interface Peristent:
+ virtual const Path &
+ inq_MyPath() const;
+
+ // Locals:
+ /** @return
+ true, if parent(!) directory exists or could be created.
+ false, if this is a root directory.
+ */
+ bool Check_Parent() const;
+ bool PhysicalCreate_Dir(
+ const char * i_sStr ) const;
+ // DATA
+ Path aPath;
+};
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/plocroot.hxx b/include/cosv/plocroot.hxx
new file mode 100644
index 000000000000..b079f04b1b9f
--- /dev/null
+++ b/include/cosv/plocroot.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_PLOCROOT_HXX
+#define CSV_PLOCROOT_HXX
+
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+#include <cosv/persist.hxx>
+
+
+namespace csv
+{
+
+class bostream;
+
+
+namespace ploc
+{
+
+
+class Root
+{
+ public:
+ virtual ~Root();
+
+ static DYN Root * Create_(
+ const char * & o_sPathAfterRoot,
+ const char * i_sPath,
+ const char * i_sDelimiter = Delimiter() );
+
+ virtual void Get( /// Does not add a '\0' at the end,
+ ostream & o_rPath ) const = 0;
+ virtual void Get( /// Does not add a '\0' at the end.
+ bostream & so_rPath ) const = 0;
+ virtual DYN Root * CreateCopy() const = 0;
+ virtual const char *
+ OwnDelimiter() const = 0;
+};
+
+
+
+} // namespace ploc
+} // namespace csv
+
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/std_outp.hxx b/include/cosv/std_outp.hxx
new file mode 100644
index 000000000000..08fe179e16ab
--- /dev/null
+++ b/include/cosv/std_outp.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_STD_OUTP_HXX
+#define CSV_STD_OUTP_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/csv_ostream.hxx>
+ // PARAMETERS
+
+
+
+
+namespace csv
+{
+
+#ifdef CSV_NO_IOSTREAMS
+class redirect_out : public ostream
+{
+ public:
+ virtual ~redirect_out() {}
+
+ static void set_(
+ redirect_out & o_rStdOut,
+ redirect_out & o_rStdErr )
+ { pStdOut_ = &o_rStdOut;
+ pStdErr_ = &o_rStdErr; }
+
+ static redirect_out &
+ std_() { return *pStdOut_; }
+ static redirect_out &
+ err_() { return *pStdErr_; }
+ static bool useme_() { return pStdOut_ != 0; }
+
+ private:
+ // DATA
+ static redirect_out *
+ pStdOut_;
+ static redirect_out *
+ pStdErr_;
+};
+#endif // defined(CSV_NO_IOSTREAMS)
+
+
+inline ostream &
+Cout()
+{
+
+#ifndef CSV_NO_IOSTREAMS
+// return redirect_out::useme_()
+// ? (ostream&)( redirect_out::std_() )
+// : (ostream&)( std::cout );
+ return (ostream&)( std::cout );
+#else
+ csv_assert( redirect_out::useme_() );
+ return redirect_out::std_();
+#endif
+}
+
+inline ostream &
+Cerr()
+{
+#ifndef CSV_NO_IOSTREAMS
+// return redirect_out::useme_()
+// ? (ostream&)( redirect_out::err_() )
+// : (ostream&)( std::cerr );
+ return (ostream&)( std::cerr );
+#else
+ csv_assert( redirect_out::useme_() );
+ return redirect_out::err_();
+#endif
+}
+
+
+
+typedef void (*F_FLUSHING_FUNC)(ostream&);
+
+void Endl( ostream& );
+
+void Flush( ostream& );
+
+
+} // namespace csv
+
+
+
+inline csv::ostream &
+operator<<( csv::ostream & io_rStream,
+ csv::F_FLUSHING_FUNC i_fFlushingFunc )
+{
+#ifndef CSV_NO_IOSTREAMS
+// (*i_fFlushingFunc)( io_rStream, csv::redirect_out::useme_(), 0 );
+ (*i_fFlushingFunc)( io_rStream );
+#else
+ csv_assert( csv::redirect_out::useme_() );
+ (*i_fFlushingFunc)( io_rStream, true, 0 );
+#endif
+ return io_rStream;
+}
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/str_types.hxx b/include/cosv/str_types.hxx
new file mode 100644
index 000000000000..ecf9c997c271
--- /dev/null
+++ b/include/cosv/str_types.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COSV_STR_TYPES_HXX
+#define COSV_STR_TYPES_HXX
+
+
+namespace csv
+{
+
+/** Provides some generally used constants.
+*/
+struct str
+{
+ public:
+ typedef ::size_t position;
+ typedef ::size_t size;
+
+ static const position npos = -1;
+ static const size maxsize = -1;
+
+ enum insert_mode
+ {
+ overwrite = 0,
+ insert = 1
+ };
+};
+
+
+/** Is used for string comparisons.
+
+ @collab String
+ @collab various csv::compare(...) functions
+*/
+class CharOrder_Table
+{
+ public:
+ /** @precond
+ Parameter i_pCharWeightsArray
+ must have size of 256.
+ */
+ CharOrder_Table(
+ const int * i_pCharWeightsArray );
+
+ /** @return the weight of the char i_c.
+ @precond
+ Even with unusual implementations, where char has more than 8 bit,
+ there must be true: 0 <= i_c < 256.
+ */
+ int operator()(
+ char i_c ) const;
+ private:
+ int cWeights[256];
+};
+
+
+// IMPLEMENTATION
+
+inline int
+CharOrder_Table::operator()( char i_c ) const
+ { return cWeights[ UINT8(i_c) ]; }
+
+
+
+} // namespace csv
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/streamstr.hxx b/include/cosv/streamstr.hxx
new file mode 100644
index 000000000000..ec13f8ec63c6
--- /dev/null
+++ b/include/cosv/streamstr.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_STREAMSTR_HXX
+#define CSV_STREAMSTR_HXX
+
+#include "sal/config.h"
+
+#include "sal/types.h"
+
+// BASE CLASSES
+#include <cosv/bstream.hxx>
+// USED SERVICES
+#include <cosv/str_types.hxx>
+#include <string.h>
+
+
+
+
+namespace csv
+{
+ class String;
+
+
+void c_str(); // Dummy needed for StreamStr::operator<<(StreamStr::F_CSTR);
+
+
+/** A string buffer class for all kinds of string manipulation.
+*/
+class StreamStr : public bostream
+{
+ public:
+ typedef StreamStr self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+ typedef intt seek_type;
+ typedef str::insert_mode insert_mode;
+
+ typedef const char * const_iterator;
+ typedef char * iterator;
+
+ typedef void (*F_CSTR)();
+
+
+ /** Represents an area within a string.
+ */
+ struct Area
+ {
+ typedef str::size size_type;
+
+ Area(
+ const char * i_str = "",
+ size_type i_nLength = str::maxsize )
+ : sStr(i_str),
+ nLength( i_nLength == str::maxsize
+ ? strlen(i_str)
+ : i_nLength ) {}
+ const char * sStr;
+ size_type nLength;
+ };
+
+ // LIFECYCLE
+ StreamStr(
+ size_type i_nCapacity );
+ /// Copies also insert_mode and current position.
+ StreamStr(
+ const self & i_rOther );
+ ~StreamStr();
+
+ // OPERATORS
+ /// Copies also insert_mode and current position.
+ self & operator=(
+ const self & i_rOther );
+
+ self & operator<<(
+ const char * i_s );
+ self & operator<<(
+ const String & i_s );
+ self & operator<<(
+ char i_c );
+ self & operator<<(
+ unsigned char i_c );
+ self & operator<<(
+ signed char i_c );
+
+ self & operator<<(
+ short i_n );
+ self & operator<<(
+ unsigned short i_n );
+ self & operator<<(
+ int i_n );
+ self & operator<<(
+ unsigned int i_n );
+ self & operator<<(
+ long i_n );
+ self & operator<<(
+ unsigned long i_n );
+
+ self & operator<<(
+ float i_n );
+ self & operator<<(
+ double i_n );
+
+ /** This operator is used to finish a sequence of streaming
+ oeprators by returning the c-string of the complete string.
+
+ @return The same as ->c_str().
+
+ @example
+ csv::StreamStr s(100);
+ const char *
+ fullname = s << qualifier() << "::" << name() << csv::c_str;
+ */
+ const char * operator<<(
+ F_CSTR i_f );
+
+ const char & operator[](
+ position_type i_nPosition ) const;
+ char & operator[](
+ position_type i_nPosition );
+
+ // OPERATIONS
+ void resize(
+ size_type i_nMinimumCapacity );
+
+ void clear();
+
+ /** Sets start point for the next operator<<() call.
+ if the intended position is not reachable, nothing happens.
+ */
+ self & seekp(
+ seek_type i_nCount,
+ seek_dir i_eDirection = ::csv::beg );
+ self & reset() { return seekp(0); }
+ /** Sets the insertion mode of all and only the operator<<() calls.
+
+ Default is str::overwrite:
+ str::overwrite: seekp() always sets the cur end of the string.
+ operator<<() calls push the end of the string forward.
+ str::insert: seekp() only sets the insertion point.
+ operator<<() calls insert their text at the tellp()
+ position and keep the rest of the string. tellp() is
+ then after the inserted text, on the beginning of the
+ rest of the string.
+ */
+ self & set_insert_mode(
+ insert_mode i_eMode );
+
+ void pop_front(
+ size_type i_nCount );
+ void pop_back(
+ size_type i_nCount );
+
+ /// Works like operator<<(). Does the same as Perl's join().
+ self & operator_join(
+ std::vector<String>::const_iterator
+ i_rBegin,
+ std::vector<String>::const_iterator
+ i_rEnd,
+ const char * i_sLink );
+ /// Works like operator<<()
+ self & operator_add_substr(
+ const char * i_sText,
+ size_type i_nLength );
+ /// Works like operator<<()
+ self & operator_add_token(
+ const char * i_sText,
+ char i_cDelimiter );
+ /// Works like operator<<()
+ self & operator_read_line(
+ bstream & i_src );
+
+ void strip_front_whitespace(); /// removes space, tab and crlf.
+ void strip_back_whitespace();
+ void strip_frontback_whitespace();
+
+ void replace_all(
+ char i_cCarToSearch,
+ char i_cReplacement );
+
+ // INQUIRY
+ const char * c_str() const;
+ const char * data() const;
+
+ bool empty() const;
+ size_type size() const;
+ size_type length() const;
+
+ size_type capacity() const;
+
+ position_type tellp() const;
+
+ const_iterator begin() const;
+ const_iterator cur() const;
+ const_iterator end() const;
+
+ // ACCESS
+ iterator begin();
+ iterator cur();
+ iterator end();
+
+ private:
+ // Interface bostream
+ virtual UINT32 do_write(
+ const void * i_pSrc,
+ UINT32 i_nNrofBytes);
+ // Locals
+ void ProvideAddingSize(
+ size_type i_nSize2Add );
+ /// Resizes with the factor 2.0 (under 128), 1.5 or until i_nMinimumCapacity, whatever is bigger.
+ void Resize(
+ size_type i_nMinimumCapacity = 0 );
+ void Advance(
+ size_type i_nAddedSize );
+ void MoveData(
+ char * i_pStart,
+ char * i_pEnd,
+ seek_type i_nDiff );
+ // DATA
+ size_type nCapacity1; /// Capacity of characters to contain + 1 for terminating 0.
+ DYN char * dpData;
+ char * pEnd;
+ char * pCur;
+ insert_mode eMode;
+};
+
+
+
+class StreamStrLock
+{
+ public:
+ StreamStrLock(
+ uintt i_nMinimalSize );
+ ~StreamStrLock();
+
+ StreamStr & operator()() { return *pStr; }
+
+ private:
+ StreamStr * pStr;
+};
+
+// IMPLEMENTATION
+
+inline const char *
+StreamStr::operator<<( SAL_UNUSED_PARAMETER F_CSTR )
+ { return dpData; }
+inline void
+StreamStr::clear()
+ { pEnd = pCur = dpData; *pEnd = '\0'; }
+inline const char *
+StreamStr::c_str() const
+ { return dpData; }
+inline const char *
+StreamStr::data() const
+ { return dpData; }
+inline bool
+StreamStr::empty() const
+ { return dpData == pEnd; }
+inline StreamStr::size_type
+StreamStr::size() const
+ { return pEnd - dpData; }
+inline StreamStr::size_type
+StreamStr::length() const
+ { return size(); }
+inline StreamStr::size_type
+StreamStr::capacity() const
+ { return nCapacity1-1; }
+inline StreamStr::position_type
+StreamStr::tellp() const
+ { return size_type(pCur-dpData); }
+inline StreamStr::const_iterator
+StreamStr::begin() const
+ { return dpData; }
+inline StreamStr::const_iterator
+StreamStr::cur() const
+ { return pCur; }
+inline StreamStr::const_iterator
+StreamStr::end() const
+ { return pEnd; }
+inline StreamStr::iterator
+StreamStr::begin()
+ { return dpData; }
+inline StreamStr::iterator
+StreamStr::cur()
+ { return pCur; }
+inline StreamStr::iterator
+StreamStr::end()
+ { return pEnd; }
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/string.hxx b/include/cosv/string.hxx
new file mode 100644
index 000000000000..756aa9a1492c
--- /dev/null
+++ b/include/cosv/string.hxx
@@ -0,0 +1,501 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COSV_STRING_HXX
+#define COSV_STRING_HXX
+
+// USED SERVICES
+#include <string.h>
+#include <cosv/stringdata.hxx>
+#include <cosv/str_types.hxx>
+#include <cosv/csv_ostream.hxx>
+#include <vector>
+
+
+
+
+namespace csv
+{
+
+
+/** The Simple String:
+ It is used to just hold short to middle long texts as
+ data, which are constant at most times. They are reference
+ counted, so they are space efficient and have constant time
+ copy semantics.
+
+ For all compare() functions the return value is like in strcmp().
+
+ @attention
+ The present version of this class is NOT thread safe.
+*/
+
+
+class String
+{
+ public:
+ typedef String self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+
+ typedef const char * const_iterator;
+
+ // LIFECYCLE
+ String();
+
+ /// Intentionally not explicit, smooth casting is intended.
+ String(
+ const char * i_str );
+ /// @precond i_nLength <= strlen(i_str) or i_nLength == str::maxsize.
+ String(
+ const char * i_str,
+ size_type i_nLength );
+
+ /** @precond i_itBegin and i_itEnd are in the same valid
+ memory-area, such that zero to finite times repetition of
+ ++i_itBegin leads to i_itBegin == i_itEnd.
+ */
+ String(
+ const_iterator i_itBegin,
+ const_iterator i_itEnd );
+
+ String(
+ const self & i_rStr );
+
+ ~String();
+ // OPERATORS
+ self & operator=(
+ const self & i_rStr );
+ self & operator=(
+ const char * i_str );
+
+ operator const char * () const;
+
+ bool operator==(
+ const self & i_rStr ) const;
+ bool operator!=(
+ const self & i_rStr ) const;
+ bool operator<(
+ const self & i_rStr ) const;
+ bool operator>(
+ const self & i_rStr ) const;
+ bool operator<=(
+ const self & i_rStr ) const;
+ bool operator>=(
+ const self & i_rStr ) const;
+
+ // OPERATIONS
+ void clear();
+
+ /// @precond i_nLength == str::maxsize OR i_nLength < strlen(i_str) .
+ void assign(
+ const char * i_str,
+ size_type i_nLength );
+ /// Create a string consisting of a sequence of i_nCount times the same char.
+ void assign(
+ size_type i_nCount,
+ char i_c );
+
+ // INQUIRY
+ const char * c_str() const;
+ const char * data() const;
+
+ bool empty() const;
+ size_type size() const;
+ size_type length() const;
+
+ const char & char_at(
+ position_type i_nPosition ) const;
+
+ const_iterator begin() const;
+
+ /// This is inefficient, so shouldn't be used within loops.
+ const_iterator end() const;
+
+ int compare(
+ const self & i_rStr ) const;
+ int compare(
+ const CharOrder_Table &
+ i_rOrder,
+ const self & i_rStr ) const;
+
+//*********** Not yet implemented *********************//
+ position_type rfind(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+ position_type rfind(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+
+ position_type find_first_not_of(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+ position_type find_first_not_of(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = 0 ) const;
+
+ position_type find_last_not_of(
+ const char * i_strToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+ position_type find_last_not_of(
+ char i_charToSearch,
+ position_type i_nSearchStartPosition = str::npos ) const;
+//*********** end - not yet implemented *****************//
+
+ static const self & Null_();
+ static const char & Nulch_();
+
+ private:
+ struct S_Data
+ {
+ S_Data();
+ /// @precond i_nValidLength <= strlen(i_sData) or i_nValidLength == str::maxsize.
+ explicit S_Data(
+ const char * i_sData,
+ size_type i_nValidLength = str::maxsize );
+ ~S_Data();
+
+ const S_Data * Acquire() const;
+
+ /// Deletes this, if nCount becomes 0.
+ void Release() const;
+
+ StringData<char> aStr;
+ mutable UINT32 nCount;
+
+ private:
+ // Forbidden functions, because this is a refcounted structure.
+ S_Data(const S_Data&);
+ S_Data & operator=(const S_Data&);
+ };
+
+ // Locals
+ const StringData<char> &
+ Str() const;
+
+ // DATA
+ const S_Data * pd;
+};
+
+
+//********** Global compare functions ***************//
+
+ //*** Natural order, no substrings
+
+inline int compare(
+ const String & i_s1,
+ const String & i_s2 );
+inline int compare(
+ const String & i_s1,
+ const char * i_s2 );
+inline int compare(
+ const char * i_s1,
+ const String & i_s2 );
+inline int compare(
+ const char * i_s1,
+ const char * i_s2 );
+
+ //*** Natural order, substrings
+
+int compare(
+ const String & i_s1,
+ csv::str::position i_nStartPosition1,
+ const char * i_s2,
+ csv::str::size i_nLength );
+inline int compare(
+ const char * i_s1,
+ const char * i_s2,
+ csv::str::size i_nLength );
+
+ //*** Defined order, no substrings
+
+inline int compare(
+ const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ const char * i_s2 );
+inline int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2 );
+int compare(
+ const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const char * i_s2 );
+} // namespace csv
+
+
+
+
+//****************** global comparation operators *********************//
+
+inline bool operator==(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator!=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator<(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator>(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator<=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+inline bool operator>=(
+ const csv::String & i_s1,
+ const char * i_s2 );
+
+inline bool operator==(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator!=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator<(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator>(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator<=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+inline bool operator>=(
+ const char * i_s1,
+ const csv::String & i_s2 );
+
+
+//****************** global stream operators *********************//
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::String & i_rSrc );
+
+
+
+
+// IMPLEMENTATION
+namespace csv
+{
+
+
+inline const StringData<char> &
+String::Str() const
+{ return pd->aStr; }
+
+
+inline const char &
+String::char_at( position_type i_nPosition ) const
+{ if ( i_nPosition < Str().Size() )
+ return Str().Data()[i_nPosition];
+ return Nulch_();
+}
+
+inline bool
+String::operator==( const self & i_rStr ) const
+{ return compare(i_rStr) == 0; }
+
+inline bool
+String::operator!=( const self & i_rStr ) const
+{ return compare(i_rStr) != 0; }
+
+inline bool
+String::operator<( const self & i_rStr ) const
+{ return compare(i_rStr) < 0; }
+
+inline bool
+String::operator>( const self & i_rStr ) const
+{ return compare(i_rStr) > 0; }
+
+inline bool
+String::operator<=( const self & i_rStr ) const
+{ return compare(i_rStr) <= 0; }
+
+inline bool
+String::operator>=( const self & i_rStr ) const
+{ return compare(i_rStr) >= 0; }
+
+inline void
+String::clear()
+{ operator=( String::Null_() ); }
+
+inline const char *
+String::c_str() const
+{ return Str().Data(); }
+
+inline
+String::operator const char * () const
+{ return c_str(); }
+
+inline const char *
+String::data() const
+{ return c_str(); }
+
+inline String::size_type
+String::size() const
+{ return Str().Size(); }
+
+inline bool
+String::empty() const
+{ return size() == 0; }
+
+inline String::size_type
+String::length() const
+{ return size(); }
+
+inline String::const_iterator
+String::begin() const
+{ return data(); }
+
+inline String::const_iterator
+String::end() const
+{ return data() + size(); }
+
+
+
+//****************** global compare-functions ********************//
+inline int
+compare( const String & i_s1,
+ const String & i_s2 )
+{ return i_s1.compare(i_s2); }
+
+inline int
+compare( const String & i_s1,
+ const char * i_s2 )
+{ return strcmp(i_s1.c_str(), i_s2); }
+
+inline int
+compare( const char * i_s1,
+ const String & i_s2 )
+{ return strcmp(i_s1, i_s2.c_str()); }
+
+inline int
+compare( const char * i_s1,
+ const char * i_s2 )
+{ return strcmp(i_s1, i_s2); }
+
+inline int
+compare( const char * i_s1,
+ const char * i_s2,
+ str::size i_nLength )
+{ return strncmp( i_s1, i_s2, i_nLength ); }
+
+inline int
+compare( const CharOrder_Table & i_rOrder,
+ const String & i_s1,
+ const char * i_s2 )
+{ return compare( i_rOrder, i_s1.c_str(), i_s2 ); }
+
+inline int
+compare( const CharOrder_Table & i_rOrder,
+ const char * i_s1,
+ const String & i_s2 )
+{ return compare( i_rOrder, i_s1, i_s2.c_str() ); }
+
+
+} // namespace csv
+
+
+inline bool
+operator==( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) == 0; }
+
+inline bool
+operator!=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) != 0; }
+
+inline bool
+operator<( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) < 0; }
+
+inline bool
+operator>( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) > 0; }
+
+inline bool
+operator<=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) <= 0; }
+
+inline bool
+operator>=( const csv::String & i_s1,
+ const char * i_s2 )
+{ return csv::compare( i_s1, i_s2 ) >= 0; }
+
+
+inline bool
+operator==( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) == 0; }
+
+inline bool
+operator!=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) != 0; }
+
+inline bool
+operator<( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) < 0; }
+
+inline bool
+operator>( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) > 0; }
+
+inline bool
+operator<=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) <= 0; }
+
+inline bool
+operator>=( const char * i_s1,
+ const csv::String & i_s2 )
+{ return csv::compare( i_s1, i_s2 ) >= 0; }
+
+
+ //************ global stream operators **************//
+
+
+inline csv::ostream &
+operator<<( csv::ostream & o_rOut,
+ const csv::String & i_rSrc )
+ { o_rOut << i_rSrc.c_str(); return o_rOut; }
+
+
+//****************** typedefs *********************//
+
+namespace csv
+{
+
+typedef std::vector<String> StringVector;
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/stringdata.hxx b/include/cosv/stringdata.hxx
new file mode 100644
index 000000000000..0187cb4265a9
--- /dev/null
+++ b/include/cosv/stringdata.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef COSV_STRINGDATA_HXX
+#define COSV_STRINGDATA_HXX
+
+
+#include <cosv/str_types.hxx>
+
+
+
+namespace csv
+{
+
+/** @tpl CHAR
+ The expression CHAR(0) has to be valid.
+*/
+template <class CHAR>
+class StringData
+{
+ public:
+ typedef StringData self;
+
+ typedef str::size size_type;
+ typedef str::position position_type;
+
+ // LIFECYCLE
+ StringData();
+ /** @precond i_pData != 0
+ @precond i_nValidLength <= strlen(i_pData)
+ */
+ StringData(
+ const CHAR * i_pData,
+ size_type i_nValidLength );
+ ~StringData();
+ // OPERATORS
+
+ // OPERATIONS
+
+ // INQUIRY
+ const CHAR * Data() const;
+
+ /** @returns the allocated number of CHAR.
+ This may be different from the number of bytes.
+ There is actually allocated one more CHAR,
+ which is guaranteed to be CHAR(0) in all circumstances.
+ */
+ size_type Size() const;
+
+ private:
+ /* Because this is used only within a refcounted structure,
+ these functions are forbidden - at least yet.
+ */
+ StringData(const self&);
+ self & operator=(const self&);
+
+ // DATA
+ DYN CHAR * dpData;
+ size_type nSize; /// The allocated size - 1 (for the finishing 0).
+};
+
+
+
+// IMPLEMENTATION
+
+template <class CHAR>
+StringData<CHAR>::StringData()
+ : dpData( new CHAR[1] ),
+ nSize(0)
+{
+ *dpData = CHAR(0);
+}
+
+template <class CHAR>
+StringData<CHAR>::StringData( const CHAR * i_pData,
+ size_type i_nValidLength )
+ : dpData( new CHAR[i_nValidLength + 1] ),
+ nSize(i_nValidLength)
+{
+ memcpy( dpData, i_pData, i_nValidLength * sizeof(CHAR) );
+ dpData[nSize] = CHAR(0);
+}
+
+template <class CHAR>
+StringData<CHAR>::~StringData()
+{
+ delete [] dpData;
+}
+
+template <class CHAR>
+const CHAR *
+StringData<CHAR>::Data() const
+{
+ return dpData;
+}
+
+template <class CHAR>
+typename StringData<CHAR>::size_type
+StringData<CHAR>::Size() const
+{
+ return nSize;
+}
+
+
+
+} // namespace csv
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/dyn.hxx b/include/cosv/tpl/dyn.hxx
new file mode 100644
index 000000000000..46095c6c3b7c
--- /dev/null
+++ b/include/cosv/tpl/dyn.hxx
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_DYN_HXX
+#define CSV_DYN_HXX
+
+
+
+
+namespace csv
+{
+
+
+/** Dyn owns an object on the heap, which will be automatically
+ deleted in its D'tor.
+
+ Dyn's main purpose is for class members on the heap:
+ You can't forget to delete them in the D'tor. Constness will be transfered
+ to the hold object.
+
+ Dyn forbids the CopyC'tor and operator=(). So you can't incidentally
+ run into problems with compiler defined CopyC'tor or operator=() of the
+ owning class. If you need those, you have to define them explicitly - as
+ you should do anyway with all classes, that own members on the heap.
+
+ Dyn also works with incomplete types.
+ You only need to write
+ class DX;
+ but needn't include #include <DX>.hxx.
+ This is a difference to std::auto_ptr, where it is not absolutely clear
+ if it is allowed to use it with incomplete types.
+
+ You can also use Dyn within function bodies, to make them exception safe.
+
+ @attention
+ If you use Dyn with an incomplete type, the owning class needs to
+ define a non-inline D'tor. Else the compiler will complain.
+*/
+template <class DX>
+class Dyn
+{
+ public:
+ // LIFECYCLE
+ /// From now on, let_dpObject is owned by this Dyn-object.
+ explicit Dyn(
+ DX * let_dpObject = 0);
+ ~Dyn();
+ // OPERATORS
+ /** This deletes a prevoiusly existing dpObject!
+ From now on, let_dpObject is owned by this Dyn-object.
+ */
+ Dyn<DX> & operator=(
+ DX * let_dpObject);
+ /// @return true, if any valid object is hold, false else.
+ operator bool() const;
+
+ const DX * operator->() const;
+ DX * operator->();
+
+ const DX & operator*() const;
+ DX & operator*();
+
+ // OPERATIONS
+ /** @return The hold object on the heap.
+
+ @ATTENTION
+ The caller of the function is responsible to delete
+ the returned object
+
+ @postcond
+ this->dpObject == 0.
+ */
+ DX * Release();
+
+ // INQUIRY
+ /// Shorthand for operator->(), if implicit overloading of -> can not be used.
+ const DX * Ptr() const;
+
+ // ACCESS
+ /// Shorthand for operator->(), if implicit overloading of -> can not be used.
+ DX * Ptr();
+ /// So const objects can return mutable pointers to the owned object.
+ DX * MutablePtr() const;
+
+ private:
+ /* Does NOT set dpObject to zero! Because it is only used
+ internally in situations where dpObject is set immediately
+ after.
+ */
+ void Delete();
+
+ /** Forbidden function!
+ -------------------
+ Help ensure, that classes with
+ dynamic pointers use a selfdefined copy constructor
+ and operator=(). If the default versions of these
+ functions are used, the compiler will throw an error.
+ **/
+ Dyn( const Dyn<DX> & );
+ /** Forbidden function!
+ -------------------
+ Help ensure, that classes with
+ dynamic pointers use a selfdefined copy constructor
+ and operator=(). If the default versions of these
+ functions are used, the compiler will throw an error.
+ **/
+ Dyn<DX> & operator=( const Dyn<DX> & );
+
+ // DATA
+ /// An owned heap object. Needs to be deleted by this class.
+ DX * dpObject;
+};
+
+
+
+
+// IMPLEMENTATION
+template <class DX>
+void
+Dyn<DX>::Delete()
+{
+ if (dpObject != 0)
+ delete dpObject;
+}
+
+template <class DX>
+inline
+Dyn<DX>::Dyn( DX * let_dpObject )
+ : dpObject(let_dpObject) {}
+
+template <class DX>
+inline
+Dyn<DX>::~Dyn()
+{ Delete(); }
+
+
+template <class DX>
+inline Dyn<DX> &
+Dyn<DX>::operator=( DX * let_dpObject )
+{
+ if ( dpObject == let_dpObject )
+ return *this;
+
+ Delete();
+ dpObject = let_dpObject;
+ return *this;
+}
+
+template <class DX>
+inline
+Dyn<DX>::operator bool() const
+{ return dpObject != 0; }
+
+template <class DX>
+inline
+const DX *
+Dyn<DX>::operator->() const
+{ return dpObject; }
+
+template <class DX>
+inline DX *
+Dyn<DX>::operator->()
+{ return dpObject; }
+
+template <class DX>
+inline const DX &
+Dyn<DX>::operator*() const
+{ csv_assert(dpObject != 0);
+ return *dpObject;
+}
+
+template <class DX>
+inline DX &
+Dyn<DX>::operator*()
+{ csv_assert(dpObject != 0);
+ return *dpObject;
+}
+
+template <class DX>
+inline DX *
+Dyn<DX>::Release()
+{ DX * ret = dpObject;
+ dpObject = 0;
+ return ret;
+}
+
+template <class DX>
+inline const DX *
+Dyn<DX>::Ptr() const
+{ return dpObject; }
+
+template <class DX>
+inline DX *
+Dyn<DX>::Ptr()
+{ return dpObject; }
+
+template <class DX>
+inline DX *
+Dyn<DX>::MutablePtr() const
+{ return dpObject; }
+
+} // namespace csv
+
+
+
+
+#ifndef CSV_HIDE_DYN
+#define Dyn ::csv::Dyn
+#endif
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/processor.hxx b/include/cosv/tpl/processor.hxx
new file mode 100644
index 000000000000..a685acd5bed6
--- /dev/null
+++ b/include/cosv/tpl/processor.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_TPL_PROCESSOR_HXX
+#define CSV_TPL_PROCESSOR_HXX
+
+// USED SERVICES
+
+
+
+
+namespace csv
+{
+
+
+/** Implements an acyclic visitor pattern. This is the abstract
+ base for the classes doing the work (the "visitors").
+*/
+class ProcessorIfc
+{
+ public:
+ virtual ~ProcessorIfc() {}
+};
+
+
+
+/** Implements an acyclic visitor pattern. This is the abstract
+ base for the classes to be processed (the "visitables").
+*/
+class ConstProcessorClient
+{
+ public:
+ virtual ~ConstProcessorClient() {}
+
+ void Accept(
+ ProcessorIfc & io_processor ) const
+ { do_Accept(io_processor); }
+ private:
+ virtual void do_Accept(
+ ProcessorIfc & io_processor ) const = 0;
+};
+
+
+/** Typed base for "visitor" classes, leaving the visited
+ object const.
+
+ @see ProcessorIfc
+ @see Processor<>
+*/
+template <typename X, typename R = void>
+class ConstProcessor
+{
+ public:
+ virtual ~ConstProcessor() {}
+
+ R Process(
+ const X & i_object )
+ { return do_Process(i_object ); }
+ private:
+ virtual R do_Process(
+ const X & i_object ) = 0;
+};
+
+
+/** Typed base for "visitor" classes which may change the visited
+ object.
+
+ @see ProcessorIfc
+ @see ConstProcessor<>
+*/
+template <typename X, typename R = void>
+class Processor
+{
+ public:
+ virtual ~Processor() {}
+
+ R Process(
+ X & i_object )
+ { return do_Process(i_object ); }
+ private:
+ virtual R do_Process(
+ X & i_object ) = 0;
+};
+
+
+template <class C>
+inline void
+CheckedCall( ProcessorIfc & io_processor,
+ const C & i_client )
+{
+ ConstProcessor<C> *
+ pProcessor = dynamic_cast< csv::ConstProcessor<C> * >
+ (&io_processor);
+ if (pProcessor != 0)
+ pProcessor->Process(i_client);
+}
+
+template <class C>
+inline void
+CheckedCall( ProcessorIfc & io_processor,
+ C & io_client )
+{
+ Processor<C> *
+ pProcessor = dynamic_cast< csv::Processor<C> * >
+ (&io_processor);
+ if (pProcessor != 0)
+ pProcessor->Process(io_client);
+}
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/swelist.hxx b/include/cosv/tpl/swelist.hxx
new file mode 100644
index 000000000000..5c64efc29cc2
--- /dev/null
+++ b/include/cosv/tpl/swelist.hxx
@@ -0,0 +1,362 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_SWELIST_HXX
+#define CSV_SWELIST_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+ // PARAMETERS
+#include <cosv/tpl/dyn.hxx>
+
+
+namespace csv
+{
+
+
+template <class XX>
+class SweListElement
+{
+ public:
+ typedef SweListElement<XX> self;
+
+ SweListElement(
+ const XX & in_aObj )
+ : aObj(in_aObj), pNext(0) {}
+
+ const XX & Obj() const { return aObj; }
+ XX & Obj() { return aObj; }
+ self * Next() const { return pNext; }
+
+ void SetNext(
+ self * i_pNext )
+ { pNext = i_pNext; }
+ private:
+ XX aObj;
+ self * pNext;
+};
+
+
+
+template <class XX> class SweListIterator;
+template <class XX> class SweListCIterator;
+
+
+template <class XX>
+class SweList
+{
+ public:
+ // TYPES
+ typedef SweList<XX> self;
+ typedef XX value_type;
+ typedef SweListIterator<XX> iterator;
+ typedef SweListCIterator<XX> const_iterator;
+ private:
+ typedef SweListElement<XX> elem;
+
+ public:
+ // LIFECYCLE
+ SweList() : pTop(0), pTail(0) {}
+ ~SweList() { erase_all(); }
+ // OPERATIONS
+ void push_front(
+ const XX & i_aObj );
+ void pop_front();
+ void push_back(
+ const XX & i_aObj );
+ void erase_all();
+
+ // INQUIRY
+ const_iterator begin() const { return pTop; }
+ iterator begin() { return pTop; }
+ const_iterator end() const { return (elem*)0; }
+ iterator end() { return (elem*)0; }
+ const XX & front() const { return pTop->Obj(); }
+ XX & front() { return pTop->Obj(); }
+ const XX & back() const { return pTail->Obj(); }
+ XX & back() { return pTail->Obj(); }
+
+ bool empty() const { return pTop == 0; }
+ uintt size() const;
+
+
+ private:
+ // Forbiddden methods.
+ SweList(
+ const self & i_rList );
+ self & operator=(
+ const self & i_rList );
+
+ // DATA
+ DYN elem * pTop;
+ elem * pTail;
+};
+
+template <class XX>
+class SweList_dyn
+{
+ public:
+ // TYPES
+ typedef SweList_dyn<XX> self;
+ typedef SweListElement< XX* > elem;
+ typedef SweListIterator< XX* > iterator;
+
+ // LIFECYCLE
+ SweList_dyn() : pTop(0), pTail(0) {}
+ ~SweList_dyn() { erase_all(); }
+ // OPERATIONS
+ void push_front(
+ XX * i_pObj );
+ void push_back(
+ XX * i_pObj );
+ void pop_front();
+ void erase_all();
+
+ // INQUIRY
+ iterator begin() const { return pTop; }
+ iterator end() const { return (elem*)0; }
+ XX * front() const { return pTop->Obj(); }
+ XX * back() const { return pTail->Obj(); }
+
+ bool empty() const { return pTop == 0; }
+ uintt size() const;
+
+ private:
+ // Forbiddden methods.
+ SweList_dyn(
+ const self & i_rList );
+ self & operator=(
+ const self & i_rList );
+
+ DYN elem * pTop;
+ elem * pTail;
+};
+
+
+
+
+template<class XX>
+class SweListIterator
+{
+ public:
+ typedef SweListIterator<XX> self;
+ typedef SweListElement<XX> elem;
+
+ SweListIterator(
+ elem * i_pElem = 0)
+ : pElem(i_pElem) { }
+
+ // OPERATORS
+ XX & operator*() const { return pElem->Obj(); }
+ self & operator++() { if (pElem != 0) pElem = pElem->Next();
+ return *this; }
+ bool operator==(
+ const self & i_rIter ) const
+ { return pElem == i_rIter.pElem; }
+ bool operator!=(
+ const self & i_rIter ) const
+ { return pElem != i_rIter.pElem; }
+ private:
+ friend class SweListCIterator<XX>;
+
+ elem * pElem;
+};
+
+template<class XX>
+class SweListCIterator
+{
+ public:
+ typedef SweListCIterator<XX> self;
+ typedef SweListElement<XX> elem;
+
+ SweListCIterator(
+ const elem * i_pElem = 0)
+ : pElem(i_pElem) { }
+
+ // OPERATORS
+ self & operator=(
+ const SweListIterator<XX> &
+ i_rIter )
+ { pElem = i_rIter.pElem; return *this; }
+
+ const XX & operator*() const { return pElem->Obj(); }
+ self & operator++() { if (pElem != 0) pElem = pElem->Next();
+ return *this; }
+ bool operator==(
+ const self & i_rIter ) const
+ { return pElem == i_rIter.pElem; }
+ bool operator!=(
+ const self & i_rIter ) const
+ { return pElem != i_rIter.pElem; }
+ private:
+ const elem * pElem;
+};
+
+// IMPLEMENTATION
+
+template <class XX>
+void
+SweList<XX>::push_front( const XX & i_aObj )
+{
+ DYN elem * dpNew = new elem(i_aObj);
+ dpNew->SetNext(pTop);
+ pTop = dpNew;
+ if (pTail == 0)
+ pTail = pTop;
+}
+
+template <class XX>
+void
+SweList<XX>::push_back( const XX & i_aObj)
+{
+ if (pTail != 0)
+ {
+ pTail->SetNext(new elem(i_aObj));
+ pTail = pTail->Next();
+ }
+ else
+ {
+ pTop = pTail = new elem(i_aObj);
+ }
+}
+
+template <class XX>
+void
+SweList<XX>::pop_front()
+{
+ if (pTop != 0)
+ {
+ elem * pDel = pTop;
+ pTop = pTop->Next();
+ delete pDel;
+ if (pTop == 0)
+ pTail = 0;
+ }
+}
+
+template <class XX>
+uintt
+SweList<XX>::size() const
+{
+ uintt ret = 0;
+ for ( const_iterator iter = begin();
+ iter != end();
+ ++iter )
+ {
+ ++ret;
+ }
+ return ret;
+}
+
+
+template <class XX>
+void
+SweList<XX>::erase_all()
+{
+ for (pTail = pTop ; pTop != 0; pTail = pTop)
+ {
+ pTop = pTop->Next();
+ delete pTail;
+ }
+ pTop = pTail = 0;
+}
+
+
+template <class XX>
+void
+SweList_dyn<XX>::push_front( XX * i_pObj )
+{
+ DYN elem * dpNew = new elem(i_pObj);
+ dpNew->SetNext(pTop);
+ pTop = dpNew;
+ if (pTail == 0)
+ pTail = pTop;
+}
+
+template <class XX>
+void
+SweList_dyn<XX>::push_back( XX * i_pObj )
+{
+ if (pTail != 0)
+ {
+ pTail->SetNext(new elem(i_pObj));
+ pTail = pTail->Next();
+ }
+ else
+ {
+ pTop = pTail = new elem(i_pObj);
+ }
+}
+
+template <class XX>
+void
+SweList_dyn<XX>::pop_front()
+{
+ if (pTop != 0)
+ {
+ elem * pDel = pTop;
+ pTop = pTop->Next();
+ if (pDel->Obj() != 0)
+ Delete_dyn(pDel->Obj());
+ delete pDel;
+ if (pTop == 0)
+ pTail = 0;
+ }
+}
+
+
+template <class XX>
+void
+SweList_dyn<XX>::erase_all()
+{
+ for (pTail = pTop ; pTop != 0; pTail = pTop)
+ {
+ pTop = pTop->Next();
+ if (pTail->Obj() != 0)
+ {
+ delete pTail->Obj();
+ }
+ delete pTail;
+ }
+ pTop = pTail = 0;
+}
+
+template <class XX>
+uintt
+SweList_dyn<XX>::size() const
+{
+ uintt ret = 0;
+ for ( iterator iter = begin();
+ iter != end();
+ ++iter )
+ {
+ ++ret;
+ }
+ return ret;
+}
+
+
+} // namespace csv
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/tpltools.hxx b/include/cosv/tpl/tpltools.hxx
new file mode 100644
index 000000000000..487a74cf8237
--- /dev/null
+++ b/include/cosv/tpl/tpltools.hxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_TPLTOOLS_HXX
+#define CSV_TPLTOOLS_HXX
+
+#include <vector>
+#include <map>
+
+
+
+
+namespace csv
+{
+
+
+template <class COLLECTION>
+inline void erase_container(
+ COLLECTION & o_rCollection );
+
+/// Version for other containers than std::map, with non-pair value_type.
+template <class COLLECTION>
+void erase_container_of_heap_ptrs(
+ COLLECTION & o_rCollection );
+
+
+template <class KEY, class VAL>
+const VAL * find_in_map( /// Usable for all kinds of values
+ const std::map< KEY, VAL > &
+ i_rMap,
+ const KEY & i_rKey );
+
+
+/** @return the value in the map, if it is in there, else 0.
+ @precond VAL has to be convertible to "0".
+*/
+template <class KEY, class VAL>
+VAL value_from_map(
+ const std::map< KEY, VAL > &
+ i_rMap,
+ const KEY & i_rKey );
+
+/** @return the value in the map, if it is in there, else i_notFound.
+*/
+template <class KEY, class VAL>
+VAL value_from_map(
+ const std::map< KEY, VAL > &
+ i_rMap,
+ const KEY & i_rKey,
+ VAL i_notFound );
+
+template <class COLLECTION, class VALUE>
+bool contains(
+ const COLLECTION & i_collection,
+ const VALUE & i_value );
+
+
+
+
+// IMPLEMENTATION
+template <class COLLECTION>
+inline void
+erase_container( COLLECTION & o_rCollection )
+{
+ o_rCollection.erase( o_rCollection.begin(),
+ o_rCollection.end() );
+}
+
+template <class COLLECTION>
+void
+erase_container_of_heap_ptrs( COLLECTION & o_rCollection )
+{
+ typename COLLECTION::iterator itEnd = o_rCollection.end();
+ for ( typename COLLECTION::iterator it = o_rCollection.begin();
+ it != itEnd;
+ ++it )
+ {
+ delete *it;
+ }
+
+ o_rCollection.erase( o_rCollection.begin(),
+ o_rCollection.end() );
+}
+
+template <class KEY, class VAL>
+const VAL *
+find_in_map( const std::map< KEY, VAL > & i_rMap,
+ const KEY & i_rKey )
+{
+ typename std::map< KEY, VAL >::const_iterator
+ ret = i_rMap.find(i_rKey);
+ return ret != i_rMap.end()
+ ? & (*ret).second
+ : (const VAL*)0;
+}
+
+template <class KEY, class VAL>
+VAL
+value_from_map( const std::map< KEY, VAL > & i_rMap,
+ const KEY & i_rKey )
+{
+ typename std::map< KEY, VAL >::const_iterator
+ ret = i_rMap.find(i_rKey);
+ return ret != i_rMap.end()
+ ? (*ret).second
+ : VAL(0);
+}
+
+template <class KEY, class VAL>
+VAL
+value_from_map( const std::map< KEY, VAL > & i_rMap,
+ const KEY & i_rKey,
+ VAL i_notFound )
+{
+ typename std::map< KEY, VAL >::const_iterator
+ ret = i_rMap.find(i_rKey);
+ return ret != i_rMap.end()
+ ? (*ret).second
+ : i_notFound;
+}
+
+template <class COLLECTION, class VALUE>
+bool
+contains( const COLLECTION & i_collection,
+ const VALUE & i_value )
+{
+ return std::find(i_collection.begin(), i_collection.end(), i_value)
+ !=
+ i_collection.end();
+}
+
+
+
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/tpl/vvector.hxx b/include/cosv/tpl/vvector.hxx
new file mode 100644
index 000000000000..dec58642bf23
--- /dev/null
+++ b/include/cosv/tpl/vvector.hxx
@@ -0,0 +1,535 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_VVECTOR_HXX
+#define CSV_VVECTOR_HXX
+
+#include <cstddef> // for ptrdiff_t
+
+// USED SERVICES
+#include <vector>
+#include <cosv/tpl/tpltools.hxx>
+
+
+
+
+namespace csv
+{
+namespace vvector
+{
+
+
+template <class TYPE>
+struct delete_ptrs
+{
+ static void Destruct(
+ std::vector< TYPE* > &
+ v)
+ { csv::erase_container_of_heap_ptrs(v); }
+
+ /// @precond ->it is a valid iterator within v
+ static void Erase(
+ std::vector< TYPE* > &
+ v,
+ typename std::vector< TYPE* >::iterator
+ it2erase )
+ { delete *it2erase; v.erase(it2erase); }
+
+ /// @precond ->v.size() > 0
+ static void PopBack(
+ std::vector< TYPE* > &
+ v )
+ { delete v.back(); v.pop_back(); }
+
+ /// @precond ->it is a valid iterator
+ static void ReplacePtr(
+ typename std::vector< TYPE* >::iterator
+ it,
+ DYN TYPE * pass_new )
+ { delete *it; *it = pass_new; }
+};
+
+
+/** One helper class for the ->csv::VirtualVector.
+ Implements a
+*/
+template <class TYPE>
+struct keep_ptrs
+{
+ static void Destruct(std::vector< TYPE* > &)
+ {}
+
+ static void Erase(
+ std::vector< TYPE* > &
+ v,
+ typename std::vector< TYPE* >::iterator
+ it2erase )
+ { v.erase(it2erase); }
+
+ static void PopBack(
+ std::vector< TYPE* > &
+ v )
+ { v.pop_back(); }
+
+ /// @precond ->it is a valid iterator
+ static void ReplacePtr(
+ typename std::vector< TYPE* >::iterator
+ it,
+ TYPE * io_new )
+ { *it = io_new; }
+};
+
+
+} // namespace vvector
+
+
+
+
+/** Implements a vector of different implementations of a base
+ class.
+
+ Implementation has to be by pointers to get the polymorphic
+ behaviour, however access is by references to the base class.
+
+ @tpl XX
+ The common base class of vector elements.
+
+ @tpl PTRDEL
+ Has two possible values:
+ vvector::delete_ptrs<XX> Elements have to be on the heap and
+ are deleted when removed (default).
+ vvector::keep_ptrs<XX> Elements are only referenced and not
+ deleted when removed.
+
+*/
+template <class XX, class PTRDEL = vvector::delete_ptrs<XX> >
+class VirtualVector
+{
+ public:
+ typedef VirtualVector<XX,PTRDEL> self;
+ typedef std::vector< DYN XX* > impl_type;
+ typedef typename impl_type::size_type size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ class const_iterator;
+ class iterator;
+
+ // LIFECYCLE
+ VirtualVector();
+ explicit VirtualVector(
+ int i_size );
+ ~VirtualVector();
+
+ // OPERATORS
+ const XX & operator[](
+ size_type i_pos ) const;
+ XX & operator[](
+ size_type i_pos );
+
+ // OPERATIONS
+ void push_back(
+ DYN XX & i_drElement );
+ void pop_back();
+
+ iterator insert(
+ iterator i_pos,
+ DYN XX & i_drElement );
+ void erase(
+ iterator i_pos );
+ void replace(
+ iterator i_pos,
+ DYN XX & i_drElement );
+ void reserve(
+ size_type i_size );
+
+ // INQUIRY
+ bool empty() const;
+ size_t size() const;
+ const_iterator begin() const;
+ const_iterator end() const;
+ const XX & front() const;
+ const XX & back() const;
+
+ // ACCESS
+ iterator begin();
+ iterator end();
+ XX & front();
+ XX & back();
+
+ private:
+ // Forbidden:
+ VirtualVector(const VirtualVector&);
+ VirtualVector & operator=(const VirtualVector&);
+
+ // DATA
+ std::vector< DYN XX* >
+ aData;
+};
+
+
+
+
+/** Should be usable for all STL algorithms.
+ Implements the Random Access Iterator concept.
+*/
+template <class XX, class PTRDEL>
+class VirtualVector<XX,PTRDEL>::
+ const_iterator
+
+ // This derivation provides type information for the STL
+ // It introduces the types "value_type" and "difference_type".
+ : public std::iterator<std::random_access_iterator_tag,
+ const XX>
+{
+ public:
+ typedef VirtualVector<XX,PTRDEL> my_container;
+ typedef typename my_container::impl_type::const_iterator impl_iterator;
+
+ // LIFECYCLE
+ const_iterator(
+ impl_iterator i_implIter )
+ : itImpl(i_implIter) {}
+
+
+ /////////// STL ITERATOR CONCEPT IMPLEMENTATION //////////////
+
+ // Default Constructible functions:
+ const_iterator()
+ : itImpl() {}
+
+ // Assignable functions:
+ // Assignment and copy constructor use the compiler generated versions.
+
+ // Equality Comparable functions:
+ bool operator==(
+ const_iterator i_other ) const
+ { return itImpl == i_other.itImpl; }
+ bool operator!=(
+ const_iterator i_other ) const
+ { return itImpl != i_other.itImpl; }
+
+ // Trivial Iterator functions:
+ const XX & operator*() const
+ { return *(*itImpl); }
+
+ // Input Iterator functions:
+ const_iterator & operator++()
+ { ++itImpl; return *this; }
+ const_iterator operator++(int)
+ { return const_iterator(itImpl++); }
+
+ // Bidirectional Iterator functions:
+ const_iterator & operator--()
+ { --itImpl; return *this; }
+ const_iterator operator--(int)
+ { return const_iterator(itImpl--); }
+
+ // Less Than Comparable functions:
+ bool operator<(
+ const_iterator i_other ) const
+ { return itImpl < i_other.itImpl; }
+
+ // Random Access Iterator functions:
+ const_iterator & operator+=(
+ difference_type i_diff )
+ { itImpl += i_diff; return *this; }
+ const_iterator operator+(
+ difference_type i_diff ) const
+ { const_iterator ret(itImpl);
+ return ret += i_diff; }
+ const_iterator & operator-=(
+ difference_type i_diff )
+ { itImpl -= i_diff; return *this; }
+ const_iterator operator-(
+ difference_type i_diff ) const
+ { const_iterator ret(itImpl);
+ return ret -= i_diff; }
+ difference_type operator-(
+ const_iterator i_it ) const
+ { return itImpl - i_it.itImpl; }
+ const XX & operator[](
+ difference_type i_index )
+ { return *(*itImpl[i_index]); }
+
+ //////////////////////////////////////////////////////////////////////////
+
+ private:
+ friend class VirtualVector<XX,PTRDEL>;
+ impl_iterator ImplValue() const { return itImpl; }
+
+ // DATA
+ impl_iterator itImpl;
+};
+
+
+
+
+/** Should be usable for all STL algorithms.
+ Implements the Random Access Iterator concept.
+*/
+template <class XX, class PTRDEL>
+class VirtualVector<XX,PTRDEL>::
+ iterator
+
+ // This derivation provides type information for the STL
+ // It introduces the types "value_type" and "difference_type".
+ : public std::iterator<std::random_access_iterator_tag,
+ XX>
+{
+ public:
+ typedef VirtualVector<XX,PTRDEL> my_container;
+ typedef typename my_container::impl_type::iterator impl_iterator;
+
+ // LIFECYCLE
+ iterator(
+ impl_iterator i_implIter )
+ : itImpl(i_implIter) {}
+
+
+ /////////// STL ITERATOR CONCEPT IMPLEMENTATION //////////////
+
+ // Default Constructible functions:
+ iterator()
+ : itImpl() {}
+
+ // Assignable functions:
+ // Assignment and copy constructor use the compiler generated versions.
+
+ // Equality Comparable functions:
+ bool operator==(
+ iterator i_other ) const
+ { return itImpl == i_other.itImpl; }
+ bool operator!=(
+ iterator i_other ) const
+ { return itImpl != i_other.itImpl; }
+
+ // Trivial Iterator functions:
+ XX & operator*() const
+ { return *(*itImpl); }
+
+ // Input Iterator functions:
+ iterator & operator++()
+ { ++itImpl; return *this; }
+ iterator operator++(int)
+ { return iterator(itImpl++); }
+
+ // Bidirectional Iterator functions:
+ iterator & operator--()
+ { --itImpl; return *this; }
+ iterator operator--(int)
+ { return iterator(itImpl--); }
+
+ // Less Than Comparable functions:
+ bool operator<(
+ iterator i_other ) const
+ { return itImpl < i_other.itImpl; }
+
+ // Random Access Iterator functions:
+ iterator & operator+=(
+ difference_type i_diff )
+ { itImpl += i_diff; return *this; }
+ iterator operator+(
+ difference_type i_diff ) const
+ { iterator ret(itImpl);
+ return ret += i_diff; }
+ iterator & operator-=(
+ difference_type i_diff )
+ { itImpl -= i_diff; return *this; }
+ iterator operator-(
+ difference_type i_diff ) const
+ { iterator ret(itImpl);
+ return ret -= i_diff; }
+ difference_type operator-(
+ iterator i_it ) const
+ { return itImpl - i_it.itImpl; }
+ XX & operator[](
+ difference_type i_index )
+ { return *(*itImpl[i_index]); }
+
+ //////////////////////////////////////////////////////////////////////////
+
+ private:
+ friend class VirtualVector<XX,PTRDEL>;
+ impl_iterator ImplValue() const { return itImpl; }
+
+ // DATA
+ impl_iterator itImpl;
+};
+
+
+
+
+// IMPLEMENTATION
+template <class XX, class PTRDEL>
+inline
+VirtualVector<XX,PTRDEL>::VirtualVector()
+ : aData()
+{
+}
+
+template <class XX, class PTRDEL>
+inline
+VirtualVector<XX,PTRDEL>::VirtualVector(int i_size)
+ : aData(i_size, 0)
+{
+}
+
+template <class XX, class PTRDEL>
+inline
+VirtualVector<XX,PTRDEL>::~VirtualVector()
+{
+ PTRDEL::Destruct(aData);
+}
+
+template <class XX, class PTRDEL>
+inline const XX &
+VirtualVector<XX,PTRDEL>::operator[]( size_type i_pos ) const
+{
+ return *aData[i_pos];
+}
+
+template <class XX, class PTRDEL>
+inline XX &
+VirtualVector<XX,PTRDEL>::operator[]( size_type i_pos )
+{
+ return *aData[i_pos];
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::push_back( DYN XX & i_drElement )
+{
+ aData.push_back(&i_drElement);
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::pop_back()
+{
+ if (NOT aData.empty())
+ PTRDEL::PopBack(aData);
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::iterator
+VirtualVector<XX,PTRDEL>::insert( iterator i_pos,
+ DYN XX & i_drElement )
+{
+ return iterator(aData.insert(i_pos.ImplValue(), &i_drElement));
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::erase( iterator i_pos )
+{
+ PTRDEL::Erase(aData, i_pos.ImplValue());
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::replace( iterator i_pos,
+ DYN XX & i_drElement )
+{
+ PTRDEL::ReplacePtr(*i_pos, &i_drElement);
+}
+
+template <class XX, class PTRDEL>
+inline void
+VirtualVector<XX,PTRDEL>::reserve( size_type i_size )
+{
+ aData.reserve(i_size);
+}
+
+template <class XX, class PTRDEL>
+inline bool
+VirtualVector<XX,PTRDEL>::empty() const
+{
+ return aData.empty();
+}
+
+template <class XX, class PTRDEL>
+inline size_t
+VirtualVector<XX,PTRDEL>::size() const
+{
+ return aData.size();
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::const_iterator
+VirtualVector<XX,PTRDEL>::begin() const
+{
+ return const_iterator(aData.begin());
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::const_iterator
+VirtualVector<XX,PTRDEL>::end() const
+{
+ return const_iterator(aData.end());
+}
+
+template <class XX, class PTRDEL>
+inline const XX &
+VirtualVector<XX,PTRDEL>::front() const
+{
+ return *aData.front();
+}
+
+template <class XX, class PTRDEL>
+inline const XX &
+VirtualVector<XX,PTRDEL>::back() const
+{
+ return *aData.back();
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::iterator
+VirtualVector<XX,PTRDEL>::begin()
+{
+ return iterator(aData.begin());
+}
+
+template <class XX, class PTRDEL>
+inline typename VirtualVector<XX,PTRDEL>::iterator
+VirtualVector<XX,PTRDEL>::end()
+{
+ return iterator(aData.end());
+}
+
+template <class XX, class PTRDEL>
+inline XX &
+VirtualVector<XX,PTRDEL>::front()
+{
+ return *aData.front();
+}
+
+template <class XX, class PTRDEL>
+inline XX &
+VirtualVector<XX,PTRDEL>::back()
+{
+ return *aData.back();
+}
+
+
+
+
+} // namespace csv
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cosv/x.hxx b/include/cosv/x.hxx
new file mode 100644
index 000000000000..755436317a39
--- /dev/null
+++ b/include/cosv/x.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef CSV_X_HXX
+#define CSV_X_HXX
+
+// USED SERVICES
+ // BASE CLASSES
+ // COMPONENTS
+#include <cosv/string.hxx>
+ // PARAMETERS
+#include <cosv/csv_ostream.hxx>
+
+
+namespace csv
+{
+
+class Exception
+{
+ public:
+ virtual ~Exception() {}
+ virtual void GetInfo(
+ ostream & o_rOutputMedium ) const = 0;
+};
+
+
+class X_Default : public Exception
+{
+ public:
+ X_Default(
+ const char * i_sMessage )
+ : sMessage(i_sMessage) {}
+ virtual void GetInfo( // Implemented in comfunc.cxx
+ ostream & o_rOutputMedium ) const;
+ private:
+ String sMessage;
+};
+
+
+} // namespace csv
+
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/basegfxfactory.hxx b/include/cppcanvas/basegfxfactory.hxx
new file mode 100644
index 000000000000..83acb38c448f
--- /dev/null
+++ b/include/cppcanvas/basegfxfactory.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_BASEGFXFACTORY_HXX
+#define _CPPCANVAS_BASEGFXFACTORY_HXX
+
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+#include <cppcanvas/polypolygon.hxx>
+#include <cppcanvas/bitmap.hxx>
+#include <cppcanvas/renderer.hxx>
+#include <cppcanvas/text.hxx>
+#include <cppcanvas/sprite.hxx>
+#include <basegfx/vector/b2isize.hxx>
+
+#include <cppcanvas/cppcanvasdllapi.h>
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+
+/* Definition of BaseGfxFactory class */
+
+namespace cppcanvas
+{
+ /** The BaseGfxFactory creates Canvas objects for various basegfx
+ primitives, such as polygons and bitmaps (not yet
+ implemented).
+
+ Please note that the objects created for a specific Canvas can
+ only be drawn on exactly that canvas. You have to regenerate
+ them for different canvases.
+ */
+ class CPPCANVAS_DLLPUBLIC BaseGfxFactory
+ {
+ public:
+ static BaseGfxFactory& getInstance();
+
+ /** Create a polygon from a ::basegfx::B2DPolygon
+
+ The created polygon initially has the same size in user
+ coordinate space as the source polygon
+ */
+ PolyPolygonSharedPtr createPolyPolygon( const CanvasSharedPtr&, const ::basegfx::B2DPolygon& rPoly ) const;
+
+ /** Create an uninitialized bitmap with the given size
+ */
+ BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
+
+ /** Create an uninitialized alpha bitmap with the given size
+ */
+ BitmapSharedPtr createAlphaBitmap( const CanvasSharedPtr&, const ::basegfx::B2ISize& rSize ) const;
+
+ private:
+ friend struct InitInstance2;
+
+ // singleton
+ BaseGfxFactory();
+
+ // default: disabled copy/assignment
+ BaseGfxFactory(const BaseGfxFactory&);
+ BaseGfxFactory& operator=( const BaseGfxFactory& );
+ };
+
+}
+
+#endif /* _CPPCANVAS_BASEGFXFACTORY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/bitmap.hxx b/include/cppcanvas/bitmap.hxx
new file mode 100644
index 000000000000..5e542e7220aa
--- /dev/null
+++ b/include/cppcanvas/bitmap.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_BITMAP_HXX
+#define _CPPCANVAS_BITMAP_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XBitmap;
+} } } }
+
+
+/* Definition of Bitmap interface */
+
+namespace cppcanvas
+{
+
+ /** This interface defines a Bitmap canvas object
+
+ Consider this object part of the view, and not of the model
+ data, as this bitmap can only be painted on its parent canvas
+ */
+ class Bitmap : public virtual CanvasGraphic
+ {
+ public:
+ /** Render to parent canvas, with global alpha.
+
+ This method renders the content to the parent canvas,
+ i.e. the canvas this object was constructed for.
+
+ @param nAlphaModulation
+ Global alpha value, with which each pixel alpha value gets
+ multiplied. For a normal, opaque bitmap, this will make
+ the bitmap appear transparent with the given alpha value
+ (value must be in the range [0,1]).
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool drawAlphaModulated( double nAlphaModulation ) const = 0;
+
+ virtual BitmapCanvasSharedPtr getBitmapCanvas() const = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmap > getUNOBitmap() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Bitmap > BitmapSharedPtr;
+}
+
+#endif /* _CPPCANVAS_BITMAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/bitmapcanvas.hxx b/include/cppcanvas/bitmapcanvas.hxx
new file mode 100644
index 000000000000..620182a14e45
--- /dev/null
+++ b/include/cppcanvas/bitmapcanvas.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_BITMAPCANVAS_HXX
+#define _CPPCANVAS_BITMAPCANVAS_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+
+#include <boost/shared_ptr.hpp>
+#include <basegfx/vector/b2isize.hxx>
+#include <cppcanvas/canvas.hxx>
+
+
+/* Definition of BitmapCanvas */
+
+namespace cppcanvas
+{
+ class BitmapCanvas;
+
+ // forward declaration, since cloneBitmapCanvas() also references BitmapCanvas
+ typedef ::boost::shared_ptr< BitmapCanvas > BitmapCanvasSharedPtr;
+
+ /** BitmapCanvas interface
+ */
+ class BitmapCanvas : public virtual Canvas
+ {
+ public:
+ virtual ::basegfx::B2ISize getSize() const = 0;
+
+ // shared_ptr does not allow for covariant return types
+ BitmapCanvasSharedPtr cloneBitmapCanvas() const
+ {
+ BitmapCanvasSharedPtr p( ::boost::dynamic_pointer_cast< BitmapCanvas >(this->clone()) );
+ OSL_ENSURE(p.get(), "BitmapCanvas::cloneBitmapCanvas(): dynamic cast failed");
+ return p;
+ }
+ };
+
+}
+
+#endif /* _CPPCANVAS_BITMAPCANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/canvas.hxx b/include/cppcanvas/canvas.hxx
new file mode 100644
index 000000000000..0a77e7129a43
--- /dev/null
+++ b/include/cppcanvas/canvas.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_CANVAS_HXX
+#define _CPPCANVAS_CANVAS_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/font.hxx>
+#include <cppcanvas/color.hxx>
+
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XCanvas;
+ struct ViewState;
+} } } }
+
+
+/* Definition of BitmapCanvas */
+
+namespace cppcanvas
+{
+ class PolyPolygon;
+ class Canvas;
+
+ // forward declaration, since PolyPolygon also references Canvas
+ typedef ::boost::shared_ptr< PolyPolygon > PolyPolygonSharedPtr;
+
+ // forward declaration, since cloneCanvas() also references Canvas
+ typedef ::boost::shared_ptr< Canvas > CanvasSharedPtr;
+
+ /** Canvas interface
+ */
+ class Canvas
+ {
+ public:
+ enum
+ {
+ /** Extra pixel used when canvas anti-aliases.
+
+ Enlarge the bounding box of drawing primitives by this
+ amount in both dimensions, and on both sides of the
+ bounds, to account for extra pixel touched outside the
+ actual primitive bounding box, when the canvas
+ performs anti-aliasing.
+ */
+ ANTIALIASING_EXTRA_SIZE=2
+ };
+
+ virtual ~Canvas() {}
+
+ virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+ virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
+
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+ virtual void setClip() = 0;
+
+ /** Get current clip
+
+ @return NULL, if no clip is set, otherwise the current clip poly-polygon
+ */
+ virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
+
+ virtual FontSharedPtr createFont( const OUString& rFontName, const double& rCellSize ) const = 0;
+
+ virtual ColorSharedPtr createColor() const = 0;
+
+ virtual CanvasSharedPtr clone() const = 0;
+ virtual void clear() const = 0;
+
+ // this should be considered private. if RTTI gets enabled
+ // someday, remove that to a separate interface
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvas > getUNOCanvas() const = 0;
+ virtual ::com::sun::star::rendering::ViewState getViewState() const = 0;
+ };
+
+}
+
+#endif /* _CPPCANVAS_CANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/canvasgraphic.hxx b/include/cppcanvas/canvasgraphic.hxx
new file mode 100644
index 000000000000..e496df6aeb33
--- /dev/null
+++ b/include/cppcanvas/canvasgraphic.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_CANVASGRAPHIC_HXX
+#define _CPPCANVAS_CANVASGRAPHIC_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/color.hxx>
+#include <cppcanvas/canvas.hxx>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+}
+
+
+/* Definition of CanvasGraphic interface */
+
+namespace cppcanvas
+{
+ // forward declaration, since PolyPolygon also derives from CanvasGraphic
+ typedef ::boost::shared_ptr< class PolyPolygon > PolyPolygonSharedPtr;
+
+
+ /** This interface defines basic properties of
+ objects that can be painted on a Canvas
+ */
+ class CanvasGraphic
+ {
+ public:
+
+ /** These enums determine how the primitive color is combined
+ with the background. When performing this calculations, it
+ is assumed that all color values are premultiplied with
+ the corresponding alpha values (if no alpha is specified,
+ 1.0 is assumed). Then, the following general compositing
+ operation is performed:
+
+ C = Ca * Fa + Cb * Fb
+
+ where C is the result color, Ca and Cb are the input
+ colors, premultiplied with alpha, and Fa and Fb are
+ described for the different composite modes (wherein Aa
+ and Ab denote source and destination alpha, respectively).
+ */
+ enum CompositeOp
+ {
+ /// Clear destination. Fa = Fb = 0.
+ CLEAR,
+
+ /// Copy source as-is to destination. Fa = 1, Fb = 0.
+ SOURCE,
+
+ /// Leave destination as-is. Fa = 0, Fb = 1.
+ DESTINATION,
+
+ /// Copy source over destination. Fa = 1, Fb = 1-Aa.
+ OVER,
+
+ /// Copy source under destination. Fa = 1-Ab, Fb = 1.
+ UNDER,
+
+ /// Copy source to destination, but limited to where the destination is. Fa = Ab, Fb = 0.
+ INSIDE,
+
+ /// Leave destination as is, but only where source was. Fa = 0, Fb = Aa.
+ INSIDE_REVERSE,
+
+ /// Copy source to destination, but limited to where destination is not. Fa = 1-Ab, Fb = 0.
+ OUTSIDE,
+
+ /// Leave destination as is, but only where source has not been. Fa = 0, Fb = 1-Aa.
+ OUTSIDE_REVERSE,
+
+ /// Copy source over destination, but only where destination is. Keep destination. Fa = Ab, Fb = 1-Aa.
+ ATOP,
+
+ /// Copy destination over source, but only where source is. Keep source. Fa = 1-Ab, Fb = Aa.
+ ATOP_REVERSE,
+
+ /// Take only parts where either source or destination, but not both are. Fa = 1-Ab, Fb = 1-Aa.
+ XOR,
+
+ /** simply add contributions of both source and destination. The
+ resulting color values are limited to the permissible color
+ range, and clipped to the maximal value, if exceeded. Fa = 1, Fb = 1.
+ */
+ ADD,
+
+ /// Fa = min(1,(1-Ab)/Aa), Fb = 1
+ SATURATE
+ };
+
+ virtual ~CanvasGraphic() {}
+
+ /** Set object transformation matrix
+ */
+ virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+ /** Get object transformation matrix
+ */
+ virtual ::basegfx::B2DHomMatrix getTransformation() const = 0;
+
+ /** Set object clipping polygon
+ */
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+ /** Clear object clipping polygon
+ */
+ virtual void setClip() = 0;
+ /** Get object clipping polygon
+
+ @return NULL, if no clip is set; otherwise, the current clip poly-polygon is returned
+ */
+ virtual ::basegfx::B2DPolyPolygon const* getClip() const = 0;
+
+ /** Set object composite mode
+ */
+ virtual void setCompositeOp( CompositeOp aOp ) = 0;
+ /** Get object composite mode
+ */
+ virtual CompositeOp getCompositeOp() const = 0;
+
+ /** Render to parent canvas
+
+ This method renders the content to the parent canvas,
+ i.e. the canvas this object was constructed for.
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool draw() const = 0;
+
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::CanvasGraphic > CanvasGraphicSharedPtr;
+}
+
+#endif /* _CPPCANVAS_CANVASGRAPHIC_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/color.hxx b/include/cppcanvas/color.hxx
new file mode 100644
index 000000000000..6d7dc957286a
--- /dev/null
+++ b/include/cppcanvas/color.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_COLOR_HXX
+#define _CPPCANVAS_COLOR_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+
+/* Definition of Color class */
+
+namespace cppcanvas
+{
+ class Color
+ {
+ public:
+ /** Color in the sRGB color space, plus alpha channel
+
+ The four bytes of the sal_uInt32 are allocated as follows
+ to the color channels and alpha: 0xRRGGBBAA.
+ */
+ typedef sal_uInt32 IntSRGBA;
+
+ virtual ~Color() {}
+
+ virtual IntSRGBA getIntSRGBA( ::com::sun::star::uno::Sequence< double >& rDeviceColor ) const = 0;
+ virtual ::com::sun::star::uno::Sequence< double > getDeviceColor( IntSRGBA aSRGBA ) const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Color > ColorSharedPtr;
+
+ inline sal_uInt8 getRed( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0xFF000000U) >> 24U );
+ }
+
+ inline sal_uInt8 getGreen( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0x00FF0000U) >> 16U );
+ }
+
+ inline sal_uInt8 getBlue( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( (nCol&0x0000FF00U) >> 8U );
+ }
+
+ inline sal_uInt8 getAlpha( Color::IntSRGBA nCol )
+ {
+ return static_cast<sal_uInt8>( nCol&0x000000FFU );
+ }
+
+ inline Color::IntSRGBA makeColor( sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue, sal_uInt8 nAlpha )
+ {
+ return (nRed << 24U)|(nGreen << 16U)|(nBlue << 8U)|(nAlpha);
+ }
+
+ inline sal_Int32 unMakeColor( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue);
+ }
+
+ inline sal_Int32 makeColorARGB( sal_uInt8 nAlpha, sal_uInt8 nRed, sal_uInt8 nGreen, sal_uInt8 nBlue)
+ {
+ return (nAlpha << 24U)|(nRed << 16U)|(nGreen << 8U)|(nBlue);
+ }
+
+}
+
+#endif /* _CPPCANVAS_COLOR_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/cppcanvasdllapi.h b/include/cppcanvas/cppcanvasdllapi.h
new file mode 100644
index 000000000000..be641aad8b2b
--- /dev/null
+++ b/include/cppcanvas/cppcanvasdllapi.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_CPPCANVASDLLAPI_H
+#define INCLUDED_CPPCANVASDLLAPI_H
+
+#if defined CPPCANVAS_DLLIMPLEMENTATION
+
+#define CPPCANVAS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define CPPCANVAS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define CPPCANVAS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
diff --git a/include/cppcanvas/customsprite.hxx b/include/cppcanvas/customsprite.hxx
new file mode 100644
index 000000000000..70004e7e5900
--- /dev/null
+++ b/include/cppcanvas/customsprite.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_CUSTOMSPRITE_HXX
+#define _CPPCANVAS_CUSTOMSPRITE_HXX
+
+#include <sal/types.h>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/sprite.hxx>
+#include <cppcanvas/canvas.hxx>
+
+
+/* Definition of CustomSprite class */
+
+namespace cppcanvas
+{
+
+ class CustomSprite : public virtual Sprite
+ {
+ public:
+
+ virtual CanvasSharedPtr getContentCanvas() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::CustomSprite > CustomSpriteSharedPtr;
+}
+
+#endif /* _CPPCANVAS_CUSTOMSPRITE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/font.hxx b/include/cppcanvas/font.hxx
new file mode 100644
index 000000000000..967903eaa8e7
--- /dev/null
+++ b/include/cppcanvas/font.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_FONT_HXX
+#define _CPPCANVAS_FONT_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XCanvasFont;
+} } } }
+
+/* Definition of Font class */
+
+namespace cppcanvas
+{
+
+ class Font
+ {
+ public:
+ virtual ~Font() {}
+
+ virtual OUString getName() const = 0;
+ virtual double getCellSize() const = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XCanvasFont > getUNOFont() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Font > FontSharedPtr;
+}
+
+#endif /* _CPPCANVAS_FONT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/polypolygon.hxx b/include/cppcanvas/polypolygon.hxx
new file mode 100644
index 000000000000..ccfbb95d3def
--- /dev/null
+++ b/include/cppcanvas/polypolygon.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_POLYPOLYGON_HXX
+#define _CPPCANVAS_POLYPOLYGON_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/canvasgraphic.hxx>
+
+namespace basegfx
+{
+ class B2DPolygon;
+ class B2DPolyPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XPolyPolygon2D;
+} } } }
+
+
+/* Definition of PolyPolygon interface */
+
+namespace cppcanvas
+{
+
+ /** This interface defines a PolyPolygon canvas object
+
+ Consider this object part of the view, and not of the model
+ data. Although the given polygon is typically copied and held
+ internally (to facilitate migration to incompatible canvases),
+ ::basegfx::B2DPolygon et al. are ref-counted copy-on-write
+ classes, i.e. memory shouldn't be wasted. On the other hand,
+ the API polygon created internally _does_ necessarily
+ duplicate the data held, but can be easily flushed away via
+ flush().
+ */
+ class PolyPolygon : public virtual CanvasGraphic
+ {
+ public:
+ virtual void addPolygon( const ::basegfx::B2DPolygon& rPoly ) = 0;
+ virtual void addPolyPolygon( const ::basegfx::B2DPolyPolygon& rPoly ) = 0;
+
+ /** Set polygon fill color
+ */
+ virtual void setRGBAFillColor( Color::IntSRGBA ) = 0;
+ /** Set polygon line color
+ */
+ virtual void setRGBALineColor( Color::IntSRGBA ) = 0;
+ /** Get polygon fill color
+ */
+ virtual Color::IntSRGBA getRGBAFillColor() const = 0;
+ /** Get polygon line color
+ */
+ virtual Color::IntSRGBA getRGBALineColor() const = 0;
+
+ virtual void setStrokeWidth( const double& rStrokeWidth ) = 0;
+ virtual double getStrokeWidth() const = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XPolyPolygon2D > getUNOPolyPolygon() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::PolyPolygon > PolyPolygonSharedPtr;
+}
+
+#endif /* _CPPCANVAS_POLYPOLYGON_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/renderer.hxx b/include/cppcanvas/renderer.hxx
new file mode 100644
index 000000000000..e260e9400248
--- /dev/null
+++ b/include/cppcanvas/renderer.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_RENDERER_HXX
+#define _CPPCANVAS_RENDERER_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <cppcanvas/canvasgraphic.hxx>
+#include <cppcanvas/color.hxx>
+
+namespace basegfx
+{
+ class B2DRange;
+}
+
+/* Definition of Renderer interface */
+
+namespace cppcanvas
+{
+
+ class Renderer : public virtual CanvasGraphic
+ {
+ public:
+ /** Render subset of metafile to given canvas
+
+ This method renders the given subset of the content to the
+ associated canvas.
+
+ @param nStartIndex
+ The index of the first action to be rendered (the indices
+ correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @param nEndIndex
+ The index of the first action _not_ painted anymore,
+ i.e. the action after the last action rendered (the
+ indices correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @return whether the rendering finished successfully.
+ */
+ virtual bool drawSubset( sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex ) const = 0;
+
+ /** Query bounding box of metafile subset
+
+ This method queries the actual bounding box of the given
+ subset, when rendered on the associated canvas.
+
+ @param nStartIndex
+ The index of the first action to be rendered (the indices
+ correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @param nEndIndex
+ The index of the first action _not_ painted anymore,
+ i.e. the action after the last action rendered (the
+ indices correspond roughly to the action indices of the
+ originating GDIMetaFile. Note, although, that certain
+ actions, e.g. text, accounts for more than one index: a
+ text produces as many addressable indices as it has
+ characters).
+
+ @return the bounding box of the specified subset
+ */
+ virtual ::basegfx::B2DRange getSubsetArea( sal_Int32 nStartIndex,
+ sal_Int32 nEndIndex ) const = 0;
+
+ /** Parameters for the Renderer
+ */
+ struct Parameters
+ {
+ /// Optionally forces the fill color attribute for all actions
+ ::boost::optional< Color::IntSRGBA > maFillColor;
+
+ /// Optionally forces the line color attribute for all actions
+ ::boost::optional< Color::IntSRGBA > maLineColor;
+
+ /// Optionally forces the text color attribute for all actions
+ ::boost::optional< Color::IntSRGBA > maTextColor;
+
+ /// Optionally forces the given fontname for all text actions
+ ::boost::optional< OUString > maFontName;
+
+ /** Optionally transforms all text output actions with the
+ given matrix (in addition to the overall canvas
+ transformation).
+
+ Note that the matrix given here is applied to the unit
+ rect coordinate system, i.e. the metafile is assumed
+ to be contained in the unit rect.
+ */
+ ::boost::optional< ::basegfx::B2DHomMatrix > maTextTransformation;
+
+ /// Optionally forces the given font weight for all text actions
+ ::boost::optional< sal_Int8 > maFontWeight;
+
+ /// Optionally forces the given font letter form (italics etc.) for all text actions
+ ::boost::optional< sal_Int8 > maFontLetterForm;
+
+ /// Optionally forces the given font proportion (condensed, monospaced etc.) for all text actions
+ ::boost::optional< sal_Int8 > maFontProportion;
+
+ /// Optionally forces underlining for all text actions
+ ::boost::optional< bool > maFontUnderline;
+ };
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Renderer > RendererSharedPtr;
+}
+
+#endif /* _CPPCANVAS_RENDERER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/sprite.hxx b/include/cppcanvas/sprite.hxx
new file mode 100644
index 000000000000..0e87ff9b9dd1
--- /dev/null
+++ b/include/cppcanvas/sprite.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_SPRITE_HXX
+#define _CPPCANVAS_SPRITE_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace basegfx
+{
+ class B2DHomMatrix;
+ class B2DPolyPolygon;
+ class B2DPoint;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XSprite;
+} } } }
+
+
+/* Definition of Sprite class */
+
+namespace cppcanvas
+{
+
+ class Sprite
+ {
+ public:
+ virtual ~Sprite() {}
+
+ virtual void setAlpha( const double& rAlpha ) = 0;
+
+ /** Set the sprite position on screen
+
+ This method differs from the XSprite::move() insofar, as
+ no viewstate/renderstate transformations are applied to
+ the specified position. The given position is interpreted
+ in device coordinates (i.e. screen pixel)
+ */
+ virtual void movePixel( const ::basegfx::B2DPoint& rNewPos ) = 0;
+
+ /** Set the sprite position on screen
+
+ This method sets the sprite position in the view
+ coordinate system of the parent canvas
+ */
+ virtual void move( const ::basegfx::B2DPoint& rNewPos ) = 0;
+
+ virtual void transform( const ::basegfx::B2DHomMatrix& rMatrix ) = 0;
+
+ /** Set output clipping
+
+ This method differs from the XSprite::clip() insofar, as
+ no viewstate/renderstate transformations are applied to
+ the specified clip polygon. The given polygon is
+ interpreted in device coordinates (i.e. screen pixel)
+ */
+ virtual void setClipPixel( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+
+ /** Set output clipping
+
+ This method applies the clip poly-polygon interpreted in
+ the view coordinate system of the parent canvas.
+ */
+ virtual void setClip( const ::basegfx::B2DPolyPolygon& rClipPoly ) = 0;
+
+ virtual void setClip() = 0;
+
+ virtual void show() = 0;
+ virtual void hide() = 0;
+
+ /** Change the sprite priority
+
+ @param fPriority
+ New sprite priority. The higher the priority, the further
+ towards the viewer the sprite appears. That is, sprites
+ with higher priority appear before ones with lower
+ priority.
+ */
+ virtual void setPriority( double fPriority ) = 0;
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XSprite > getUNOSprite() const = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Sprite > SpriteSharedPtr;
+}
+
+#endif /* _CPPCANVAS_SPRITE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/spritecanvas.hxx b/include/cppcanvas/spritecanvas.hxx
new file mode 100644
index 000000000000..6a606b331edf
--- /dev/null
+++ b/include/cppcanvas/spritecanvas.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_SPRITECANVAS_HXX
+#define _CPPCANVAS_SPRITECANVAS_HXX
+
+#include <sal/types.h>
+#include <osl/diagnose.h>
+#include <basegfx/vector/b2dsize.hxx>
+
+#include <boost/noncopyable.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/sprite.hxx>
+#include <cppcanvas/customsprite.hxx>
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XSpriteCanvas;
+} } } }
+
+
+/* Definition of SpriteCanvas */
+
+namespace cppcanvas
+{
+ class SpriteCanvas;
+
+ // forward declaration, since cloneSpriteCanvas() also references SpriteCanvas
+ typedef ::boost::shared_ptr< ::cppcanvas::SpriteCanvas > SpriteCanvasSharedPtr;
+
+ /** SpriteCanvas interface
+ */
+ class SpriteCanvas : public virtual BitmapCanvas, private boost::noncopyable
+ {
+ public:
+ virtual bool updateScreen( bool bUpdateAll ) const = 0;
+
+ virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const = 0;
+ virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const = 0;
+
+ // shared_ptr does not allow for covariant return types
+ SpriteCanvasSharedPtr cloneSpriteCanvas() const
+ {
+ SpriteCanvasSharedPtr p( ::boost::dynamic_pointer_cast< SpriteCanvas >(this->clone()) );
+ OSL_ENSURE(p.get(), "SpriteCanvas::cloneSpriteCanvas(): dynamic cast failed");
+ return p;
+ }
+
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const = 0;
+ };
+
+}
+
+#endif /* _CPPCANVAS_SPRITECANVAS_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/text.hxx b/include/cppcanvas/text.hxx
new file mode 100644
index 000000000000..4ca53532c282
--- /dev/null
+++ b/include/cppcanvas/text.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_TEXT_HXX
+#define _CPPCANVAS_TEXT_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <cppcanvas/canvasgraphic.hxx>
+
+
+
+
+/* Definition of Text interface */
+
+namespace cppcanvas
+{
+ class Text : public virtual CanvasGraphic
+ {
+ public:
+ virtual void setFont( const FontSharedPtr& ) = 0;
+ virtual FontSharedPtr getFont() = 0;
+ };
+
+ typedef ::boost::shared_ptr< ::cppcanvas::Text > TextSharedPtr;
+}
+
+#endif /* _CPPCANVAS_TEXT_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cppcanvas/vclfactory.hxx b/include/cppcanvas/vclfactory.hxx
new file mode 100644
index 000000000000..b5d2f9612be9
--- /dev/null
+++ b/include/cppcanvas/vclfactory.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _CPPCANVAS_VCLFACTORY_HXX
+#define _CPPCANVAS_VCLFACTORY_HXX
+
+#include <cppcanvas/canvas.hxx>
+#include <cppcanvas/bitmapcanvas.hxx>
+#include <cppcanvas/spritecanvas.hxx>
+#include <cppcanvas/polypolygon.hxx>
+#include <cppcanvas/bitmap.hxx>
+#include <cppcanvas/renderer.hxx>
+#include <cppcanvas/text.hxx>
+#include <cppcanvas/sprite.hxx>
+
+#include <cppcanvas/cppcanvasdllapi.h>
+
+class Window;
+class Bitmap;
+class BitmapEx;
+class Polygon;
+class PolyPolygon;
+class Size;
+class Graphic;
+class GDIMetaFile;
+class Animation;
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ class XBitmapCanvas;
+ class XSpriteCanvas;
+} } } }
+
+/* Definition of VCLFactory class */
+
+namespace cppcanvas
+{
+ /** The VCLFactory creates Canvas objects for various VCL
+ OutputDevice primitives, such as windows, polygons, bitmaps
+ and metafiles.
+
+ Please note that the objects created for a specific Canvas can
+ only be drawn on exactly that canvas. You have to regenerate
+ them for different canvases.
+ */
+ class CPPCANVAS_DLLPUBLIC VCLFactory
+ {
+ public:
+ static VCLFactory& getInstance();
+
+ BitmapCanvasSharedPtr createCanvas( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XBitmapCanvas >& xCanvas );
+
+ SpriteCanvasSharedPtr createSpriteCanvas( const ::Window& rVCLWindow ) const;
+ SpriteCanvasSharedPtr createSpriteCanvas( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::rendering::XSpriteCanvas >& xCanvas ) const;
+
+ /** Create a bitmap from a VCL Bitmap
+ */
+ BitmapSharedPtr createBitmap( const CanvasSharedPtr&, const ::BitmapEx& rBmpEx ) const;
+
+ /** Create a renderer object from a Metafile
+
+ The created renderer initially draws the metafile
+ one-by-one units large, in user coordinate space
+ */
+ RendererSharedPtr createRenderer( const CanvasSharedPtr& rCanvas,
+ const ::GDIMetaFile& rMtf,
+ const Renderer::Parameters& rParms ) const;
+
+ private:
+ friend struct InitInstance;
+
+ // singleton
+ VCLFactory();
+
+ // default: disabled copy/assignment
+ VCLFactory(const VCLFactory&);
+ VCLFactory& operator=( const VCLFactory& );
+ };
+
+}
+
+#endif /* _CPPCANVAS_VCLFACTORY_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/XShapeDumper.hxx b/include/drawinglayer/XShapeDumper.hxx
new file mode 100644
index 000000000000..a1cd59948362
--- /dev/null
+++ b/include/drawinglayer/XShapeDumper.hxx
@@ -0,0 +1,71 @@
+/* -*- 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.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Artur Dorda <artur.dorda+libo@gmail.com> (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.
+ */
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <com/sun/star/drawing/LineStyle.hpp>
+#include <com/sun/star/drawing/LineDash.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
+
+#include <com/sun/star/drawing/PolygonKind.hpp>
+
+#include <com/sun/star/drawing/TextFitToSizeType.hpp>
+#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/TextAnimationDirection.hpp>
+#include <com/sun/star/drawing/TextAnimationKind.hpp>
+#include <com/sun/star/text/WritingMode.hpp>
+
+#include <com/sun/star/drawing/HomogenMatrixLine3.hpp>
+#include <com/sun/star/drawing/HomogenMatrix3.hpp>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#ifndef XShapeDumper_hxx
+#define XShapeDumper_hxx
+
+class DRAWINGLAYER_DLLPUBLIC XShapeDumper
+{
+
+public:
+ XShapeDumper();
+ OUString dump(com::sun::star::uno::Reference<com::sun::star::drawing::XShapes> xPageShapes);
+
+};
+#endif
diff --git a/include/drawinglayer/animation/animationtiming.hxx b/include/drawinglayer/animation/animationtiming.hxx
new file mode 100644
index 000000000000..08ee95090f6c
--- /dev/null
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+#define INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace animation
+ {
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntry
+ {
+ private:
+ AnimationEntry(const AnimationEntry&);
+ AnimationEntry& operator=(const AnimationEntry& rCandidate);
+
+ public:
+ AnimationEntry();
+ virtual ~AnimationEntry();
+ virtual AnimationEntry* clone() const = 0;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const = 0;
+ virtual double getDuration() const = 0;
+ virtual double getStateAtTime(double fTime) const = 0;
+ virtual double getNextEventTime(double fTime) const = 0;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed : public AnimationEntry
+ {
+ protected:
+ double mfDuration;
+ double mfState;
+
+ public:
+ AnimationEntryFixed(double fDuration, double fState = 0.0);
+ virtual ~AnimationEntryFixed();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear : public AnimationEntry
+ {
+ protected:
+ double mfDuration;
+ double mfFrequency;
+ double mfStart;
+ double mfStop;
+
+ public:
+ AnimationEntryLinear(double fDuration, double fFrequency = 250.0, double fStart = 0.0, double fStop = 1.0);
+ virtual ~AnimationEntryLinear();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry
+ {
+ protected:
+ double mfDuration;
+ ::std::vector< AnimationEntry* > maEntries;
+
+ // helpers
+ sal_uInt32 impGetIndexAtTime(double fTime, double &rfAddedTime) const;
+
+ public:
+ AnimationEntryList();
+ virtual ~AnimationEntryList();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ void append(const AnimationEntry& rCandidate);
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+
+ class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop : public AnimationEntryList
+ {
+ protected:
+ sal_uInt32 mnRepeat;
+
+ public:
+ AnimationEntryLoop(sal_uInt32 nRepeat = 0xffffffff);
+ virtual ~AnimationEntryLoop();
+ virtual AnimationEntry* clone() const;
+
+ virtual bool operator==(const AnimationEntry& rCandidate) const;
+ virtual double getDuration() const;
+ virtual double getStateAtTime(double fTime) const;
+ virtual double getNextEventTime(double fTime) const;
+ };
+
+ //////////////////////////////////////////////////////////////////////////////
+ } // end of namespace animation
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillbitmapattribute.hxx b/include/drawinglayer/attribute/fillbitmapattribute.hxx
new file mode 100644
index 000000000000..851dc5ed0697
--- /dev/null
+++ b/include/drawinglayer/attribute/fillbitmapattribute.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class BitmapEx;
+
+namespace basegfx {
+ class B2DPoint;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpFillBitmapAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC FillBitmapAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFillBitmapAttribute > ImplType;
+
+ private:
+ ImplType mpFillBitmapAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ FillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft,
+ const basegfx::B2DVector& rSize,
+ bool bTiling);
+ FillBitmapAttribute(const FillBitmapAttribute& rCandidate);
+ FillBitmapAttribute& operator=(const FillBitmapAttribute& rCandidate);
+ ~FillBitmapAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillBitmapAttribute& rCandidate) const;
+
+ // data read access
+ const BitmapEx& getBitmapEx() const;
+ const basegfx::B2DPoint& getTopLeft() const;
+ const basegfx::B2DVector& getSize() const;
+ bool getTiling() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLBITMAPATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx b/include/drawinglayer/attribute/fillgradientattribute.hxx
new file mode 100644
index 000000000000..e791193651a0
--- /dev/null
+++ b/include/drawinglayer/attribute/fillgradientattribute.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpFillGradientAttribute;
+}}
+
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ enum GradientStyle
+ {
+ GRADIENTSTYLE_LINEAR,
+ GRADIENTSTYLE_AXIAL,
+ GRADIENTSTYLE_RADIAL,
+ GRADIENTSTYLE_ELLIPTICAL,
+ GRADIENTSTYLE_SQUARE,
+ GRADIENTSTYLE_RECT
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFillGradientAttribute > ImplType;
+
+ private:
+ ImplType mpFillGradientAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ FillGradientAttribute(
+ GradientStyle eStyle,
+ double fBorder,
+ double fOffsetX,
+ double fOffsetY,
+ double fAngle,
+ const basegfx::BColor& rStartColor,
+ const basegfx::BColor& rEndColor,
+ sal_uInt16 nSteps);
+ FillGradientAttribute();
+ FillGradientAttribute(const FillGradientAttribute& rCandidate);
+ FillGradientAttribute& operator=(const FillGradientAttribute& rCandidate);
+ ~FillGradientAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillGradientAttribute& rCandidate) const;
+
+ // data read access
+ GradientStyle getStyle() const;
+ double getBorder() const;
+ double getOffsetX() const;
+ double getOffsetY() const;
+ double getAngle() const;
+ const basegfx::BColor& getStartColor() const;
+ const basegfx::BColor& getEndColor() const;
+ sal_uInt16 getSteps() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLGRADIENTATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx
new file mode 100644
index 000000000000..7e6244be090b
--- /dev/null
+++ b/include/drawinglayer/attribute/fillhatchattribute.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpFillHatchAttribute;
+}}
+
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ enum HatchStyle
+ {
+ HATCHSTYLE_SINGLE,
+ HATCHSTYLE_DOUBLE,
+ HATCHSTYLE_TRIPLE
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC FillHatchAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFillHatchAttribute > ImplType;
+
+ private:
+ ImplType mpFillHatchAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ FillHatchAttribute(
+ HatchStyle eStyle,
+ double fDistance,
+ double fAngle,
+ const basegfx::BColor& rColor,
+ bool bFillBackground);
+ FillHatchAttribute();
+ FillHatchAttribute(const FillHatchAttribute& rCandidate);
+ FillHatchAttribute& operator=(const FillHatchAttribute& rCandidate);
+ ~FillHatchAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FillHatchAttribute& rCandidate) const;
+
+ // data read access
+ HatchStyle getStyle() const;
+ double getDistance() const;
+ double getAngle() const;
+ const basegfx::BColor& getColor() const;
+ bool isFillBackground() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FILLHATCHATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/fontattribute.hxx b/include/drawinglayer/attribute/fontattribute.hxx
new file mode 100644
index 000000000000..b49ab83b300e
--- /dev/null
+++ b/include/drawinglayer/attribute/fontattribute.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class String;
+
+namespace drawinglayer { namespace attribute {
+ class ImpFontAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ /** FontAttribute class
+
+ This attribute class is able to hold all parameters needed/used
+ to completely define the parametrisation of a text portion.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FontAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpFontAttribute > ImplType;
+
+ private:
+ ImplType mpFontAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ /// TODO: pair kerning and CJK kerning
+ FontAttribute(
+ const String& rFamilyName,
+ const String& rStyleName,
+ sal_uInt16 nWeight,
+ bool bSymbol = false,
+ bool bVertical = false,
+ bool bItalic = false,
+ bool bMonospaced = false,
+ bool bOutline = false,
+ bool bRTL = false,
+ bool bBiDiStrong = false);
+ FontAttribute();
+ FontAttribute(const FontAttribute& rCandidate);
+ FontAttribute& operator=(const FontAttribute& rCandidate);
+ ~FontAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const FontAttribute& rCandidate) const;
+
+ /// data read access
+ const String& getFamilyName() const;
+ const String& getStyleName() const;
+ sal_uInt16 getWeight() const;
+ bool getSymbol() const;
+ bool getVertical() const;
+ bool getItalic() const;
+ bool getOutline() const;
+ bool getRTL() const;
+ bool getBiDiStrong() const;
+ bool getMonospaced() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_FONTATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/lineattribute.hxx b/include/drawinglayer/attribute/lineattribute.hxx
new file mode 100644
index 000000000000..58eb987714e3
--- /dev/null
+++ b/include/drawinglayer/attribute/lineattribute.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpLineAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC LineAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpLineAttribute > ImplType;
+
+ private:
+ ImplType mpLineAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ explicit LineAttribute(
+ const basegfx::BColor& rColor,
+ double fWidth = 0.0,
+ basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND,
+ com::sun::star::drawing::LineCap aLineCap = com::sun::star::drawing::LineCap_BUTT);
+ LineAttribute();
+ LineAttribute(const LineAttribute& rCandidate);
+ LineAttribute& operator=(const LineAttribute& rCandidate);
+ ~LineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const LineAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ double getWidth() const;
+ basegfx::B2DLineJoin getLineJoin() const;
+ com::sun::star::drawing::LineCap getLineCap() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/linestartendattribute.hxx b/include/drawinglayer/attribute/linestartendattribute.hxx
new file mode 100644
index 000000000000..e02d3565aaf7
--- /dev/null
+++ b/include/drawinglayer/attribute/linestartendattribute.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpLineStartEndAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC LineStartEndAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpLineStartEndAttribute > ImplType;
+
+ private:
+ ImplType mpLineStartEndAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ LineStartEndAttribute(
+ double fWidth,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ bool bCentered);
+ LineStartEndAttribute();
+ LineStartEndAttribute(const LineStartEndAttribute& rCandidate);
+ LineStartEndAttribute& operator=(const LineStartEndAttribute& rCandidate);
+ ~LineStartEndAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const LineStartEndAttribute& rCandidate) const;
+
+ // data read access
+ double getWidth() const;
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const;
+ bool isCentered() const;
+ bool isActive() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/materialattribute3d.hxx b/include/drawinglayer/attribute/materialattribute3d.hxx
new file mode 100644
index 000000000000..9c4d34dce155
--- /dev/null
+++ b/include/drawinglayer/attribute/materialattribute3d.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpMaterialAttribute3D;
+}}
+
+namespace basegfx {
+ class BColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC MaterialAttribute3D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpMaterialAttribute3D > ImplType;
+
+ private:
+ ImplType mpMaterialAttribute3D;
+
+ public:
+ // constructors/destructor
+ MaterialAttribute3D(
+ const basegfx::BColor& rColor,
+ const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission,
+ sal_uInt16 nSpecularIntensity);
+ MaterialAttribute3D(const basegfx::BColor& rColor);
+ MaterialAttribute3D();
+ MaterialAttribute3D(const MaterialAttribute3D& rCandidate);
+ ~MaterialAttribute3D();
+
+ // assignment operator
+ MaterialAttribute3D& operator=(const MaterialAttribute3D& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const MaterialAttribute3D& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ const basegfx::BColor& getSpecular() const;
+ const basegfx::BColor& getEmission() const;
+ sal_uInt16 getSpecularIntensity() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_MATERIALATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrallattribute3d.hxx b/include/drawinglayer/attribute/sdrallattribute3d.hxx
new file mode 100644
index 000000000000..abd46bf273fe
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrallattribute3d.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/attribute/sdrlineattribute.hxx>
+#include <drawinglayer/attribute/sdrfillattribute.hxx>
+#include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
+#include <drawinglayer/attribute/sdrshadowattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineFillShadowAttribute3D
+ {
+ private:
+ const SdrLineAttribute maLine;
+ const SdrFillAttribute maFill;
+ const SdrLineStartEndAttribute maLineStartEnd;
+ const SdrShadowAttribute maShadow;
+ const FillGradientAttribute maFillFloatTransGradient;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineFillShadowAttribute3D(
+ const SdrLineAttribute& rLine,
+ const SdrFillAttribute& rFill,
+ const SdrLineStartEndAttribute& rLineStartEnd,
+ const SdrShadowAttribute& rShadow,
+ const FillGradientAttribute& rFillFloatTransGradient);
+ SdrLineFillShadowAttribute3D();
+
+ // compare operator
+ bool operator==(const SdrLineFillShadowAttribute3D& rCandidate) const;
+
+ // data read access
+ const SdrLineAttribute& getLine() const { return maLine; }
+ const SdrFillAttribute& getFill() const { return maFill; }
+ const SdrLineStartEndAttribute& getLineStartEnd() const { return maLineStartEnd; }
+ const SdrShadowAttribute& getShadow() const { return maShadow; }
+ const FillGradientAttribute& getFillFloatTransGradient() const { return maFillFloatTransGradient; }
+ };
+ } // end of namespace overlay
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRALLATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrfillattribute.hxx b/include/drawinglayer/attribute/sdrfillattribute.hxx
new file mode 100644
index 000000000000..7fd3d38c224e
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrfillattribute.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrFillAttribute;
+ class FillGradientAttribute;
+ class FillHatchAttribute;
+ class SdrFillBitmapAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrFillAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFillAttribute > ImplType;
+
+ private:
+ ImplType mpSdrFillAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFillAttribute(
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ const FillGradientAttribute& rGradient,
+ const FillHatchAttribute& rHatch,
+ const SdrFillBitmapAttribute& rBitmap);
+ SdrFillAttribute();
+ SdrFillAttribute(const SdrFillAttribute& rCandidate);
+ SdrFillAttribute& operator=(const SdrFillAttribute& rCandidate);
+ ~SdrFillAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFillAttribute& rCandidate) const;
+
+ // data read access
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ const FillGradientAttribute& getGradient() const;
+ const FillHatchAttribute& getHatch() const;
+ const SdrFillBitmapAttribute& getBitmap() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx b/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx
new file mode 100644
index 000000000000..78417f3577c9
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrfillbitmapattribute.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class BitmapEx;
+
+namespace basegfx {
+ class B2DRange;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class FillBitmapAttribute;
+ class ImpSdrFillBitmapAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrFillBitmapAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrFillBitmapAttribute > ImplType;
+
+ private:
+ ImplType mpSdrFillBitmapAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrFillBitmapAttribute(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DVector& rSize,
+ const basegfx::B2DVector& rOffset,
+ const basegfx::B2DVector& rOffsetPosition,
+ const basegfx::B2DVector& rRectPoint,
+ bool bTiling,
+ bool bStretch,
+ bool bLogSize);
+ SdrFillBitmapAttribute();
+ SdrFillBitmapAttribute(const SdrFillBitmapAttribute& rCandidate);
+ SdrFillBitmapAttribute& operator=(const SdrFillBitmapAttribute& rCandidate);
+ ~SdrFillBitmapAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrFillBitmapAttribute& rCandidate) const;
+
+ // data read access
+ const BitmapEx& getBitmapEx() const;
+ const basegfx::B2DVector& getSize() const;
+ const basegfx::B2DVector& getOffset() const;
+ const basegfx::B2DVector& getOffsetPosition() const;
+ const basegfx::B2DVector& getRectPoint() const;
+ bool getTiling() const;
+ bool getStretch() const;
+
+ // FillBitmapAttribute generator
+ FillBitmapAttribute getFillBitmapAttribute(const basegfx::B2DRange& rRange) const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRFILLBITMAPATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlightattribute3d.hxx b/include/drawinglayer/attribute/sdrlightattribute3d.hxx
new file mode 100644
index 000000000000..f9e35798cd3e
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlightattribute3d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B3DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdr3DLightAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC Sdr3DLightAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdr3DLightAttribute > ImplType;
+
+ private:
+ ImplType mpSdr3DLightAttribute;
+
+ public:
+ // constructors/destructor
+ Sdr3DLightAttribute(
+ const basegfx::BColor& rColor,
+ const basegfx::B3DVector& rDirection,
+ bool bSpecular);
+ explicit Sdr3DLightAttribute(const basegfx::BColor& rColor);
+ Sdr3DLightAttribute(const Sdr3DLightAttribute& rCandidate);
+ ~Sdr3DLightAttribute();
+
+ // assignment operator
+ Sdr3DLightAttribute& operator=(const Sdr3DLightAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const Sdr3DLightAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::BColor& getColor() const;
+ const basegfx::B3DVector& getDirection() const;
+ bool getSpecular() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlightingattribute3d.hxx b/include/drawinglayer/attribute/sdrlightingattribute3d.hxx
new file mode 100644
index 000000000000..0c3bb96b9f70
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlightingattribute3d.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B3DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrLightingAttribute;
+ class Sdr3DLightAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLightingAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLightingAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLightingAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLightingAttribute(
+ const basegfx::BColor& rAmbientLight,
+ const ::std::vector< Sdr3DLightAttribute >& rLightVector);
+ SdrLightingAttribute();
+ SdrLightingAttribute(const SdrLightingAttribute& rCandidate);
+ SdrLightingAttribute& operator=(const SdrLightingAttribute& rCandidate);
+ ~SdrLightingAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLightingAttribute& rCandidate) const;
+
+ // data read access
+ const ::std::vector< Sdr3DLightAttribute >& getLightVector() const;
+
+ // color model solver
+ basegfx::BColor solveColorModel(
+ const basegfx::B3DVector& rNormalInEyeCoordinates,
+ const basegfx::BColor& rColor, const basegfx::BColor& rSpecular,
+ const basegfx::BColor& rEmission, sal_uInt16 nSpecularIntensity) const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLIGHTINGATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlineattribute.hxx b/include/drawinglayer/attribute/sdrlineattribute.hxx
new file mode 100644
index 000000000000..bedbd9f29bb9
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlineattribute.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <basegfx/vector/b2enums.hxx>
+#include <com/sun/star/drawing/LineCap.hpp>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrLineAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLineAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLineAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineAttribute(
+ basegfx::B2DLineJoin eJoin,
+ double fWidth,
+ double fTransparence,
+ const basegfx::BColor& rColor,
+ com::sun::star::drawing::LineCap eCap,
+ const ::std::vector< double >& rDotDashArray,
+ double fFullDotDashLen);
+ SdrLineAttribute();
+ SdrLineAttribute(const SdrLineAttribute& rCandidate);
+ SdrLineAttribute& operator=(const SdrLineAttribute& rCandidate);
+ ~SdrLineAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineAttribute& rCandidate) const;
+
+ // data access
+ basegfx::B2DLineJoin getJoin() const;
+ double getWidth() const;
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ const ::std::vector< double >& getDotDashArray() const;
+ double getFullDotDashLen() const;
+ com::sun::star::drawing::LineCap getCap() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrlinestartendattribute.hxx b/include/drawinglayer/attribute/sdrlinestartendattribute.hxx
new file mode 100644
index 000000000000..19c1a5147db0
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrlinestartendattribute.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrLineStartEndAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrLineStartEndAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrLineStartEndAttribute > ImplType;
+
+ private:
+ ImplType mpSdrLineStartEndAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrLineStartEndAttribute(
+ const basegfx::B2DPolyPolygon& rStartPolyPolygon,
+ const basegfx::B2DPolyPolygon& rEndPolyPolygon,
+ double fStartWidth,
+ double fEndWidth,
+ bool bStartActive,
+ bool bEndActive,
+ bool bStartCentered,
+ bool bEndCentered);
+ SdrLineStartEndAttribute();
+ SdrLineStartEndAttribute(const SdrLineStartEndAttribute& rCandidate);
+ SdrLineStartEndAttribute& operator=(const SdrLineStartEndAttribute& rCandidate);
+ ~SdrLineStartEndAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrLineStartEndAttribute& rCandidate) const;
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getStartPolyPolygon() const;
+ const basegfx::B2DPolyPolygon& getEndPolyPolygon() const;
+ double getStartWidth() const;
+ double getEndWidth() const;
+ bool isStartActive() const;
+ bool isEndActive() const;
+ bool isStartCentered() const;
+ bool isEndCentered() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRLINESTARTENDATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrobjectattribute3d.hxx b/include/drawinglayer/attribute/sdrobjectattribute3d.hxx
new file mode 100644
index 000000000000..860093a67666
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrobjectattribute3d.hxx
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/NormalsKind.hpp>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <com/sun/star/drawing/TextureKind2.hpp>
+#include <com/sun/star/drawing/TextureMode.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdr3DObjectAttribute;
+ class MaterialAttribute3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC Sdr3DObjectAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdr3DObjectAttribute > ImplType;
+
+ private:
+ ImplType mpSdr3DObjectAttribute;
+
+ public:
+ // constructors/destructor
+ Sdr3DObjectAttribute(
+ ::com::sun::star::drawing::NormalsKind aNormalsKind,
+ ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionX,
+ ::com::sun::star::drawing::TextureProjectionMode aTextureProjectionY,
+ ::com::sun::star::drawing::TextureKind2 aTextureKind,
+ ::com::sun::star::drawing::TextureMode aTextureMode,
+ const MaterialAttribute3D& rMaterial,
+ bool bNormalsInvert,
+ bool bDoubleSided,
+ bool bShadow3D,
+ bool bTextureFilter,
+ bool bReducedLineGeometry);
+ Sdr3DObjectAttribute(const Sdr3DObjectAttribute& rCandidate);
+ ~Sdr3DObjectAttribute();
+
+ // assignment operator
+ Sdr3DObjectAttribute& operator=(const Sdr3DObjectAttribute& rCandidate);
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const Sdr3DObjectAttribute& rCandidate) const;
+
+ // data read access
+ ::com::sun::star::drawing::NormalsKind getNormalsKind() const;
+ ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionX() const;
+ ::com::sun::star::drawing::TextureProjectionMode getTextureProjectionY() const;
+ ::com::sun::star::drawing::TextureKind2 getTextureKind() const;
+ ::com::sun::star::drawing::TextureMode getTextureMode() const;
+ const MaterialAttribute3D& getMaterial() const;
+ bool getNormalsInvert() const;
+ bool getDoubleSided() const;
+ bool getShadow3D() const;
+ bool getTextureFilter() const;
+ bool getReducedLineGeometry() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDROBJECTATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrsceneattribute3d.hxx b/include/drawinglayer/attribute/sdrsceneattribute3d.hxx
new file mode 100644
index 000000000000..61d4d8a67378
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrsceneattribute3d.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/ShadeMode.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrSceneAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrSceneAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrSceneAttribute > ImplType;
+
+ private:
+ ImplType mpSdrSceneAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrSceneAttribute(
+ double fDistance,
+ double fShadowSlant,
+ ::com::sun::star::drawing::ProjectionMode aProjectionMode,
+ ::com::sun::star::drawing::ShadeMode aShadeMode,
+ bool bTwoSidedLighting);
+ SdrSceneAttribute();
+ SdrSceneAttribute(const SdrSceneAttribute& rCandidate);
+ SdrSceneAttribute& operator=(const SdrSceneAttribute& rCandidate);
+ ~SdrSceneAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrSceneAttribute& rCandidate) const;
+
+ // data read access
+ double getShadowSlant() const;
+ ::com::sun::star::drawing::ProjectionMode getProjectionMode() const;
+ ::com::sun::star::drawing::ShadeMode getShadeMode() const;
+ bool getTwoSidedLighting() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSCENEATTRIBUTE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/sdrshadowattribute.hxx b/include/drawinglayer/attribute/sdrshadowattribute.hxx
new file mode 100644
index 000000000000..ee1f36292505
--- /dev/null
+++ b/include/drawinglayer/attribute/sdrshadowattribute.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BColor;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class ImpSdrShadowAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrShadowAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpSdrShadowAttribute > ImplType;
+
+ private:
+ ImplType mpSdrShadowAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ SdrShadowAttribute(
+ const basegfx::B2DVector& rOffset,
+ double fTransparence,
+ const basegfx::BColor& rColor);
+ SdrShadowAttribute();
+ SdrShadowAttribute(const SdrShadowAttribute& rCandidate);
+ SdrShadowAttribute& operator=(const SdrShadowAttribute& rCandidate);
+ ~SdrShadowAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const SdrShadowAttribute& rCandidate) const;
+
+ // data access
+ const basegfx::B2DVector& getOffset() const;
+ double getTransparence() const;
+ const basegfx::BColor& getColor() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_SDRSHADOWATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/attribute/strokeattribute.hxx b/include/drawinglayer/attribute/strokeattribute.hxx
new file mode 100644
index 000000000000..6d4cea978482
--- /dev/null
+++ b/include/drawinglayer/attribute/strokeattribute.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <o3tl/cow_wrapper.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace attribute {
+ class ImpStrokeAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace attribute
+ {
+ class DRAWINGLAYER_DLLPUBLIC StrokeAttribute
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpStrokeAttribute > ImplType;
+
+ private:
+ ImplType mpStrokeAttribute;
+
+ public:
+ /// constructors/assignmentoperator/destructor
+ explicit StrokeAttribute(
+ const ::std::vector< double >& rDotDashArray,
+ double fFullDotDashLen = 0.0);
+ StrokeAttribute();
+ StrokeAttribute(const StrokeAttribute& rCandidate);
+ StrokeAttribute& operator=(const StrokeAttribute& rCandidate);
+ ~StrokeAttribute();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ // compare operator
+ bool operator==(const StrokeAttribute& rCandidate) const;
+
+ // data read access
+ const ::std::vector< double >& getDotDashArray() const;
+ double getFullDotDashLen() const;
+ };
+ } // end of namespace attribute
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/drawinglayerdllapi.h b/include/drawinglayer/drawinglayerdllapi.h
new file mode 100644
index 000000000000..0b3983504919
--- /dev/null
+++ b/include/drawinglayer/drawinglayerdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_DRAWINGLAYERDLLAPI_H
+#define INCLUDED_DRAWINGLAYER_DRAWINGLAYERDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined(DRAWINGLAYER_DLLIMPLEMENTATION)
+#define DRAWINGLAYER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define DRAWINGLAYER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define DRAWINGLAYER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx
new file mode 100644
index 000000000000..f8e0d6699448
--- /dev/null
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
+#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+// the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
+// pre-declarations of com/sun/star namespace), include sal/config.h here
+// where sun is redefined as 'sun' (so i guess the problem is known).
+#include <sal/config.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ImpViewInformation2D;
+}}
+
+namespace basegfx {
+ class B2DHomMatrix;
+ class B2DRange;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace geometry
+ {
+ /** ViewInformation2D class
+
+ This class holds all view-relevant information for a 2d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ ::com::sun::star::graphic::XPrimitive2D for C++ implementations working with those
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewInformation2D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpViewInformation2D, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ /// pointer to private implementation class
+ ImplType mpViewInformation2D;
+
+ public:
+ /** Constructor: Create a ViewInformation2D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rViewTransformation
+ The Transformation from World to View coordinates (normally logic coordinates
+ to discrete units, e.g. pixels).
+
+ @param rViewport
+ The visible part of the view in World coordinates. If empty (getViewport().isEmpty())
+ everything is visible. The data is in World coordinates.
+
+ @param rxDrawPage
+ The currently displaqyed page. This information is needed e.g. due to existing PageNumber
+ fields which need to be interpreted.
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
+ ViewInformation2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const basegfx::B2DHomMatrix& rViewTransformation,
+ const basegfx::B2DRange& rViewport,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ double fViewTime,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
+
+ /** Constructor: Create a ViewInformation2D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is feeded completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
+ explicit ViewInformation2D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
+
+ /// default (empty) constructor
+ ViewInformation2D();
+
+ /// copy constructor
+ ViewInformation2D(const ViewInformation2D& rCandidate);
+
+ /// destructor
+ ~ViewInformation2D();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ /// assignment operator
+ ViewInformation2D& operator=(const ViewInformation2D& rCandidate);
+
+ /// compare operators
+ bool operator==(const ViewInformation2D& rCandidate) const;
+ bool operator!=(const ViewInformation2D& rCandidate) const { return !operator==(rCandidate); }
+
+ /// data access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const;
+ const basegfx::B2DHomMatrix& getViewTransformation() const;
+ const basegfx::B2DRange& getViewport() const;
+ double getViewTime() const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getVisualizedPage() const;
+
+ /// On-demand prepared Object to View transformation and it's inerse for convenience
+ const basegfx::B2DHomMatrix& getObjectToViewTransformation() const;
+ const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const;
+
+ /// On-demand prepared Viewport in discrete units for convenience
+ const basegfx::B2DRange& getDiscreteViewport() const;
+
+ /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
+ is used e.g. to allow to lower display quality for OverlayPrimitives and
+ may lead to simpler decompositions in the local create2DDecomposition
+ implementations of the primitives
+ */
+ bool getReducedDisplayQuality() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
+
+ Use this call if You need to extract all contained ViewInformation. The ones
+ directly supported for convenience will be added to the ones only available
+ as PropertyValues. This set completely describes this ViewInformation2D and
+ can be used for complete information transport over UNO API.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation2D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
+ };
+ } // end of namespace geometry
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation3d.hxx b/include/drawinglayer/geometry/viewinformation3d.hxx
new file mode 100644
index 000000000000..86c9a2c16296
--- /dev/null
+++ b/include/drawinglayer/geometry/viewinformation3d.hxx
@@ -0,0 +1,175 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+#define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+// the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
+// pre-declarations of com/sun/star namespace), include sal/config.h here
+// where sun is redefined as 'sun' (so i guess the problem is known).
+#include <sal/config.h>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <o3tl/cow_wrapper.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ImpViewInformation3D;
+}}
+
+namespace basegfx {
+ class B3DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace geometry
+ {
+ /** ViewInformation3D class
+
+ This class holds all view-relevant information for a 3d geometry. It works
+ together with UNO API definitions and supports holding a sequence of PropertyValues.
+ The most used data is for convenience offered directly using basegfx tooling classes.
+ It is an implementation to support the sequence of PropertyValues used in a
+ ::com::sun::star::graphic::XPrimitive3D for C++ implementations working with those
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewInformation3D
+ {
+ public:
+ typedef o3tl::cow_wrapper< ImpViewInformation3D, o3tl::ThreadSafeRefCountingPolicy > ImplType;
+
+ private:
+ /// pointer to private implementation class
+ ImplType mpViewInformation3D;
+
+ public:
+ /** Constructor: Create a ViewInformation3D
+
+ @param rObjectTransformation
+ The Transformation from Object to World coordinates (normally logic coordinates).
+
+ @param rOrientation
+ A part of the 3D ViewTransformation, the World to Camera coordinates transformation
+ which holds the camera coordinate system.
+
+ @param rProjection
+ A part of the 3D ViewTransformation, the Camera to Device transformation which
+ transforms coordinates to a [0.0 .. 1.0] device range in X,Y and Z. Z may be used
+ as source for for Z-Buffers. This transformation may be e.g. a parallell projection,
+ but also a perspective one and thus may use the last line of the matrix.
+
+ @param rDeviceToView
+ A part of the 3D ViewTransformation, the Device to View transformation which normally
+ translates and scales from [0.0 .. 1.0] range in X,Y and Z to discrete position and
+ size.
+
+ rOrientation, rProjection and rDeviceToView define the 3D transformation pipeline
+ and are normally used multiplied together to have a direct transformation from
+ World to View coordinates
+
+ @param fViewTime
+ The time the view is defined for. Default is 0.0. This parameter is used e.g. for
+ animated objects
+
+ @param rExtendedParameters
+ A sequence of property values which allows holding various other parameters besides
+ the obvious and needed ones above. For this constructor none of the other parameters
+ should be added as data. The constructor will parse the given parameters and if
+ data for the other parameters is given, the value in rExtendedParameters will
+ be preferred and overwrite the given parameter
+ */
+ ViewInformation3D(
+ const basegfx::B3DHomMatrix& rObjectTransformation,
+ const basegfx::B3DHomMatrix& rOrientation,
+ const basegfx::B3DHomMatrix& rProjection,
+ const basegfx::B3DHomMatrix& rDeviceToView,
+ double fViewTime,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
+
+ /** Constructor: Create a ViewInformation3D
+
+ @param rViewParameters
+ A sequence of property values which allows holding any combination of local and various
+ other parameters. This constructor is feeded completely with a sequence of PropertyValues
+ which will be parsed to be able to offer the most used ones in a convenient way.
+ */
+ explicit ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
+
+ /// default (empty) constructor
+ ViewInformation3D();
+
+ /// copy constructor
+ ViewInformation3D(const ViewInformation3D& rCandidate);
+
+ /// destructor
+ ~ViewInformation3D();
+
+ // checks if the incarnation is default constructed
+ bool isDefault() const;
+
+ /// assignment operator
+ ViewInformation3D& operator=(const ViewInformation3D& rCandidate);
+
+ /// compare operators
+ bool operator==(const ViewInformation3D& rCandidate) const;
+ bool operator!=(const ViewInformation3D& rCandidate) const { return !operator==(rCandidate); }
+
+ /// data access
+ const basegfx::B3DHomMatrix& getObjectTransformation() const;
+ const basegfx::B3DHomMatrix& getOrientation() const;
+ const basegfx::B3DHomMatrix& getProjection() const;
+ const basegfx::B3DHomMatrix& getDeviceToView() const;
+ double getViewTime() const;
+
+ /// for convenience, the linear combination of the above four transformations is offered
+ const basegfx::B3DHomMatrix& getObjectToView() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
+
+ Use this call if You need to extract all contained ViewInformation. The ones
+ directly supported for convenience will be added to the ones only available
+ as PropertyValues. This set completely describes this ViewInformation3D and
+ can be used for complete information transport over UNO API.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
+
+ /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
+ not offered directly
+
+ Use this call if You only need ViewInformation which is not offered conveniently,
+ but only exists as PropertyValue. This is e.g. used to create partially updated
+ incarnations of ViewInformation3D without losing the only with PropertyValues
+ defined data. It does not contain a complete description.
+ */
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
+ };
+ } // end of namespace geometry
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/animatedprimitive2d.hxx b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
new file mode 100644
index 000000000000..59ee3225dc78
--- /dev/null
+++ b/include/drawinglayer/primitive2d/animatedprimitive2d.hxx
@@ -0,0 +1,171 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+namespace drawinglayer { namespace animation {
+ class AnimationEntry;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** AnimatedSwitchPrimitive2D class
+
+ This is the basic class for simple, animated primitives. The basic idea
+ is to have an animation definition (AnimationEntry) who's basic
+ functionality is to return a state value for any given animation time in
+ the range of [0.0 .. 1.0]. Depending on the state, the decomposition
+ calculates an index, which of the members of the child vector is to
+ be visualized.
+
+ An example: For blinking, the Child vector should exist of two entries;
+ for values of [0.0 .. 0.5] the first, else the last entry will be used.
+ This mechanism is not limited to two entries, though.
+ */
+ class DRAWINGLAYER_DLLPUBLIC AnimatedSwitchPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /**
+ The animation definition which allows translation of a point in time
+ to an animation state [0.0 .. 1.0]. This member contains a cloned
+ definition and is owned by this implementation.
+ */
+ animation::AnimationEntry* mpAnimationEntry;
+
+ /// bitfield
+ /** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate
+ between both types if they are on/off
+ */
+ unsigned mbIsTextAnimation : 1;
+
+ public:
+ /// constructor
+ AnimatedSwitchPrimitive2D(
+ const animation::AnimationEntry& rAnimationEntry,
+ const Primitive2DSequence& rChildren,
+ bool bIsTextAnimation);
+
+ /// destructor - needed due to mpAnimationEntry
+ virtual ~AnimatedSwitchPrimitive2D();
+
+ /// data read access
+ const animation::AnimationEntry& getAnimationEntry() const { return *mpAnimationEntry; }
+ bool isTextAnimation() const { return mbIsTextAnimation; }
+ bool isGraphicAnimation() const { return !isTextAnimation(); }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /** The getDecomposition is overloaded here since the decompose is dependent of the point in time,
+ so the default implementation is nut useful here, it needs to be handled locally
+ */
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** AnimatedBlinkPrimitive2D class
+
+ Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the
+ decomposition is specialized in delivering the children in the
+ range [0.0.. 0.5] and an empty sequence else
+ */
+ class DRAWINGLAYER_DLLPUBLIC AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D
+ {
+ protected:
+ public:
+ /// constructor
+ AnimatedBlinkPrimitive2D(
+ const animation::AnimationEntry& rAnimationEntry,
+ const Primitive2DSequence& rChildren,
+ bool bIsTextAnimation);
+
+ /// create local decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** AnimatedInterpolatePrimitive2D class
+
+ Specialized on multi-step animations based on matrix transformations. The
+ Child sequelce will be embedded in a matrix transformation. That transformation
+ will be linearly combined from the decomposed values and the animation value
+ to allow a smooth animation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D
+ {
+ private:
+ /// the transformations
+ std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose > maMatrixStack;
+
+ protected:
+ public:
+ /// constructor
+ AnimatedInterpolatePrimitive2D(
+ const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack,
+ const animation::AnimationEntry& rAnimationEntry,
+ const Primitive2DSequence& rChildren,
+ bool bIsTextAnimation);
+
+ /// create local decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx b/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx
new file mode 100644
index 000000000000..3986aba3566b
--- /dev/null
+++ b/include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// BackgroundColorPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BackgroundColorPrimitive2D class
+
+ This primitive is defined to fill the whole visible Viewport with
+ the given color (and thus decomposes to a filled polygon). This
+ makes it a view-depnendent primitive by definition. It only has
+ a valid decomposition if a valid Viewport is given in the
+ ViewInformation2D at decomposition time.
+
+ It will try to buffer it's last decomposition using maLastViewport
+ to detect changes in the get2DDecomposition call.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BackgroundColorPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the fill color to use
+ basegfx::BColor maBColor;
+
+ /// the last used viewInformation, used from getDecomposition for buffering
+ basegfx::B2DRange maLastViewport;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ explicit BackgroundColorPrimitive2D(
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BACKGROUNDCOLORPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
new file mode 100644
index 000000000000..157c13bb33a8
--- /dev/null
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -0,0 +1,296 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <cppuhelper/compbase1.hxx>
+#include <boost/utility.hpp>
+#include <com/sun/star/graphic/XPrimitive2D.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+/** defines for DeclPrimitrive2DIDBlock and ImplPrimitrive2DIDBlock
+ Added to be able to simply change identification stuff later, e.g. add
+ a identification string and/or ID to the interface and to the implementation
+ ATM used to delclare implement getPrimitive2DID()
+*/
+
+#define DeclPrimitrive2DIDBlock() \
+ virtual sal_uInt32 getPrimitive2DID() const;
+
+#define ImplPrimitrive2DIDBlock(TheClass, TheID) \
+ sal_uInt32 TheClass::getPrimitive2DID() const { return TheID; }
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation2D;
+}}
+
+namespace drawinglayer { namespace primitive2d {
+ /// typedefs for basePrimitive2DImplBase, Primitive2DSequence and Primitive2DReference
+ typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitive2D > BasePrimitive2DImplBase;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive2D > Primitive2DReference;
+ typedef ::com::sun::star::uno::Sequence< Primitive2DReference > Primitive2DSequence;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// basePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BasePrimitive2D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+
+ This class is strongly virtual due to the lack of getPrimitiveID() implementation.
+ This is by purpose, this base class shall not be incarnated and be used directly as
+ a XPrimitive2D.
+
+ Is is derived from boost::noncopyable to make clear that a primitive is a read-only
+ instance and copying or changing values is not intended. The idea is to hold all data
+ needed for visualisation of this primitive in unchangeable form.
+
+ It is derived from comphelper::OBaseMutex to have a Mutex at hand; in a base
+ implementation this may not be needed, but e.g. when buffering at last decomposition
+ in a local member, multiple threads may try to decompose at the same time, so locking
+ is needed to avoid race conditions seen from the UNO object implementation.
+
+ A method to get a simplified representation is provided by get2DDecomposition. The
+ default implementation returns an empty sequence. The idea is that processors
+ using this primitive and do not know it, may get the decomposition and process
+ these instead. An example is e.g. a fat line, who's decomposition may contain
+ the geometric representation of that line using filled polygon prmimitives. When
+ the renderer knows how to handle fat lines, he may proccess this primitive directly;
+ if not he can use the decomposition. With this functionality, renderers may operate by
+ knowing only a small set of primitives.
+
+ When a primitive does not implement get2DDecomposition, it is called a 'Basic Primitive' and
+ belongs to the set of primitives which a processor should be able to handle. Practice
+ will define this minimal sets of primitives. When defined and the concept is prooved,
+ unique UNO APIs may be defined/implemented for these set to allow more intense work
+ with primitives using UNO.
+
+ Current Basic 2D Primitives are:
+
+ - BitmapPrimitive2D (bitmap data, evtl. with transparence)
+ - PointArrayPrimitive2D (single points)
+ - PolygonHairlinePrimitive2D (hairline curves/polygons)
+ - PolyPolygonColorPrimitive2D (colored polygons)
+
+ UPDATE: MetafilePrimitive2D (VCL Metafile) is taken off this list since
+ it is implemented with the integration of CWS aw078 into DV300m69.
+
+ All other implemented primitives have a defined decomposition and can thus be
+ decomposed down to this small set.
+
+ A renderer implementing support for this minimal set of primitives can completely
+ render primitive-based visualisations. Of course, he also has to take states into account
+ which are representated by GroupPrimitive2D derivations, see groupprimitive2d.hxx
+
+ To support getting the geometric BoundRect, getB2DRange is used. The default
+ implementation will use the get2DDecomposition result and merge a range from the
+ entries. Thus, an implementation is only necessary for the Basic Primitives, but
+ of course speedups are possible (and are used) by implementing the method at higher-level
+ primitives.
+
+ For primitive identification, getPrimitiveID is used currently in this implementations
+ to allow a fast switch/case processing. This needs a unique identifier mechanism which
+ currently uses defines (see drawinglayer_primitivetypes2d.hxx). For UNO prmitive API
+ it will be needed to add a unique descriptor (Name?) later to the API.
+
+ This base implementation provides mappings from the methods from XPrimitive2D
+ (getDecomposition/getRange) to the appropriate methods in the C++ implementations
+ (get2DDecomposition/getB2DRange). The PropertyValue ViewParameters is converted to
+ the appropriate C++ implementation class ViewInformation2D.
+
+ This base class does not implement any buffering; e.g. buffering the decompositon
+ and/or the range. These may be buffered anytime since the definition is that the primitive
+ is read-only and thus unchangeable. This implies that the decomposition and/or getting
+ the range will lead to the same result as last time, under the precondition that
+ the parameter ViewInformation2D is the same as the last one. This is usually the case
+ for view-independent primitives which are defined by not using ViewInformation2D
+ in their get2DDecomposition/getB2DRange implementations.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BasePrimitive2D
+ : private boost::noncopyable,
+ protected comphelper::OBaseMutex,
+ public BasePrimitive2DImplBase
+ {
+ private:
+ protected:
+ public:
+ // constructor/destructor
+ BasePrimitive2D();
+ virtual ~BasePrimitive2D();
+
+ /** the ==operator is mainly needed to allow testing newly-created primitives against their last
+ incarnation which buffers/holds the made decompositions. The default implementation
+ uses getPrimitive2DID()-calls to test if it's the same ID at last. Overloaded implementation are then
+ based on this implementation
+ */
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+ bool operator!=( const BasePrimitive2D& rPrimitive ) const { return !operator==(rPrimitive); }
+
+ /// The default implementation will use getDecomposition results to create the range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from drawinglayer_primitivetypes2d.hxx to define unique IDs.
+ This method is normally defined using DeclPrimitrive2DIDBlock()
+ */
+ virtual sal_uInt32 getPrimitive2DID() const = 0;
+
+ /// The default implementation will return an empty sequence
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ //
+ // Methods from XPrimitive2D
+ //
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual Primitive2DSequence SAL_CALL getDecomposition( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** The getRange implementation for UNO API will use getRange from this implementation. It
+ will construct a ViewInformation2D from the ViewParameters for that purpose
+ */
+ virtual ::com::sun::star::geometry::RealRectangle2D SAL_CALL getRange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// BufferedDecompositionPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BufferedDecompositionPrimitive2D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+ which want to buffer the decomoposition result
+
+ Buffering the decomposition is the most-used buffering and is thus used my most
+ primitive implementations which support a decomposition as base class.
+
+ The buffering is done by holding the last decomposition in the local parameter
+ maBuffered2DDecomposition. The default implementation of get2DDecomposition checks
+ if maBuffered2DDecomposition is empty. If yes, it uses create2DDecomposition
+ to create the content. In all cases, maBuffered2DDecomposition is returned.
+
+ For view-dependent primitives derived from Primitive2DBufferDecomposition more needs
+ to be done when the decomposition depends on parts of the parameter ViewInformation2D.
+ This defines a standard method for processing these:
+
+ Implement a view-dependent get2DDecomposition doing te following steps:
+ (a) Locally extract needed parameters from ViewInformation2D to new, local parameters
+ (this may be a complete local copy of ViewInformation2D)
+ (b) If a buffered decomposition exists, ckeck if one of the new local parameters
+ differs from the corresponding locally remembered (as member) ones. If yes,
+ clear maBuffered2DDecomposition
+ (d) call baseclass::get2DDecomposition which will use create2DDecomposition
+ to fill maBuffered2DDecomposition if it's empty
+ (e) copy the new local parameters to the corresponding locally remembered ones
+ to identify if a new decomposition is needed at the next call
+ (f) return maBuffered2DDecomposition
+ */
+ class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive2D
+ : public BasePrimitive2D
+ {
+ private:
+ /// a sequence used for buffering the last create2DDecomposition() result
+ Primitive2DSequence maBuffered2DDecomposition;
+
+ protected:
+ /** access methods to maBuffered2DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive2DSequence& getBuffered2DDecomposition() const { return maBuffered2DDecomposition; }
+ void setBuffered2DDecomposition(const Primitive2DSequence& rNew) { maBuffered2DDecomposition = rNew; }
+
+ /** method which is to be used to implement the local decomposition of a 2D primitive. The default
+ implementation will just return an empty decomposition
+ */
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ // constructor/destructor
+ BufferedDecompositionPrimitive2D();
+
+ /** The getDecomposition default implementation will on demand use create2DDecomposition() if
+ maBuffered2DDecomposition is empty. It will set maBuffered2DDecomposition to this obtained decomposition
+ to buffer it. If the decomposition is also ViewInformation2D-dependent, this method needs to be
+ overloaded and the ViewInformation2D for the last decomposition need to be remembered, too, and
+ be used in the next call to decide if the buffered decomposition may be reused or not.
+ */
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// support to handle a sequence of primitives as stl vector and convert it during creation
+ typedef ::std::vector< BasePrimitive2D* > Primitive2DVector;
+ Primitive2DSequence DRAWINGLAYER_DLLPUBLIC Primitive2DVectorToPrimitive2DSequence(const Primitive2DVector& rSource, bool bInvert = false);
+
+ /// get B2DRange from a given Primitive2DReference
+ basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& aViewInformation);
+
+ /// get B2DRange from a given Primitive2DSequence
+ basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const geometry::ViewInformation2D& aViewInformation);
+
+ /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DReferencesEqual(const Primitive2DReference& rA, const Primitive2DReference& rB);
+
+ /// compare two Primitive2DReferences for equality, uses arePrimitive2DReferencesEqual internally
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB);
+
+ /// concatenate sequence
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive2DSequenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DSequence& rSource);
+
+ /// concatenate single Primitive2D
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive2DReferenceToPrimitive2DSequence(Primitive2DSequence& rDest, const Primitive2DReference& rSource);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
new file mode 100644
index 000000000000..fa262bd9fe95
--- /dev/null
+++ b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// BitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BitmapPrimitive2D class
+
+ This class is the central primitive for Bitmap-based primitives.
+ It provides RGBA-based bitmaps, currently using a BitmapEx from VCL.
+ This may change in the future to any other, maybe more general base
+ class providing 24bit RGBA.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BitmapPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the RGBA Bitmap-data
+ BitmapEx maBitmapEx;
+
+ /** the object transformation from unit coordinates, defining
+ size, shear, rotate and position
+ */
+ basegfx::B2DHomMatrix maTransform;
+
+ public:
+ /// constructor
+ BitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DHomMatrix& rTransform);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BITMAPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
new file mode 100644
index 000000000000..d9ed473851f4
--- /dev/null
+++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <svtools/ctrlbox.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BorderLinePrimitive2D class
+
+ This is the basic primitive to build frames around objects, e.g. tables.
+ It defines a single or double line from Start to nd using the LeftWidth,
+ Distance and RightWidth definitions.
+ The LineStart/End overlap is defined by the Extend(Inner|Outer)(Start|End)
+ definitions.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BorderLinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the line definition
+ basegfx::B2DPoint maStart;
+ basegfx::B2DPoint maEnd;
+
+ /// the widths of single/double line
+ double mfLeftWidth;
+ double mfDistance;
+ double mfRightWidth;
+
+ /// edge overlap sizes
+ double mfExtendLeftStart;
+ double mfExtendLeftEnd;
+ double mfExtendRightStart;
+ double mfExtendRightEnd;
+
+ /// the line colors
+ basegfx::BColor maRGBColorRight;
+ basegfx::BColor maRGBColorLeft;
+ basegfx::BColor maRGBColorGap;
+ bool mbHasGapColor;
+
+ short mnStyle;
+
+ /// local helpers
+ double getWidth(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ bool isSolidLine() const
+ {
+ return (mnStyle==STYLE_SOLID);
+ }
+
+ bool isInsideUsed() const
+ {
+ return !basegfx::fTools::equalZero(mfLeftWidth);
+ }
+
+ bool isOutsideUsed() const
+ {
+ return !basegfx::fTools::equalZero(mfRightWidth);
+ }
+
+ protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ BorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ double fExtendLeftStart,
+ double fExtendLeftEnd,
+ double fExtendRightStart,
+ double fExtendRightEnd,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle );
+
+ /// data read access
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+ double getLeftWidth() const { return mfLeftWidth; }
+ double getDistance() const { return mfDistance; }
+ double getRightWidth() const { return mfRightWidth; }
+ double getExtendLeftStart() const { return mfExtendLeftStart; }
+ double getExtendLeftEnd() const { return mfExtendLeftEnd; }
+ double getExtendRightStart() const { return mfExtendRightStart; }
+ double getExtendRightEnd() const { return mfExtendRightEnd; }
+ const basegfx::BColor& getRGBColorRight () const { return maRGBColorRight; }
+ const basegfx::BColor& getRGBColorLeft () const { return maRGBColorLeft; }
+ const basegfx::BColor& getRGBColorGap () const { return maRGBColorGap; }
+ bool hasGapColor( ) const { return mbHasGapColor; }
+ short getStyle () const { return mnStyle; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BORDERLINEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
new file mode 100644
index 000000000000..6db292fd6859
--- /dev/null
+++ b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** BorderLinePrimitive2D clipped by the intersection with a provided
+ polygon.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ClippedBorderLinePrimitive2D : public BorderLinePrimitive2D
+ {
+ private:
+ const basegfx::B2DPolygon maIntersection;
+
+ protected:
+ virtual basegfx::B2DPolyPolygon getClipPolygon(
+ const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ ClippedBorderLinePrimitive2D(
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ double fLeftWidth,
+ double fDistance,
+ double fRightWidth,
+ const basegfx::B2DPolygon& rIntersection,
+ const basegfx::BColor& rRGBColorRight,
+ const basegfx::BColor& rRGBColorLeft,
+ const basegfx::BColor& rRGBColorGap,
+ bool bHasGapColor,
+ const short nStyle );
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CLIPPEDBORDERLINEPRIMITIVE2D_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/controlprimitive2d.hxx b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
new file mode 100644
index 000000000000..789b7aa38471
--- /dev/null
+++ b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/awt/XControl.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ControlPrimitive2D class
+
+ Base class for ControlPrimitive handling. It decoposes to a
+ graphical representation (Bitmap data) of the control. This
+ representation is limited to a quadratic pixel maximum defined
+ in the applicatin settings.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ControlPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// object's base data
+ basegfx::B2DHomMatrix maTransform;
+ com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel;
+
+ /// the created an cached awt::XControl
+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxXControl;
+
+ /// the last used scaling, used from getDecomposition for buffering
+ basegfx::B2DVector maLastViewScaling;
+
+ /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl
+ and from thereon always used and returned by getXControl()
+ */
+ void createXControl();
+
+ /// single local decompositions, used from create2DDecomposition()
+ Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ protected:
+ /// local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ ControlPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel);
+
+ /** constructor with an additional XControl as parameter to allow to hand it over at incarnation time
+ if it exists. This will avoid to create a 2nd one on demand in createXControl()
+ and thus double the XControls.
+ */
+ ControlPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel,
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& rxXControl);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& getControlModel() const { return mxControlModel; }
+
+ /** mxControl access. This will on demand create the awt::XControl using createXControl()
+ if it does not exist. It may already have been created or even handed over at
+ incarnation
+ */
+ const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& getXControl() const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/cropprimitive2d.hxx b/include/drawinglayer/primitive2d/cropprimitive2d.hxx
new file mode 100644
index 000000000000..25d044b3231f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/cropprimitive2d.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** CropPrimitive2D class
+
+ Caution: Due to old constraints (old core definitions) the
+ crop distances describe how the uncropped content is defined
+ relative to the current object size. This means that maTransformation
+ describes the rurrent object size (the part of the object visible
+ with the crop applied). To get the original size and orientation
+ of the uncropped content it is necessary to calc back from the
+ current situation (maTransformation) using the crop values
+ to get to the uncropped original content.
+
+ Thus a transformation has to be calculated which will be applied
+ to the already exsisting content to get it to the uncropped state
+ ans then this is masked with the current state (mask polygon
+ created from unit polygon and maTransformation).
+
+ At least in this primitive the units of the crop values are
+ already in the local coordinate system; inthe core these distances
+ are defined relative to the object content size (PrefMapMode
+ and PrefSize of the content)...
+
+ Of course this is a primitive, so feel free to just ignore all that
+ stuff and use the automatically generated decomposition. Sigh.
+ */
+ class DRAWINGLAYER_DLLPUBLIC CropPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ // the transformation already applied to the child geometry
+ basegfx::B2DHomMatrix maTransformation;
+
+ // the crop offsets relative to the range of the unrotated content
+ double mfCropLeft;
+ double mfCropTop;
+ double mfCropRight;
+ double mfCropBottom;
+
+ public:
+ /// constructor
+ CropPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const basegfx::B2DHomMatrix& rTransformation,
+ double fCropLeft,
+ double fCropTop,
+ double fCropRight,
+ double fCropBottom);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ double getCropLeft() const { return mfCropLeft; }
+ double getCropTop() const { return mfCropTop; }
+ double getCropRight() const { return mfCropRight; }
+ double getCropBottom() const { return mfCropBottom; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// local decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
new file mode 100644
index 000000000000..9b8528057c14
--- /dev/null
+++ b/include/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// DiscreteBitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteBitmapPrimitive2D class
+
+ This class defines a view-dependent BitmapPrimitive which has a
+ logic position for the top-left position and is always to be
+ painted in 1:1 pixel resolution. It will never be sheared, rotated
+ or scaled with the view.
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteBitmapPrimitive2D : public ObjectAndViewTransformationDependentPrimitive2D
+ {
+ private:
+ /// the RGBA Bitmap-data
+ BitmapEx maBitmapEx;
+
+ /** the top-left object position */
+ basegfx::B2DPoint maTopLeft;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ DiscreteBitmapPrimitive2D(
+ const BitmapEx& rBitmapEx,
+ const basegfx::B2DPoint& rTopLeft);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+ const basegfx::B2DPoint& getTopLeft() const { return maTopLeft; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_DISCRETEBITMAPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx b/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
new file mode 100644
index 000000000000..2c10292b1c59
--- /dev/null
+++ b/include/drawinglayer/primitive2d/discreteshadowprimitive2d.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// DiscreteShadowPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteShadow data class
+
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteShadow
+ {
+ private:
+ /// the original shadow BitmapEx in a special form
+ BitmapEx maBitmapEx;
+
+ /// buffered extracted parts of CombinedShadow for easier usage
+ BitmapEx maTopLeft;
+ BitmapEx maTop;
+ BitmapEx maTopRight;
+ BitmapEx maRight;
+ BitmapEx maBottomRight;
+ BitmapEx maBottom;
+ BitmapEx maBottomLeft;
+ BitmapEx maLeft;
+
+ public:
+ /// constructor
+ explicit DiscreteShadow(const BitmapEx& rBitmapEx);
+
+ /// data read access
+ const BitmapEx& getBitmapEx() const { return maBitmapEx; }
+
+ /// compare operator
+ bool operator==(const DiscreteShadow& rCompare) const
+ {
+ return getBitmapEx() == rCompare.getBitmapEx();
+ }
+
+ /// helper accesses which create on-demand needed segments
+ const BitmapEx& getTopLeft() const;
+ const BitmapEx& getTop() const;
+ const BitmapEx& getTopRight() const;
+ const BitmapEx& getRight() const;
+ const BitmapEx& getBottomRight() const;
+ const BitmapEx& getBottom() const;
+ const BitmapEx& getBottomLeft() const;
+ const BitmapEx& getLeft() const;
+ };
+
+ /** DiscreteShadowPrimitive2D class
+
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteShadowPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ // the object transformation of the rectangular object
+ basegfx::B2DHomMatrix maTransform;
+
+ // the bitmap shadow data
+ DiscreteShadow maDiscreteShadow;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ DiscreteShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const DiscreteShadow& rDiscreteShadow);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const DiscreteShadow& getDiscreteShadow() const { return maDiscreteShadow; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_QUADRATICSHADOWPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
new file mode 100644
index 000000000000..cb8ff0efd0ff
--- /dev/null
+++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// define ranges for other libraries
+
+#define PRIMITIVE2D_ID_RANGE_DRAWINGLAYER (0 << 16)
+#define PRIMITIVE2D_ID_RANGE_SVX (1 << 16)
+#define PRIMITIVE2D_ID_RANGE_SD (2 << 16)
+#define PRIMITIVE2D_ID_RANGE_SW (3 << 16)
+#define PRIMITIVE2D_ID_RANGE_SC (4 << 16)
+
+//////////////////////////////////////////////////////////////////////////////
+// local primitives
+
+#define PRIMITIVE2D_ID_TRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 0)
+#define PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 1)
+#define PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 2)
+#define PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 3)
+#define PRIMITIVE2D_ID_BACKGROUNDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 4)
+#define PRIMITIVE2D_ID_BITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 5)
+#define PRIMITIVE2D_ID_CONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 6)
+#define PRIMITIVE2D_ID_EMBEDDED3DPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 7)
+#define PRIMITIVE2D_ID_FILLBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 8)
+#define PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE2D_ID_GRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE2D_ID_GRIDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE2D_ID_GROUPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE2D_ID_HELPLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE2D_ID_MARKERARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE2D_ID_MASKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE2D_ID_MEDIAPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE2D_ID_METAFILEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 18)
+#define PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 19)
+#define PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 20)
+#define PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 21)
+#define PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 22)
+#define PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 23)
+#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 24)
+#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 25)
+#define PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 26)
+#define PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 27)
+#define PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 28)
+#define PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 29)
+#define PRIMITIVE2D_ID_SCENEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 30)
+#define PRIMITIVE2D_ID_SHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 31)
+#define PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 32)
+#define PRIMITIVE2D_ID_TEXTDECORATEDPORTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 33)
+#define PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 34)
+#define PRIMITIVE2D_ID_UNIFIEDTRANSPARENCEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 35)
+#define PRIMITIVE2D_ID_POINTARRAYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 36)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYFIELDPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 37)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 38)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYPARAGRAPHPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 39)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYBLOCKPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 40)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 41)
+#define PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 42)
+#define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43)
+#define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44)
+#define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45)
+#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46)
+#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47)
+#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48)
+#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49)
+#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
+#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
+#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
+#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
+#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
+#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
+#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
+#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
+#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
+#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
+#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
+#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
+#define PRIMITIVE2D_ID_SVGLINEARGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
+#define PRIMITIVE2D_ID_SVGLINEARATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
+#define PRIMITIVE2D_ID_SVGRADIALATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 65)
+#define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66)
+#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
+#define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
+
+#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVETYPES2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx b/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
new file mode 100644
index 000000000000..d7389bea2bc3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// Embedded3DPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** Embedded3DPrimitive2D class
+
+ This is a helper primitive which allows embedding of single 3D
+ primitives to the 2D primitive logic. It will get the scene it's
+ involved and thus the 3D transformation. With this information it
+ is able to provide 2D range data for a 3D primitive.
+
+ This primitive will not be visualized and decomposes to a yellow
+ 2D rectangle to visualize that this should never be visualized
+ */
+ class DRAWINGLAYER_DLLPUBLIC Embedded3DPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the sequence of 3d primitives
+ primitive3d::Primitive3DSequence mxChildren3D;
+
+ /// the 2D scene object transformation
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// the 3D transformations
+ geometry::ViewInformation3D maViewInformation3D;
+
+ /** if the embedded 3D primitives contain shadow, these parameters are needed
+ to extract the shadow wich is a sequence od 2D primitives and may expand
+ the 2D range. Since every single 3D object in a scene may individually
+ have shadow or not, these values need to be provided and prepared. The shadow
+ distance itself (a 2D transformation) is part of the 3D shadow definition
+ */
+ basegfx::B3DVector maLightNormal;
+ double mfShadowSlant;
+ basegfx::B3DRange maScene3DRange;
+
+ /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DSequence maShadowPrimitives;
+
+ /// #i96669# add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+ /// bitfield
+ /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
+ are created in maShadowPrimitives
+ */
+ unsigned mbShadow3DChecked : 1;
+
+ /// private helpers
+ bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ Embedded3DPrimitive2D(
+ const primitive3d::Primitive3DSequence& rxChildren3D,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const geometry::ViewInformation3D& rViewInformation3D,
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rScene3DRange);
+
+ /// data read access
+ const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ const basegfx::B3DVector& getLightNormal() const { return maLightNormal; }
+ double getShadowSlant() const { return mfShadowSlant; }
+ const basegfx::B3DRange& getScene3DRange() const { return maScene3DRange; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EMBEDDED3DPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/epsprimitive2d.hxx b/include/drawinglayer/primitive2d/epsprimitive2d.hxx
new file mode 100644
index 000000000000..577554481d6e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/epsprimitive2d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/gfxlink.hxx>
+#include <vcl/gdimtf.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** EpsPrimitive2D class */
+ class DRAWINGLAYER_DLLPUBLIC EpsPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maEpsTransform;
+
+ /// the Eps content definition
+ GfxLink maGfxLink;
+
+ /// the replacement content definition
+ GDIMetaFile maMetaFile;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ EpsPrimitive2D(
+ const basegfx::B2DHomMatrix& rEpsTransform,
+ const GfxLink& rGfxLink,
+ const GDIMetaFile& rMetaFile);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getEpsTransform() const { return maEpsTransform; }
+ const GfxLink& getGfxLink() const { return maGfxLink; }
+ const GDIMetaFile& getMetaFile() const { return maMetaFile; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_EPSPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx b/include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx
new file mode 100644
index 000000000000..0c82458840ad
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillbitmapprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// FillbitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FillBitmapPrimitive2D class
+
+ This class defines a bitmap filling for a rectangular area. The
+ Range is defined by the Transformation, the fill by the FillBitmapAttribute.
+ There, the fill consists of a Bitmap (not transparent) defining the fill data
+ and a Point/Vector pair defining the relative position/size [0.0 .. 1.0]
+ inside the area where the bitmap is positioned. A flag defines then if this
+ is tiled or not.
+
+ Renderers should handle this primitive; it has a geometrically correct
+ decomposition, but on pixel oututs the areas where the tiled pieces are
+ aligned tend to show up (one overlapping or empty pixel)
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillBitmapPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DHomMatrix maTransformation;
+
+ /// the fill attributes
+ attribute::FillBitmapAttribute maFillBitmap;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ FillBitmapPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const attribute::FillBitmapAttribute& rFillBitmap);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLBITMAPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
new file mode 100644
index 000000000000..0f6c33ae8f95
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillgradientprimitive2d.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx { class B2DPolygon; }
+
+//////////////////////////////////////////////////////////////////////////////
+// FillGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FillGradientPrimitive2D class
+
+ This class defines a gradient filling for a rectangular area. The
+ Range is defined by the Transformation, the gradient by the FillGradientAttribute.
+
+ The decomposition will deliver the decomposed gradient, e.g. for an ellipse
+ gradient the various ellipses in various color steps will be created.
+
+ I have added functionality to create both versions of filled decompositions:
+ Those who overlap and non-overlapping ones. The overlapping version is the
+ default one since it works with and without AntiAliasing. The non-overlapping
+ version is used in the MetafilePrimitive2D decomposition when the old XOR
+ paint was recorded.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillGradientPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DRange maObjectRange;
+
+ /// the gradient definition
+ attribute::FillGradientAttribute maFillGradient;
+
+ /// local helpers
+ void generateMatricesAndColors(
+ std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ std::vector< basegfx::BColor >& rColors) const;
+ Primitive2DSequence createOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+ Primitive2DSequence createNonOverlappingFill(
+ const std::vector< basegfx::B2DHomMatrix >& rMatrices,
+ const std::vector< basegfx::BColor >& rColors,
+ const basegfx::B2DPolygon& rUnitPolygon) const;
+
+ protected:
+ /// local helper
+ Primitive2DSequence createFill(bool bOverlapping) const;
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ FillGradientPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ /// data read access
+ const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
+ const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLGRADIENTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
new file mode 100644
index 000000000000..b0c27ba89107
--- /dev/null
+++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// FillHatchPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FillHatchPrimitive2D class
+
+ This class defines a hatch filling for a rectangular area. The
+ Range is defined by the Transformation, the hatch by the FillHatchAttribute.
+ If the background is to be filled, a flag in FillHatchAttribute is set and
+ the BColor defines the background color.
+
+ The decomposition will deliver the hatch lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DRange maObjectRange;
+
+ /// the hatch definition
+ attribute::FillHatchAttribute maFillHatch;
+
+ /// hatch background color (if used)
+ basegfx::BColor maBColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ FillHatchPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const basegfx::BColor& rBColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+
+ /// data read access
+ const basegfx::B2DRange& getObjectRange() const { return maObjectRange; }
+ const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_FILLHATCHPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/graphicprimitive2d.hxx b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
new file mode 100644
index 000000000000..75bb6fc99341
--- /dev/null
+++ b/include/drawinglayer/primitive2d/graphicprimitive2d.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <svtools/grfmgr.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** GraphicPrimitive2D class
+
+ Primitive to hold graphics defined by GraphicObject and GraphicAttr
+ combination. This includes MetaFiles and diverse pixel-oriented graphic
+ formats. It even includes animated GIFs, Croppings and other changes
+ defined in GraphicAttr.
+
+ This makes the decomposition contain a wide variety of possibilites,
+ too. From a simple BitmapPrimitive over AnimatedSwitchPrimitive2D,
+ MetafilePrimitive2D (with and without embedding in a masking when e.g.
+ the Metafile is bigger than the geometry) and embeddings in
+ TransformPrimitive2D and MaskPrimitive2D for croppings.
+
+ The primitive geometry area is defined by Transform.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GraphicPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometric definition
+ basegfx::B2DHomMatrix maTransform;
+
+ /// the GraphicObject with all it's content possibilities
+ GraphicObject maGraphicObject;
+
+ /// The GraphicAttr with all it's modification possibilities
+ GraphicAttr maGraphicAttr;
+
+ protected:
+ /// local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor(s)
+ GraphicPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const GraphicObject& rGraphicObject,
+ const GraphicAttr& rGraphicAttr);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const GraphicObject& getGraphicObject() const { return maGraphicObject; }
+ const GraphicAttr& getGraphicAttr() const { return maGraphicAttr; }
+ bool isTransparent() const;
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRAPHICPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/gridprimitive2d.hxx b/include/drawinglayer/primitive2d/gridprimitive2d.hxx
new file mode 100644
index 000000000000..3db300ff4da4
--- /dev/null
+++ b/include/drawinglayer/primitive2d/gridprimitive2d.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// GridPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** GridPrimitive2D class
+
+ This primitive is specialized to Grid visualisation. The graphic definition
+ (Transform) contains the whole grid area, but will of course be combined
+ with the visible area (Viewport) when decomposed. Also a reolution-dependent
+ point reduction is used to not create too much grid visualisation data. This
+ makes this primitive highly view-dependent and it dynamically buffers
+ the last decomposition dependent from the Viewport used.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GridPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// The geometry definition for the grid area
+ basegfx::B2DHomMatrix maTransform;
+
+ /// grid layout definitions
+ double mfWidth;
+ double mfHeight;
+ double mfSmallestViewDistance;
+ double mfSmallestSubdivisionViewDistance;
+ sal_uInt32 mnSubdivisionsX;
+ sal_uInt32 mnSubdivisionsY;
+
+ /// Grid color for single-pixel grid points
+ basegfx::BColor maBColor;
+
+ /// The Bitmap (with transparence) for grid cross points
+ BitmapEx maCrossMarker;
+
+ /** the last used object to view transformtion and the last Viewport,
+ used from getDecomposition for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+ basegfx::B2DRange maLastViewport;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ GridPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ double fWidth,
+ double fHeight,
+ double fSmallestViewDistance,
+ double fSmallestSubdivisionViewDistance,
+ sal_uInt32 nSubdivisionsX,
+ sal_uInt32 nSubdivisionsY,
+ const basegfx::BColor& rBColor,
+ const BitmapEx& rCrossMarker);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ double getWidth() const { return mfWidth; }
+ double getHeight() const { return mfHeight; }
+ double getSmallestViewDistance() const { return mfSmallestViewDistance; }
+ double getSmallestSubdivisionViewDistance() const { return mfSmallestSubdivisionViewDistance; }
+ sal_uInt32 getSubdivisionsX() const { return mnSubdivisionsX; }
+ sal_uInt32 getSubdivisionsY() const { return mnSubdivisionsY; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ const BitmapEx& getCrossMarker() const { return maCrossMarker; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get 2d range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/groupprimitive2d.hxx b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
new file mode 100644
index 000000000000..7dab4a628638
--- /dev/null
+++ b/include/drawinglayer/primitive2d/groupprimitive2d.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// GroupPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** GroupPrimitive2D class
+
+ Baseclass for all grouping 2D primitives
+
+ The grouping primitive in it's basic form is capable of holding
+ a child primitive content and returns it on decomposition on default.
+ It is used for two main purposes, but more may apply:
+
+ - to transport extended information, e.g. for text classification,
+ see e.g. TextHierarchy*Primitive2D implementations. Since they
+ decompose to their child content, renderers not aware/interested
+ in that extra information will just ignore these primitives
+
+ - to encapsulate common geometry, e.g. the ShadowPrimitive2D implements
+ applying a generic shadow to a child sequence by adding the needed
+ offset and color stuff in the decomposition
+
+ In most cases the decomposition is straightforward, so by default
+ this primitive will not buffer the result and is not derived from
+ BufferedDecompositionPrimitive2D, but from BasePrimitive2D.
+
+ A renderer has to take GroupPrimitive2D derivations into account which
+ are used to hold a state.
+
+ Current Basic 2D StatePrimitives are:
+
+ - TransparencePrimitive2D (objects with freely defined transparence)
+ - InvertPrimitive2D (for XOR)
+ - MaskPrimitive2D (for masking)
+ - ModifiedColorPrimitive2D (for a stack of color modifications)
+ - TransformPrimitive2D (for a transformation stack)
+ */
+ class DRAWINGLAYER_DLLPUBLIC GroupPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the children. Declared private since this shall never be changed at all after construction
+ Primitive2DSequence maChildren;
+
+ public:
+ /// constructor
+ explicit GroupPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const Primitive2DSequence& getChildren() const { return maChildren; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// local decomposition. Implementation will just return children
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GROUPPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/helplineprimitive2d.hxx b/include/drawinglayer/primitive2d/helplineprimitive2d.hxx
new file mode 100644
index 000000000000..c9addb8f3810
--- /dev/null
+++ b/include/drawinglayer/primitive2d/helplineprimitive2d.hxx
@@ -0,0 +1,114 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// HelplinePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** HelplineStyle2D definition
+
+ The available styles of Helplines
+ */
+ enum HelplineStyle2D
+ {
+ HELPLINESTYLE2D_POINT,
+ HELPLINESTYLE2D_LINE
+ };
+
+ /** HelplinePrimitive2D class
+
+ This primitive provides a view-dependent helpline definition. The Helpline
+ is defined by a line equation (Point and vector) and a style. When the style
+ is a line, dependent from Viewport the visible part of that Helpline is
+ constructed. For Point, a cross is constructed. This primitive is highly
+ view-dependent.
+
+ The visualisation uses the two given colors to create a dashed line with
+ the given dash length.
+ */
+ class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// Helpline geometry definition
+ basegfx::B2DPoint maPosition;
+ basegfx::B2DVector maDirection;
+ HelplineStyle2D meStyle;
+
+ /// Helpline style definition
+ basegfx::BColor maRGBColA;
+ basegfx::BColor maRGBColB;
+ double mfDiscreteDashLength;
+
+ /** the last used object to view transformtion and the last Viewport,
+ used from getDecomposition for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+ basegfx::B2DRange maLastViewport;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ HelplinePrimitive2D(
+ const basegfx::B2DPoint& rPosition,
+ const basegfx::B2DVector& rDirection,
+ HelplineStyle2D eStyle,
+ const basegfx::BColor& rRGBColA,
+ const basegfx::BColor& aRGBColB,
+ double fDiscreteDashLength);
+
+ /// data read access
+ const basegfx::B2DPoint& getPosition() const { return maPosition; }
+ const basegfx::B2DVector& getDirection() const { return maDirection; }
+ HelplineStyle2D getStyle() const { return meStyle; }
+ const basegfx::BColor& getRGBColA() const { return maRGBColA; }
+ const basegfx::BColor& getRGBColB() const { return maRGBColB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx b/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx
new file mode 100644
index 000000000000..35c8de40bc4d
--- /dev/null
+++ b/include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // This primitive is used to represent geometry for non-visible objects,
+ // e.g. a PresObj's outline. To still be able to use primitives for HitTest
+ // functionality, the 2d decompositions will produce an as much as possible
+ // simplified line geometry encapsulated in this primtive when there is no
+ // line geometry. In a further enchanced version this may change to 'if neither
+ // filled nor lines' creation criteria. The whole primitive decomposes to nothing,
+ // so no one not knowing it will be influenced. Only helper processors for hit test
+ // (and maybe BoundRect extractors) will use it and it's children subcontent.
+ class DRAWINGLAYER_DLLPUBLIC HiddenGeometryPrimitive2D : public GroupPrimitive2D
+ {
+ public:
+ explicit HiddenGeometryPrimitive2D(const Primitive2DSequence& rChildren);
+
+ // despite returning an empty decomposition since it's no visualisation data,
+ // range calculation is intended to use hidden geometry, so
+ // the local implementation will return the children's range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// local decomposition. Implementation will return empty Primitive2DSequence
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ // provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HIDDENGEOMETRYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/invertprimitive2d.hxx b/include/drawinglayer/primitive2d/invertprimitive2d.hxx
new file mode 100644
index 000000000000..dfff3d9034ba
--- /dev/null
+++ b/include/drawinglayer/primitive2d/invertprimitive2d.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** InvertPrimitive2D class
+
+ This is a helper class which encapsulates geometry that should be
+ painted XOR, e.g. old cursor visualisations. It decomposes to
+ it's content, so when not supporting it, the contained geometry
+ will be visualized normally.
+ Unfortunately this is still needed, but hard to support on various
+ systems. XOR painting needs read access to the target, so modern
+ graphic systems tend to not support it anymore.
+ */
+ class DRAWINGLAYER_DLLPUBLIC InvertPrimitive2D : public GroupPrimitive2D
+ {
+ public:
+ /// constructor
+ explicit InvertPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INVERTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx
new file mode 100644
index 000000000000..b1bca354e60e
--- /dev/null
+++ b/include/drawinglayer/primitive2d/markerarrayprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// MarkerArrayPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MarkerArrayPrimitive2D class
+
+ This primtive defines an array of markers. Their size is defined
+ in pixels and independent from the view transformation which makes
+ this primitive highly view-dependent. It is also transformation
+ invariant, so that the bitmap is always visualized unscaled and
+ unrotated.
+ It is used e.g. for grid position visualisation. The given Bitmap
+ (with transparence) is defined to be visible centered at each of the given
+ positions.
+ It decomposes to the needed number of BitmapPrimitive2D's, so it would
+ be efficient to handle it directly in a renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MarkerArrayPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the positions for the marker
+ std::vector< basegfx::B2DPoint > maPositions;
+
+ /// the marker definintion to visualize
+ BitmapEx maMarker;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ MarkerArrayPrimitive2D(
+ const std::vector< basegfx::B2DPoint >& rPositions,
+ const BitmapEx& rMarker);
+
+ /// data read access
+ const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
+ const BitmapEx& getMarker() const { return maMarker; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/maskprimitive2d.hxx b/include/drawinglayer/primitive2d/maskprimitive2d.hxx
new file mode 100644
index 000000000000..af5fcd9177d1
--- /dev/null
+++ b/include/drawinglayer/primitive2d/maskprimitive2d.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MaskPrimitive2D class
+
+ This is the central masking primitive. It's a grouping
+ primitive and contains a PolyPolygon which defines the visible
+ area. Only visualisation parts of the Child primitive sequence
+ inside of the mask PolyPolygon is defined to be visible.
+
+ This primitive should be handled by a renderer. If it is not handled,
+ it decomposes to it's Child content, and thus the visualisation would
+ contaiun no clips.
+
+ The geometrc range of this primitive is completely defined by the Mask
+ PolyPolygon since by definition nothing outside of the mask is visible.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MaskPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the mask PolyPolygon
+ basegfx::B2DPolyPolygon maMask;
+
+ public:
+ /// constructor
+ MaskPrimitive2D(
+ const basegfx::B2DPolyPolygon& rMask,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MASKPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/mediaprimitive2d.hxx b/include/drawinglayer/primitive2d/mediaprimitive2d.hxx
new file mode 100644
index 000000000000..df75569ecb64
--- /dev/null
+++ b/include/drawinglayer/primitive2d/mediaprimitive2d.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vcl/graph.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MediaPrimitive2D class
+
+ This is a unified primitive for Media visualisation, e.g. animations
+ or sounds. It's geometry is defined by Transform. For conveinience,
+ it also contains a discrete border size (aka Pixels) which will be added
+ if used. This makes it a view-dependent primitive. It also gets a filled
+ background and the decomposition will try to create a graphic representation
+ if te content (defined by the URL), e.g. a still frome for animated stuff.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MediaPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maTransform;
+
+ /// the content definition
+ OUString maURL;
+
+ /// style: background color
+ basegfx::BColor maBackgroundColor;
+
+ /// discrete border (in 'pixels')
+ sal_uInt32 mnDiscreteBorder;
+
+ const Graphic maSnapshot;
+
+ protected:
+ /// local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ MediaPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransform,
+ const OUString& rURL,
+ const basegfx::BColor& rBackgroundColor,
+ sal_uInt32 nDiscreteBorder,
+ const Graphic &rSnapshot);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ const OUString& getURL() const { return maURL; }
+ const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
+ sal_uInt32 getDiscreteBorder() const { return mnDiscreteBorder; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MEDIAPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/metafileprimitive2d.hxx b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
new file mode 100644
index 000000000000..a8e8cf883991
--- /dev/null
+++ b/include/drawinglayer/primitive2d/metafileprimitive2d.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/gdimtf.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// MetafilePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** MetafilePrimitive2D class
+
+ This is the MetaFile representing primitive. It's geometry is defined
+ by MetaFileTransform. The content (defined by MetaFile) will be scaled
+ to the geometric definiton by using PrefMapMode and PrefSize of the
+ Metafile.
+
+ It has shown that this not always guarantees that all Metafile content
+ is inside the geometric definition, but this primitive defines that this
+ is the case to allow a getB2DRange implementation. If it cannot be
+ guaranteed that the Metafile is inside the geometric definition, it should
+ be embedded to a MaskPrimitive2D.
+
+ This primitive has no decomposition yet, so when not supported by a renderer,
+ it will not be visualized.
+
+ In the future, a decomposition implementation would be appreciated and would
+ have many advantages; Metafile would no longer have to be rendered by
+ sub-systems and a standard way for converting Metafiles would exist.
+ */
+ class DRAWINGLAYER_DLLPUBLIC MetafilePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the geometry definition
+ basegfx::B2DHomMatrix maMetaFileTransform;
+
+ /// the content definition
+ GDIMetaFile maMetaFile;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ public:
+ /// constructor
+ MetafilePrimitive2D(
+ const basegfx::B2DHomMatrix& rMetaFileTransform,
+ const GDIMetaFile& rMetaFile);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransform() const { return maMetaFileTransform; }
+ const GDIMetaFile& getMetaFile() const { return maMetaFile; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_METAFILEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx b/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx
new file mode 100644
index 000000000000..7584cfad27b7
--- /dev/null
+++ b/include/drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ModifiedColorPrimitive2D class
+
+ This primitive is a grouping primitive and allows to define
+ how the colors of it's child content shall be modified for
+ visualisation. This can be (and is) used e.g. for generic shadow
+ visualisation by forcing all color usages of the contained
+ sub-content to the shadow color.
+
+ For the possibilities of color modifications, please refer
+ to the basegfx::BColorModifier definitions in basegfx. For
+ processing there is tooling in basegfx to build a stack of
+ BColorModifiers to always be able to proccess the correct
+ colors.
+
+ If a renderer does not handle this primitive, the content will
+ be visualized unchanged.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ModifiedColorPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// The ColorModifier to use
+ basegfx::BColorModifier maColorModifier;
+
+ public:
+ /// constructor
+ ModifiedColorPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const basegfx::BColorModifier& rColorModifier);
+
+ /// data read access
+ const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MODIFIEDCOLORPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx b/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx
new file mode 100644
index 000000000000..ec5452773751
--- /dev/null
+++ b/include/drawinglayer/primitive2d/objectinfoprimitive2d.hxx
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INFOHIERARCHYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INFOHIERARCHYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <tools/string.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ObjectInfoPrimitive2D class
+
+ Info hierarchy helper class to hold contents like Name, Title and
+ Description which are valid for the child content, e.g. created for
+ primitives based on DrawingLayer objects or SVG parts. It decomposes
+ to it's content, so all direct renderers may ignore it. May e.g.
+ be used when re-creating graphical content from a sequence of primitives
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectInfoPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ OUString maName;
+ OUString maTitle;
+ OUString maDesc;
+
+ public:
+ /// constructor
+ ObjectInfoPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const OUString& rName,
+ const OUString& rTitle,
+ const OUString& rDesc);
+
+ /// data read access
+ const OUString& getName() const { return maName; }
+ const OUString& getTitle() const { return maTitle; }
+ const OUString& getDesc() const { return maDesc; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_INFOHIERARCHYPRIMITIVE2D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx b/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx
new file mode 100644
index 000000000000..5acdf2157f10
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PagePreviewPrimitive2D class
+
+ This primitive is needed to have the correct XDrawPage as ViewInformation for decomposing
+ the page contents (given as PageContent here) if these contain e.g.
+ view-dependent (in this case XDrawPage-dependent) text fields like PageNumber. If You want
+ those primitives to be visualized correctly, Your renderer needs to locally correct it's
+ ViewInformation2D to reference the new XDrawPage.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PagePreviewPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the XDrawPage visualized by this primitive. When we go forward with primitives
+ this will not only be used by the renderers to provide the correct decompose
+ graphic attribute context, but also to completely create the page's sub-content.
+ */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxDrawPage;
+
+ /// the PageContent
+ Primitive2DSequence maPageContent;
+
+ /// the own geometry
+ basegfx::B2DHomMatrix maTransform;
+
+ /// content width and height
+ double mfContentWidth;
+ double mfContentHeight;
+
+ /// bitfield
+ /// flag to allow keeping the aspect ratio
+ unsigned mbKeepAspectRatio : 1;
+
+ protected:
+ /// local decomposition. Implementation will just return children
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PagePreviewPrimitive2D(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& rxDrawPage,
+ const basegfx::B2DHomMatrix& rTransform,
+ double fContentWidth,
+ double fContentHeight,
+ const Primitive2DSequence& rPageContent,
+ bool bKeepAspectRatio);
+
+ /// data read access
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& getXDrawPage() const { return mxDrawPage; }
+ const Primitive2DSequence& getPageContent() const { return maPageContent; }
+ const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+ double getContentWidth() const { return mfContentWidth; }
+ double getContentHeight() const { return mfContentHeight; }
+ bool getKeepAspectRatio() const { return mbKeepAspectRatio; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// own getB2DRange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PAGEPREVIEWPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
new file mode 100644
index 000000000000..7787d6f6ba28
--- /dev/null
+++ b/include/drawinglayer/primitive2d/patternfillprimitive2d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PatternFillPrimitive2D class
+
+ This primitive allows filling a given PolyPolygon with a pattern
+ defined by a sequence of primitives which are mapped to the unit range.
+ The pattern is defined using a reference range which defines a rectangular
+ area relative to the PolyPolygon (in unit coordinates) which is virtually
+ infinitely repeated.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PatternFillPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ const basegfx::B2DPolyPolygon maMask;
+ const Primitive2DSequence maChildren;
+ const basegfx::B2DRange maReferenceRange;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PatternFillPrimitive2D(
+ const basegfx::B2DPolyPolygon& rMask,
+ const Primitive2DSequence& rChildren,
+ const basegfx::B2DRange& rReferenceRange);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getMask() const { return maMask; }
+ const Primitive2DSequence& getChildren() const { return maChildren; }
+ const basegfx::B2DRange& getReferenceRange() const { return maReferenceRange; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PATTERNFILLPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
new file mode 100644
index 000000000000..8acb5956f60f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/pointarrayprimitive2d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POINTARRAYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POINTARRAYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// PointArrayPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PointArrayPrimitive2D class
+
+ This primitive defines single,discrete 'pixels' for the given
+ positions in the given color. This makes it view-dependent since
+ the logic size of a 'pixel' depends on the view transformation.
+
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it (Currently it is only used for grid visualisation,
+ but this may change).
+ */
+ class DRAWINGLAYER_DLLPUBLIC PointArrayPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the array of positions
+ std::vector< basegfx::B2DPoint > maPositions;
+
+ /// the color to use
+ basegfx::BColor maRGBColor;
+
+ /// #i96669# add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+
+ public:
+ /// constructor
+ PointArrayPrimitive2D(
+ const std::vector< basegfx::B2DPoint >& rPositions,
+ const basegfx::BColor& rRGBColor);
+
+ /// data read access
+ const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
+ const basegfx::BColor& getRGBColor() const { return maRGBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POINTARRAYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/polygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
new file mode 100644
index 000000000000..09e5b29039b3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/polygonprimitive2d.hxx
@@ -0,0 +1,310 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonHairlinePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonHairlinePrimitive2D class
+
+ This primitive defines a Hairline. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolygonHairlinePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonMarkerPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonMarkerPrimitive2D class
+
+ This primitive defines a two-colored marker hairline which is
+ dashed with the given dash length. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ It will be decomposed to the needed PolygonHairlinePrimitive2D if
+ not handled directly by a renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the marker hairline geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the two colors
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+
+ /// the dash distance in 'pixels'
+ double mfDiscreteDashLength;
+
+ /// decomposition is view-dependent, remember last InverseObjectToViewTransformation
+ basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonMarkerPrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonStrokePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonStrokePrimitive2D class
+
+ This primitive defines a line with line width, line join, line color
+ and stroke attributes. It will be decomposed dependent on the definition
+ to the needed primitives, e.g. filled PolyPolygons for fat lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the line geometry
+ basegfx::B2DPolygon maPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonStrokePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// constructor without stroking
+ PolygonStrokePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute);
+
+ /// data read access
+ const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonWavePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonWavePrimitive2D class
+
+ This primitive defines a waveline based on a PolygonStrokePrimitive2D
+ where the wave is defined by wave width and wave length.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonWavePrimitive2D : public PolygonStrokePrimitive2D
+ {
+ private:
+ /// wave definition
+ double mfWaveWidth;
+ double mfWaveHeight;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonWavePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ double fWaveWidth,
+ double fWaveHeight);
+
+ /// constructor without stroking
+ PolygonWavePrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ double fWaveWidth,
+ double fWaveHeight);
+
+ /// data read access
+ double getWaveWidth() const { return mfWaveWidth; }
+ double getWaveHeight() const { return mfWaveHeight; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolygonStrokeArrowPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolygonStrokeArrowPrimitive2D class
+
+ This primitive defines a PolygonStrokePrimitive2D which is extended
+ eventually by start and end definitions which are normally used for
+ arrows.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D
+ {
+ private:
+ /// geometric definitions for line start and end
+ attribute::LineStartEndAttribute maStart;
+ attribute::LineStartEndAttribute maEnd;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonStrokeArrowPrimitive2D(
+ const basegfx::B2DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute,
+ const attribute::LineStartEndAttribute& rStart,
+ const attribute::LineStartEndAttribute& rEnd);
+
+ /// data read access
+ const attribute::LineStartEndAttribute& getStart() const { return maStart; }
+ const attribute::LineStartEndAttribute& getEnd() const { return maEnd; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
new file mode 100644
index 000000000000..f53d4cdf5759
--- /dev/null
+++ b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
@@ -0,0 +1,382 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+#include <drawinglayer/attribute/linestartendattribute.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonHairlinePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonHairlinePrimitive2D class
+
+ This primitive defines a multi-PolygonHairlinePrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonHairlinePrimitive2Ds.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonMarkerPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonMarkerPrimitive2D class
+
+ This primitive defines a multi-PolygonMarkerPrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonMarkerPrimitive2Ds.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the marker hairline geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the two colors
+ basegfx::BColor maRGBColorA;
+ basegfx::BColor maRGBColorB;
+
+ /// the dash distance in 'pixels'
+ double mfDiscreteDashLength;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonMarkerPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rRGBColorA,
+ const basegfx::BColor& rRGBColorB,
+ double fDiscreteDashLength);
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
+ const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
+ double getDiscreteDashLength() const { return mfDiscreteDashLength; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonStrokePrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonStrokePrimitive2D class
+
+ This primitive defines a multi-PolygonStrokePrimitive2D and is
+ just for convenience. The definition is not different from the single
+ defined PolygonStrokePrimitive2Ds.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the line geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonStrokePrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ PolyPolygonStrokePrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::LineAttribute& rLineAttribute);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonColorPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonColorPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with a single color.
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D : public BasePrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the polygon fill color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolyPolygonColorPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonColorPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with a gradient. The
+ decomosition will create a MaskPrimitive2D containing a
+ FillGradientPrimitive2D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the gradient definition
+ attribute::FillGradientAttribute maFillGradient;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonHatchPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonHatchPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with a hatch. The
+ decomosition will create a MaskPrimitive2D containing a
+ FillHatchPrimitive2D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the hatch background color (if used)
+ basegfx::BColor maBackgroundColor;
+
+ /// the hatch definition
+ attribute::FillHatchAttribute maFillHatch;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonHatchPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::BColor& rBackgroundColor,
+ const attribute::FillHatchAttribute& rFillHatch);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
+ const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// PolyPolygonBitmapPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** PolyPolygonBitmapPrimitive2D class
+
+ This primitive defines a PolyPolygon filled with bitmap data
+ (including transparence). The decomosition will create a MaskPrimitive2D
+ containing a FillBitmapPrimitive2D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the bitmap fill definition (may include tiling)
+ attribute::FillBitmapAttribute maFillBitmap;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolyPolygonBitmapPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const attribute::FillBitmapAttribute& rFillBitmap);
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/primitivetools2d.hxx b/include/drawinglayer/primitive2d/primitivetools2d.hxx
new file mode 100644
index 000000000000..6ef63f1e916b
--- /dev/null
+++ b/include/drawinglayer/primitive2d/primitivetools2d.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** DiscreteMetricDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
+ regarding the size of a discrete unit. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
+ */
+ class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used fDiscreteUnit definitions for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ double mfDiscreteUnit;
+
+ public:
+ /// constructor
+ DiscreteMetricDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ mfDiscreteUnit(0.0)
+ {
+ }
+
+ /// data read access
+ double getDiscreteUnit() const { return mfDiscreteUnit; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ViewportDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
+ regarding the viewport. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date Viewport accessible using getViewport()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used Viewport definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DRange maViewport;
+
+ public:
+ /// constructor
+ ViewportDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewport()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DRange& getViewport() const { return maViewport; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ regarding the complete Viewtransformation. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation definition for decomposition. Since this
+ is checked and updated from get2DDecomposition() it will be current and
+ usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+
+ public:
+ /// constructor
+ ViewTransformationDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewTransformation()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ObjectAndViewTransformationDependentPrimitive2D class
+
+ tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
+ and Object-Transform dependent. The implementation of get2DDecomposition
+ guards the buffered local decomposition and ensures that a create2DDecomposition
+ implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
+ and an object transformation via getObjectTransformation()
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /** the last used ViewTransformation and the last ObjectTransformation
+ definition for decomposition. Since this is checked and updated from
+ get2DDecomposition() it will be current and usable in create2DDecomposition()
+ */
+ basegfx::B2DHomMatrix maViewTransformation;
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ public:
+ /// constructor
+ ObjectAndViewTransformationDependentPrimitive2D()
+ : BufferedDecompositionPrimitive2D(),
+ maViewTransformation(),
+ maObjectTransformation()
+ {
+ }
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/sceneprimitive2d.hxx b/include/drawinglayer/primitive2d/sceneprimitive2d.hxx
new file mode 100644
index 000000000000..d865ba15161a
--- /dev/null
+++ b/include/drawinglayer/primitive2d/sceneprimitive2d.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SCENEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SCENEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
+#include <drawinglayer/attribute/sdrlightattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ScenePrimitive2D class
+
+ This primitive defines a 3D scene as a 2D primitive and is the anchor point
+ for a 3D visualisation. The decomposition is view-dependent and will try to
+ re-use already rendered 3D content.
+
+ The rendering is done using the default-3D renderer from basegfx which supports
+ AntiAliasing.
+
+ The 2D primitive's geometric range is defined completely by the
+ ObjectTransformation combined with evtl. 2D shadows from the 3D objects. The
+ shadows of 3D objects are 2D polygons, projected with the 3D transformation.
+
+ This is the class a renderer may process directly when he wants to implement
+ an own (e.g. system-specific) 3D renderer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ScenePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the 3D geometry definition
+ primitive3d::Primitive3DSequence mxChildren3D;
+
+ /// 3D scene attribute set
+ attribute::SdrSceneAttribute maSdrSceneAttribute;
+
+ /// lighting attribute set
+ attribute::SdrLightingAttribute maSdrLightingAttribute;
+
+ /// object transformation for scene for 2D definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// scene transformation set and object transformation
+ geometry::ViewInformation3D maViewInformation3D;
+
+ /// the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
+ Primitive2DSequence maShadowPrimitives;
+
+ /// bitfield
+ /** flag if given 3D geometry is already cheched for shadow definitions and 2d shadows
+ are created in maShadowPrimitives
+ */
+ unsigned mbShadow3DChecked : 1;
+
+ /// the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition
+ double mfOldDiscreteSizeX;
+ double mfOldDiscreteSizeY;
+ basegfx::B2DRange maOldUnitVisiblePart;
+
+ /** the last created BitmapEx, e.g. for fast HitTest. This does not really need
+ memory since BitmapEx is internally RefCounted
+ */
+ BitmapEx maOldRenderedBitmap;
+
+ /// private helpers
+ bool impGetShadow3D(const geometry::ViewInformation2D& rViewInformation) const;
+ void calculateDiscreteSizes(
+ const geometry::ViewInformation2D& rViewInformation,
+ basegfx::B2DRange& rDiscreteRange,
+ basegfx::B2DRange& rVisibleDiscreteRange,
+ basegfx::B2DRange& rUnitVisibleRange) const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// public helpers
+ /** Geometry extractor. Shadow will be added as in create2DDecomposition, but
+ the 3D content is not converted to a bitmap visualisation but to projected 2D gemetry. This
+ helper is useful e.g. for Contour extraction or HitTests.
+ */
+ Primitive2DSequence getGeometry2D() const;
+ Primitive2DSequence getShadow2D(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /** Fast HitTest which uses the last buffered BitmapEx from the last
+ rendered area if available. The return value describes if the check
+ could be done with the current information, so do NOT use o_rResult
+ when it returns false. o_rResult will be changed on return true and
+ then contains a definitive answer if content of this scene is hit or
+ not. On return false, it is normally necessary to use the geometric
+ HitTest (see CutFindProcessor usages). The given HitPoint
+ has to be in logic coordinates in scene's ObjectCoordinateSystem.
+ */
+ bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint& rLogicHitPoint, bool& o_rResult) const;
+
+ /// constructor
+ ScenePrimitive2D(
+ const primitive3d::Primitive3DSequence& rxChildren3D,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const geometry::ViewInformation3D& rViewInformation3D);
+
+ /// data read access
+ const primitive3d::Primitive3DSequence& getChildren3D() const { return mxChildren3D; }
+ const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return maSdrSceneAttribute; }
+ const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return maSdrLightingAttribute; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// get local decomposition. Overloaded since this decomposition is view-dependent
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SCENEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx b/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
new file mode 100644
index 000000000000..5ac29383ff76
--- /dev/null
+++ b/include/drawinglayer/primitive2d/sdrdecompositiontools2d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ // helpers to create HitTestPrimitives Line
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DPolyPolygon& rPolygon);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DRange& rRange);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DRange& rRange,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ Primitive2DReference DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives2D(
+ bool bFilled,
+ const basegfx::B2DPolyPolygon& rPolygon,
+ const basegfx::B2DHomMatrix& rMatrix);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SDRDECOMPOSITIONTOOLS2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
new file mode 100644
index 000000000000..956d1a3e2d76
--- /dev/null
+++ b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** ShadowPrimitive2D class
+
+ This primitive defines a generic shadow geometry construction
+ for 2D objects. It decomposes to a TransformPrimitive2D embedded
+ into a ModifiedColorPrimitive2D.
+
+ It's for primtive usage convenience, so that not everyone has
+ to implement the generic shadow construction by himself.
+
+ The same geometry as sequence of primitives is used as geometry and
+ as shadow. Since these are RefCounted Uno-Api objects, no extra objects
+ are needed for the shadow itself; all the local decompositions of the
+ original geometry can be reused from the renderer for shadow visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the shadow transformation, normally just an offset
+ basegfx::B2DHomMatrix maShadowTransform;
+
+ /// the shadow color to which all geometry is to be forced
+ basegfx::BColor maShadowColor;
+
+ public:
+ /// constructor
+ ShadowPrimitive2D(
+ const basegfx::B2DHomMatrix& rShadowTransform,
+ const basegfx::BColor& rShadowColor,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
+ const basegfx::BColor& getShadowColor() const { return maShadowColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SHADOWPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
new file mode 100644
index 000000000000..bc2396e5ab23
--- /dev/null
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_STRUCTURETAGPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_STRUCTURETAGPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <vcl/pdfwriter.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** StructureTagPrimitive2D class
+
+ This class is used to provode simple support for adding grouped
+ pdf writer structured element information like used in sd from
+ unomodel.cxx where a ViewObjectContactRedirector is used to add
+ such information for diverse objects.
+ This primitive encapsulates these and the VCLPdfRenderer uses it
+ to apply the needed infos directly to the pdf export in a compatible
+ way.
+ If a renderer ignores this, it just decomposes to it's child
+ content.
+ */
+ class DRAWINGLAYER_DLLPUBLIC StructureTagPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the PDF structure element this grouping represents
+ vcl::PDFWriter::StructElement maStructureElement;
+
+ public:
+ /// constructor
+ StructureTagPrimitive2D(
+ const vcl::PDFWriter::StructElement& rStructureElement,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const vcl::PDFWriter::StructElement& getStructureElement() const { return maStructureElement; }
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_STRUCTURETAGPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
new file mode 100644
index 000000000000..0e7dab93ff14
--- /dev/null
+++ b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
@@ -0,0 +1,413 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SVGGRADIENTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SVGGRADIENTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgGradientEntry class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// a single GradientStop defining a color and opacity at a distance
+ class SvgGradientEntry
+ {
+ private:
+ double mfOffset;
+ basegfx::BColor maColor;
+ double mfOpacity;
+
+ public:
+ SvgGradientEntry(double fOffset, const basegfx::BColor& rColor = basegfx::BColor(0.0, 0.0, 0.0), double fOpacity = 1.0)
+ : mfOffset(fOffset),
+ maColor(rColor),
+ mfOpacity(fOpacity)
+ {
+ }
+
+ double getOffset() const { return mfOffset; }
+ const basegfx::BColor& getColor() const { return maColor; }
+ double getOpacity() const { return mfOpacity; }
+
+ bool operator==(const SvgGradientEntry& rCompare) const
+ {
+ return (getOffset() == rCompare.getOffset()
+ && getColor() == getColor()
+ && getOpacity() == getOpacity());
+ }
+
+ bool operator<(const SvgGradientEntry& rCompare) const
+ {
+ return getOffset() < rCompare.getOffset();
+ }
+ };
+
+ typedef ::std::vector< SvgGradientEntry > SvgGradientEntryVector;
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgGradientHelper class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ enum SpreadMethod
+ {
+ Spread_pad = 0,
+ Spread_reflect,
+ Spread_repeat
+ };
+
+ /* helper for linear and radial gradient, both get derived from this
+ to share common definitions and functionality
+ **/
+ class SvgGradientHelper
+ {
+ private:
+ /// geometric definition, the geometry to be filled
+ basegfx::B2DPolyPolygon maPolyPolygon;
+
+ /// the gradient definition
+ SvgGradientEntryVector maGradientEntries;
+
+ /// start and/or center point
+ basegfx::B2DPoint maStart;
+
+ /// how to spread
+ SpreadMethod maSpreadMethod;
+
+ /// bitfield
+ bool mbPreconditionsChecked : 1;
+ bool mbCreatesContent : 1;
+ bool mbSingleEntry : 1;
+ bool mbFullyOpaque : 1;
+
+ // true = interpret in unit coordinate system -> object aspect ratio will scale result
+ // false = interpret in object coordinate system -> object aspect ratio will not scale result
+ // (related to SVG's gradientUnits (userSpaceOnUse|objectBoundingBox)
+ bool mbUseUnitCoordinates : 1;
+
+ protected:
+ /// local helpers
+ Primitive2DSequence createSingleGradientEntryFill() const;
+ virtual void createAtom(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffset) const = 0;
+ double createRun(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ double fPos,
+ double fMax,
+ const SvgGradientEntryVector& rEntries,
+ sal_Int32 nOffset) const;
+ virtual void checkPreconditions();
+ Primitive2DSequence createResult(
+ const Primitive2DVector& rTargetColor,
+ const Primitive2DVector& rTargetOpacity,
+ const basegfx::B2DHomMatrix& rUnitGradientToObject,
+ bool bInvert = false) const;
+ bool getCreatesContent() const { return mbCreatesContent; }
+ bool getSingleEntry() const { return mbSingleEntry; }
+ void setSingleEntry() { mbSingleEntry = true; }
+ bool getPreconditionsChecked() const { return mbPreconditionsChecked; }
+ bool getFullyOpaque() const { return mbFullyOpaque; }
+
+ public:
+ /// constructor
+ SvgGradientHelper(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const SvgGradientEntryVector& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod = Spread_pad);
+ virtual ~SvgGradientHelper() {}
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ const SvgGradientEntryVector& getGradientEntries() const { return maGradientEntries; }
+ const basegfx::B2DPoint& getStart() const { return maStart; }
+ bool getUseUnitCoordinates() const { return mbUseUnitCoordinates; }
+ SpreadMethod getSpreadMethod() const { return maSpreadMethod; }
+
+ /// compare operator
+ bool equalTo(const SvgGradientHelper& rSvgGradientHelper) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgLinearGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// the basic linear gradient primitive
+ class DRAWINGLAYER_DLLPUBLIC SvgLinearGradientPrimitive2D : public BufferedDecompositionPrimitive2D, public SvgGradientHelper
+ {
+ private:
+ /// the end point for linear gradient
+ basegfx::B2DPoint maEnd;
+
+ protected:
+ /// local helpers
+ virtual void createAtom(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffset) const;
+ virtual void checkPreconditions();
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgLinearGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const SvgGradientEntryVector& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod = Spread_pad);
+ virtual ~SvgLinearGradientPrimitive2D();
+
+ /// data read access
+ const basegfx::B2DPoint& getEnd() const { return maEnd; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgRadialGradientPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /// the basic radial gradient primitive
+ class DRAWINGLAYER_DLLPUBLIC SvgRadialGradientPrimitive2D : public BufferedDecompositionPrimitive2D, public SvgGradientHelper
+ {
+ private:
+ /// the geometric definition
+ double mfRadius;
+
+ /// Focal only used when focal is set at all, see constructors
+ basegfx::B2DPoint maFocal;
+ basegfx::B2DVector maFocalVector;
+ double maFocalLength;
+
+ // internal helper for case Spread_reflect
+ SvgGradientEntryVector maMirroredGradientEntries;
+
+ /// bitfield
+ bool mbFocalSet : 1;
+
+ /// local helpers
+ const SvgGradientEntryVector& getMirroredGradientEntries() const;
+ void createMirroredGradientEntries();
+
+ protected:
+ /// local helpers
+ virtual void createAtom(
+ Primitive2DVector& rTargetColor,
+ Primitive2DVector& rTargetOpacity,
+ const SvgGradientEntry& rFrom,
+ const SvgGradientEntry& rTo,
+ sal_Int32 nOffset) const;
+ virtual void checkPreconditions();
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgRadialGradientPrimitive2D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const SvgGradientEntryVector& rGradientEntries,
+ const basegfx::B2DPoint& rStart,
+ double fRadius,
+ bool bUseUnitCoordinates,
+ SpreadMethod aSpreadMethod = Spread_pad,
+ const basegfx::B2DPoint* pFocal = 0);
+ virtual ~SvgRadialGradientPrimitive2D();
+
+ /// data read access
+ double getRadius() const { return mfRadius; }
+ const basegfx::B2DPoint& getFocal() const { return maFocal; }
+ bool isFocalSet() const { return mbFocalSet; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgLinearAtomPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /* basic primitive for a single linear GradientRun in unit coordiantes.
+ It's derived from DiscreteMetricDependentPrimitive2D to allow view-dependent
+ decompositions allowing reduced color steps
+ **/
+ class DRAWINGLAYER_DLLPUBLIC SvgLinearAtomPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometric definition in unit coordiantes
+ basegfx::BColor maColorA;
+ basegfx::BColor maColorB;
+ double mfOffsetA;
+ double mfOffsetB;
+
+ protected:
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgLinearAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fOffsetA,
+ const basegfx::BColor& aColorB, double fOffsetB);
+
+ /// data read access
+ const basegfx::BColor& getColorA() const { return maColorA; }
+ const basegfx::BColor& getColorB() const { return maColorB; }
+ double getOffsetA() const { return mfOffsetA; }
+ double getOffsetB() const { return mfOffsetB; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// SvgRadialAtomPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /* basic primitive for a single radial GradientRun in unit coordiantes.
+ It's derived from DiscreteMetricDependentPrimitive2D to allow view-dependent
+ decompositions allowing reduced color steps
+ **/
+ class DRAWINGLAYER_DLLPUBLIC SvgRadialAtomPrimitive2D : public DiscreteMetricDependentPrimitive2D
+ {
+ private:
+ /// the geometric definition in unit coordiantes
+ basegfx::BColor maColorA;
+ basegfx::BColor maColorB;
+ double mfScaleA;
+ double mfScaleB;
+
+ // helper to hold translation vectors when given (for focal)
+ struct VectorPair
+ {
+ basegfx::B2DVector maTranslateA;
+ basegfx::B2DVector maTranslateB;
+
+ VectorPair(const basegfx::B2DVector& rTranslateA, const basegfx::B2DVector& rTranslateB)
+ : maTranslateA(rTranslateA),
+ maTranslateB(rTranslateB)
+ {
+ }
+ };
+
+ /// Only used when focal is set
+ VectorPair* mpTranslate;
+
+ protected:
+
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SvgRadialAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fScaleA, const basegfx::B2DVector& rTranslateA,
+ const basegfx::BColor& aColorB, double fScaleB, const basegfx::B2DVector& rTranslateB);
+ SvgRadialAtomPrimitive2D(
+ const basegfx::BColor& aColorA, double fScaleA,
+ const basegfx::BColor& aColorB, double fScaleB);
+ virtual ~SvgRadialAtomPrimitive2D();
+
+ /// data read access
+ const basegfx::BColor& getColorA() const { return maColorA; }
+ const basegfx::BColor& getColorB() const { return maColorB; }
+ double getScaleA() const { return mfScaleA; }
+ double getScaleB() const { return mfScaleB; }
+ bool isTranslateSet() const { return (0 != mpTranslate); }
+ basegfx::B2DVector getTranslateA() const { if(mpTranslate) return mpTranslate->maTranslateA; return basegfx::B2DVector(); }
+ basegfx::B2DVector getTranslateB() const { if(mpTranslate) return mpTranslate->maTranslateB; return basegfx::B2DVector(); }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_SVGGRADIENTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textbreakuphelper.hxx b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
new file mode 100644
index 000000000000..4a3996353a93
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTBREAKUPHELPER_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTBREAKUPHELPER_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <basegfx/matrix/b2dhommatrixtools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ enum BreakupUnit
+ {
+ BreakupUnit_character,
+ BreakupUnit_word,
+ BreakupUnit_sentence
+ };
+
+ class DRAWINGLAYER_DLLPUBLIC TextBreakupHelper
+ {
+ private:
+ const TextSimplePortionPrimitive2D& mrSource;
+ Primitive2DSequence mxResult;
+ TextLayouterDevice maTextLayouter;
+ basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose maDecTrans;
+
+ /// bitfield
+ bool mbNoDXArray : 1;
+
+ /// create a portion from nIndex to nLength and append to rTempResult
+ void breakupPortion(Primitive2DVector& rTempResult, sal_uInt32 nIndex, sal_uInt32 nLength, bool bWordLineMode);
+
+ /// breakup complete primitive
+ void breakup(BreakupUnit aBreakupUnit);
+
+ protected:
+ /// allow user callback to allow changes to the new TextTransformation. Default
+ /// does nothing. Retval defines if a primitive gets created, e.g. return false
+ /// to suppress creation
+ virtual bool allowChange(sal_uInt32 nCount, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 nIndex, sal_uInt32 nLength);
+
+ /// allow read access to evtl. useful local parts
+ const TextLayouterDevice& getTextLayouter() const { return maTextLayouter; }
+ const basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& getDecTrans() const { return maDecTrans; }
+ const TextSimplePortionPrimitive2D& getSource() const { return mrSource; }
+
+ public:
+ TextBreakupHelper(const TextSimplePortionPrimitive2D& rSource);
+ virtual ~TextBreakupHelper();
+
+ /// get result
+ const Primitive2DSequence& getResult(BreakupUnit aBreakupUnit = BreakupUnit_character) const;
+ };
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTBREAKUPHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
new file mode 100644
index 000000000000..506510958848
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx { namespace tools {
+ class B2DHomMatrixBufferedOnDemandDecompose;
+}}
+
+namespace com { namespace sun { namespace star { namespace i18n {
+ struct Boundary;
+}}}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextDecoratedPortionPrimitive2D class
+
+ This primitive expands the TextSimplePortionPrimitive2D by common
+ decorations used in the office. It can be decomposed and will create
+ a TextSimplePortionPrimitive2D and all the contained decorations (if used)
+ as geometry.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextDecoratedPortionPrimitive2D : public TextSimplePortionPrimitive2D
+ {
+ private:
+ /// decoration definitions
+ basegfx::BColor maOverlineColor;
+ basegfx::BColor maTextlineColor;
+ TextLine meFontOverline;
+ TextLine meFontUnderline;
+ TextStrikeout meTextStrikeout;
+ TextEmphasisMark meTextEmphasisMark;
+ TextRelief meTextRelief;
+
+ /// bitfield
+ unsigned mbUnderlineAbove : 1;
+ unsigned mbWordLineMode : 1;
+ unsigned mbEmphasisMarkAbove : 1;
+ unsigned mbEmphasisMarkBelow : 1;
+ unsigned mbShadow : 1;
+
+ /// helper methods
+ void impCreateGeometryContent(
+ std::vector< Primitive2DReference >& rTarget,
+ basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
+ const String& rText,
+ xub_StrLen aTextPosition,
+ xub_StrLen aTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute) const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextDecoratedPortionPrimitive2D(
+
+ /// TextSimplePortionPrimitive2D parameters
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const String& rText,
+ xub_StrLen aTextPosition,
+ xub_StrLen aTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+
+ /// local parameters
+ const basegfx::BColor& rOverlineColor,
+ const basegfx::BColor& rTextlineColor,
+ TextLine eFontOverline = TEXT_LINE_NONE,
+ TextLine eFontUnderline = TEXT_LINE_NONE,
+ bool bUnderlineAbove = false,
+ TextStrikeout eTextStrikeout = TEXT_STRIKEOUT_NONE,
+ bool bWordLineMode = false,
+ TextEmphasisMark eTextEmphasisMark = TEXT_EMPHASISMARK_NONE,
+ bool bEmphasisMarkAbove = true,
+ bool bEmphasisMarkBelow = false,
+ TextRelief eTextRelief = TEXT_RELIEF_NONE,
+ bool bShadow = false);
+
+ /// data read access
+ TextLine getFontOverline() const { return meFontOverline; }
+ TextLine getFontUnderline() const { return meFontUnderline; }
+ TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
+ TextEmphasisMark getTextEmphasisMark() const { return meTextEmphasisMark; }
+ TextRelief getTextRelief() const { return meTextRelief; }
+ const basegfx::BColor& getOverlineColor() const { return maOverlineColor; }
+ const basegfx::BColor& getTextlineColor() const { return maTextlineColor; }
+ bool getUnderlineAbove() const { return mbUnderlineAbove; }
+ bool getWordLineMode() const { return mbWordLineMode; }
+ bool getEmphasisMarkAbove() const { return mbEmphasisMarkAbove; }
+ bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
+ bool getShadow() const { return mbShadow; }
+
+ /// check if this needs to be a TextDecoratedPortionPrimitive2D or
+ /// if a TextSimplePortionPrimitive2D would be suficcient
+ bool decoratedIsNeeded() const;
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTDECORATEDPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/texteffectprimitive2d.hxx b/include/drawinglayer/primitive2d/texteffectprimitive2d.hxx
new file mode 100644
index 000000000000..01fff05473d5
--- /dev/null
+++ b/include/drawinglayer/primitive2d/texteffectprimitive2d.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextEffectStyle2D definition */
+ enum TextEffectStyle2D
+ {
+ TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED_DEFAULT,
+ TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED_DEFAULT,
+ TEXTEFFECTSTYLE2D_RELIEF_EMBOSSED,
+ TEXTEFFECTSTYLE2D_RELIEF_ENGRAVED,
+ TEXTEFFECTSTYLE2D_OUTLINE
+ };
+
+ /** TextEffectPrimitive2D class
+
+ This primitive embeds text primitives (normally, as can be seen can
+ also be used for any other primitives) which have some TextEffect applied
+ and create the needed geometry and embedding on decomposition.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextEffectPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// the text (or other) content
+ Primitive2DSequence maTextContent;
+
+ /// the style to apply, the direction and the rotation center
+ const basegfx::B2DPoint maRotationCenter;
+ double mfDirection;
+ TextEffectStyle2D meTextEffectStyle2D;
+
+ /** the last used object to view transformtion used from getDecomposition
+ for decide buffering
+ */
+ basegfx::B2DHomMatrix maLastObjectToViewTransformation;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// construcor
+ TextEffectPrimitive2D(
+ const Primitive2DSequence& rTextContent,
+ const basegfx::B2DPoint& rRotationCenter,
+ double fDirection,
+ TextEffectStyle2D eTextEffectStyle2D);
+
+ /// data read access
+ const Primitive2DSequence& getTextContent() const { return maTextContent; }
+ const basegfx::B2DPoint& getRotationCenter() const { return maRotationCenter; }
+ double getDirection() const { return mfDirection; }
+ TextEffectStyle2D getTextEffectStyle2D() const { return meTextEffectStyle2D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /** own get range implementation to solve more effective. Content is by definition displaced
+ by a fixed discrete unit, thus the contained geometry needs only once be asked for it's
+ own basegfx::B2DRange
+ */
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+
+ /// Overload standard getDecomposition call to be view-dependent here
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTEFFECTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx
new file mode 100644
index 000000000000..36531e6fce16
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textenumsprimitive2d.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <vcl/vclenum.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextLine definition
+
+ This is used for both underline and overline
+ */
+ enum TextLine
+ {
+ TEXT_LINE_NONE,
+ TEXT_LINE_SINGLE,
+ TEXT_LINE_DOUBLE,
+ TEXT_LINE_DOTTED,
+ TEXT_LINE_DASH,
+ TEXT_LINE_LONGDASH,
+ TEXT_LINE_DASHDOT,
+ TEXT_LINE_DASHDOTDOT,
+ TEXT_LINE_SMALLWAVE,
+ TEXT_LINE_WAVE,
+ TEXT_LINE_DOUBLEWAVE,
+ TEXT_LINE_BOLD,
+ TEXT_LINE_BOLDDOTTED,
+ TEXT_LINE_BOLDDASH,
+ TEXT_LINE_BOLDLONGDASH,
+ TEXT_LINE_BOLDDASHDOT,
+ TEXT_LINE_BOLDDASHDOTDOT,
+ TEXT_LINE_BOLDWAVE
+ };
+
+ /** helper to convert LineStyle */
+ TextLine DRAWINGLAYER_DLLPUBLIC mapFontUnderlineToTextLine(FontUnderline eLineStyle);
+ FontUnderline DRAWINGLAYER_DLLPUBLIC mapTextLineToFontUnderline(TextLine eLineStyle);
+
+ /** FontStrikeout definition */
+ enum TextStrikeout
+ {
+ TEXT_STRIKEOUT_NONE,
+ TEXT_STRIKEOUT_SINGLE,
+ TEXT_STRIKEOUT_DOUBLE,
+ TEXT_STRIKEOUT_BOLD,
+ TEXT_STRIKEOUT_SLASH,
+ TEXT_STRIKEOUT_X
+ };
+
+ /** helper to convert FontStrikeout */
+ TextStrikeout DRAWINGLAYER_DLLPUBLIC mapFontStrikeoutToTextStrikeout(::FontStrikeout eFontStrikeout);
+ ::FontStrikeout DRAWINGLAYER_DLLPUBLIC mapTextStrikeoutToFontStrikeout(TextStrikeout eFontStrikeout);
+
+ /** TextEmphasisMark definition */
+ enum TextEmphasisMark
+ {
+ TEXT_EMPHASISMARK_NONE,
+ TEXT_EMPHASISMARK_DOT,
+ TEXT_EMPHASISMARK_CIRCLE,
+ TEXT_EMPHASISMARK_DISC,
+ TEXT_EMPHASISMARK_ACCENT
+ };
+
+ /** TextRelief definition */
+ enum TextRelief
+ {
+ TEXT_RELIEF_NONE,
+ TEXT_RELIEF_EMBOSSED,
+ TEXT_RELIEF_ENGRAVED
+ };
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTENUMSPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
new file mode 100644
index 000000000000..e9fb01f094ff
--- /dev/null
+++ b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
@@ -0,0 +1,212 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <tools/string.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyLinePrimitive2D class
+
+ Text format hierarchy helper class. It decomposes to it's
+ content, so all direct renderers may ignore it. If You need
+ to know more about line hierarchies You may react on it and
+ also need to take care that the source of data uses it.
+
+ This primitive encapsulates text lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyLinePrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyLinePrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyBulletPrimitive2D class
+
+ This primitive encapsulates text bullets.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyBulletPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyBulletPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyParagraphPrimitive2D class
+
+ This primitive encapsulates text paragraphs.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyParagraphPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyParagraphPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyBlockPrimitive2D class
+
+ This primitive encapsulates text blocks.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyBlockPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyBlockPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** FieldType definition */
+ enum FieldType
+ {
+ /** unspecified. If more info is needed for a FieldType,
+ create a new type and it's handling
+ */
+ FIELD_TYPE_COMMON,
+
+ /** uses "FIELD_SEQ_BEGIN;PageField" -> special handling */
+ FIELD_TYPE_PAGE,
+
+ /** uses URL as string -> special handling */
+ FIELD_TYPE_URL
+ };
+
+ /** TextHierarchyFieldPrimitive2D class
+
+ This primitive encapsulates text fields.
+ Also: This type uses a type enum to transport the encapsulated field
+ type. Also added is a String which is type-dependent. E.g. for URL
+ fields, it contains the URL.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyFieldPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ FieldType meType;
+ OUString maString;
+
+ public:
+ /// constructor
+ TextHierarchyFieldPrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const FieldType& rFieldType,
+ const OUString& rString);
+
+ /// data read access
+ FieldType getType() const { return meType; }
+ const OUString& getString() const { return maString; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextHierarchyEditPrimitive2D class
+
+ #i97628#
+ Primitive to encapsulate text from an active text edit; some
+ renderers need to suppress this output due to painting the
+ edited text in e.g. an OutlinerEditView. It's derived from
+ GroupPrimitive2D, so the implicit decomposition will use the
+ content. To suppress, this primitive needs to be parsed by
+ the renderer without taking any action.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextHierarchyEditPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ public:
+ /// constructor
+ explicit TextHierarchyEditPrimitive2D(const Primitive2DSequence& rChildren);
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTHIERARCHYPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
new file mode 100644
index 000000000000..a0338a371aad
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+#define INCLUDED_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <tools/solar.h>
+#include <tools/poly.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <vector>
+#include <com/sun/star/lang/Locale.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class VirtualDevice;
+class Font;
+class String;
+class OutputDevice;
+class GDIMetaFile;
+
+namespace drawinglayer { namespace attribute {
+ class FontAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// access to one global impTimedRefDev incarnation in namespace drawinglayer::primitive
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextLayouterDevice class
+
+ This helper class exists to isolate all accesses to VCL
+ text formatting/handling functionality for primitive implementations.
+ When in the future FontHandling may move to an own library independent
+ from VCL, primitives will be prepared.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextLayouterDevice
+ {
+ /// internally used VirtualDevice
+ VirtualDevice& mrDevice;
+
+ public:
+ /// constructor/destructor
+ TextLayouterDevice();
+ ~TextLayouterDevice();
+
+ /// tooling methods
+ void setFont(const Font& rFont);
+ void setFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
+ double fFontScaleX,
+ double fFontScaleY,
+ const ::com::sun::star::lang::Locale & rLocale);
+
+ double getTextHeight() const;
+ double getOverlineHeight() const;
+ double getOverlineOffset() const;
+ double getUnderlineHeight() const;
+ double getUnderlineOffset() const;
+ double getStrikeoutOffset() const;
+
+ double getTextWidth(
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+
+ bool getTextOutlines(
+ basegfx::B2DPolyPolygonVector&,
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength,
+ const ::std::vector< double >& rDXArray) const;
+
+ basegfx::B2DRange getTextBoundRect(
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+
+ double getFontAscent() const;
+ double getFontDescent() const;
+
+ void addTextRectActions(
+ const Rectangle& rRectangle,
+ const String& rText,
+ sal_uInt16 nStyle,
+ GDIMetaFile& rGDIMetaFile) const;
+
+ ::std::vector< double > getTextArray(
+ const String& rText,
+ sal_uInt32 nIndex,
+ sal_uInt32 nLength) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// helper methods for vcl font handling
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** Create a VCL-Font based on the definitions in FontAttribute
+ and the given FontScaling. The FontScaling defines the FontHeight
+ (fFontScaleY) and the FontWidth (fFontScaleX). The combination of
+ both defines FontStretching, where no stretching happens at
+ fFontScaleY == fFontScaleX
+ */
+ Font DRAWINGLAYER_DLLPUBLIC getVclFontFromFontAttribute(
+ const attribute::FontAttribute& rFontAttribute,
+ double fFontScaleX,
+ double fFontScaleY,
+ double fFontRotation,
+ const ::com::sun::star::lang::Locale & rLocale);
+
+ /** Generate FontAttribute DataSet derived from the given VCL-Font.
+ The FontScaling with fFontScaleY, fFontScaleX relationship (see
+ above) will be set in return parameter o_rSize to allow further
+ processing
+ */
+ attribute::FontAttribute DRAWINGLAYER_DLLPUBLIC getFontAttributeFromVclFont(
+ basegfx::B2DVector& o_rSize,
+ const Font& rFont,
+ bool bRTL,
+ bool bBiDiStrong);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_TEXTLAYOUTDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textlineprimitive2d.hxx b/include/drawinglayer/primitive2d/textlineprimitive2d.hxx
new file mode 100644
index 000000000000..6bcca85a8bc2
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textlineprimitive2d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC TextLinePrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometric definitions
+ basegfx::B2DHomMatrix maObjectTransformation;
+ double mfWidth;
+ double mfOffset;
+ double mfHeight;
+
+ /// decoration definitions
+ TextLine meTextLine;
+ basegfx::BColor maLineColor;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextLinePrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ double fOffset,
+ double fHeight,
+ TextLine eTextLine,
+ const basegfx::BColor& rLineColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ double getWidth() const { return mfWidth; }
+ double getOffset() const { return mfOffset; }
+ double getHeight() const { return mfHeight; }
+ TextLine getTextLine() const { return meTextLine; }
+ const basegfx::BColor& getLineColor() const { return maLineColor; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTLINEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx b/include/drawinglayer/primitive2d/textprimitive2d.hxx
new file mode 100644
index 000000000000..5a12e2bc678f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -0,0 +1,181 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <tools/string.hxx>
+#include <vcl/font.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <vector>
+#include <com/sun/star/lang/Locale.hpp>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class OutputDevice;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TextSimplePortionPrimitive2D class
+
+ This is the basic primitive for representing a text portion. It contains
+ all needed information. If it is not handled by a renderer, it's decomposition
+ will provide the text PolyPolygon outlines as filled polygons, correctly
+ transformed.
+
+ To get better text quality, it is suggested to handle tis primitive directly
+ in a renderer. In that case, e.g. hintings on the system can be supported.
+
+ @param maTextTransform
+ The text transformation contains the text start position (always baselined)
+ as translation, the FontSize as scale (where width relative to height defines
+ font scaling and width == height means no font scaling) and the font rotation
+ and shear.
+ When shear is used and a renderer does not support it, it may be better to use
+ the decomposition which will do everything correctly. Same is true for mirroring
+ which would be expressed as negative scalings.
+
+ @param rText
+ The text to be used. Only a part may be used, but a bigger part of the string
+ may be necessary for correct layouting (e.g. international)
+
+ @param aTextPosition
+ The index to the first character to use from rText
+
+ @param aTextLength
+ The number of characters to use from rText
+
+ @param rDXArray
+ The distances between the characters. This parameter may be empty, in that case
+ the renderer is responsible to do something useful. If it is given, it has to be of
+ the size aTextLength. Its values are in logical coordinates and describe the
+ distance for each character to use. This is independent from the font width which
+ is given with maTextTransform. The first value is the offset to use from the start
+ point in FontCoordinateSystem X-Direction (given by maTextTransform) to the start
+ point of the second character
+
+ @param rFontAttribute
+ The font definition
+
+ @param rLocale
+ The locale to use
+
+ @param rFontColor
+ The font color to use
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextSimplePortionPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// text transformation (FontCoordinateSystem)
+ basegfx::B2DHomMatrix maTextTransform;
+
+ /// The text, used from maTextPosition up to maTextPosition + maTextLength
+ String maText;
+
+ /// The index from where on maText is used
+ xub_StrLen maTextPosition;
+
+ /// The length for maText usage, starting from maTextPosition
+ xub_StrLen maTextLength;
+
+ /// The DX array in logic units
+ ::std::vector< double > maDXArray;
+
+ /// The font definition
+ attribute::FontAttribute maFontAttribute;
+
+ /// The Locale for the text
+ ::com::sun::star::lang::Locale maLocale;
+
+ /// font color
+ basegfx::BColor maFontColor;
+
+ /// #i96669# internal: add simple range buffering for this primitive
+ basegfx::B2DRange maB2DRange;
+ bool mbFilled; // Whether to fill a given width with the text
+ long mnWidthToFill; // the width to fill
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextSimplePortionPrimitive2D(
+ const basegfx::B2DHomMatrix& rNewTransform,
+ const String& rText,
+ xub_StrLen aTextPosition,
+ xub_StrLen aTextLength,
+ const ::std::vector< double >& rDXArray,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale,
+ const basegfx::BColor& rFontColor,
+ bool bFilled = false,
+ long nWidthToFill = 0);
+
+ /// helpers
+ /** get text outlines as polygons and their according ObjectTransformation. Handles all
+ the necessary VCL outline extractins, scaling adaptions and other stuff.
+ */
+ void getTextOutlinesAndTransformation(basegfx::B2DPolyPolygonVector& rTarget, basegfx::B2DHomMatrix& rTransformation) const;
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTextTransform() const { return maTextTransform; }
+ const String& getText() const { return maText; }
+ xub_StrLen getTextPosition() const { return maTextPosition; }
+ xub_StrLen getTextLength() const { return maTextLength; }
+ const ::std::vector< double >& getDXArray() const { return maDXArray; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
+ const basegfx::BColor& getFontColor() const { return maFontColor; }
+ bool isFilled() const { return mbFilled; }
+ long getWidthToFill() const { return mnWidthToFill; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+
+ /// small helper to have a compare operator for Locale
+ bool DRAWINGLAYER_DLLPUBLIC LocalesAreEqual(const ::com::sun::star::lang::Locale& rA, const ::com::sun::star::lang::Locale& rB);
+
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx b/include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx
new file mode 100644
index 000000000000..216fe740933a
--- /dev/null
+++ b/include/drawinglayer/primitive2d/textstrikeoutprimitive2d.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textenumsprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <drawinglayer/attribute/fontattribute.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC BaseTextStrikeoutPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometric definitions
+ basegfx::B2DHomMatrix maObjectTransformation;
+ double mfWidth;
+
+ /// decoration definitions
+ basegfx::BColor maFontColor;
+
+ public:
+ /// constructor
+ BaseTextStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ double getWidth() const { return mfWidth; }
+ const basegfx::BColor& getFontColor() const { return maFontColor; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC TextCharacterStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D
+ {
+ private:
+ sal_Unicode maStrikeoutChar;
+ attribute::FontAttribute maFontAttribute;
+ ::com::sun::star::lang::Locale maLocale;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextCharacterStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ sal_Unicode aStrikeoutChar,
+ const attribute::FontAttribute& rFontAttribute,
+ const ::com::sun::star::lang::Locale& rLocale);
+
+ /// data read access
+ sal_Unicode getStrikeoutChar() const { return maStrikeoutChar; }
+ const attribute::FontAttribute& getFontAttribute() const { return maFontAttribute; }
+ const ::com::sun::star::lang::Locale& getLocale() const { return maLocale; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ class DRAWINGLAYER_DLLPUBLIC TextGeometryStrikeoutPrimitive2D : public BaseTextStrikeoutPrimitive2D
+ {
+ private:
+ double mfHeight;
+ double mfOffset;
+ TextStrikeout meTextStrikeout;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ TextGeometryStrikeoutPrimitive2D(
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ double fWidth,
+ const basegfx::BColor& rFontColor,
+ double fHeight,
+ double fOffset,
+ TextStrikeout eTextStrikeout);
+
+ /// data read access
+ double getHeight() const { return mfHeight; }
+ double getOffset() const { return mfOffset; }
+ TextStrikeout getTextStrikeout() const { return meTextStrikeout; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive2D& rPrimitive ) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TEXTSTRIKEOUTPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/transformprimitive2d.hxx b/include/drawinglayer/primitive2d/transformprimitive2d.hxx
new file mode 100644
index 000000000000..e58c530fa71f
--- /dev/null
+++ b/include/drawinglayer/primitive2d/transformprimitive2d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TransformPrimitive2D class
+
+ This is one of the basic grouping primitives and it provides
+ embedding a sequence of primitives (a geometry) into a
+ transformation. All renderers have to handle this, usually by
+ building a current transformation stack (linear combination)
+ and applying this to all to-be-rendered geometry. If not handling
+ this, the output will be mostly wrong since this primitive is
+ widely used.
+
+ It does transform by embedding an existing geometry into a
+ transformation as Child-content. This allows re-usage of the
+ refcounted Uno-Api primitives and their existung, buffered
+ decompositions.
+
+ It could e.g. be used to show a single object geometry in 1000
+ different, transformed states without the need to create those
+ thousand primitive contents.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransformPrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ // the transformation to apply to the child geometry
+ basegfx::B2DHomMatrix maTransformation;
+
+ public:
+ /// constructor
+ TransformPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ const Primitive2DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSFORMPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx b/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx
new file mode 100644
index 000000000000..1c742da909d3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/transparenceprimitive2d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** TransparencePrimitive2D class
+
+ This is the basic primitive for applying freely defined transparence
+ to freely defined content. The basic idea is to associate a content
+ which is defined as a sequence of primitives and hold as child content
+ in the GroupPrimitive2D with a transparence channel also defined as a sequence
+ of primitives and hold in the transparence member.
+
+ The basic definition is to use the transparence content as transparence-Mask by
+ interpreting the transparence-content not as RGB, but as Luminance transparence mask
+ using the common RGB_to_luminance definition as e.g. used by VCL.
+
+ The defining geometry is the Range of the child primitive sequence,
+ this means the renderers will/shall use this geometric information for
+ rendering, not the transparent one. The transparent one should/will be clipped
+ accordingly.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransparencePrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// The transparence-Mask who's RGB-Values are interpreted as Luminance
+ Primitive2DSequence maTransparence;
+
+ public:
+ /** constructor
+
+ @param rChildren
+ The content which is defined to have a transparency. The
+ range of this primitive is defined by this content
+
+ @param rTransparence
+ The definition of the Transparence-channel for this primitive. It
+ will be interpreted as mask by interpreting as gray values
+ using the common RGB_to_luminance definitions
+ */
+ TransparencePrimitive2D(
+ const Primitive2DSequence& rChildren,
+ const Primitive2DSequence& rTransparence);
+
+ /// data read access
+ const Primitive2DSequence& getTransparence() const { return maTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_TRANSPARENCEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx b/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx
new file mode 100644
index 000000000000..e30de32107f6
--- /dev/null
+++ b/include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** UnifiedTransparencePrimitive2D class
+
+ This primitive encapsualtes a child hierarchy and defines
+ that it shall be visualized with the given transparency. That
+ transparency is unique for all contained geometry, so that
+ e.g. overlapping polygons in the child geometry will not show
+ regions of combined transparency, but be all rendered with the
+ defined, single transparency.
+ */
+ class DRAWINGLAYER_DLLPUBLIC UnifiedTransparencePrimitive2D : public GroupPrimitive2D
+ {
+ private:
+ /// the unified transparence
+ double mfTransparence;
+
+ public:
+ /// constructor
+ UnifiedTransparencePrimitive2D(
+ const Primitive2DSequence& rChildren,
+ double fTransparence);
+
+ /// data read access
+ double getTransparence() const { return mfTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// own getB2DRange implementation to include transparent geometries to BoundRect calculations
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// create decomposition
+ virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_UNIFIEDTRANSPARENCEPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx b/include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx
new file mode 100644
index 000000000000..0e370b74dab0
--- /dev/null
+++ b/include/drawinglayer/primitive2d/wallpaperprimitive2d.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/primitivetools2d.hxx>
+#include <vcl/bitmapex.hxx>
+#include <vcl/wall.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** WallpaperBitmapPrimitive2D class
+
+ This is a specialized primtive for the Wallpaper definitions included in
+ VCL and Metafiles. The extraordinary about the bitmap definition part of
+ the Wallpaper is that it uses PIXEL size of the given Bitmap and not
+ the logic and/or discrete size derived by PrefMapMode/PrefSize methods.
+ To emulate this, a ViewTransformation dependent primitive is needed which
+ takes over the correct scaling(s).
+
+ Since a specialized primitive is needed anyways, i opted to also add the
+ layouting which is dependent from WallpaperStyle; thus it does not need
+ to be handled anywhere else in the future.
+ */
+ class DRAWINGLAYER_DLLPUBLIC WallpaperBitmapPrimitive2D : public ViewTransformationDependentPrimitive2D
+ {
+ private:
+ basegfx::B2DRange maObjectRange;
+ BitmapEx maBitmapEx;
+ WallpaperStyle meWallpaperStyle;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ WallpaperBitmapPrimitive2D(
+ const basegfx::B2DRange& rObjectRange,
+ const BitmapEx& rBitmapEx,
+ WallpaperStyle eWallpaperStyle);
+
+ /// data read access
+ const basegfx::B2DRange& getLocalObjectRange() const { return maObjectRange; }
+ const BitmapEx& getBitmapEx() const { return maBitmapEx ; }
+ WallpaperStyle getWallpaperStyle() const { return meWallpaperStyle; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// get B2Drange
+ virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WALLPAPERPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx b/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx
new file mode 100644
index 000000000000..cafd40f40aa3
--- /dev/null
+++ b/include/drawinglayer/primitive2d/wrongspellprimitive2d.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WRONGSPELLPRIMITIVE2D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WRONGSPELLPRIMITIVE2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// WrongSpellPrimitive2D class
+
+namespace drawinglayer
+{
+ namespace primitive2d
+ {
+ /** WrongSpellPrimitive2D class
+
+ This is a helper primitive to hold evtl. WrongSpell visualisations
+ in the sequence of primitives. The primitive holds this information
+ separated form the TextPortions to where it belongs to tot expand the
+ TextSimplePortionPrimitive2D more as needed.
+
+ A renderer who does not want to visualize this (if contained at all)
+ can detect and ignore this primitive. If it's decomposition is used,
+ it will be visualized as red wavelines.
+
+ The geometric definition defines a line on the X-Axis (no Y-coordinates)
+ which will when transformed by Transformation, create the coordinate data.
+ */
+ class DRAWINGLAYER_DLLPUBLIC WrongSpellPrimitive2D : public BufferedDecompositionPrimitive2D
+ {
+ private:
+ /// geometry definition
+ basegfx::B2DHomMatrix maTransformation;
+ double mfStart;
+ double mfStop;
+
+ /// color (usually red)
+ basegfx::BColor maColor;
+
+ protected:
+ /// create local decomposition
+ virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
+
+ public:
+ /// constructor
+ WrongSpellPrimitive2D(
+ const basegfx::B2DHomMatrix& rTransformation,
+ double fStart,
+ double fStop,
+ const basegfx::BColor& rColor);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
+ double getStart() const { return mfStart; }
+ double getStop() const { return mfStop; }
+ const basegfx::BColor& getColor() const { return maColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive2DIDBlock()
+ };
+ } // end of namespace primitive2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_WRONGSPELLPRIMITIVE2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/baseprimitive3d.hxx b/include/drawinglayer/primitive3d/baseprimitive3d.hxx
new file mode 100644
index 000000000000..974c47d9e485
--- /dev/null
+++ b/include/drawinglayer/primitive3d/baseprimitive3d.hxx
@@ -0,0 +1,213 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <cppuhelper/compbase1.hxx>
+#include <boost/utility.hpp>
+#include <com/sun/star/graphic/XPrimitive3D.hpp>
+#include <comphelper/broadcasthelper.hxx>
+#include <basegfx/range/b3drange.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+/** defines for DeclPrimitrive3DIDBlock and ImplPrimitrive3DIDBlock
+ Added to be able to simply change identification stuff later, e.g. add
+ a identification string and/or ID to the interface and to the implementation
+ ATM used to delclare implement getPrimitive3DID()
+ */
+
+#define DeclPrimitrive3DIDBlock() \
+ virtual sal_uInt32 getPrimitive3DID() const;
+
+#define ImplPrimitrive3DIDBlock(TheClass, TheID) \
+ sal_uInt32 TheClass::getPrimitive3DID() const { return TheID; }
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+namespace drawinglayer { namespace primitive3d {
+ /// typedefs for basePrimitive3DImplBase, Primitive3DSequence and Primitive3DReference
+ typedef cppu::WeakComponentImplHelper1< ::com::sun::star::graphic::XPrimitive3D > BasePrimitive3DImplBase;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XPrimitive3D > Primitive3DReference;
+ typedef ::com::sun::star::uno::Sequence< Primitive3DReference > Primitive3DSequence;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+// basePrimitive3D class
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** BasePrimitive3D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+
+ The description/functionality is identical with the 2D case in baseprimitive2d.hxx,
+ please see there for detailed information.
+
+ Current Basic 3D Primitives are:
+
+ - PolygonHairlinePrimitive3D (for 3D hairlines)
+ - PolyPolygonMaterialPrimitive3D (for 3D filled plane polygons)
+
+ That's all for 3D!
+ */
+ class DRAWINGLAYER_DLLPUBLIC BasePrimitive3D
+ : private boost::noncopyable,
+ protected comphelper::OBaseMutex,
+ public BasePrimitive3DImplBase
+ {
+ private:
+ protected:
+ public:
+ // constructor/destructor
+ BasePrimitive3D();
+ virtual ~BasePrimitive3D();
+
+ /** the ==operator is mainly needed to allow testing newly-created high level primitives against their last
+ incarnation which buffers/holds the decompositionsThe default implementation
+ uses getPrimitive3DID()-calls to test if it's the same ID at last. Overloaded implementation are then
+ based on this implementation.
+ */
+ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const;
+ bool operator!=( const BasePrimitive3D& rPrimitive ) const { return !operator==(rPrimitive); }
+
+ /** This method is for places where using the C++ implementation directly is possible. The subprocessing
+ and range merging is more efficient when working directly on basegfx::B3DRange. The default implementation
+ will use getDecomposition results to create the range
+ */
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /** provide unique ID for fast identifying of known primitive implementations in renderers. These use
+ the defines from primitivetypes3d.hxx to define unique IDs.
+ */
+ virtual sal_uInt32 getPrimitive3DID() const = 0;
+
+ /// The default implementation returns an empty sequence
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ //
+ // Methods from XPrimitive3D
+ //
+
+ /** The getDecomposition implementation for UNO API will use getDecomposition from this implementation. It
+ will get the ViewInformation from the ViewParameters for that purpose
+ */
+ virtual Primitive3DSequence SAL_CALL getDecomposition( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+
+ /** the getRange default implemenation will use getDecomposition to create the range information from merging
+ getRange results from the single local decomposition primitives.
+ */
+ virtual ::com::sun::star::geometry::RealRectangle3D SAL_CALL getRange( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters ) throw ( ::com::sun::star::uno::RuntimeException );
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// BufferedDecompositionPrimitive3D class
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** BufferedDecompositionPrimitive3D class
+
+ Baseclass for all C++ implementations of com::sun::star::graphic::XPrimitive2D
+
+ The description/functionality is identical with the 2D case in baseprimitive2d.hxx,
+ please see there for detailed information
+ */
+ class DRAWINGLAYER_DLLPUBLIC BufferedDecompositionPrimitive3D
+ : public BasePrimitive3D
+ {
+ private:
+ /// a sequence used for buffering the last create3DDecomposition() result
+ Primitive3DSequence maBuffered3DDecomposition;
+
+ protected:
+ /** access methods to maBuffered3DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive3DSequence& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; }
+ void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; }
+
+ /** method which is to be used to implement the local decomposition of a 2D primitive. The default
+ implementation will just return an empty decomposition
+ */
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ // constructor
+ BufferedDecompositionPrimitive3D();
+
+ /** The getDecomposition default implementation will on demand use create3DDecomposition() if
+ maBuffered3DDecomposition is empty. It will set maBuffered3DDecomposition to this obtained decomposition
+ to buffer it. If the decomposition is also ViewInformation-dependent, this method needs to be
+ overloaded and the ViewInformation for the last decomposition needs to be remembered, too, and
+ be used in the next call to decide if the buffered decomposition may be reused or not.
+ */
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+// tooling
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /// get B3DRange from a given Primitive3DReference
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getB3DRangeFromPrimitive3DReference(const Primitive3DReference& rCandidate, const geometry::ViewInformation3D& aViewInformation);
+
+ /// get range3D from a given Primitive3DSequence
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getB3DRangeFromPrimitive3DSequence(const Primitive3DSequence& rCandidate, const geometry::ViewInformation3D& aViewInformation);
+
+ /** compare two Primitive2DReferences for equality, including trying to get implementations (BasePrimitive2D)
+ and using compare operator
+ */
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive3DReferencesEqual(const Primitive3DReference& rA, const Primitive3DReference& rB);
+
+ /// compare two Primitive3DReferences for equality, uses arePrimitive3DReferencesEqual internally
+ bool DRAWINGLAYER_DLLPUBLIC arePrimitive3DSequencesEqual(const Primitive3DSequence& rA, const Primitive3DSequence& rB);
+
+ /// concatenate sequence
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive3DSequenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DSequence& rSource);
+
+ /// concatenate single Primitive3D
+ void DRAWINGLAYER_DLLPUBLIC appendPrimitive3DReferenceToPrimitive3DSequence(Primitive3DSequence& rDest, const Primitive3DReference& rSource);
+
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_BASEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx b/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
new file mode 100644
index 000000000000..3be15ad5e8bb
--- /dev/null
+++ b/include/drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// define ranges for other libraries
+
+#define PRIMITIVE3D_ID_RANGE_DRAWINGLAYER (0 << 16)
+
+//////////////////////////////////////////////////////////////////////////////
+// local primitives
+
+#define PRIMITIVE3D_ID_GROUPPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 0)
+#define PRIMITIVE3D_ID_HATCHTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 1)
+#define PRIMITIVE3D_ID_MODIFIEDCOLORPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 2)
+#define PRIMITIVE3D_ID_POLYGONHAIRLINEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 3)
+#define PRIMITIVE3D_ID_POLYGONSTROKEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 4)
+#define PRIMITIVE3D_ID_POLYGONTUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 5)
+#define PRIMITIVE3D_ID_POLYPOLYGONMATERIALPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 6)
+#define PRIMITIVE3D_ID_SDRCUBEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 7)
+#define PRIMITIVE3D_ID_SDREXTRUDEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 8)
+#define PRIMITIVE3D_ID_SDRLATHEPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 9)
+#define PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 10)
+#define PRIMITIVE3D_ID_SDRSPHEREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 11)
+#define PRIMITIVE3D_ID_SHADOWPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 12)
+#define PRIMITIVE3D_ID_UNIFIEDTRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 13)
+#define PRIMITIVE3D_ID_GRADIENTTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 14)
+#define PRIMITIVE3D_ID_BITMAPTEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 15)
+#define PRIMITIVE3D_ID_TRANSPARENCETEXTUREPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 16)
+#define PRIMITIVE3D_ID_TRANSFORMPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 17)
+#define PRIMITIVE3D_ID_HIDDENGEOMETRYPRIMITIVE3D (PRIMITIVE3D_ID_RANGE_DRAWINGLAYER| 18)
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_PRIMITIVETYPES3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/groupprimitive3d.hxx b/include/drawinglayer/primitive3d/groupprimitive3d.hxx
new file mode 100644
index 000000000000..d8d3f5b77446
--- /dev/null
+++ b/include/drawinglayer/primitive3d/groupprimitive3d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** GroupPrimitive3D class
+
+ Baseclass for all grouping 3D primitives
+
+ The description/functionality is identical with the 2D case in groupprimitive2d.hxx,
+ please see there for detailed information.
+
+ Current Basic 3D StatePrimitives are:
+
+ - ModifiedColorPrimitive3D (for a stack of color modifications)
+ - ShadowPrimitive3D (for 3D objects with shadow; this is a special case
+ since the shadow of a 3D primitive is a 2D primitive set)
+ - TexturePrimitive3D (with the following variations)
+ - GradientTexturePrimitive3D (for 3D gradient fill)
+ - BitmapTexturePrimitive3D (for 3D Bitmap fill)
+ - TransparenceTexturePrimitive3D (for 3D transparence)
+ - HatchTexturePrimitive3D (for 3D hatch fill)
+ - TransformPrimitive3D (for a transformation stack)
+ */
+ class DRAWINGLAYER_DLLPUBLIC GroupPrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the children. Declared private since this shall never be changed at all after construction
+ Primitive3DSequence maChildren;
+
+ public:
+ /// constructor
+ explicit GroupPrimitive3D(const Primitive3DSequence& rChildren);
+
+ /// data read access
+ Primitive3DSequence getChildren() const { return maChildren; }
+
+ /// compare operator
+ virtual bool operator==( const BasePrimitive3D& rPrimitive ) const;
+
+ /// local decomposition. Implementation will just return children
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_GROUPPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx b/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
new file mode 100644
index 000000000000..981027a1615b
--- /dev/null
+++ b/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/textureprimitive3d.hxx>
+#include <drawinglayer/attribute/fillhatchattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** HatchTexturePrimitive3D class
+
+ HatchTexturePrimitive3D is derived from GroupPrimitive3D, but implements
+ a decomposition which is complicated enough for buffering. Since the group
+ primitive has no default buffering, it is necessary here to add a local
+ buffering mechanism for the decomposition
+ */
+ class DRAWINGLAYER_DLLPUBLIC HatchTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// the hatch definition
+ attribute::FillHatchAttribute maHatch;
+
+ /// the buffered decomposed hatch
+ Primitive3DSequence maBuffered3DDecomposition;
+
+ protected:
+ /// helper: local decomposition
+ Primitive3DSequence impCreate3DDecomposition() const;
+
+ /// local access methods to maBufferedDecomposition
+ const Primitive3DSequence& getBuffered3DDecomposition() const { return maBuffered3DDecomposition; }
+ void setBuffered3DDecomposition(const Primitive3DSequence& rNew) { maBuffered3DDecomposition = rNew; }
+
+ public:
+ /// constructor
+ HatchTexturePrimitive3D(
+ const attribute::FillHatchAttribute& rHatch,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const attribute::FillHatchAttribute& getHatch() const { return maHatch; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// local decomposition.
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HATCHTEXTUREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx b/include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx
new file mode 100644
index 000000000000..7fe7359b4824
--- /dev/null
+++ b/include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ // This primitive is used to represent geometry for non-visible objects,
+ // e.g. a 3D cube without fill attributes. To still be able to use
+ // primitives for HitTest functionality, the 3d decompositions produce
+ // an as much as possible simplified fill geometry encapsulated in this
+ // primtive when there is no fill geometry. Currently, the 3d hit test
+ // uses only areas, so maybe in a further enchanced version this will change
+ // to 'if neither filled nor lines' creation criteria. The whole primitive
+ // decomposes to nothing, so no one not knowing it will be influenced. Only
+ // helper processors for hit test (and maybe BoundRect extractors) will
+ // use it and it's children subcontent.
+ class DRAWINGLAYER_DLLPUBLIC HiddenGeometryPrimitive3D : public GroupPrimitive3D
+ {
+ public:
+ explicit HiddenGeometryPrimitive3D(const Primitive3DSequence& rChildren);
+
+ // despite returning an empty decomposition since it's no visualisation data,
+ // range calculation is intended to use hidden geometry, so
+ // the local implementation will return the children's range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// The default implementation returns an empty sequence
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ // provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_HIDDENGEOMETRYPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx b/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx
new file mode 100644
index 000000000000..0e5fe4329e12
--- /dev/null
+++ b/include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** ModifiedColorPrimitive3D class
+
+ This primitive is a grouping primitive and allows to define
+ how the colors of it's child content shall be modified for
+ visualisation. Please see the ModifiedColorPrimitive2D
+ description for more info.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ModifiedColorPrimitive3D : public GroupPrimitive3D
+ {
+ private:
+ /// The ColorModifier to use
+ basegfx::BColorModifier maColorModifier;
+
+ public:
+ /// constructor
+ ModifiedColorPrimitive3D(
+ const Primitive3DSequence& rChildren,
+ const basegfx::BColorModifier& rColorModifier);
+
+ /// data read access
+ const basegfx::BColorModifier& getColorModifier() const { return maColorModifier; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_MODIFIEDCOLORPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polygonprimitive3d.hxx b/include/drawinglayer/primitive3d/polygonprimitive3d.hxx
new file mode 100644
index 000000000000..62fb60265732
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polygonprimitive3d.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <drawinglayer/attribute/lineattribute.hxx>
+#include <drawinglayer/attribute/strokeattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolygonHairlinePrimitive3D class
+
+ This primitive defines a Hairline in 3D. Since hairlines are view-dependent,
+ this primitive is view-dependent, too.
+
+ This is one of the non-decomposable 3D primitives, so a renderer
+ should proccess it.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the hairline geometry
+ basegfx::B3DPolygon maPolygon;
+
+ /// the hairline color
+ basegfx::BColor maBColor;
+
+ public:
+ /// constructor
+ PolygonHairlinePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const basegfx::BColor& rBColor);
+
+ /// data read access
+ const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolygonStrokePrimitive3D class
+
+ This primitive defines a 3D line with line width, line join, line color
+ and stroke attributes. It will be decomposed dependent on the definition
+ to the needed primitives, e.g. filled Tubes for fat lines.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive3D : public BufferedDecompositionPrimitive3D
+ {
+ private:
+ /// the line geometry
+ basegfx::B3DPolygon maPolygon;
+
+ /// the line attributes like width, join and color
+ attribute::LineAttribute maLineAttribute;
+
+ /// the line stroking (if used)
+ attribute::StrokeAttribute maStrokeAttribute;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonStrokePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const attribute::LineAttribute& rLineAttribute,
+ const attribute::StrokeAttribute& rStrokeAttribute);
+
+ /// data read access
+ basegfx::B3DPolygon getB3DPolygon() const { return maPolygon; }
+ const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
+ const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
new file mode 100644
index 000000000000..56f7dc4b4d4a
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B3DPolyPolygon;
+ class B3DHomMatrix;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolygonStrokePrimitive3D class
+
+ This 3D primitive extends a 3D hairline to a 3D tube which is
+ e.g. used for fat lines in 3D. It's decomposition will create all
+ 3D objects needed for the line tubes and the edge roundings
+ in full 3D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolygonTubePrimitive3D : public PolygonHairlinePrimitive3D
+ {
+ private:
+ /// hold the last decompositon since it's expensive
+ Primitive3DSequence maLast3DDecomposition;
+
+ /// visualisation parameters
+ double mfRadius;
+ double mfDegreeStepWidth;
+ double mfMiterMinimumAngle;
+ basegfx::B2DLineJoin maLineJoin;
+ com::sun::star::drawing::LineCap maLineCap;
+
+ protected:
+ /** access methods to maLast3DDecomposition. The usage of this methods may allow
+ later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
+ implementations for buffering the last decomposition.
+ */
+ const Primitive3DSequence& getLast3DDecomposition() const { return maLast3DDecomposition; }
+ void setLast3DDecomposition(const Primitive3DSequence& rNew) { maLast3DDecomposition = rNew; }
+
+ /// local decomposition.
+ Primitive3DSequence impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ PolygonTubePrimitive3D(
+ const basegfx::B3DPolygon& rPolygon,
+ const basegfx::BColor& rBColor,
+ double fRadius,
+ basegfx::B2DLineJoin aLineJoin,
+ com::sun::star::drawing::LineCap aLineCap,
+ double fDegreeStepWidth = 10.0 * F_PI180,
+ double fMiterMinimumAngle = 15.0 * F_PI180);
+
+ /// data read access
+ double getRadius() const { return mfRadius; }
+ double getDegreeStepWidth() const { return mfDegreeStepWidth; }
+ double getMiterMinimumAngle() const { return mfMiterMinimumAngle; }
+ basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; }
+ com::sun::star::drawing::LineCap getLineCap() const { return maLineCap; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /** local decomposition. Use own buffering since we are not derived from
+ BufferedDecompositionPrimitive3D
+ */
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx b/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx
new file mode 100644
index 000000000000..7f916afe978c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <drawinglayer/attribute/materialattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** PolyPolygonMaterialPrimitive3D class
+
+ This primitive defines a planar 3D PolyPolygon filled with a single color.
+ This is one of the non-decomposable primitives, so a renderer
+ should proccess it.
+
+ It is assumed here that the PolyPolgon is a single plane in 3D.
+ */
+ class DRAWINGLAYER_DLLPUBLIC PolyPolygonMaterialPrimitive3D : public BasePrimitive3D
+ {
+ private:
+ /// the PolyPolygon geometry
+ basegfx::B3DPolyPolygon maPolyPolygon;
+
+ /// the fill parameters
+ attribute::MaterialAttribute3D maMaterial;
+
+ /// bitfield
+ unsigned mbDoubleSided : 1;
+
+ public:
+ /// constructor
+ PolyPolygonMaterialPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon,
+ const attribute::MaterialAttribute3D& rMaterial,
+ bool bDoubleSided);
+
+ /// data read access
+ const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
+ const attribute::MaterialAttribute3D& getMaterial() const { return maMaterial; }
+ bool getDoubleSided() const { return mbDoubleSided; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYPOLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx
new file mode 100644
index 000000000000..513d120c5343
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrCubePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D cube definition.
+ The cube is implicitely in unit coordinates and the given transformation
+ defines it's geometry in space.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrCubePrimitive3D : public SdrPrimitive3D
+ {
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrCubePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRCUBEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx b/include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx
new file mode 100644
index 000000000000..ffe0e2cea676
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <com/sun/star/drawing/TextureProjectionMode.hpp>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class B3DPolygon;
+ class B3DPolyPolygon;
+ class B3DHomMatrix;
+ class B2DVector;
+}
+
+namespace drawinglayer { namespace attribute {
+ class SdrLineAttribute;
+ class SdrFillAttribute;
+ class Sdr3DObjectAttribute;
+ class FillGradientAttribute;
+ class SdrShadowAttribute;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ // #i98295#
+ basegfx::B3DRange DRAWINGLAYER_DLLPUBLIC getRangeFrom3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill);
+ void DRAWINGLAYER_DLLPUBLIC applyNormalsKindSphereTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill, const basegfx::B3DRange& rRange);
+ void DRAWINGLAYER_DLLPUBLIC applyNormalsKindFlatTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill);
+ void DRAWINGLAYER_DLLPUBLIC applyNormalsInvertTo3DGeometry(::std::vector< basegfx::B3DPolyPolygon >& rFill);
+
+ // #i98314#
+ void DRAWINGLAYER_DLLPUBLIC applyTextureTo3DGeometry(
+ ::com::sun::star::drawing::TextureProjectionMode eModeX,
+ ::com::sun::star::drawing::TextureProjectionMode eModeY,
+ ::std::vector< basegfx::B3DPolyPolygon >& rFill,
+ const basegfx::B3DRange& rRange,
+ const basegfx::B2DVector& rTextureSize);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC create3DPolyPolygonLinePrimitives(
+ const basegfx::B3DPolyPolygon& rUnitPolyPolygon,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const attribute::SdrLineAttribute& rLine);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC create3DPolyPolygonFillPrimitives(
+ const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute,
+ const attribute::SdrFillAttribute& rFill,
+ const attribute::FillGradientAttribute& rFillGradient);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC createShadowPrimitive3D(
+ const Primitive3DSequence& rSource,
+ const attribute::SdrShadowAttribute& rShadow,
+ bool bShadow3D);
+
+ Primitive3DSequence DRAWINGLAYER_DLLPUBLIC createHiddenGeometryPrimitives3D(
+ const ::std::vector< basegfx::B3DPolyPolygon >& r3DPolyPolygonVector,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::Sdr3DObjectAttribute& aSdr3DObjectAttribute);
+
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PRIMITIVE3D_SDRDECOMPOSITIONTOOLS3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx b/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
new file mode 100644
index 000000000000..d741b4c1b223
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace drawinglayer { namespace geometry {
+ class ViewInformation3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SliceType3D definition */
+ enum SliceType3D
+ {
+ SLICETYPE3D_REGULAR, // normal geoemtry Slice3D
+ SLICETYPE3D_FRONTCAP, // front cap
+ SLICETYPE3D_BACKCAP // back cap
+ };
+
+ /// class to hold one Slice3D
+ class DRAWINGLAYER_DLLPUBLIC Slice3D
+ {
+ protected:
+ basegfx::B3DPolyPolygon maPolyPolygon;
+ SliceType3D maSliceType;
+
+ public:
+ Slice3D(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B3DHomMatrix& aTransform,
+ SliceType3D aSliceType = SLICETYPE3D_REGULAR)
+ : maPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)),
+ maSliceType(aSliceType)
+ {
+ maPolyPolygon.transform(aTransform);
+ }
+
+ explicit Slice3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon,
+ SliceType3D aSliceType = SLICETYPE3D_REGULAR)
+ : maPolyPolygon(rPolyPolygon),
+ maSliceType(aSliceType)
+ {
+ }
+
+ // data access
+ const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; }
+ SliceType3D getSliceType() const { return maSliceType; }
+ };
+
+ /// typedef for a group of Slice3Ds
+ typedef ::std::vector< Slice3D > Slice3DVector;
+
+ /// helpers for creation
+ void DRAWINGLAYER_DLLPUBLIC createLatheSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fRotation,
+ sal_uInt32 nSteps,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+
+ void DRAWINGLAYER_DLLPUBLIC createExtrudeSlices(
+ Slice3DVector& rSliceVector,
+ const basegfx::B2DPolyPolygon& rSource,
+ double fBackScale,
+ double fDiagonal,
+ double fDepth,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+
+ /// helpers for geometry extraction
+ basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines);
+ basegfx::B3DPolyPolygon DRAWINGLAYER_DLLPUBLIC extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector);
+
+ void DRAWINGLAYER_DLLPUBLIC extractPlanesFromSlice(
+ ::std::vector< basegfx::B3DPolyPolygon >& rFill,
+ const Slice3DVector& rSliceVector,
+ bool bCreateNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothNormals,
+ bool bSmoothLids,
+ bool bClosed,
+ double fSmoothNormalsMix,
+ double fSmoothLidsMix,
+ bool bCreateTextureCoordinates,
+ const basegfx::B2DHomMatrix& rTexTransform);
+
+ void DRAWINGLAYER_DLLPUBLIC createReducedOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DHomMatrix& rObjectTransform,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget);
+
+ } // end of namespace overlay
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
new file mode 100644
index 000000000000..055e7e71dd4c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrExtrudePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
+ The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
+ and gets extruded in Z-Direction by Depth.
+
+ Various possibilities e.g. for creating diagonals (edge roudings in 3D)
+ and similar are given.
+
+ The decomposition will create all necessary 3D planes for visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
+ Slice3DVector maSlices;
+
+ /// primitive geometry data
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ double mfDepth;
+ double mfDiagonal;
+ double mfBackScale;
+
+ /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ geometry::ViewInformation3D* mpLastRLGViewInformation;
+
+ /// bitfield
+ unsigned mbSmoothNormals : 1; // Plane self
+ unsigned mbSmoothHorizontalNormals : 1; // always
+ unsigned mbSmoothLids : 1; // Front/back
+ unsigned mbCharacterMode : 1;
+ unsigned mbCloseFront : 1;
+ unsigned mbCloseBack : 1;
+
+ /// create slices
+ void impCreateSlices();
+
+ /// get (evtl. create) slices
+ const Slice3DVector& getSlices() const;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrExtrudePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDepth,
+ double fDiagonal,
+ double fBackScale,
+ bool bSmoothNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothLids,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+ virtual ~SdrExtrudePrimitive3D();
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ double getDepth() const { return mfDepth; }
+ double getDiagonal() const { return mfDiagonal; }
+ double getBackScale() const { return mfBackScale; }
+ bool getSmoothNormals() const { return mbSmoothNormals; }
+ bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
+ bool getSmoothLids() const { return mbSmoothLids; }
+ bool getCharacterMode() const { return mbCharacterMode; }
+ bool getCloseFront() const { return mbCloseFront; }
+ bool getCloseBack() const { return mbCloseBack; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
new file mode 100644
index 000000000000..7632e8e5985c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrLathePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D rotation definition.
+ The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
+ and gets rotated around the Y-Axis.
+
+ Various possibilities e.g. for creating diagonals (edge roudings in 3D)
+ and similar are given.
+
+ The decomposition will create all necessary 3D planes for visualisation.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrLathePrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// geometry helper for slices
+ basegfx::B2DPolyPolygon maCorrectedPolyPolygon;
+ Slice3DVector maSlices;
+
+ /// primitive geometry data
+ basegfx::B2DPolyPolygon maPolyPolygon;
+ sal_uInt32 mnHorizontalSegments;
+ sal_uInt32 mnVerticalSegments;
+ double mfDiagonal;
+ double mfBackScale;
+ double mfRotation;
+
+ /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
+ geometry::ViewInformation3D* mpLastRLGViewInformation;
+
+ /// bitfield
+ unsigned mbSmoothNormals : 1; // Plane self
+ unsigned mbSmoothHorizontalNormals : 1; // always
+ unsigned mbSmoothLids : 1; // Front/back
+ unsigned mbCharacterMode : 1;
+ unsigned mbCloseFront : 1;
+ unsigned mbCloseBack : 1;
+
+ /// create slices
+ void impCreateSlices();
+
+ /// get (evtl. create) slices
+ const Slice3DVector& getSlices() const;
+
+ protected:
+ /// local helpers
+ void impCreateOutlines(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPolygon& rLoopA,
+ const basegfx::B3DPolygon& rLoopB,
+ basegfx::B3DPolyPolygon& rTarget) const;
+
+ bool impHasCutWith(
+ const basegfx::B2DPolygon& rPoly,
+ const basegfx::B2DPoint& rStart,
+ const basegfx::B2DPoint& rEnd) const;
+
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrLathePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments,
+ double fDiagonal,
+ double fBackScale,
+ double fRotation,
+ bool bSmoothNormals,
+ bool bSmoothHorizontalNormals,
+ bool bSmoothLids,
+ bool bCharacterMode,
+ bool bCloseFront,
+ bool bCloseBack);
+ virtual ~SdrLathePrimitive3D();
+
+ /// data read access
+ const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
+ sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
+ sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
+ double getDiagonal() const { return mfDiagonal; }
+ double getBackScale() const { return mfBackScale; }
+ double getRotation() const { return mfRotation; }
+ bool getSmoothNormals() const { return mbSmoothNormals; }
+ bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
+ bool getSmoothLids() const { return mbSmoothLids; }
+ bool getCharacterMode() const { return mbCharacterMode; }
+ bool getCloseFront() const { return mbCloseFront; }
+ bool getCloseBack() const { return mbCloseBack; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx
new file mode 100644
index 000000000000..2d9976224e6b
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrPolyPolygonPrimitive3D class
+
+ This 3D primitive defines a PolyPolgon in space which may have
+ Line- and FillStyles and extra 3D surface attributes. It is assumed
+ that the given 3D PolyPolgon (which may contain texture and normal
+ information) is planar in 3D.
+
+ The decomposition will include all needed 3D data for visualisation,
+ including FatLines and fill styles.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrPolyPolygonPrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// the planar polyPolygon evtl with normals and texture coordinates
+ basegfx::B3DPolyPolygon maPolyPolygon3D;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrPolyPolygonPrimitive3D(
+ const basegfx::B3DPolyPolygon& rPolyPolygon3D,
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// data access
+ const basegfx::B3DPolyPolygon& getPolyPolygon3D() const { return maPolyPolygon3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPOLYPOLYGONPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrprimitive3d.hxx
new file mode 100644
index 000000000000..6563f5172f67
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrprimitive3d.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/sdrallattribute3d.hxx>
+#include <drawinglayer/primitive3d/sdrextrudelathetools3d.hxx>
+#include <drawinglayer/attribute/sdrobjectattribute3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ /** SdrPrimitive3D class
+
+ Base class for the more complicated geometric primitives, so
+ derive from buffered primitive to allow overloading of
+ create3DDecomposition there.
+ */
+ namespace primitive3d
+ {
+ class DRAWINGLAYER_DLLPUBLIC SdrPrimitive3D : public BufferedDecompositionPrimitive3D
+ {
+ private:
+ /// object surface attributes
+ basegfx::B3DHomMatrix maTransform;
+ basegfx::B2DVector maTextureSize;
+ attribute::SdrLineFillShadowAttribute3D maSdrLFSAttribute;
+ attribute::Sdr3DObjectAttribute maSdr3DObjectAttribute;
+
+ protected:
+ /** Standard implementation for primitive3D which
+ will use maTransform as range and expand by evtl. line width / 2
+ */
+ basegfx::B3DRange getStandard3DRange() const;
+
+ /** implementation for primitive3D which
+ will use given Slice3Ds and expand by evtl. line width / 2
+ */
+ basegfx::B3DRange get3DRangeFromSlices(const Slice3DVector& rSlices) const;
+
+ public:
+ /// constructor
+ SdrPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute);
+
+ /// data read access
+ const basegfx::B3DHomMatrix& getTransform() const { return maTransform; }
+ const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
+ const attribute::SdrLineFillShadowAttribute3D& getSdrLFSAttribute() const { return maSdrLFSAttribute; }
+ const attribute::Sdr3DObjectAttribute getSdr3DObjectAttribute() const { return maSdr3DObjectAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx b/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx
new file mode 100644
index 000000000000..48e7ee42ceb2
--- /dev/null
+++ b/include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** SdrSpherePrimitive3D class
+
+ This 3D primitive expands the SdrPrimitive3D to a 3D sphere definition.
+ The sphere is implicitely in unit coordinates and the given transformation
+ defines it's geometry in space.
+ */
+ class DRAWINGLAYER_DLLPUBLIC SdrSpherePrimitive3D : public SdrPrimitive3D
+ {
+ private:
+ /// additional geometry definitions
+ sal_uInt32 mnHorizontalSegments;
+ sal_uInt32 mnVerticalSegments;
+
+ protected:
+ /// local decomposition.
+ virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ public:
+ /// constructor
+ SdrSpherePrimitive3D(
+ const basegfx::B3DHomMatrix& rTransform,
+ const basegfx::B2DVector& rTextureSize,
+ const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
+ const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
+ sal_uInt32 nHorizontalSegments,
+ sal_uInt32 nVerticalSegments);
+
+ /// data read access
+ sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
+ sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRSPHEREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/shadowprimitive3d.hxx b/include/drawinglayer/primitive3d/shadowprimitive3d.hxx
new file mode 100644
index 000000000000..76be7e7742f4
--- /dev/null
+++ b/include/drawinglayer/primitive3d/shadowprimitive3d.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** ShadowPrimitive3D class
+
+ This 3D grouping primitive is used to define a shadow for
+ 3d geometry by embedding it. The shadow of 3D objects are
+ 2D polygons, so the shadow transformation is a 2D transformation.
+
+ If the Shadow3D flag is set, the shadow definition has to be
+ combined with the scene and camera definition to create the correct
+ projected shadow 2D-Polygons.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ShadowPrimitive3D : public GroupPrimitive3D
+ {
+ protected:
+ /// 2D shadow definition
+ basegfx::B2DHomMatrix maShadowTransform;
+ basegfx::BColor maShadowColor;
+ double mfShadowTransparence;
+
+ /// bitfield
+ unsigned mbShadow3D : 1;
+
+ public:
+ /// constructor
+ ShadowPrimitive3D(
+ const basegfx::B2DHomMatrix& rShadowTransform,
+ const basegfx::BColor& rShadowColor,
+ double fShadowTransparence,
+ bool bShadow3D,
+ const Primitive3DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
+ const basegfx::BColor& getShadowColor() const { return maShadowColor; }
+ double getShadowTransparence() const { return mfShadowTransparence; }
+ bool getShadow3D() const { return mbShadow3D; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SHADOWPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/textureprimitive3d.hxx b/include/drawinglayer/primitive3d/textureprimitive3d.hxx
new file mode 100644
index 000000000000..1ce8e9bcd57c
--- /dev/null
+++ b/include/drawinglayer/primitive3d/textureprimitive3d.hxx
@@ -0,0 +1,230 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <drawinglayer/attribute/fillbitmapattribute.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <drawinglayer/attribute/fillgradientattribute.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** TexturePrimitive3D class
+
+ This 3D grouping primitive is used to define a texture for
+ 3d geometry by embedding it. It is used as bae class for
+ extended texture definitions
+ */
+ class DRAWINGLAYER_DLLPUBLIC TexturePrimitive3D : public GroupPrimitive3D
+ {
+ private:
+ /// texture geometry definition
+ basegfx::B2DVector maTextureSize;
+
+ /// bitfield
+ /// flag if texture shall be modulated with white interpolated color
+ unsigned mbModulate : 1;
+
+ /// flag if texture shall be filtered
+ unsigned mbFilter : 1;
+
+ public:
+ /// constructor
+ TexturePrimitive3D(
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
+ bool getModulate() const { return mbModulate; }
+ bool getFilter() const { return mbFilter; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** UnifiedTransparenceTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a unified
+ transparence texture definition. All 3D primitives
+ embedded here will be shown with the given transparency.
+ */
+ class DRAWINGLAYER_DLLPUBLIC UnifiedTransparenceTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// transparency definition
+ double mfTransparence;
+
+ public:
+ /// constructor
+ UnifiedTransparenceTexturePrimitive3D(
+ double fTransparence,
+ const Primitive3DSequence& rChildren);
+
+ /// data read access
+ double getTransparence() const { return mfTransparence; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// own getB3DRange implementation to include transparent geometries to BoundRect calculations
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// local decomposition.
+ virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** GradientTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a gradient texture
+ definition. All 3D primitives embedded here will be shown with the
+ defined gradient.
+ */
+ class DRAWINGLAYER_DLLPUBLIC GradientTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// the gradient definition
+ attribute::FillGradientAttribute maGradient;
+
+ public:
+ /// constructor
+ GradientTexturePrimitive3D(
+ const attribute::FillGradientAttribute& rGradient,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const attribute::FillGradientAttribute& getGradient() const { return maGradient; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** BitmapTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a bitmap texture
+ definition. All 3D primitives embedded here will be shown with the
+ defined bitmap (maybe tiled if defined).
+ */
+ class DRAWINGLAYER_DLLPUBLIC BitmapTexturePrimitive3D : public TexturePrimitive3D
+ {
+ private:
+ /// bitmap fill attribute
+ attribute::FillBitmapAttribute maFillBitmapAttribute;
+
+ public:
+ /// constructor
+ BitmapTexturePrimitive3D(
+ const attribute::FillBitmapAttribute& rFillBitmapAttribute,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize,
+ bool bModulate,
+ bool bFilter);
+
+ /// data read access
+ const attribute::FillBitmapAttribute& getFillBitmapAttribute() const { return maFillBitmapAttribute; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** TransparenceTexturePrimitive3D class
+
+ This 3D primitive expands TexturePrimitive3D to a transparence texture
+ definition. For transparence definition, a gradient is used. The values in
+ that gradient will be interpreted as luminance Transparence-Values. All 3D
+ primitives embedded here will be shown with the defined transparence.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransparenceTexturePrimitive3D : public GradientTexturePrimitive3D
+ {
+ public:
+ /// constructor
+ TransparenceTexturePrimitive3D(
+ const attribute::FillGradientAttribute& rGradient,
+ const Primitive3DSequence& rChildren,
+ const basegfx::B2DVector& rTextureSize);
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive3d/transformprimitive3d.hxx b/include/drawinglayer/primitive3d/transformprimitive3d.hxx
new file mode 100644
index 000000000000..85a88a330d77
--- /dev/null
+++ b/include/drawinglayer/primitive3d/transformprimitive3d.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+#define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/groupprimitive3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace primitive3d
+ {
+ /** TransformPrimitive3D class
+
+ This is one of the basic grouping 3D primitives and it provides
+ embedding a sequence of primitives (a geometry) into a
+ 3D transformation.
+
+ Please see the description for TransformPrimitive2D since these
+ primitives are pretty similar.
+ */
+ class DRAWINGLAYER_DLLPUBLIC TransformPrimitive3D : public GroupPrimitive3D
+ {
+ private:
+ // the 3D transformation to apply
+ basegfx::B3DHomMatrix maTransformation;
+
+ public:
+ /// constructor
+ TransformPrimitive3D(
+ const basegfx::B3DHomMatrix& rTransformation,
+ const Primitive3DSequence& rChildren);
+
+ /// data read access
+ const basegfx::B3DHomMatrix& getTransformation() const { return maTransformation; }
+
+ /// compare operator
+ virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
+
+ /// get range
+ virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
+
+ /// provide unique ID
+ DeclPrimitrive3DIDBlock()
+ };
+ } // end of namespace primitive3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TRANSFORMPRIMITIVE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/baseprocessor2d.hxx b/include/drawinglayer/processor2d/baseprocessor2d.hxx
new file mode 100644
index 000000000000..62a0f874a9ae
--- /dev/null
+++ b/include/drawinglayer/processor2d/baseprocessor2d.hxx
@@ -0,0 +1,196 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** BaseProcessor2D class
+
+ Baseclass for all C++ implementations of instances which process
+ primitives.
+
+ Instances which process primitives can be renderers, but also stuff
+ for HitTests, BoundRect calculations and/or animation processing. The
+ main usage are renderers, but they are supposed to handle any primitive
+ processing.
+
+ The base implementation is constructed with a ViewInformation2D which
+ is accessible throughout the processor implementations. The idea is
+ to construct any processor with a given ViewInformation2D. To be able
+ to handle primitives which need to change the current transformation
+ (as e.g. TransformPrimitive2D) it is allowed for the processor implementation
+ to change tis local value using updateViewInformation.
+
+ The basic processing method is process(..) which gets handed over the
+ sequence of primitives to process. For convenience of the C++ implementations,
+ the default implementation of process(..) maps all accesses to primitives to
+ single calls to processBasePrimitive2D(..) where the primitive in question is
+ already casted to the C++ implementation class.
+
+ The process(..) implementation makes a complete iteration over the given
+ sequence of primitives. If the Primitive is not derived from BasePrimitive2D
+ and thus not part of the C++ implementations, it converts ViewInformation2D
+ to the corresponding API implementation (an uno::Sequence< beans::PropertyValue >)
+ and recursively calls the method process(..) at the primitive with the decomposition
+ derived from that primitive. This is the preparation to handle unknown implementations
+ of the com::sun::star::graphic::XPrimitive2D interface in the future.
+
+ So, to implement a basic processor, it is necessary to overload and implement the
+ processBasePrimitive2D(..) method. A minimal renderer has to support the
+ Basic Primitives (see baseprimitive2d.hxx) and the Grouping Primitives (see
+ groupprimitive2d.hxx). These are (currently):
+
+ Basic Primitives:
+
+ - BitmapPrimitive2D (bitmap data, evtl. with transparence)
+ - PointArrayPrimitive2D (single points)
+ - PolygonHairlinePrimitive2D (hairline curves/polygons)
+ - PolyPolygonColorPrimitive2D (colored polygons)
+
+ Grouping Primitives:
+
+ - TransparencePrimitive2D (objects with freely defined transparence)
+ - InvertPrimitive2D (for XOR)
+ - MaskPrimitive2D (for masking)
+ - ModifiedColorPrimitive2D (for a stack of color modifications)
+ - TransformPrimitive2D (for a transformation stack)
+
+ A processor doing so is a minimal processor. Of course a processor may
+ handle any higher-level prmitive (that has a decomposition implementation)
+ for more direct data access or performance reasons, too.
+
+ The main part of a processBasePrimitive2D implementation is a switch..case
+ construct, looking like the following:
+
+ void foo::processBasePrimitive2D(const BasePrimitive2D& rCandidate)
+ {
+ switch(rCandidate.getPrimitive2DID())
+ {
+ case PRIMITIVE2D_ID_??? :
+ {
+ // process PRIMITIVE2D_ID_??? here...
+
+ ...
+
+ break;
+ }
+
+ ...
+
+ default :
+ {
+ // process recursively
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ break;
+ }
+ }
+ }
+
+ The default case makes the processor work with all complex primitives
+ by recursively using their decomposition.
+
+ You can also add a case for ignoring primitives by using:
+
+ case PRIMITIVE2D_ID_...IGNORE.A.. :
+ case PRIMITIVE2D_ID_...IGNORE.B.. :
+ case PRIMITIVE2D_ID_...IGNORE.C.. :
+ {
+ // ignore these primitives by neither processing nor
+ // recursively processing their decomposition
+ break;
+ }
+
+ Another useful case is embedding the processing of a complex primitive by
+ bracketing it with some actions:
+
+ case PRIMITIVE2D_ID_SOME_TEXT :
+ {
+ // encapsulate e.g. with changing local varibles, e.g.
+ // sometimes it's good to know if a basic primitive is
+ // part of a text, especially when not handling the text
+ // self but by purpose want to handle the decomposed
+ // geometries in the processor
+ startText();
+ process(rCandidate.get2DDecomposition(getViewInformation2D()));
+ endText();
+ break;
+ }
+
+ As an example a processor collecting the outlines of a sequence of primitives
+ only needs to handle some Basic Primitives and create outline and collect
+ outline polygons e.g. for primitives with area like BitmapPrimitive2D (a
+ rectangle) and PolyPolygonColorPrimitive2D. When also handling the Grouping
+ Primitives MaskPrimitive2D (e.g. ignoring it's content, using the mask polyPolygon)
+ and TransformPrimitive2D (to have the correct local transformation), a processor
+ creating the outline can be written using just four (4) primitives. As a tipp, it can
+ be helpful to add many for the purpose not interesting higher level primitives
+ to not force their decomposition to be created and/or parsed.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BaseProcessor2D
+ {
+ private:
+ /// The ViewInformation2D itself. It's private to isolate accesses to it
+ geometry::ViewInformation2D maViewInformation2D;
+
+ protected:
+ /* access method to allow the implementations to change the current
+ ViewInformation2D if needed. This allows isolating these accesses
+ later if needed
+ */
+ void updateViewInformation(const geometry::ViewInformation2D& rViewInformation2D)
+ {
+ maViewInformation2D = rViewInformation2D;
+ }
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive2D-based.
+ Default implementation does nothing
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ /// constructor/destructor
+ explicit BaseProcessor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~BaseProcessor2D();
+
+ /// the central processing method
+ virtual void process(const primitive2d::Primitive2DSequence& rSource);
+
+ /// data read access
+ const geometry::ViewInformation2D& getViewInformation2D() const { return maViewInformation2D; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_BASEPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/canvasprocessor.hxx b/include/drawinglayer/processor2d/canvasprocessor.hxx
new file mode 100644
index 000000000000..5dea3b450c19
--- /dev/null
+++ b/include/drawinglayer/processor2d/canvasprocessor.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
+#define _DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+#include <com/sun/star/rendering/ViewState.hpp>
+#include <com/sun/star/rendering/RenderState.hpp>
+#include <i18nlangtag/lang.h>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <vcl/mapmod.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// forward declaration
+
+namespace basegfx {
+ class BColor;
+ class B2DPolygon;
+}
+
+namespace com { namespace sun { namespace star { namespace rendering {
+ class XCanvas;
+ class XPolyPolygon2D;
+}}}}
+
+namespace drawinglayer { namespace primitive2d {
+ class MaskPrimitive2D;
+ class MetafilePrimitive2D;
+ class TextSimplePortionPrimitive2D;
+ class BitmapPrimitive2D;
+ class TransparencePrimitive2D;
+ class PolygonStrokePrimitive2D;
+ class FillBitmapPrimitive2D;
+ class UnifiedTransparencePrimitive2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** canvasProcessor2D class
+
+ A basic implementation of a renderer for com::sun::star::rendering::XCanvas
+ as a target
+ */
+ class DRAWINGLAYER_DLLPUBLIC canvasProcessor2D : public BaseProcessor2D
+ {
+ private:
+ // the (current) destination OutDev and canvas
+ OutputDevice* mpOutputDevice;
+ com::sun::star::uno::Reference< com::sun::star::rendering::XCanvas > mxCanvas;
+ com::sun::star::rendering::ViewState maViewState;
+ com::sun::star::rendering::RenderState maRenderState;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ // the current clipping PolyPolygon from MaskPrimitive2D, always in
+ // object coordinates
+ basegfx::B2DPolyPolygon maClipPolyPolygon;
+
+ // determined LanguageType
+ LanguageType meLang;
+
+ // as tooling, the process() implementation takes over API handling and calls this
+ // virtual render method when the primitive implementation is BasePrimitive2D-based.
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ // direct primitive renderer support
+ void impRenderMaskPrimitive2D(const primitive2d::MaskPrimitive2D& rMaskCandidate);
+ void impRenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rMetaCandidate);
+ void impRenderTextSimplePortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
+ void impRenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void impRenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransparenceCandidate);
+ void impRenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokePrimitive);
+ void impRenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapPrimitive2D);
+ void impRenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rUniTransparenceCandidate);
+
+ public:
+ canvasProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~canvasProcessor2D();
+
+ // access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PROCESSOR_CANVASPROCESSOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/contourextractor2d.hxx b/include/drawinglayer/processor2d/contourextractor2d.hxx
new file mode 100644
index 000000000000..af390a8cd7b7
--- /dev/null
+++ b/include/drawinglayer/processor2d/contourextractor2d.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** ContourExtractor2D class
+
+ A processor who extracts the contour of the primtives feeded to it
+ in the single local PolyPolygon
+ */
+ class DRAWINGLAYER_DLLPUBLIC ContourExtractor2D : public BaseProcessor2D
+ {
+ private:
+ /// the extracted contour
+ basegfx::B2DPolyPolygonVector maExtractedContour;
+
+ /// bitfield
+ bool mbExtractFillOnly : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ explicit ContourExtractor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ bool bExtractFillOnly);
+
+ virtual ~ContourExtractor2D();
+
+ const basegfx::B2DPolyPolygonVector& getExtractedContour() const { return maExtractedContour; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_CONTOUREXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/hittestprocessor2d.hxx b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
new file mode 100644
index 000000000000..fc2ab3252558
--- /dev/null
+++ b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
@@ -0,0 +1,108 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace basegfx { class B2DPolygon; }
+namespace basegfx { class B2DPolyPolygon; }
+namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** HitTestProcessor2D class
+
+ This processor implements a HitTest with the feeded primitives,
+ given tolerance and extras
+ */
+ class DRAWINGLAYER_DLLPUBLIC HitTestProcessor2D : public BaseProcessor2D
+ {
+ private:
+ /// discrete HitTest position
+ basegfx::B2DPoint maDiscreteHitPosition;
+
+ /// discrete HitTolerance
+ double mfDiscreteHitTolerance;
+
+ /// bitfield
+ unsigned mbHit : 1;
+ unsigned mbHitToleranceUsed : 1;
+
+ /* this flag decides if primitives which are embedded to an
+ UnifiedTransparencePrimitive2D and are invisible will be taken into account for
+ HitTesting or not. Those primitives are created for objects which are else
+ completely invisible and normally their content exists of hairline
+ primitives describing the object's contour
+ */
+ unsigned mbUseInvisiblePrimitiveContent : 1;
+
+ /// flag to concentraze on text hits only
+ unsigned mbHitTextOnly : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+ bool checkHairlineHitWithTolerance(
+ const basegfx::B2DPolygon& rPolygon,
+ double fDiscreteHitTolerance);
+ bool checkFillHitWithTolerance(
+ const basegfx::B2DPolyPolygon& rPolyPolygon,
+ double fDiscreteHitTolerance);
+ void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
+
+ public:
+ HitTestProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ const basegfx::B2DPoint& rLogicHitPosition,
+ double fLogicHitTolerance,
+ bool bHitTextOnly);
+ virtual ~HitTestProcessor2D();
+
+ /// data write access
+ void setUseInvisiblePrimitiveContent(bool bNew)
+ {
+ if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
+ }
+
+ /// data read access
+ const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
+ double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
+ bool getHit() const { return mbHit; }
+ bool getHitToleranceUsed() const { return mbHitToleranceUsed; }
+ bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
+ bool getHitTextOnly() const { return mbHitTextOnly; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx
new file mode 100644
index 000000000000..4905f4062c5f
--- /dev/null
+++ b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** LineGeometryExtractor2D class
+
+ This processor can extract the line geometry from feeded primpitives. The
+ hairlines and the fille geometry from fat lines are separated.
+ */
+ class DRAWINGLAYER_DLLPUBLIC LineGeometryExtractor2D : public BaseProcessor2D
+ {
+ private:
+ basegfx::B2DPolygonVector maExtractedHairlines;
+ basegfx::B2DPolyPolygonVector maExtractedLineFills;
+
+ /// bitfield
+ unsigned mbInLineGeometry : 1;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ LineGeometryExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~LineGeometryExtractor2D();
+
+ const basegfx::B2DPolygonVector& getExtractedHairlines() const { return maExtractedHairlines; }
+ const basegfx::B2DPolyPolygonVector& getExtractedLineFills() const { return maExtractedLineFills; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_LINEGEOMETRYEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/objectinfoextractor2d.hxx b/include/drawinglayer/processor2d/objectinfoextractor2d.hxx
new file mode 100644
index 000000000000..42f4fb3970de
--- /dev/null
+++ b/include/drawinglayer/processor2d/objectinfoextractor2d.hxx
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer { namespace primitive2d { class ObjectInfoPrimitive2D; }}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** ObjectInfoPrimitiveExtractor2D class
+
+ A processor to find the first incarnation of ObjectInfoPrimitive2D
+ in a given hierarchy
+ */
+ class DRAWINGLAYER_DLLPUBLIC ObjectInfoPrimitiveExtractor2D : public BaseProcessor2D
+ {
+ private:
+ /// the target
+ const primitive2d::ObjectInfoPrimitive2D* mpFound;
+
+ /// tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ ObjectInfoPrimitiveExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~ObjectInfoPrimitiveExtractor2D();
+
+ const primitive2d::ObjectInfoPrimitive2D* getResult() const { return mpFound; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_OBJECTINFOEXTRACTOR2D_HXX
+
+// eof
diff --git a/include/drawinglayer/processor2d/processorfromoutputdevice.hxx b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
new file mode 100644
index 000000000000..cd149db71e6d
--- /dev/null
+++ b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _PROCESSOR_FROM_OUTPUTDEVICE_HXX
+#define _PROCESSOR_FROM_OUTPUTDEVICE_HXX
+
+#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include "drawinglayer/drawinglayerdllapi.h"
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+class OutputDevice;
+
+namespace drawinglayer { namespace processor2d {
+ class BaseProcessor2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ // create a mating VCL-Provessor for given OutputDevice. This includes
+ // looking for MetaFile-recording. The returned renderer changes owner,
+ // deletion is duty of the caller
+ DRAWINGLAYER_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ OutputDevice& rTargetOutDev,
+ const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
+
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_PROCESSOR_FROM_OUTPUTDEVICE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx b/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx
new file mode 100644
index 000000000000..239e624ccced
--- /dev/null
+++ b/include/drawinglayer/processor2d/textaspolygonextractor2d.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /// helper data structure for returning the result
+ struct DRAWINGLAYER_DLLPUBLIC TextAsPolygonDataNode
+ {
+ private:
+ basegfx::B2DPolyPolygon maB2DPolyPolygon;
+ basegfx::BColor maBColor;
+ bool mbIsFilled;
+
+ public:
+ TextAsPolygonDataNode(
+ const basegfx::B2DPolyPolygon& rB2DPolyPolygon,
+ const basegfx::BColor& rBColor,
+ bool bIsFilled)
+ : maB2DPolyPolygon(rB2DPolyPolygon),
+ maBColor(rBColor),
+ mbIsFilled(bIsFilled)
+ {
+ }
+
+ // data read access
+ const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maB2DPolyPolygon; }
+ const basegfx::BColor& getBColor() const { return maBColor; }
+ bool getIsFilled() const { return mbIsFilled; }
+ };
+
+ /// typedef for a vector of that helper data
+ typedef ::std::vector< TextAsPolygonDataNode > TextAsPolygonDataNodeVector;
+
+ /** TextAsPolygonExtractor2D class
+
+ This processor extracts text in the feeded primitives to filled polygons
+ */
+ class DRAWINGLAYER_DLLPUBLIC TextAsPolygonExtractor2D : public BaseProcessor2D
+ {
+ private:
+ // extraction target
+ TextAsPolygonDataNodeVector maTarget;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // flag if we are in a decomposed text
+ sal_uInt32 mnInText;
+
+ // tooling methods
+ void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ explicit TextAsPolygonExtractor2D(const geometry::ViewInformation2D& rViewInformation);
+ virtual ~TextAsPolygonExtractor2D();
+
+ // data read access
+ const TextAsPolygonDataNodeVector& getTarget() const { return maTarget; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_TEXTASPOLYGONEXTRACTOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
new file mode 100644
index 000000000000..fa85105939c8
--- /dev/null
+++ b/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <com/sun/star/i18n/XBreakIterator.hpp>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// vcl::PDFExtOutDevData support
+
+#include <vcl/pdfextoutdevdata.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+class GDIMetaFile;
+class Rectangle;
+class Gradient;
+class SvtGraphicFill;
+class SvtGraphicStroke;
+
+namespace drawinglayer { namespace attribute {
+ class FillGradientAttribute;
+ class LineAttribute;
+ class StrokeAttribute;
+ class LineStartEndAttribute;
+}}
+
+namespace basegfx {
+ class BColor;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** VclMetafileProcessor2D class
+
+ This processor derived from VclProcessor2D is the base class for rendering
+ all feeded primitives to a classical VCL-Metafile, including all over the
+ time grown extra data in comments and PDF exception data creations. Also
+ printing needs some exception stuff.
+
+ All in all it is needed to emulate the old ::paint output from the old
+ Drawinglayer as long as exporters and/or filters still use the Metafile
+ and the extra-data added to it (which can be seen mostly as 'extensions'
+ or simply as 'hacks').
+ */
+ class DRAWINGLAYER_DLLPUBLIC VclMetafileProcessor2D : public VclProcessor2D
+ {
+ private:
+ /// local helper(s)
+ Rectangle impDumpToMetaFile(
+ const primitive2d::Primitive2DSequence& rContent,
+ GDIMetaFile& o_rContentMetafile);
+ void impConvertFillGradientAttributeToVCLGradient(
+ Gradient& o_rVCLGradient,
+ const attribute::FillGradientAttribute& rFiGrAtt,
+ bool bIsTransparenceGradient);
+ void impStartSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
+ void impEndSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
+ SvtGraphicStroke* impTryToCreateSvtGraphicStroke(
+ const basegfx::B2DPolygon& rB2DPolygon,
+ const basegfx::BColor* pColor,
+ const attribute::LineAttribute* pLineAttribute,
+ const attribute::StrokeAttribute* pStrokeAttribute,
+ const attribute::LineStartEndAttribute* pStart,
+ const attribute::LineStartEndAttribute* pEnd);
+ void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
+ void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
+
+ /// Convert the fWidth to the same space as its coordinates.
+ double getTransformedLineWidth( double fWidth ) const;
+
+ /// the current clipping PolyPolygon from MaskPrimitive2D
+ basegfx::B2DPolyPolygon maClipPolyPolygon;
+
+ /// the target MetaFile
+ GDIMetaFile* mpMetaFile;
+
+ /* do not allow embedding SvtGraphicFills into each other,
+ use a counter to prevent that
+ */
+ sal_uInt32 mnSvtGraphicFillCount;
+
+ /// same for SvtGraphicStroke
+ sal_uInt32 mnSvtGraphicStrokeCount;
+
+ /* hold the last unified transparence value to have it handy
+ on SvtGraphicStroke creation
+ */
+ double mfCurrentUnifiedTransparence;
+
+ /* break iterator support
+ made static so it only needs to be fetched once, even with many single
+ constructed VclMetafileProcessor2D. It's still incarnated on demand,
+ but exists for OOo runtime now by purpose.
+ */
+ static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator > mxBreakIterator;
+
+ /* vcl::PDFExtOutDevData support
+ For the first step, some extra actions at vcl::PDFExtOutDevData need to
+ be emulated with the VclMetafileProcessor2D. These are potentially temporarily
+ since PDF export may use PrimitiveSequences one day directly.
+ */
+ vcl::PDFExtOutDevData* mpPDFExtOutDevData;
+
+ protected:
+ /* the local processor for BasePrinitive2D-Implementation based primitives,
+ called from the common process()-implementation
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ /// constructor/destructor
+ VclMetafileProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~VclMetafileProcessor2D();
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLMETAFILEPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx
new file mode 100644
index 000000000000..c3003f096467
--- /dev/null
+++ b/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPIXELPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPIXELPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/vclprocessor2d.hxx>
+#include <vcl/outdev.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** VclPixelProcessor2D class
+
+ This processor derived from VclProcessor2D is the base class for rendering
+ all feeded primitives to a VCL Window. It is the currently used renderer
+ for all VCL editing output from the DrawingLayer.
+ */
+ class DRAWINGLAYER_DLLPUBLIC VclPixelProcessor2D : public VclProcessor2D
+ {
+ private:
+ protected:
+ /* the local processor for BasePrinitive2D-Implementation based primitives,
+ called from the common process()-implementation
+ */
+ virtual void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
+
+ public:
+ /// constructor/destructor
+ VclPixelProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~VclPixelProcessor2D();
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPIXELPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor2d/vclprocessor2d.hxx b/include/drawinglayer/processor2d/vclprocessor2d.hxx
new file mode 100644
index 000000000000..32dafbc42b0a
--- /dev/null
+++ b/include/drawinglayer/processor2d/vclprocessor2d.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPROCESSOR2D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPROCESSOR2D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor2d/baseprocessor2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+class OutputDevice;
+
+namespace drawinglayer { namespace primitive2d {
+ class TextSimplePortionPrimitive2D;
+ class PolygonHairlinePrimitive2D;
+ class BitmapPrimitive2D;
+ class FillBitmapPrimitive2D;
+ class PolyPolygonGradientPrimitive2D;
+ class PolyPolygonBitmapPrimitive2D;
+ class PolyPolygonColorPrimitive2D;
+ class MetafilePrimitive2D;
+ class MaskPrimitive2D;
+ class UnifiedTransparencePrimitive2D;
+ class TransparencePrimitive2D;
+ class TransformPrimitive2D;
+ class MarkerArrayPrimitive2D;
+ class PointArrayPrimitive2D;
+ class ModifiedColorPrimitive2D;
+ class PolygonStrokePrimitive2D;
+ class ControlPrimitive2D;
+ class PagePreviewPrimitive2D;
+ class EpsPrimitive2D;
+ class SvgLinearAtomPrimitive2D;
+ class SvgRadialAtomPrimitive2D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor2d
+ {
+ /** VclProcessor2D class
+
+ This processor is the base class for VCL-Based processors. It has no
+ processBasePrimitive2D implementation and thus is not usable directly.
+ */
+ class DRAWINGLAYER_DLLPUBLIC VclProcessor2D : public BaseProcessor2D
+ {
+ protected:
+ // the destination OutDev
+ OutputDevice* mpOutputDevice;
+
+ // the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ // the current transformation. Since VCL pixel renderer transforms to pixels
+ // and VCL MetaFile renderer to World (logic) coordinates, the local
+ // ViewInformation2D cannot directly be used, but needs to be kept up to date
+ basegfx::B2DHomMatrix maCurrentTransformation;
+
+ // SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ // stack value (increment and decrement) to count how deep we are in
+ // PolygonStrokePrimitive2D's decompositions (normally only one)
+ sal_uInt32 mnPolygonStrokePrimitive2D;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // common VCL rendering support
+
+ void RenderTextSimpleOrDecoratedPortionPrimitive2D(const primitive2d::TextSimplePortionPrimitive2D& rTextCandidate);
+ void RenderPolygonHairlinePrimitive2D(const primitive2d::PolygonHairlinePrimitive2D& rPolygonCandidate, bool bPixelBased);
+ void RenderBitmapPrimitive2D(const primitive2d::BitmapPrimitive2D& rBitmapCandidate);
+ void RenderFillBitmapPrimitive2D(const primitive2d::FillBitmapPrimitive2D& rFillBitmapCandidate);
+ void RenderPolyPolygonGradientPrimitive2D(const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate);
+ void RenderPolyPolygonBitmapPrimitive2D(const primitive2d::PolyPolygonBitmapPrimitive2D& rPolygonCandidate);
+ void RenderPolyPolygonColorPrimitive2D(const primitive2d::PolyPolygonColorPrimitive2D& rPolygonCandidate);
+ void RenderMetafilePrimitive2D(const primitive2d::MetafilePrimitive2D& rPolygonCandidate);
+ void RenderMaskPrimitive2DPixel(const primitive2d::MaskPrimitive2D& rMaskCandidate);
+ void RenderModifiedColorPrimitive2D(const primitive2d::ModifiedColorPrimitive2D& rModifiedCandidate);
+ void RenderUnifiedTransparencePrimitive2D(const primitive2d::UnifiedTransparencePrimitive2D& rTransCandidate);
+ void RenderTransparencePrimitive2D(const primitive2d::TransparencePrimitive2D& rTransCandidate);
+ void RenderTransformPrimitive2D(const primitive2d::TransformPrimitive2D& rTransformCandidate);
+ void RenderPagePreviewPrimitive2D(const primitive2d::PagePreviewPrimitive2D& rPagePreviewCandidate);
+ void RenderMarkerArrayPrimitive2D(const primitive2d::MarkerArrayPrimitive2D& rMarkerArrayCandidate);
+ void RenderPointArrayPrimitive2D(const primitive2d::PointArrayPrimitive2D& rPointArrayCandidate);
+ void RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate);
+ void RenderEpsPrimitive2D(const primitive2d::EpsPrimitive2D& rEpsPrimitive2D);
+ void RenderSvgLinearAtomPrimitive2D(const primitive2d::SvgLinearAtomPrimitive2D& rCandidate);
+ void RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate);
+
+ /////////////////////////////////////////////////////////////////////////////
+ // DrawMode adaption support
+ void adaptLineToFillDrawMode() const;
+ void adaptTextToFillDrawMode() const;
+
+ public:
+ // constructor/destructor
+ VclProcessor2D(
+ const geometry::ViewInformation2D& rViewInformation,
+ OutputDevice& rOutDev);
+ virtual ~VclProcessor2D();
+
+ // access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace processor2d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLPROCESSOR2D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/baseprocessor3d.hxx b/include/drawinglayer/processor3d/baseprocessor3d.hxx
new file mode 100644
index 000000000000..834779982ba5
--- /dev/null
+++ b/include/drawinglayer/processor3d/baseprocessor3d.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/primitive3d/baseprimitive3d.hxx>
+#include <drawinglayer/geometry/viewinformation3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** BaseProcessor3D class
+
+ Baseclass for all C++ implementations of instances which process
+ primitives.
+
+ Please have a look at baseprocessor2d.hxx for more comments.
+ */
+ class DRAWINGLAYER_DLLPUBLIC BaseProcessor3D
+ {
+ private:
+ geometry::ViewInformation3D maViewInformation3D;
+
+ protected:
+ void updateViewInformation(const geometry::ViewInformation3D& rViewInformation3D)
+ {
+ maViewInformation3D = rViewInformation3D;
+ }
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ Default implementation does nothing
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ explicit BaseProcessor3D(const geometry::ViewInformation3D& rViewInformation);
+ virtual ~BaseProcessor3D();
+
+ // the central processing method
+ virtual void process(const primitive3d::Primitive3DSequence& rSource);
+
+ // data access
+ const geometry::ViewInformation3D& getViewInformation3D() const { return maViewInformation3D; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_PROCESSOR3D_BASEPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/cutfindprocessor3d.hxx b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx
new file mode 100644
index 000000000000..2b4714ca3054
--- /dev/null
+++ b/include/drawinglayer/processor3d/cutfindprocessor3d.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/defaultprocessor3d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** CutFindProcessor class
+
+ This processor extracts all cuts of 3D plane geometries in the feeded primitives
+ with the given cut vector, based on the ViewInformation3D given.
+ */
+ class DRAWINGLAYER_DLLPUBLIC CutFindProcessor : public BaseProcessor3D
+ {
+ private:
+ /// the start and stop point for the cut vector
+ basegfx::B3DPoint maFront;
+ basegfx::B3DPoint maBack;
+
+ /// the found cut points
+ ::std::vector< basegfx::B3DPoint > maResult;
+
+ /* #i102956# the transformation change from TransformPrimitive3D processings
+ needs to be remembered to be able to transform found cuts to the
+ basic coordinate system the processor starts with
+ */
+ basegfx::B3DHomMatrix maCombinedTransform;
+
+ /// bitfield
+ bool mbAnyHit : 1;
+
+ /* this flag decides if primitives which are invisible will be taken into account for
+ HitTesting or not.
+ */
+ bool mbUseInvisiblePrimitiveContent : 1;
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ CutFindProcessor(const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B3DPoint& rFront,
+ const basegfx::B3DPoint& rBack,
+ bool bAnyHit);
+
+ /// data write access
+ void setUseInvisiblePrimitiveContent(bool bNew)
+ {
+ if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
+ }
+
+ /// data read access
+ const ::std::vector< basegfx::B3DPoint >& getCutPoints() const { return maResult; }
+ bool getAnyHit() const { return mbAnyHit; }
+ bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_CUTFINDPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/defaultprocessor3d.hxx b/include/drawinglayer/processor3d/defaultprocessor3d.hxx
new file mode 100644
index 000000000000..010fba3b1f1d
--- /dev/null
+++ b/include/drawinglayer/processor3d/defaultprocessor3d.hxx
@@ -0,0 +1,158 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+#include <svtools/optionsdrawinglayer.hxx>
+#include <boost/shared_ptr.hpp>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BZPixelRaster;
+ class B3DPolygon;
+ class B3DPolyPolygon;
+}
+
+namespace drawinglayer { namespace attribute {
+ class SdrSceneAttribute;
+ class SdrLightingAttribute;
+ class MaterialAttribute3D;
+}}
+
+namespace drawinglayer { namespace primitive3d {
+ class PolygonHairlinePrimitive3D;
+ class PolyPolygonMaterialPrimitive3D;
+ class GradientTexturePrimitive3D;
+ class HatchTexturePrimitive3D;
+ class BitmapTexturePrimitive3D;
+ class TransformPrimitive3D;
+ class ModifiedColorPrimitive3D;
+}}
+
+namespace drawinglayer { namespace texture {
+ class GeoTexSvx;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** DefaultProcessor3D class
+
+ This processor renders all feeded primitives to a 2D raster where for all
+ primitives the two basic methods rasterconvertB3DPolygon for hairlines and
+ rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to
+ e.g. base a Z-Buffer supported renderer on the 3D primitive processing.
+ */
+ class DRAWINGLAYER_DLLPUBLIC DefaultProcessor3D : public BaseProcessor3D
+ {
+ protected:
+ /// read-only scene infos (normal handling, etc...)
+ const attribute::SdrSceneAttribute& mrSdrSceneAttribute;
+
+ /// read-only light infos (lights, etc...)
+ const attribute::SdrLightingAttribute& mrSdrLightingAttribute;
+
+ /// renderer range. Need to be correctly set by the derived implementations
+ /// normally the (0, 0, W, H) range from mpBZPixelRaster
+ basegfx::B2DRange maRasterRange;
+
+ /// the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ /// the current active texture
+ boost::shared_ptr< texture::GeoTexSvx > mpGeoTexSvx;
+
+ /// the current active transparence texture
+ boost::shared_ptr< texture::GeoTexSvx > mpTransparenceGeoTexSvx;
+
+ /// SvtOptionsDrawinglayer incarnation to react on diverse settings
+ const SvtOptionsDrawinglayer maDrawinglayerOpt;
+
+ /// counter for entered transparence textures
+ sal_uInt32 mnTransparenceCounter;
+
+ /// bitfield
+ unsigned mbModulate : 1;
+ unsigned mbFilter : 1;
+ unsigned mbSimpleTextureActive : 1;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // rendering support
+
+ void impRenderGradientTexturePrimitive3D(const primitive3d::GradientTexturePrimitive3D& rPrimitive, bool bTransparence);
+ void impRenderHatchTexturePrimitive3D(const primitive3d::HatchTexturePrimitive3D& rPrimitive);
+ void impRenderBitmapTexturePrimitive3D(const primitive3d::BitmapTexturePrimitive3D& rPrimitive);
+ void impRenderModifiedColorPrimitive3D(const primitive3d::ModifiedColorPrimitive3D& rModifiedCandidate);
+ void impRenderPolygonHairlinePrimitive3D(const primitive3d::PolygonHairlinePrimitive3D& rPrimitive);
+ void impRenderPolyPolygonMaterialPrimitive3D(const primitive3d::PolyPolygonMaterialPrimitive3D& rPrimitive);
+ void impRenderTransformPrimitive3D(const primitive3d::TransformPrimitive3D& rTransformCandidate);
+
+ //////////////////////////////////////////////////////////////////////////////
+ // rasterconversions for filled and non-filled polygons. These NEED to be
+ // implemented from derivations
+
+ virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const = 0;
+ virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const = 0;
+
+ // the processing method for a single, known primitive
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rBasePrimitive);
+
+ public:
+ DefaultProcessor3D(
+ const geometry::ViewInformation3D& rViewInformation,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute);
+ virtual ~DefaultProcessor3D();
+
+ /// data read access
+ const attribute::SdrSceneAttribute& getSdrSceneAttribute() const { return mrSdrSceneAttribute; }
+ const attribute::SdrLightingAttribute& getSdrLightingAttribute() const { return mrSdrLightingAttribute; }
+
+ /// data read access renderer stuff
+ const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
+ const boost::shared_ptr< texture::GeoTexSvx >& getGeoTexSvx() const { return mpGeoTexSvx; }
+ const boost::shared_ptr< texture::GeoTexSvx >& getTransparenceGeoTexSvx() const { return mpTransparenceGeoTexSvx; }
+ sal_uInt32 getTransparenceCounter() const { return mnTransparenceCounter; }
+ bool getModulate() const { return mbModulate; }
+ bool getFilter() const { return mbFilter; }
+ bool getSimpleTextureActive() const { return mbSimpleTextureActive; }
+
+ /// access to Drawinglayer configuration options
+ const SvtOptionsDrawinglayer& getOptionsDrawinglayer() const { return maDrawinglayerOpt; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_PROCESSOR3D_DEFAULTPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/geometry2dextractor.hxx b/include/drawinglayer/processor3d/geometry2dextractor.hxx
new file mode 100644
index 000000000000..d85e6843f54d
--- /dev/null
+++ b/include/drawinglayer/processor3d/geometry2dextractor.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** Geometry2DExtractingProcessor class
+
+ This processor extracts the 2D geometry (projected geometry) of all feeded primitives.
+ It is e.g. used as sub-processor for contour extraction where 3D geometry is only
+ useful as 2D projected geometry.
+ */
+ class DRAWINGLAYER_DLLPUBLIC Geometry2DExtractingProcessor : public BaseProcessor3D
+ {
+ private:
+ /// result holding vector (2D)
+ primitive2d::Primitive2DSequence maPrimitive2DSequence;
+
+ /// object transformation for scene for 2d definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// the modifiedColorPrimitive stack
+ basegfx::BColorModifierStack maBColorModifierStack;
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ Geometry2DExtractingProcessor(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B2DHomMatrix& rObjectTransformation);
+
+ // data read access
+ const primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const basegfx::BColorModifierStack& getBColorModifierStack() const { return maBColorModifierStack; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_GEOMETRY2DEXTRACTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/shadow3dextractor.hxx b/include/drawinglayer/processor3d/shadow3dextractor.hxx
new file mode 100644
index 000000000000..183d61271c83
--- /dev/null
+++ b/include/drawinglayer/processor3d/shadow3dextractor.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/baseprocessor3d.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+#include <basegfx/matrix/b3dhommatrix.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b3dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** Shadow3DExtractingProcessor class
+
+ This processor extracts the 2D shadow geometry (projected geometry) of all feeded primitives.
+ It is used to create the shadow of 3D objects which consists of 2D geometry. It needs quite
+ some data to do so since we do not only offer flat projected 2D shadow, but also projections
+ dependent on the light source
+ */
+ class DRAWINGLAYER_DLLPUBLIC Shadow3DExtractingProcessor : public BaseProcessor3D
+ {
+ private:
+ /// result holding vector (2D) and target vector for stacking (inited to &maPrimitive2DSequence)
+ primitive2d::Primitive2DVector maPrimitive2DSequence;
+ primitive2d::Primitive2DVector* mpPrimitive2DSequence;
+
+ /// object transformation for scene for 2d definition
+ basegfx::B2DHomMatrix maObjectTransformation;
+
+ /// prepared data (transformations) for 2D/3D shadow calculations
+ basegfx::B3DHomMatrix maWorldToEye;
+ basegfx::B3DHomMatrix maEyeToView;
+ basegfx::B3DVector maLightNormal;
+ basegfx::B3DVector maShadowPlaneNormal;
+ basegfx::B3DPoint maPlanePoint;
+ double mfLightPlaneScalar;
+
+ /* the shadow color used for sub-primitives. Can stay at black since
+ the encapsulating 2d shadow primitive will contain the color
+ */
+ basegfx::BColor maPrimitiveColor;
+
+ /// bitfield
+ /// flag if shadow plane projection preparation leaded to valid results
+ unsigned mbShadowProjectionIsValid : 1;
+
+ /// flag if conversion is switched on
+ unsigned mbConvert : 1;
+
+ /// flag if conversion shall use projection
+ unsigned mbUseProjection : 1;
+
+ /// local helpers
+ basegfx::B2DPolygon impDoShadowProjection(const basegfx::B3DPolygon& rSource);
+ basegfx::B2DPolyPolygon impDoShadowProjection(const basegfx::B3DPolyPolygon& rSource);
+
+ /* as tooling, the process() implementation takes over API handling and calls this
+ virtual render method when the primitive implementation is BasePrimitive3D-based.
+ */
+ virtual void processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate);
+
+ public:
+ Shadow3DExtractingProcessor(
+ const geometry::ViewInformation3D& rViewInformation,
+ const basegfx::B2DHomMatrix& rObjectTransformation,
+ const basegfx::B3DVector& rLightNormal,
+ double fShadowSlant,
+ const basegfx::B3DRange& rContained3DRange);
+ virtual ~Shadow3DExtractingProcessor();
+
+ /// data read access
+ const primitive2d::Primitive2DSequence getPrimitive2DSequence() const;
+ const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
+ const basegfx::B3DHomMatrix& getWorldToEye() const { return maWorldToEye; }
+ const basegfx::B3DHomMatrix& getEyeToView() const { return maEyeToView; }
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+#endif //_DRAWINGLAYER_PROCESSOR3D_SHADOW3DEXTRACTOR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/processor3d/zbufferprocessor3d.hxx b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx
new file mode 100644
index 000000000000..8570809b465d
--- /dev/null
+++ b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
+#define INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/processor3d/defaultprocessor3d.hxx>
+#include <vcl/bitmapex.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predefines
+
+namespace basegfx {
+ class BZPixelRaster;
+}
+
+namespace drawinglayer {
+ namespace attribute {
+ class SdrSceneAttribute;
+ class SdrLightingAttribute;
+ class MaterialAttribute3D;
+ }
+ namespace geometry {
+ class ViewInformation2D;
+ }
+}
+
+class ZBufferRasterConverter3D;
+class RasterPrimitive3D;
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace processor3d
+ {
+ /** ZBufferProcessor3D class
+
+ This 3D renderer derived from DefaultProcessor3D renders all feeded primitives to a 2D
+ raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle
+ transparent content.
+ */
+ class DRAWINGLAYER_DLLPUBLIC ZBufferProcessor3D : public DefaultProcessor3D
+ {
+ private:
+ /// the raster target, a Z-Buffer
+ basegfx::BZPixelRaster* mpBZPixelRaster;
+
+ /// inverse of EyeToView for rasterconversion with evtl. Phong shading
+ basegfx::B3DHomMatrix maInvEyeToView;
+
+ /// The raster converter for Z-Buffer
+ ZBufferRasterConverter3D* mpZBufferRasterConverter3D;
+
+ /* AA value. Defines how many oversmples will be used in X and Y. Values 0, 1
+ will switch it off while e.g. 2 will use 2x2 pixels for each pixel to create
+ */
+ sal_uInt16 mnAntiAlialize;
+
+ /* remembered RasterPrimitive3D's which need to be painted back to front
+ for transparent 3D parts
+ */
+ std::vector< RasterPrimitive3D >* mpRasterPrimitive3Ds;
+
+ //////////////////////////////////////////////////////////////////////////////
+ // rasterconversions for filled and non-filled polygons
+
+ virtual void rasterconvertB3DPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolygon& rHairline) const;
+ virtual void rasterconvertB3DPolyPolygon(const attribute::MaterialAttribute3D& rMaterial, const basegfx::B3DPolyPolygon& rFill) const;
+
+ public:
+ ZBufferProcessor3D(
+ const geometry::ViewInformation3D& rViewInformation3D,
+ const geometry::ViewInformation2D& rViewInformation2D,
+ const attribute::SdrSceneAttribute& rSdrSceneAttribute,
+ const attribute::SdrLightingAttribute& rSdrLightingAttribute,
+ double fSizeX,
+ double fSizeY,
+ const basegfx::B2DRange& rVisiblePart,
+ sal_uInt16 nAntiAlialize);
+ virtual ~ZBufferProcessor3D();
+
+ void finish();
+
+ /// get the result as bitmapEx
+ BitmapEx getBitmapEx() const;
+ };
+ } // end of namespace processor3d
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //INCLUDED_DRAWINGLAYER_PROCESSOR3D_ZBUFFERPROCESSOR3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/texture/texture.hxx b/include/drawinglayer/texture/texture.hxx
new file mode 100644
index 000000000000..5d1751d70889
--- /dev/null
+++ b/include/drawinglayer/texture/texture.hxx
@@ -0,0 +1,260 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+#define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/tools/gradienttools.hxx>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvx
+ {
+ public:
+ GeoTexSvx();
+ virtual ~GeoTexSvx();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ bool operator!=(const GeoTexSvx& rGeoTexSvx) const { return !operator==(rGeoTexSvx); }
+
+ // virtual base methods
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradient : public GeoTexSvx
+ {
+ protected:
+ basegfx::ODFGradientInfo maGradientInfo;
+ basegfx::B2DRange maTargetRange;
+ basegfx::BColor maStart;
+ basegfx::BColor maEnd;
+ double mfBorder;
+
+ // helpers
+ void impAppendMatrix(::std::vector< basegfx::B2DHomMatrix >& rMatrices, const basegfx::B2DRange& rRange);
+ void impAppendColorsRadial(::std::vector< basegfx::BColor >& rColors);
+
+ public:
+ GeoTexSvxGradient(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder);
+ virtual ~GeoTexSvxGradient();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+
+ // virtual base methods
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors) = 0;
+
+ // data access
+ const basegfx::BColor& getStart() const { return maStart; }
+ const basegfx::BColor& getEnd() const { return maEnd; }
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientLinear : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientLinear(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle);
+ virtual ~GeoTexSvxGradientLinear();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientAxial : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientAxial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fAngle);
+ virtual ~GeoTexSvxGradientAxial();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRadial : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientRadial(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY);
+ virtual ~GeoTexSvxGradientRadial();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientElliptical : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientElliptical(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ virtual ~GeoTexSvxGradientElliptical();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientSquare : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientSquare(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ virtual ~GeoTexSvxGradientSquare();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxGradientRect : public GeoTexSvxGradient
+ {
+ public:
+ GeoTexSvxGradientRect(const basegfx::B2DRange& rTargetRange, const basegfx::BColor& rStart, const basegfx::BColor& rEnd, sal_uInt32 nSteps, double fBorder, double fOffsetX, double fOffsetY, double fAngle);
+ virtual ~GeoTexSvxGradientRect();
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ virtual void appendColors(::std::vector< basegfx::BColor >& rColors);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxHatch : public GeoTexSvx
+ {
+ protected:
+ basegfx::B2DHomMatrix maTextureTransform;
+ basegfx::B2DHomMatrix maBackTextureTransform;
+ double mfDistance;
+ double mfAngle;
+ sal_uInt32 mnSteps;
+
+ public:
+ GeoTexSvxHatch(const basegfx::B2DRange& rTargetRange, double fDistance, double fAngle);
+ virtual ~GeoTexSvxHatch();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ double getDistanceToHatch(const basegfx::B2DPoint& rUV) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxTiled : public GeoTexSvx
+ {
+ protected:
+ basegfx::B2DPoint maTopLeft;
+ basegfx::B2DVector maSize;
+
+ public:
+ GeoTexSvxTiled(const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ virtual ~GeoTexSvxTiled();
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+
+ virtual void appendTransformations(::std::vector< basegfx::B2DHomMatrix >& rMatrices);
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_DRAWINGLAYER_TEXTURE_TEXTURE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/texture/texture3d.hxx b/include/drawinglayer/texture/texture3d.hxx
new file mode 100644
index 000000000000..713cea76c928
--- /dev/null
+++ b/include/drawinglayer/texture/texture3d.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
+#define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+
+#include <drawinglayer/texture/texture.hxx>
+#include <vcl/bitmap.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+// predeclarations
+
+namespace drawinglayer { namespace primitive3d {
+ class HatchTexturePrimitive3D;
+}}
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMono : public GeoTexSvx
+ {
+ protected:
+ basegfx::BColor maSingleColor;
+ double mfOpacity;
+
+ public:
+ GeoTexSvxMono(const basegfx::BColor& rSingleColor, double fOpacity);
+
+ // compare operator
+ virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const;
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmap : public GeoTexSvx
+ {
+ protected:
+ Bitmap maBitmap;
+ BitmapReadAccess* mpRead;
+ basegfx::B2DPoint maTopLeft;
+ basegfx::B2DVector maSize;
+ double mfMulX;
+ double mfMulY;
+
+ // helpers
+ bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const;
+
+ public:
+ GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ virtual ~GeoTexSvxBitmap();
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapTiled : public GeoTexSvxBitmap
+ {
+ protected:
+ // helpers
+ basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const
+ {
+ double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX()));
+ double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY()));
+
+ if(fX < 0.0)
+ {
+ fX += maSize.getX();
+ }
+
+ if(fY < 0.0)
+ {
+ fY += maSize.getY();
+ }
+
+ return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY());
+ }
+
+ public:
+ GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize);
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace texture
+ {
+ class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx
+ {
+ protected:
+ basegfx::BColor maColor;
+ double mfLogicPixelSize;
+ GeoTexSvxHatch* mp0;
+ GeoTexSvxHatch* mp1;
+ GeoTexSvxHatch* mp2;
+
+ // bitfield
+ unsigned mbFillBackground : 1;
+
+ // helpers
+ bool impIsOnHatch(const basegfx::B2DPoint& rUV) const;
+
+ public:
+ GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize);
+ virtual ~GeoTexSvxMultiHatch();
+ virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const;
+ virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const;
+
+ // dada access
+ bool getFillBackground() const { return mbFillBackground; }
+ };
+ } // end of namespace texture
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/tools/converters.hxx b/include/drawinglayer/tools/converters.hxx
new file mode 100644
index 000000000000..5bc9ddbb18e4
--- /dev/null
+++ b/include/drawinglayer/tools/converters.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_DRAWINGLAYER_TOOLS_CONVERTERS_HXX
+#define INCLUDED_DRAWINGLAYER_TOOLS_CONVERTERS_HXX
+
+#include <drawinglayer/drawinglayerdllapi.h>
+#include <vcl/bitmapex.hxx>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace drawinglayer
+{
+ namespace tools
+ {
+ BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx(
+ const drawinglayer::primitive2d::Primitive2DSequence& rSeq,
+ const geometry::ViewInformation2D& rViewInformation2D,
+ sal_uInt32 nDiscreteWidth,
+ sal_uInt32 nDiscreteHeight,
+ sal_uInt32 nMaxQuadratPixels);
+
+ } // end of namespace tools
+} // end of namespace drawinglayer
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // INCLUDED_DRAWINGLAYER_TOOLS_CONVERTERS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleComponentBase.hxx b/include/editeng/AccessibleComponentBase.hxx
new file mode 100644
index 000000000000..ea292e0e439c
--- /dev/null
+++ b/include/editeng/AccessibleComponentBase.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_EXTENDED_COMPONENT_BASE_HXX
+
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/awt/XFocusListener.hpp>
+#include "editeng/editengdllapi.h"
+
+namespace accessibility {
+
+/** @descr
+ This base class provides (will provice) a base implementation of the
+ <type>XAccessibleComponent</type> and the
+ <type>XAccessibleExtendedComponent</type> for all shapes. For
+ more detailed documentation about the methods refer to the interface
+ descriptions of <type>XAccessible</type>,
+ <type>XAccessibleContext</type>, <type>XInterface</type>,
+ <type>XServiceInfo</type>, and <type>XTypeProvider</type>.
+*/
+class EDITENG_DLLPUBLIC AccessibleComponentBase
+ : public ::com::sun::star::accessibility::XAccessibleExtendedComponent
+{
+public:
+ //===== internal ========================================================
+ AccessibleComponentBase (void);
+ virtual ~AccessibleComponentBase (void);
+
+
+ //===== XAccessibleComponent ================================================
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine whether the given point lies
+ inside this object.
+ */
+ virtual sal_Bool SAL_CALL containsPoint (
+ const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty reference.
+ */
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > SAL_CALL
+ getAccessibleAtPoint (
+ const ::com::sun::star::awt::Point& aPoint)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty rectangle.
+ */
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the location.
+ */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation returns an empty position, i.e. the
+ * result of the default constructor of <type>com::sun::star::awt::Point</type>.
+ */
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation uses the result of
+ <member>getBounds</member> to determine the size.
+ */
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation ignores this call.
+ */
+ virtual void SAL_CALL addFocusListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation ignores this call.
+ */
+ virtual void SAL_CALL removeFocusListener (const ::com::sun::star::uno::Reference<
+ ::com::sun::star::awt::XFocusListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** The default implementation does nothing.
+ */
+ virtual void SAL_CALL grabFocus (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns black as the default foreground color.
+ */
+ virtual sal_Int32 SAL_CALL getForeground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns white as the default background color.
+ */
+ virtual sal_Int32 SAL_CALL getBackground (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //===== XAccessibleExtendedComponent ====================================
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL
+ getFont (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTitledBorderText (void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getToolTipText (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XTypeProvider ===================================================
+
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleContextBase.hxx b/include/editeng/AccessibleContextBase.hxx
new file mode 100644
index 000000000000..574582a68ae1
--- /dev/null
+++ b/include/editeng/AccessibleContextBase.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_CONTEXT_BASE_HXX
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <cppuhelper/weak.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <osl/mutex.hxx>
+#include <cppuhelper/compbase4.hxx>
+#include <editeng/editengdllapi.h>
+
+
+namespace accessibility {
+
+struct MutexOwner {mutable ::osl::Mutex maMutex;};
+
+/** @descr
+ This base class provides an implementation of the
+ <type>AccessibleContext</type> service. Appart from the
+ <type>XXAccessible<type> and <type>XAccessibleContextContext</type>
+ interfaces it supports the <type>XServiceInfo</type> interface.
+*/
+class EDITENG_DLLPUBLIC AccessibleContextBase
+ : public MutexOwner,
+ public cppu::PartialWeakComponentImplHelper4<
+ ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+
+ //===== internal ========================================================
+
+ /** The origin of the accessible name or description.
+ */
+ enum StringOrigin {
+ ManuallySet,
+ FromShape,
+ AutomaticallyCreated,
+ NotSet
+ };
+
+ AccessibleContextBase (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ const sal_Int16 aRole);
+ virtual ~AccessibleContextBase (void);
+
+
+ /** Call all accessiblity event listeners to inform them about the
+ specified event.
+ @param aEventId
+ Id of the event type.
+ @param rNewValue
+ New value of the modified attribute. Pass empty structure if
+ not applicable.
+ @param rOldValue
+ Old value of the modified attribute. Pass empty structure if
+ not applicable.
+ */
+ void CommitChange (sal_Int16 aEventId,
+ const ::com::sun::star::uno::Any& rNewValue,
+ const ::com::sun::star::uno::Any& rOldValue);
+
+ /** Set a new description and, provided that the new name differs from
+ the old one, broadcast an accessibility event.
+ @param rsDescription
+ The new description.
+ @param eDescriptionOrigin
+ The origin of the description. This is used to determine
+ whether the given description overrules the existing one. An
+ origin with a lower numerical value overrides one with a higher
+ value.
+ */
+ void SetAccessibleDescription (
+ const OUString& rsDescription,
+ StringOrigin eDescriptionOrigin)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set a new description and, provided that the new name differs from
+ the old one, broadcast an accessibility event.
+ @param rsName
+ The new name.
+ @param eNameOrigin
+ The origin of the name. This is used to determine whether the
+ given name overrules the existing one. An origin with a lower
+ numerical value overrides one with a higher value.
+ */
+ void SetAccessibleName (
+ const OUString& rsName,
+ StringOrigin eNameOrigin)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set the specified state (turn it on) and send events to all
+ listeners to inform them of the change.
+
+ @param aState
+ The state to turn on.
+
+ @return
+ If the specified state changed its value due to this call
+ <TRUE/> is returned, otherwise <FALSE/>.
+ */
+ virtual sal_Bool SetState (sal_Int16 aState);
+
+ /** Reset the specified state (turn it off) and send events to all
+ listeners to inform them of the change.
+
+ @param aState
+ The state to turn off.
+
+ @return
+ If the specified state changed its value due to this call
+ <TRUE/> is returned, otherwise <FALSE/>.
+ */
+ virtual sal_Bool ResetState (sal_Int16 aState);
+
+ /** Return the state of the specified state.
+
+ @param aState
+ The state for which to return its value.
+
+ @return
+ A value of <TRUE/> indicates that the state is set. A <FALSE/>
+ value indicates an unset state.
+ */
+ sal_Bool GetState (sal_Int16 aState);
+
+ /** Replace the current relation set with the specified one. Send
+ events for relations that are not in both sets.
+
+ @param rRelationSet
+ The new relation set that replaces the old one.
+ */
+ virtual void SetRelationSet (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet>& rxRelationSet)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessible =====================================================
+
+ /// Return the XAccessibleContext.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+ getAccessibleContext (void) throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or throw exception.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild (sal_Int32 nIndex)
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ /// Return a reference to the parent.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's role.
+ virtual sal_Int16 SAL_CALL
+ getAccessibleRole (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return this object's description.
+ virtual OUString SAL_CALL
+ getAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual OUString SAL_CALL
+ getAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return NULL to indicate that an empty relation set.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+ getAccessibleRelationSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return the parents locale or throw exception if this object has no
+ parent yet/anymore.
+ */
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale (void)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::accessibility::IllegalAccessibleComponentStateException);
+
+ //===== XAccessibleEventBroadcaster ========================================
+
+ virtual void SAL_CALL
+ addAccessibleEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL
+ removeAccessibleEventListener (
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener >& xListener)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual OUString SAL_CALL
+ getImplementationName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Return whether the specified service is supported by this class.
+ */
+ virtual sal_Bool SAL_CALL
+ supportsService (const OUString& sServiceName)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a list of all supported services. In this case that is just
+ the AccessibleContext service.
+ */
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL
+ getSupportedServiceNames (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ //===== XTypeProvider ===================================================
+
+ /** Returns a sequence of all supported interfaces.
+ */
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
+ getTypes (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Returns a implementation id.
+ */
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /** The state set.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> mxStateSet;
+
+ /** The relation set. Relations can be set or removed by calling the
+ <member>AddRelation</member> and <member>RemoveRelation</member> methods.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleRelationSet> mxRelationSet;
+
+ // This method is called from the component helper base class while disposing.
+ virtual void SAL_CALL disposing (void);
+
+ /** Create the accessible object's name. This method may be called more
+ than once for a single object.
+ @return
+ The returned string is a unique (among the accessible object's
+ siblings) name.
+ */
+ virtual OUString CreateAccessibleName (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /** Create the accessible object's descriptive string. May be called
+ more than once.
+ @return
+ Descriptive string. Not necessarily unique.
+ */
+ virtual OUString
+ CreateAccessibleDescription (void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ void FireEvent (const ::com::sun::star::accessibility::AccessibleEventObject& aEvent);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed). If that is the case then
+ DisposedException is thrown to inform the (indirect) caller of the
+ foul deed.
+ */
+ void ThrowIfDisposed (void)
+ throw (::com::sun::star::lang::DisposedException);
+
+ /** Check whether or not the object has been disposed (or is in the
+ state of beeing disposed).
+
+ @return TRUE, if the object is disposed or in the course
+ of being disposed. Otherwise, FALSE is returned.
+ */
+ sal_Bool IsDisposed (void);
+
+ /** sets the role as returned by XaccessibleContext::getAccessibleRole
+
+ <p>Caution: This is only to be used in the construction phase (means within
+ the ctor or late ctor), <em>never</em> when the object is still alive and part
+ of an Accessibility hierarchy.</p>
+ */
+ void SetAccessibleRole( sal_Int16 _nRole );
+
+private:
+ /// Reference to the parent object.
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible> mxParent;
+
+ /** Description of this object. This is not a constant because it can
+ be set from the outside. Furthermore, it changes according the the
+ draw page's display mode.
+ */
+ OUString msDescription;
+
+ /** The origin of the description is used to determine whether new
+ descriptions given to the SetAccessibleDescription is ignored or
+ whether that replaces the old value in msDescription.
+ */
+ StringOrigin meDescriptionOrigin;
+
+ /** Name of this object. It changes according the draw page's
+ display mode.
+ */
+ OUString msName;
+
+ /** The origin of the name is used to determine whether new
+ name given to the SetAccessibleName is ignored or
+ whether that replaces the old value in msName.
+ */
+ StringOrigin meNameOrigin;
+
+ /** client id in the AccessibleEventNotifier queue
+ */
+ sal_uInt32 mnClientId;
+
+ /** This is the role of this object.
+ */
+ sal_Int16 maRole;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleEditableTextPara.hxx b/include/editeng/AccessibleEditableTextPara.hxx
new file mode 100644
index 000000000000..5f245d0786f5
--- /dev/null
+++ b/include/editeng/AccessibleEditableTextPara.hxx
@@ -0,0 +1,386 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
+#define _SVX_ACCESSIBLE_EDITABLE_TEXT_PARA_HXX
+
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/compbase9.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+
+#include <comphelper/accessibletexthelper.hxx>
+#include <comphelper/broadcasthelper.hxx>
+#include "editeng/AccessibleParaManager.hxx"
+#include "editeng/AccessibleImageBullet.hxx"
+#include "editeng/unoedprx.hxx"
+#include "editeng/editengdllapi.h"
+
+namespace accessibility
+{
+ typedef ::cppu::PartialWeakComponentImplHelper9< ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEditableText,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::accessibility::XAccessibleTextAttributes,
+ ::com::sun::star::accessibility::XAccessibleHypertext,
+ ::com::sun::star::accessibility::XAccessibleMultiLineText,
+ ::com::sun::star::lang::XServiceInfo > AccessibleTextParaInterfaceBase;
+
+ /** This class implements the actual text paragraphs for the EditEngine/Outliner UAA
+ */
+ class EDITENG_DLLPUBLIC AccessibleEditableTextPara : public ::comphelper::OBaseMutex, public AccessibleTextParaInterfaceBase, public ::comphelper::OCommonAccessibleText
+ {
+
+ protected:
+ // override OCommonAccessibleText methods
+ virtual OUString implGetText();
+ virtual ::com::sun::star::lang::Locale implGetLocale();
+ virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
+ virtual void implGetParagraphBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+ virtual void implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex );
+
+ public:
+ /// Create accessible object for given parent
+ // #i27138#
+ // - add parameter <_pParaManager> (default value NULL)
+ // This has to be the instance of <AccessibleParaManager>, which
+ // created and manages this accessible paragraph.
+ AccessibleEditableTextPara ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent,
+ const AccessibleParaManager* _pParaManager = NULL );
+
+ virtual ~AccessibleEditableTextPara ();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
+ /// Maximal length of text returned by getAccessibleDescription()
+ enum { MaxDescriptionLen = 40 };
+ virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleText (this comes implicitely inherited by XAccessibleEditableText AND by XAccessibleMultiLineText)
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEditableText
+ virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aAttributeSet ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setText( const OUString& sText ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTextAttributes
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( ::sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleHypertext
+ virtual ::sal_Int32 SAL_CALL getHyperLinkCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > SAL_CALL getHyperLink( ::sal_Int32 nLinkIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getHyperLinkIndex( ::sal_Int32 nCharIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleMultiLineText
+ virtual ::sal_Int32 SAL_CALL getLineNumberAtIndex( ::sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineNumber( ::sal_Int32 nLineNo ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getNumberOfLineWithCaret( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceName
+ virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetIndexInParent( sal_Int32 nIndex );
+
+ /** Get the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetIndexInParent() const;
+
+ /** Set the current paragraph number
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetParagraphIndex( sal_Int32 nIndex );
+
+ /** Query the current paragraph number (0 - nParas-1)
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the edit engine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEEOffset( const Point& rOffset );
+
+ /** Set the EditEngine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEditSource( SvxEditSourceAdapter* pEditSource );
+
+ /** Dispose this object
+
+ Notifies and deregisters the listeners, drops all references.
+ */
+ void Dispose();
+
+ /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
+ virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ /// Sets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void SetState( const sal_Int16 nStateId );
+ /// Unsets the given state on the internal state set and fires STATE_CHANGE event. Don't hold locks when calling this!
+ void UnSetState( const sal_Int16 nStateId );
+
+ static Rectangle LogicToPixel( const Rectangle& rRect, const MapMode& rMapMode, SvxViewForwarder& rForwarder );
+
+ SvxEditSourceAdapter& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the SvxTextForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxAccessibleTextAdapter& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the SvxViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query whether a GetEditViewForwarder( sal_False ) will return a forwarder
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Bool HaveEditView() const;
+
+ /** Query the SvxEditViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxAccessibleTextEditViewAdapter& GetEditViewForwarder( sal_Bool bCreate = sal_False ) const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Send a TEXT_CHANGED event for this paragraph
+
+ This method internally caters for calculating text
+ differences, and sends the appropriate Anys in the
+ Accessibility::TEXT_CHANGED event
+ */
+ void TextChanged();
+
+ private:
+
+ // declared, but not defined
+ AccessibleEditableTextPara( const AccessibleEditableTextPara& );
+ AccessibleEditableTextPara& operator= ( const AccessibleEditableTextPara& );
+
+ /** Calculate character range of similar attributes
+
+ @param nStartIndex
+ Therein, the start of the character range with the same attributes is returned
+
+ @param nEndIndex
+ Therein, the end (exclusively) of the character range with the same attributes is returned
+
+ @param nIndex
+ The character index at where to look for similar character attributes
+
+ @return sal_False, if the method was not able to determine the range
+ */
+ sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nIndex );
+
+ // syntactic sugar for FireEvent
+ void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
+ void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
+
+ int getNotifierClientId() const;
+
+ /// Do we have children? This is the case for image bullets
+ sal_Bool HaveChildren();
+
+ const Point& GetEEOffset() const;
+
+ // Get text from forwarder
+ String GetTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ sal_uInt16 GetTextLen() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Get the current selection of this paragraph
+
+ @return sal_False, if nothing in this paragraph is selected
+ */
+ sal_Bool GetSelection( sal_uInt16& nStartPos, sal_uInt16& nEndPos ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** create selection from Accessible selection.
+
+ */
+ ESelection MakeSelection( sal_Int32 nStartEEIndex, sal_Int32 nEndEEIndex );
+ ESelection MakeSelection( sal_Int32 nEEIndex );
+ ESelection MakeCursor( sal_Int32 nEEIndex );
+
+ // check whether index value is within permitted range
+
+ /// Check whether 0<=nIndex<=n-1
+ void CheckIndex( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+ /// Check whether 0<=nIndex<=n
+ void CheckPosition( sal_Int32 nIndex ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+ /// Check whether 0<=nStart<=n and 0<=nEnd<=n
+ void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
+
+ // the paragraph index in the edit engine (guarded by solar mutex)
+ sal_Int32 mnParagraphIndex;
+
+ // our current index in the parent (guarded by solar mutex)
+ sal_Int32 mnIndexInParent;
+
+ // the current edit source (guarded by solar mutex)
+ SvxEditSourceAdapter* mpEditSource;
+
+ // the possible child (for image bullets, guarded by solar mutex)
+ typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleImageBullet > WeakBullet;
+ WeakBullet maImageBullet;
+
+ // the last string used for an Accessibility::TEXT_CHANGED event (guarded by solar mutex)
+ OUString maLastTextString;
+
+ // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
+ Point maEEOffset;
+
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
+
+ /// The shape we're the accessible for (unguarded)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
+
+ /// Our listeners (guarded by maMutex)
+ int mnNotifierClientId;
+
+ // Text paragraphs should provide FLOWS_TO and FLOWS_FROM relations (#i27138#)
+ // the paragraph manager, which created this instance - is NULL, if
+ // instance isn't created by AccessibleParaManager.
+ // Needed for method <getAccessibleRelationSet()> to retrieve predecessor
+ // paragraph and the successor paragraph.
+ const AccessibleParaManager* mpParaManager;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleImageBullet.hxx b/include/editeng/AccessibleImageBullet.hxx
new file mode 100644
index 000000000000..9d852962e9e6
--- /dev/null
+++ b/include/editeng/AccessibleImageBullet.hxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
+#define _SVX_ACCESSIBLE_IMAGE_BULLET_HXX
+
+#include <tools/gen.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase5.hxx>
+
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include "editeng/AccessibleParaManager.hxx"
+#include <editeng/unoedsrc.hxx>
+
+namespace accessibility
+{
+ typedef ::cppu::WeakImplHelper5< ::com::sun::star::accessibility::XAccessible,
+ ::com::sun::star::accessibility::XAccessibleContext,
+ ::com::sun::star::accessibility::XAccessibleComponent,
+ ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+ ::com::sun::star::lang::XServiceInfo > AccessibleImageBulletInterfaceBase;
+
+ /** This class implements the image bullets for the EditEngine/Outliner UAA
+ */
+ class AccessibleImageBullet : public AccessibleImageBulletInterfaceBase
+ {
+
+ public:
+ /// Create accessible object for given parent
+ AccessibleImageBullet ( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rParent );
+
+ virtual ~AccessibleImageBullet ();
+
+ // XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface (const ::com::sun::star::uno::Type & rType) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessible
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL getAccessibleRole() throw (::com::sun::star::uno::RuntimeException);
+ /// Maximal length of text returned by getAccessibleDescription()
+ enum { MaxDescriptionLen = 40 };
+ virtual OUString SAL_CALL getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale() throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleEventBroadcaster
+ virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleComponent
+ virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getForeground( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getBackground( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName (void) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException);
+
+ // XServiceName
+ virtual OUString SAL_CALL getServiceName (void) throw (::com::sun::star::uno::RuntimeException);
+
+ /** Set the current index in the accessibility parent
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetIndexInParent( sal_Int32 nIndex );
+
+ /** Set the edit engine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEEOffset( const Point& rOffset );
+
+ /** Set the EditEngine offset
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetEditSource( SvxEditSource* pEditSource );
+
+ /** Dispose this object
+
+ Notifies and deregisters the listeners, drops all references.
+ */
+ void Dispose();
+
+ /** Set the current paragraph number
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ void SetParagraphIndex( sal_Int32 nIndex );
+
+ /** Query the current paragraph number (0 - nParas-1)
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ sal_Int32 GetParagraphIndex() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /// Calls all Listener objects to tell them the change. Don't hold locks when calling this!
+ virtual void FireEvent(const sal_Int16 nEventId, const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(), const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ private:
+
+ // declared, but not defined
+ AccessibleImageBullet( const AccessibleImageBullet& );
+ AccessibleImageBullet& operator= ( const AccessibleImageBullet& );
+
+ // syntactic sugar for FireEvent
+ void GotPropertyEvent( const ::com::sun::star::uno::Any& rNewValue, const sal_Int16 nEventId ) const;
+ void LostPropertyEvent( const ::com::sun::star::uno::Any& rOldValue, const sal_Int16 nEventId ) const;
+
+ // maintain state set and send STATE_CHANGE events
+ void SetState( const sal_Int16 nStateId );
+ void UnSetState( const sal_Int16 nStateId );
+
+ SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ int getNotifierClientId() const;
+
+ /** Query the SvxTextForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxTextForwarder& GetTextForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Query the SvxViewForwarder for EditEngine access.
+
+ @attention This method does not lock the SolarMutex,
+ leaving that to the calling code. This is because only
+ there potential deadlock situations can be resolved. Thus,
+ make sure SolarMutex is locked when calling this.
+ */
+ SvxViewForwarder& GetViewForwarder() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ const Point& GetEEOffset() const;
+
+ // the paragraph index in the edit engine (guarded by solar mutex)
+ sal_Int32 mnParagraphIndex;
+
+ // our current index in the parent (guarded by solar mutex)
+ sal_Int32 mnIndexInParent;
+
+ // the current edit source (guarded by solar mutex)
+ SvxEditSource* mpEditSource;
+
+ // the offset of the underlying EditEngine from the shape/cell (guarded by solar mutex)
+ Point maEEOffset;
+
+ // the current state set (updated from SetState/UnSetState and guarded by solar mutex)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet;
+
+ mutable osl::Mutex maMutex;
+
+ /// The shape we're the accessible for (unguarded)
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
+
+ /// Our listeners (guarded by maMutex)
+ int mnNotifierClientId;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleParaManager.hxx b/include/editeng/AccessibleParaManager.hxx
new file mode 100644
index 000000000000..90bc3d8a111d
--- /dev/null
+++ b/include/editeng/AccessibleParaManager.hxx
@@ -0,0 +1,334 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBLE_PARA_MANAGER_HXX
+#define _SVX_ACCESSIBLE_PARA_MANAGER_HXX
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+#include <utility>
+#include <tools/gen.hxx>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include "editeng/editengdllapi.h"
+
+class SvxEditSourceAdapter;
+
+namespace accessibility
+{
+ class AccessibleEditableTextPara;
+
+ /** Helper class for WeakCppRef
+
+ This class is returned by WeakChild::get() and contains a hard
+ reference and a reference to the c++ object. This combination
+ prevents the c++ object from destruction during usage. Hold
+ this object only as long as absolutely necessary, prevents
+ referenced object from vanishing otherwise
+ */
+ template < class UnoType, class CppType > class HardCppRef
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType InterfaceType;
+
+ HardCppRef( const ::com::sun::star::uno::WeakReference< UnoInterfaceType >& xRef, InterfaceType* rImpl ) :
+ mxRef( xRef ),
+ mpImpl( rImpl )
+ {
+ }
+
+ /** Query whether the reference is still valid.
+
+ Hands off also from the implementation pointer if this
+ returns sal_False!
+ */
+ sal_Bool is() const { return mxRef.is(); }
+ InterfaceType* operator->() const { return mpImpl; }
+ InterfaceType& operator*() const { return *mpImpl; }
+ ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() { return mxRef; }
+ const ::com::sun::star::uno::Reference< UnoInterfaceType >& getRef() const { return mxRef; }
+
+ // default copy constructor and assignment will do
+ // HardCppRef( const HardCppRef& );
+ // HardCppRef& operator= ( const HardCppRef& );
+
+ private:
+
+ // the interface, hard reference to prevent object from vanishing
+ ::com::sun::star::uno::Reference< UnoInterfaceType > mxRef;
+
+ // the c++ object, for our internal stuff
+ InterfaceType* mpImpl;
+
+ };
+
+ /** Helper class for weak object references plus implementation
+
+ This class combines a weak reference (to facilitate automatic
+ object disposal if user drops last reference) and hard
+ reference to the c++ class (for fast access and bypassing of
+ the UNO interface)
+ */
+ template < class UnoType, class CppType > class WeakCppRef
+ {
+ public:
+
+ typedef UnoType UnoInterfaceType;
+ typedef CppType InterfaceType;
+ typedef HardCppRef< UnoInterfaceType, InterfaceType > HardRefType;
+
+ WeakCppRef() : maWeakRef(), maUnsafeRef( NULL ) {}
+ WeakCppRef( InterfaceType& rImpl ) :
+ maWeakRef( ::com::sun::star::uno::Reference< UnoInterfaceType >( rImpl, ::com::sun::star::uno::UNO_QUERY ) ),
+ maUnsafeRef( &rImpl )
+ {
+ }
+
+ WeakCppRef( HardRefType& rImpl ) :
+ maWeakRef( rImpl.getRef() ),
+ maUnsafeRef( rImpl.operator->() )
+ {
+ }
+
+ // get object with c++ object and hard reference (which
+ // prevents the c++ object from destruction during use)
+ HardRefType get() const { return HardRefType( maWeakRef, maUnsafeRef ); }
+
+ // default copy constructor and assignment will do
+ // WeakCppRef( const WeakCppRef& );
+ // WeakCppRef& operator= ( const WeakCppRef& );
+
+ private:
+
+ // the interface, hold weakly
+ ::com::sun::star::uno::WeakReference< UnoInterfaceType > maWeakRef;
+
+ // hard ref to c++ class, _only_ valid if maWeakRef.is() is true
+ InterfaceType* maUnsafeRef;
+ };
+
+
+ /** This class manages the paragraphs of an AccessibleTextHelper
+
+ To facilitate automatic deletion of paragraphs no longer used,
+ this class uses the WeakCppRef helper to hold the objects weakly.
+ */
+ class EDITENG_DLLPUBLIC AccessibleParaManager
+ {
+ public:
+ typedef WeakCppRef < ::com::sun::star::accessibility::XAccessible, AccessibleEditableTextPara > WeakPara;
+ typedef ::std::pair< WeakPara, ::com::sun::star::awt::Rectangle > WeakChild;
+ typedef ::std::pair< ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible > , ::com::sun::star::awt::Rectangle > Child;
+ typedef ::std::vector< WeakChild > VectorOfChildren;
+ typedef ::std::vector< sal_Int16 > VectorOfStates;
+
+ AccessibleParaManager();
+ ~AccessibleParaManager();
+
+ /** Sets a vector of additional accessible states.
+
+ The states are passed to every created child object
+ (text paragraph). The state values are defined in
+ com::sun::star::accessibility::AccessibleStateType.
+ */
+ void SetAdditionalChildStates( const VectorOfStates& rChildStates );
+
+ /** Set the number of paragraphs
+
+ @param nNumPara
+ The total number of paragraphs the EditEngine currently
+ has (_not_ the number of currently visible children)
+ */
+ void SetNum( sal_Int32 nNumParas );
+
+ /** Get the number of paragraphs currently possible */
+ sal_uInt32 GetNum() const;
+
+ // iterators
+ VectorOfChildren::iterator begin();
+ VectorOfChildren::iterator end();
+ VectorOfChildren::const_iterator begin() const;
+ VectorOfChildren::const_iterator end() const;
+
+ // dealing with single paragraphs (release reference, return reference etc)
+ void Release( sal_uInt32 nPara );
+ /// Set focus to given child
+ void SetFocus( sal_Int32 nChild );
+
+ void FireEvent( sal_uInt32 nPara,
+ const sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
+ const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ static sal_Bool IsReferencable( WeakPara::HardRefType aChild );
+ sal_Bool IsReferencable( sal_uInt32 nChild ) const;
+ static void ShutdownPara( const WeakChild& rChild );
+
+ Child CreateChild( sal_Int32 nChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xFrontEnd,
+ SvxEditSourceAdapter& rEditSource,
+ sal_uInt32 nParagraphIndex );
+
+ WeakChild GetChild( sal_uInt32 nParagraphIndex ) const;
+
+ // forwarder to all paragraphs
+ /// Make all children active and editable (or off)
+ void SetActive( sal_Bool bActive = sal_True );
+ /// Set state of all children
+ void SetState( const sal_Int16 nStateId );
+ /// Unset state of all children
+ void UnSetState( const sal_Int16 nStateId );
+ /// Set offset to edit engine for all children
+ void SetEEOffset ( const Point& rOffset );
+ /// Dispose all living children
+ void Dispose ();
+
+ // forwarder to given paragraphs
+ //------------------------------------------------------------------------
+ /** Release the given range of paragraphs
+
+ All ranges have the meaning [start,end), similar to STL
+
+ @param nStartPara
+ Index of paragraph to start with releasing
+
+ @param nEndPara
+ Index of first paragraph to stop with releasing
+ */
+ void Release( sal_uInt32 nStartPara, sal_uInt32 nEndPara );
+
+ /** Fire event for the given range of paragraphs
+
+ All ranges have the meaning [start,end), similar to STL
+
+ @param nStartPara
+ Index of paragraph to start with event firing
+
+ @param nEndPara
+ Index of first paragraph to stop with event firing
+ */
+ void FireEvent( sal_uInt32 nStartPara,
+ sal_uInt32 nEndPara,
+ const sal_Int16 nEventId,
+ const ::com::sun::star::uno::Any& rNewValue = ::com::sun::star::uno::Any(),
+ const ::com::sun::star::uno::Any& rOldValue = ::com::sun::star::uno::Any() ) const;
+
+ /** Functor adapter for ForEach template
+
+ Adapts giving functor such that only the paragraph objects
+ are accessed and the fact that our children are held
+ weakly is hidden
+
+ The functor must provide the following method:
+ void operator() ( AccessibleEditablePara& )
+
+ */
+ template < typename Functor > class WeakChildAdapter : public ::std::unary_function< const WeakChild&, void >
+ {
+ public:
+ WeakChildAdapter( Functor& rFunctor ) : mrFunctor(rFunctor) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ mrFunctor( *aHardRef );
+ }
+
+ private:
+ Functor& mrFunctor;
+ };
+
+ /** Adapter for unary member functions
+
+ Since STL's binder don't work with const& arguments (and
+ BOOST's neither, at least on MSVC), have to provide our
+ own adapter for unary member functions.
+
+ Create with pointer to member function of
+ AccessibleEditableTextPara and the corresponding argument.
+ */
+ template < typename Argument > class MemFunAdapter : public ::std::unary_function< const WeakChild&, void >
+ {
+ public:
+ typedef void (::accessibility::AccessibleEditableTextPara::*FunctionPointer)( Argument );
+
+ MemFunAdapter( FunctionPointer aFunPtr, Argument aArg ) : maFunPtr(aFunPtr), maArg(aArg) {}
+ void operator()( const WeakChild& rPara )
+ {
+ // retrieve hard reference from weak one
+ WeakPara::HardRefType aHardRef( rPara.first.get() );
+
+ if( aHardRef.is() )
+ (*aHardRef.*maFunPtr)( maArg );
+ }
+
+ private:
+ FunctionPointer maFunPtr;
+ Argument maArg;
+ };
+
+ /** Generic algorithm on given paragraphs
+
+ Convenience method, that already adapts the given functor with WeakChildAdapter
+ */
+ template < typename Functor > void ForEach( Functor& rFunctor )
+ {
+ ::std::for_each( begin(), end(), WeakChildAdapter< Functor >(rFunctor) );
+ }
+
+ private:
+ /// Set state on given child
+ void SetState( sal_Int32 nChild, const sal_Int16 nStateId );
+ /// Unset state on given child
+ void UnSetState( sal_Int32 nChild, const sal_Int16 nStateId );
+ /// Init child with default state (as stored in previous SetFocus and SetActive calls)
+ void InitChild( AccessibleEditableTextPara& rChild,
+ SvxEditSourceAdapter& rEditSource,
+ sal_Int32 nChild,
+ sal_uInt32 nParagraphIndex ) const;
+
+ // vector the size of the paragraph number of the underlying EditEngine
+ VectorOfChildren maChildren;
+
+ /// Additional states that will be set at every created child object.
+ VectorOfStates maChildStates;
+
+ // cache EE offset for child creation
+ Point maEEOffset;
+
+ // which child currently has the focus (-1 for none)
+ sal_Int32 mnFocusedChild;
+
+ // whether children are active and editable
+ sal_Bool mbActive;
+ };
+
+} // end of namespace accessibility
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleSelectionBase.hxx b/include/editeng/AccessibleSelectionBase.hxx
new file mode 100644
index 000000000000..7935d5dd1ae2
--- /dev/null
+++ b/include/editeng/AccessibleSelectionBase.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
+#define _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
+
+#include <comphelper/accessibleselectionhelper.hxx>
+#include "editeng/editengdllapi.h"
+
+namespace accessibility
+{
+/** @descr
+ This base class provides a base implementation of the
+ <type>XAccessibleSelection</type> interface.
+ The following methods have to be implemented if this
+ class is used:
+
+ <method>implGetMutex</method>,
+ <method>implGetAccessibleContext</method>,
+ <method>implIsSelected</method>,
+ <method>implSelect</method>,
+*/
+ class EDITENG_DLLPUBLIC AccessibleSelectionBase : public ::comphelper::OCommonAccessibleSelection,
+ public ::com::sun::star::accessibility::XAccessibleSelection
+ {
+ protected:
+
+ virtual ::osl::Mutex& implGetMutex() = 0;
+
+ public:
+
+ // XAccessibleSelection - default implementations
+ virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearAccessibleSelection( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL selectAllAccessibleChildren( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ public:
+
+ AccessibleSelectionBase();
+ virtual ~AccessibleSelectionBase();
+ };
+
+}
+
+#endif // _SVX_ACCESSIBILITY_ACCESSIBLE_SELECTION_BASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleStaticTextBase.hxx b/include/editeng/AccessibleStaticTextBase.hxx
new file mode 100644
index 000000000000..8ca75d7a5766
--- /dev/null
+++ b/include/editeng/AccessibleStaticTextBase.hxx
@@ -0,0 +1,277 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_
+#define _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_
+
+#include <memory>
+#include <tools/gen.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+#include "editeng/editengdllapi.h"
+
+
+class SvxEditSource;
+class SvxEditViewForwarder;
+
+namespace accessibility
+{
+
+ class AccessibleStaticTextBase_Impl;
+
+ typedef ::cppu::ImplHelper2<
+ ::com::sun::star::accessibility::XAccessibleText,
+ ::com::sun::star::accessibility::XAccessibleTextAttributes > AccessibleStaticTextBase_BASE;
+
+ /** Helper class for objects containing EditEngine/Outliner text
+
+ This class implements the XAccessibleText interface for static
+ text, somewhat similar to the children of the
+ AccessibleTextHelper class. Currently, there are no children,
+ i.e. the whole text is presented in one big chunk. This might
+ change in the future, if a need for image bullets should
+ arise. These, by convention, would be represented as children
+ of the text.
+
+ You have to implement the SvxEditSource, SvxTextForwarder,
+ SvxViewForwarder and SvxEditViewForwarder interfaces in order
+ to enable your object to cooperate with this
+ class. SvxTextForwarder encapsulates the fact that text
+ objects do not necessarily have an EditEngine at their
+ disposal, SvxViewForwarder and SvxEditViewForwarder do the
+ same for the document and the edit view. The three mentioned
+ forwarder objects are not stored by the AccessibleTextHelper,
+ but fetched every time from the SvxEditSource. So you are best
+ off making your SvxEditSource::Get*Forwarder methods cache the
+ current forwarder.
+
+ As this class is intended for static (i.e. non-changing) text
+ only, no event broadcasting is necessary. You must handle
+ visibility by yourself, the bounding boxes returned by
+ getCharacterBounds() are relative to your accessibility
+ object.
+
+ @attention All public non-UNO methods (those are the uppercase
+ ones) must not be called with any mutex hold, except when
+ calling from the main thread (with holds the solar mutex),
+ unless stated otherwise. This is because they themselves might
+ need the solar mutex in addition to the object mutex, and the
+ ordering of the locking must be: first solar mutex, then
+ object mutex. Furthermore, state change events might be fired
+ internally.
+
+ @derive Use this class as a base for objects containing static
+ edit engine text. To avoid overwriting every interface method
+ to intercept derived object defunc state, just set NULL as the
+ edit source. Every interface method will then properly throw
+ an exception.
+ */
+ class EDITENG_DLLPUBLIC AccessibleStaticTextBase : public AccessibleStaticTextBase_BASE
+ {
+
+ public:
+ /** Create accessible text object for given edit source
+
+ @param pEditSource
+ The edit source to use. Object ownership is transferred
+ from the caller to the callee. The object listens on the
+ SvxEditSource for object disposal, so no provisions have
+ to be taken if the caller destroys the data (e.g. the
+ model) contained in the given SvxEditSource.
+
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ explicit AccessibleStaticTextBase( ::std::auto_ptr< SvxEditSource > pEditSource );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ virtual ~AccessibleStaticTextBase();
+
+ private:
+
+ // declared, but not defined
+ EDITENG_DLLPRIVATE AccessibleStaticTextBase( const AccessibleStaticTextBase& );
+ // declared, but not defined
+ EDITENG_DLLPRIVATE AccessibleStaticTextBase& operator= ( const AccessibleStaticTextBase& );
+
+ public:
+ /** Query the current edit source
+
+ @attention This method returns by reference, so you are
+ responsible for serialization (typically, you aquired the
+ solar mutex when calling this method). Thus, the method
+ should only be called from the main office thread.
+
+ */
+ virtual const SvxEditSource& GetEditSource() const SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Set the current edit source
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ The EditSource set here is required to broadcast out the
+ following hints: EDITSOURCE_HINT_PARASMOVED,
+ EDITSOURCE_HINT_SELECTIONCHANGED, TEXT_HINT_MODIFIED,
+ TEXT_HINT_PARAINSERTED, TEXT_HINT_PARAREMOVED,
+ TEXT_HINT_TEXTHEIGHTCHANGED,
+ TEXT_HINT_VIEWSCROLLED. Otherwise, not all state changes
+ will get noticed by the accessibility object. Further
+ more, when the corresponding core object or the model is
+ dying, either the edit source must be set to NULL or it
+ has to broadcast a SFX_HINT_DYING hint.
+
+ This class does not have a dispose method, since it is not
+ a UNO component. Nevertheless, it holds C++ references to
+ several core objects, so you should issue a
+ SetEditSource(::std::auto_ptr<SvxEditSource>(NULL)) in
+ your dispose() method.
+
+ @param pEditSource
+ The new edit source to set. Object ownership is transferred
+ from the caller to the callee.
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ virtual void SetEditSource( ::std::auto_ptr< SvxEditSource > pEditSource ) SAL_THROW((::com::sun::star::uno::RuntimeException));
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ /** Set the event source
+
+ @attention When setting a reference here, you should call
+ Dispose() when you as the owner are disposing, since until
+ then this object will hold that reference
+
+ @param rInterface
+ The interface that should be set as the source for
+ accessibility events sent by this object.
+ */
+ virtual void SetEventSource( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& rInterface );
+
+ /** Get the event source
+
+ @return the interface that is set as the source for
+ accessibility events sent by this object.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > GetEventSource() const;
+
+ /** Set offset of EditEngine from parent
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ If the origin of the underlying EditEngine does
+ not correspond to the upper left corner of the object
+ using this class, you have to specify the offset.
+
+ @param rPoint
+ The offset in screen coordinates (i.e. pixel)
+ */
+ virtual void SetOffset( const Point& rPoint );
+
+ /** Query offset of EditEngine from parent
+
+ @return the offset in screen coordinates (i.e. pixel)
+ */
+ virtual Point GetOffset() const;
+
+ /** Update the visible children
+
+ As this class currently does not represent any content
+ using children, this does nothing at the moment.
+
+ @attention You are required to have the solar mutex
+ locked, when calling this method. Thus, the method should
+ only be called from the main office thread.
+
+ This method reevaluates the visibility of all
+ children. Call this method if your visibility state has
+ changed somehow, e.g. if the visible area has changed and
+ the AccessibleStaticTextHelper isn't notified
+ internally. Normally, there should not be a need to call
+ this method.
+ */
+ virtual void UpdateChildren() SAL_THROW((::com::sun::star::uno::RuntimeException));
+
+ /** Drop all references and enter disposed state
+
+ This method drops all references to external objects (also
+ the event source reference set via SetEventSource()) and
+ sets the object into the disposed state (i.e. the methods
+ return default values or throw a uno::DisposedException
+ exception).
+ */
+ virtual void Dispose();
+
+ // XAccessibleText interface implementation
+ virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
+ /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
+ virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// Does not support AccessibleTextType::SENTENCE (missing feature in EditEngine)
+ virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ /// This will only work with a functional SvxEditViewForwarder, i.e. an EditEngine/Outliner in edit mode
+ virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // XAccessibleTextAttributes
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getDefaultAttributes( const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getRunAttributes( sal_Int32 Index, const ::com::sun::star::uno::Sequence< OUString >& RequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // child-related methods from XAccessibleContext
+ virtual sal_Int32 SAL_CALL getAccessibleChildCount() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+ // child-related methods from XAccessibleComponent
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+
+ protected:
+ Rectangle GetParagraphBoundingBox() const;
+
+ private:
+
+ /// @dyn
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ const std::auto_ptr< AccessibleStaticTextBase_Impl > mpImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ };
+
+} // end of namespace accessibility
+
+#endif /* _SVX_ACCESSILE_STATIC_TEXT_BASE_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/AccessibleStringWrap.hxx b/include/editeng/AccessibleStringWrap.hxx
new file mode 100644
index 000000000000..cae879f95a1a
--- /dev/null
+++ b/include/editeng/AccessibleStringWrap.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _ACCESSIBLESTRINGWRAP_HXX
+#define _ACCESSIBLESTRINGWRAP_HXX
+
+#include <sal/types.h>
+#include <tools/string.hxx>
+
+#include <editeng/editengdllapi.h>
+
+class OutputDevice;
+class SvxFont;
+class Rectangle;
+class Point;
+
+//------------------------------------------------------------------------
+//
+// AccessibleStringWrap declaration
+//
+//------------------------------------------------------------------------
+
+class AccessibleStringWrap
+{
+public:
+
+ EDITENG_DLLPUBLIC AccessibleStringWrap( OutputDevice& rDev, SvxFont& rFont, const String& rText );
+
+ EDITENG_DLLPUBLIC sal_Bool GetCharacterBounds( sal_Int32 nIndex, Rectangle& rRect );
+ EDITENG_DLLPUBLIC sal_Int32 GetIndexAtPoint( const Point& rPoint );
+
+private:
+
+ OutputDevice& mrDev;
+ SvxFont& mrFont;
+ String maText;
+};
+
+#endif /* _ACCESSIBLESTRINGWRAP_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/LatinLookupTree.hxx b/include/editeng/LatinLookupTree.hxx
new file mode 100644
index 000000000000..9407780f5b80
--- /dev/null
+++ b/include/editeng/LatinLookupTree.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef LATINLOOKUPTREE_HXX
+#define LATINLOOKUPTREE_HXX
+
+#include <editeng/LookupTree.hxx>
+#include <editeng/TreeHead.hxx>
+#include <editeng/editengdllapi.h>
+
+/**
+ * LatinLookupTree implements a tree that is optimized for storing and looking
+ * up words that mainly consist of roman characters, although any other
+ * language can be handled, too.
+ */
+class EDITENG_DLLPUBLIC LatinLookupTree : public LookupTree, public TreeHead
+{
+public:
+
+ explicit LatinLookupTree(OUString sLanguage);
+ ~LatinLookupTree();
+
+
+ /* =================== Implemented Virtuals From LookupTree =================== */
+ void returnToRoot();
+ void gotoNode(OUString sNode);
+ void advance(const sal_Unicode a);
+ void goBack();
+ void insert(OUString sKey, const int nProbability = 1);
+ void insert(const int nProbability = 1);
+ void remove(OUString sKey);
+ OUString suggestAutoCompletion() const;
+ void clear();
+
+ /* =================== Implemented Virtuals From Node =================== */
+ bool isSeparatedlyHandled(const sal_Unicode cKey) const;
+ Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false);
+ void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const;
+ void freeMemory();
+
+
+ /* =================== Implemented Virtual From TreeHead =================== */
+ Node* newNode(Node* pParent, const sal_Unicode cKey, const int nProbability = 0);
+
+ /* =================== Member Variables =================== */
+ // position of lower case letter 'a' within the selected char encoding.
+ static const unsigned int our_nLowerCaseA;
+
+ // position of upper case letter 'A' within the selected char encoding.
+ static const unsigned int our_nUpperCaseA;
+
+private:
+ Node* m_pLeaves[52]; // handles [a-z] and [A-Z]
+};
+
+#endif // LATINLOOKUPTREE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/LatinTreeNode.hxx b/include/editeng/LatinTreeNode.hxx
new file mode 100644
index 000000000000..5e406858697c
--- /dev/null
+++ b/include/editeng/LatinTreeNode.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef LATINTREENODE_HXX
+#define LATINTREENODE_HXX
+
+#include <editeng/Node.hxx>
+
+/**
+ * LatinTreeNode represents a node within a LatinLookupTree. As en external
+ * caller, you should never have to do anything with this class directly.
+ * Use the class LatinLookupTree instead for constructing a new tree.
+ */
+class LatinTreeNode : public Node
+{
+public:
+ explicit LatinTreeNode(TreeHead *pHead, Node* pParent, const sal_Unicode cKey, const int nProbability = 0);
+ ~LatinTreeNode();
+
+ /* =================== Implemented Virtuals From Node =================== */
+ bool isSeparatedlyHandled(const sal_Unicode cKey) const;
+ Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false);
+ void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const;
+ void freeMemory();
+
+private:
+ Node* m_pLeaves[26]; // handles [a-z]
+};
+
+#endif // LATINTREENODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/LookupTree.hxx b/include/editeng/LookupTree.hxx
new file mode 100644
index 000000000000..95abcf25d6f8
--- /dev/null
+++ b/include/editeng/LookupTree.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef LOOKUPTREE_H
+#define LOOKUPTREE_H
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <editeng/editengdllapi.h>
+
+/** LookupTree is an interface class that allows for unified access to tree
+ * structures used for storing dictionnary words as well as their respective
+ * probabilities.
+ * It allows you to insert or remove words from the tree, navigate threw the
+ * tree along its branches and request for a suggestion for autocompletion
+ * according to the position within the tree.
+ * It also allows you to attribute a specific language to each tree so that
+ * it is possible to serve the correct auto completions even within a document
+ * that contains content in more than one language.
+ */
+class EDITENG_DLLPUBLIC LookupTree
+{
+public:
+ explicit inline LookupTree(OUString sLanguage);
+ virtual ~LookupTree() {}
+
+ inline OUString language() const;
+
+ // Resets the current item to root.
+ virtual void returnToRoot() = 0;
+
+ // Advances from the root position key by key towards the node keyed with
+ // the last char of sKey.
+ virtual void gotoNode(OUString sNode) = 0;
+
+ // Advances from the current position towards the node keyed with cKey.
+ virtual void advance(const sal_Unicode cKey) = 0;
+
+ // Sets the focus to the parent of the current node. Removes the current
+ // node if it is invalid.
+ virtual void goBack() = 0;
+
+ // Inserts a complete keyword starting from the root node of the tree.
+ // Does not change the current position within the tree.
+ virtual void insert(OUString sKey, const int nProbability = 1) = 0;
+
+ // Inserts a keyword with the given probability at the current position
+ // within the tree. Does not change the current position within the tree.
+ virtual void insert(const int nProbability = 1) = 0;
+
+ // Removes a complete keyword starting from the root node of the tree.
+ // Does not change the current position within the tree.
+ virtual void remove(OUString sKey) = 0;
+
+ // Returns the suggested autocompletion for the current location within
+ // the tree.
+ virtual OUString suggestAutoCompletion() const = 0;
+
+ // Clears the tree and removes any information it contains.
+ virtual void clear() = 0;
+
+
+private:
+ const OUString m_sLanguage; // language handled by this tree
+};
+
+LookupTree::LookupTree(OUString sLanguage) :
+ m_sLanguage( sLanguage )
+{
+}
+
+OUString LookupTree::language() const
+{
+ return m_sLanguage;
+}
+
+#endif // LOOKUPTREE_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/Node.hxx b/include/editeng/Node.hxx
new file mode 100644
index 000000000000..3159e48a99b7
--- /dev/null
+++ b/include/editeng/Node.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef NODE_HXX
+#define NODE_HXX
+
+#include <sal/types.h>
+#include <rtl/ustring.hxx>
+#include <list>
+
+class TreeHead;
+
+/**
+ * Node represents a node within a LookupTree. As en external caller, you
+ * should never have to do anything with this class directly.
+ * Use any of the classes derived from LookupTree instead for constructing a
+ * new tree.
+ */
+class Node
+{
+public:
+ //explicit Node(TreeHead* const pHead);
+ explicit Node(TreeHead* const pHead, Node* const pParent = NULL,
+ const sal_Unicode cKey = 0, const int nProbability = 0);
+
+ virtual ~Node();
+
+ // Removes the specified child from this node. Make sure you may remove it
+ // before doing so.
+ void removeChild(Node*& pChild);
+
+ // Inserts a complete keyword starting from this node of the tree.
+ void insertKey(OUString sKey, const int nProbability);
+ // Removes a complete keyword starting from this node of the tree.
+ void removeKey(OUString sKey);
+
+ // Returns the child node keyed with cKey.
+ Node* advanceKey(const sal_Unicode cKey);
+
+ // Use this to inform a parent about its child having changed.
+ // Call this only with nProbability = 0 if you have made sure the node can
+ // be removed.
+ void childHasChanged(Node* pChild, const int nProbability, bool bAllowRemoval = false);
+
+ // Rechose the node that is suggested for auto-completion
+ void reevaluateSuggestion(bool& bNodeProbabilityChanged);
+
+
+ /* =================== Virtuals =================== */
+ virtual bool isSeparatedlyHandled(const sal_Unicode cKey) const = 0;
+
+ // Returns a reference to the pointer to the child node for the requested
+ // char. Returns NULL if no such child could be found.
+ // IMPORTANT: In the latter case, you may NOT overwrite the return value,
+ // if you did not set bCreatePlaceholder to true.
+ virtual Node*& getChildRef(const sal_Unicode cKey, bool bCreatePlaceholder = false) = 0;
+
+ // Sets nSuggest to the highest probability within the subtree and pSuggest
+ // to point to the (first) node with this probability.
+ virtual void evaluateSeparateStorage(int& nSuggest, Node*& pSuggest) const = 0;
+
+ // Removes all child nodes and clears all memory.
+ virtual void freeMemory() = 0;
+
+ /* =================== Member Variables =================== */
+ const sal_Unicode m_cKey; // the char represented by this node
+ int m_nKeyProbability; // the number of occurrences of this key
+
+ // the highest KeyProbability in the tree sprouting from this node
+ int m_nHighestProbaInSubtree;
+
+ Node* const m_pParent; // the parent of this node
+ Node* m_pSuggest; // next node in chain to the suggested autocompletion
+
+ TreeHead* const m_pHead; // head of the tree
+
+ unsigned short m_nChildren; // the number of children of the node
+ std::list<Node*> m_lChildren; // all chars not handled by array
+
+ // Allows returning a reference to a valid Null pointer. May NOT be overwritten.
+ static Node* our_pNodeNullPointer;
+};
+
+#endif // NODE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/SpellPortions.hxx b/include/editeng/SpellPortions.hxx
new file mode 100644
index 000000000000..f96a14b0f557
--- /dev/null
+++ b/include/editeng/SpellPortions.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_SPELL_PORTIONS_HXX
+#define SVX_SPELL_PORTIONS_HXX
+
+#include <i18nlangtag/lang.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/linguistic2/SingleProofreadingError.hpp>
+#include <com/sun/star/linguistic2/XProofreader.hpp>
+#include <vector>
+
+namespace com{ namespace sun{ namespace star{ namespace linguistic2{
+ class XSpellAlternatives;
+}}}}
+
+namespace svx{
+/** contains a portion of text that has the same language attributes applied
+ and belongs to the same script type.
+ */
+struct SpellPortion
+{
+ /** contains the text of the portion.
+ */
+ OUString sText;
+ /** Marks the portion as field, footnote symbol or any other special content that
+ should be protected against unintentional deletion.
+ */
+ bool bIsField;
+ /** Marks the portion hidden content that should not be touched by spell checking
+ and not be removed like redlines. The creator of the portions has to take care
+ for them.
+ */
+ bool bIsHidden;
+ /** contains the language applied to the text. It has to match the script type.
+ */
+ LanguageType eLanguage;
+ /** for wrong words this reference is filled with the error information otherwise
+ it's an empty reference
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellAlternatives> xAlternatives;
+ /** determines whether the error type is a grammar error
+ */
+ bool bIsGrammarError;
+ /** contains the grammar error information
+ */
+ com::sun::star::linguistic2::SingleProofreadingError aGrammarError;
+ /** provides access to the grammar checker interface
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XProofreader > xGrammarChecker;
+ /** marks portion as to-be-ignored. This is a return parameter.
+ */
+ /** contains the proposed dialog title if the proof reading component provides one.
+ */
+ OUString sDialogTitle;
+
+ bool bIgnoreThisError;
+ SpellPortion() :
+ bIsField(false),
+ bIsHidden(false),
+ eLanguage(LANGUAGE_DONTKNOW),
+ bIsGrammarError(false),
+ bIgnoreThisError(false)
+ {
+ aGrammarError.nErrorStart = aGrammarError.nErrorLength = aGrammarError.nErrorType = 0;
+ }
+};
+typedef std::vector<SpellPortion> SpellPortions;
+}//namespace svx
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/TreeHead.hxx b/include/editeng/TreeHead.hxx
new file mode 100644
index 000000000000..12c8b33c8d66
--- /dev/null
+++ b/include/editeng/TreeHead.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef TREEHEAD_HXX
+#define TREEHEAD_HXX
+
+#include <editeng/Node.hxx>
+
+/**
+ * Represents the root node of a LookupTree.
+ */
+class TreeHead : public Node
+{
+public:
+ explicit inline TreeHead();
+ virtual ~TreeHead() {}
+
+ /* =================== Virtuals =================== */
+ virtual Node* newNode(Node* pParent, const sal_Unicode cKey, const int nProbability = 0) = 0;
+
+ /* =================== Member Variables =================== */
+ Node* m_pCurrent; // current location within the tree
+};
+
+TreeHead::TreeHead() :
+ Node( this ),
+ m_pCurrent( this )
+{
+}
+
+#endif // TREEHEAD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/UnoForbiddenCharsTable.hxx b/include/editeng/UnoForbiddenCharsTable.hxx
new file mode 100644
index 000000000000..9fea61b9084c
--- /dev/null
+++ b/include/editeng/UnoForbiddenCharsTable.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFORBIDDENCHARSTABLE_HXX_
+#define _SVX_UNOFORBIDDENCHARSTABLE_HXX_
+
+#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
+#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
+#include <rtl/ref.hxx>
+
+#include <cppuhelper/implbase2.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvxForbiddenCharactersTable;
+
+class EDITENG_DLLPUBLIC SvxUnoForbiddenCharsTable : public cppu::WeakImplHelper2<
+ com::sun::star::i18n::XForbiddenCharacters,
+ com::sun::star::linguistic2::XSupportedLocales>
+{
+protected:
+ /** this virtual function is called if the forbidden characters are changed */
+ virtual void onChange();
+
+ rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenChars;
+
+public:
+ SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars);
+ ~SvxUnoForbiddenCharsTable();
+
+ // XForbiddenCharacters
+ virtual com::sun::star::i18n::ForbiddenCharacters SAL_CALL getForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::container::NoSuchElementException, com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setForbiddenCharacters( const com::sun::star::lang::Locale& rLocale, const com::sun::star::i18n::ForbiddenCharacters& rForbiddenCharacters ) throw(com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeForbiddenCharacters( const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException);
+
+ // XSupportedLocales
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::lang::Locale > SAL_CALL getLocales( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasLocale( const ::com::sun::star::lang::Locale& aLocale ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _SVX_UNOFORBIDDENCHARSTABLE_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/acorrcfg.hxx b/include/editeng/acorrcfg.hxx
new file mode 100644
index 000000000000..3c3321ccfc2d
--- /dev/null
+++ b/include/editeng/acorrcfg.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVXACCFG_HXX
+#define _SVXACCFG_HXX
+
+#include "editeng/editengdllapi.h"
+#include <unotools/configitem.hxx>
+
+class SvxAutoCorrect;
+class SvxAutoCorrCfg;
+class EDITENG_DLLPUBLIC SvxBaseAutoCorrCfg : public utl::ConfigItem
+{
+ SvxAutoCorrCfg& rParent;
+ com::sun::star::uno::Sequence<OUString> GetPropertyNames();
+
+public:
+ SvxBaseAutoCorrCfg(SvxAutoCorrCfg& rParent);
+ ~SvxBaseAutoCorrCfg();
+
+ void Load(sal_Bool bInit);
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
+ void SetModified() {ConfigItem::SetModified();}
+};
+
+class EDITENG_DLLPUBLIC SvxSwAutoCorrCfg : public utl::ConfigItem
+{
+ SvxAutoCorrCfg& rParent;
+ com::sun::star::uno::Sequence<OUString> GetPropertyNames();
+
+public:
+ SvxSwAutoCorrCfg(SvxAutoCorrCfg& rParent);
+ ~SvxSwAutoCorrCfg();
+
+ void Load(sal_Bool bInit);
+ virtual void Commit();
+ virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
+ void SetModified() {ConfigItem::SetModified();}
+};
+/*--------------------------------------------------------------------
+ Description: Configuration for Auto Correction
+ --------------------------------------------------------------------*/
+class EDITENG_DLLPUBLIC SvxAutoCorrCfg
+{
+ friend class SvxBaseAutoCorrCfg;
+ friend class SvxSwAutoCorrCfg;
+
+ SvxAutoCorrect* pAutoCorrect;
+
+ SvxBaseAutoCorrCfg aBaseConfig;
+ SvxSwAutoCorrCfg aSwConfig;
+
+ // Flags for Autotext:
+ sal_Bool bFileRel;
+ sal_Bool bNetRel;
+ // Help tip for Autotext as you type
+ sal_Bool bAutoTextTip;
+ sal_Bool bAutoTextPreview;
+ sal_Bool bAutoFmtByInput;
+ sal_Bool bSearchInAllCategories;
+
+public:
+ void SetModified()
+ {
+ aBaseConfig.SetModified();
+ aSwConfig.SetModified();
+ }
+ void Commit()
+ {
+ aBaseConfig.Commit();
+ aSwConfig.Commit();
+ }
+
+ SvxAutoCorrect* GetAutoCorrect() { return pAutoCorrect; }
+ const SvxAutoCorrect* GetAutoCorrect() const { return pAutoCorrect; }
+ // the pointer is transferred to the possession of the ConfigItems!
+ void SetAutoCorrect( SvxAutoCorrect* );
+
+ sal_Bool IsAutoFmtByInput() const { return bAutoFmtByInput; }
+ void SetAutoFmtByInput( sal_Bool bSet ) { bAutoFmtByInput = bSet;aSwConfig.SetModified();}
+
+ sal_Bool IsSaveRelFile() const { return bFileRel; }
+ void SetSaveRelFile( sal_Bool bSet ) { bFileRel = bSet; aSwConfig.SetModified(); }
+
+ sal_Bool IsSaveRelNet() const { return bNetRel; }
+ void SetSaveRelNet( sal_Bool bSet ) { bNetRel = bSet; aSwConfig.SetModified();}
+
+ sal_Bool IsAutoTextPreview() const {return bAutoTextPreview;}
+ void SetAutoTextPreview(sal_Bool bSet) {bAutoTextPreview = bSet; aSwConfig.SetModified();}
+
+ sal_Bool IsAutoTextTip() const { return bAutoTextTip; }
+ void SetAutoTextTip(sal_Bool bSet ) { bAutoTextTip = bSet;aSwConfig.SetModified();}
+
+ sal_Bool IsSearchInAllCategories() const { return bSearchInAllCategories;}
+ void SetSearchInAllCategories(sal_Bool bSet ) { bSearchInAllCategories = bSet; aSwConfig.SetModified(); }
+
+ SvxAutoCorrCfg();
+ virtual ~SvxAutoCorrCfg();
+ static SvxAutoCorrCfg& Get();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/adjustitem.hxx b/include/editeng/adjustitem.hxx
new file mode 100644
index 000000000000..e19907cd1737
--- /dev/null
+++ b/include/editeng/adjustitem.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ADJITEM_HXX
+#define _SVX_ADJITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxAdjustItem ---------------------------------------------------
+
+/*
+[Description]
+This item describes the row orientation.
+*/
+#define ADJUST_LASTBLOCK_VERSION ((sal_uInt16)0x0001)
+
+class EDITENG_DLLPUBLIC SvxAdjustItem : public SfxEnumItemInterface
+{
+ sal_Bool bLeft : 1;
+ sal_Bool bRight : 1;
+ sal_Bool bCenter : 1;
+ sal_Bool bBlock : 1;
+
+ // only activ when bBlock
+ sal_Bool bOneBlock : 1;
+ sal_Bool bLastCenter : 1;
+ sal_Bool bLastBlock : 1;
+
+ friend SvStream& operator<<( SvStream&, SvxAdjustItem& ); //$ ostream
+public:
+ TYPEINFO();
+
+ SvxAdjustItem( const SvxAdjust eAdjst /*= SVX_ADJUST_LEFT*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ inline void SetOneWord( const SvxAdjust eType )
+ {
+ bOneBlock = eType == SVX_ADJUST_BLOCK;
+ }
+
+ inline void SetLastBlock( const SvxAdjust eType )
+ {
+ bLastBlock = eType == SVX_ADJUST_BLOCK;
+ bLastCenter = eType == SVX_ADJUST_CENTER;
+ }
+
+ inline void SetAdjust( const SvxAdjust eType )
+ {
+ bLeft = eType == SVX_ADJUST_LEFT;
+ bRight = eType == SVX_ADJUST_RIGHT;
+ bCenter = eType == SVX_ADJUST_CENTER;
+ bBlock = eType == SVX_ADJUST_BLOCK;
+ }
+
+ inline SvxAdjust GetLastBlock() const
+ {
+ SvxAdjust eRet = SVX_ADJUST_LEFT;
+
+ if ( bLastBlock )
+ eRet = SVX_ADJUST_BLOCK;
+ else if( bLastCenter )
+ eRet = SVX_ADJUST_CENTER;
+ return eRet;
+ }
+
+ inline SvxAdjust GetOneWord() const
+ {
+ SvxAdjust eRet = SVX_ADJUST_LEFT;
+
+ if ( bBlock && bOneBlock )
+ eRet = SVX_ADJUST_BLOCK;
+ return eRet;
+ }
+
+ inline SvxAdjust GetAdjust() const
+ {
+ SvxAdjust eRet = SVX_ADJUST_LEFT;
+
+ if ( bRight )
+ eRet = SVX_ADJUST_RIGHT;
+ else if ( bCenter )
+ eRet = SVX_ADJUST_CENTER;
+ else if ( bBlock )
+ eRet = SVX_ADJUST_BLOCK;
+ return eRet;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/autokernitem.hxx b/include/editeng/autokernitem.hxx
new file mode 100644
index 000000000000..6d849dc39d23
--- /dev/null
+++ b/include/editeng/autokernitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_AKRNITEM_HXX
+#define _SVX_AKRNITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxAutoKernItem -------------------------------------------------
+
+/*
+ [Description]
+ Attribute for Pair-Kerning.
+*/
+
+class EDITENG_DLLPUBLIC SvxAutoKernItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxAutoKernItem( const sal_Bool bAutoKern /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxAutoKernItem& operator=(const SvxAutoKernItem& rAutoKern)
+ {
+ SetValue( rAutoKern.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/blinkitem.hxx b/include/editeng/blinkitem.hxx
new file mode 100644
index 000000000000..0d495e6e100e
--- /dev/null
+++ b/include/editeng/blinkitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BLNKITEM_HXX
+#define _SVX_BLNKITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxBlinkItem -------------------------------------------------
+
+/*
+ [Description]
+ This item describes, whether to flash.
+*/
+
+class EDITENG_DLLPUBLIC SvxBlinkItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxBlinkItem( const sal_Bool bBlink /*= sal_False*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxBlinkItem& operator=(const SvxBlinkItem& rBlink) {
+ SetValue(rBlink.GetValue());
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/borderline.hxx b/include/editeng/borderline.hxx
new file mode 100644
index 000000000000..067e216aaa9a
--- /dev/null
+++ b/include/editeng/borderline.hxx
@@ -0,0 +1,169 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_BORDERLINE_HXX
+#define SVX_BORDERLINE_HXX
+
+#include <com/sun/star/table/BorderLineStyle.hpp>
+
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <svtools/ctrlbox.hxx>
+
+// Line defaults in twips (former Writer defaults):
+
+#define DEF_LINE_WIDTH_0 1
+#define DEF_LINE_WIDTH_1 20
+#define DEF_LINE_WIDTH_2 50
+#define DEF_LINE_WIDTH_3 80
+#define DEF_LINE_WIDTH_4 100
+#define DEF_LINE_WIDTH_5 10
+
+// ============================================================================
+
+namespace editeng {
+
+ // values from ::com::sun::star::table::BorderLineStyle
+ typedef sal_Int16 SvxBorderStyle;
+
+ // convert border style between Word formats and LO
+ SvxBorderStyle EDITENG_DLLPUBLIC ConvertBorderStyleFromWord(int);
+ /// convert border width in twips between Word formats and LO
+ double EDITENG_DLLPUBLIC ConvertBorderWidthToWord(SvxBorderStyle, double);
+ double EDITENG_DLLPUBLIC ConvertBorderWidthFromWord(SvxBorderStyle,
+ double, int);
+
+ class EDITENG_DLLPUBLIC SvxBorderLine
+ {
+ protected:
+ Color aColor;
+
+ long m_nWidth;
+ bool m_bMirrorWidths;
+ BorderWidthImpl m_aWidthImpl;
+ long m_nMult;
+ long m_nDiv;
+
+ SvxBorderStyle m_nStyle;
+ sal_uInt16 nOutWidth;
+ sal_uInt16 nInWidth;
+ sal_uInt16 nDistance;
+
+ bool m_bUseLeftTop;
+ Color (*m_pColorOutFn)( Color );
+ Color (*m_pColorInFn)( Color );
+ Color (*m_pColorGapFn)( Color );
+
+ public:
+ SvxBorderLine( const Color *pCol = 0,
+ long nWidth = 0, SvxBorderStyle nStyle =
+ ::com::sun::star::table::BorderLineStyle::SOLID,
+ bool bUseLeftTop = false,
+ Color (*pColorOutFn)( Color ) = &darkColor,
+ Color (*pColorInFn)( Color ) = &darkColor,
+ Color (*pColorGapFn)( Color ) = NULL );
+ SvxBorderLine( const SvxBorderLine& r );
+
+ SvxBorderLine& operator=( const SvxBorderLine& r );
+
+ const Color& GetColor() const { return aColor; }
+ Color GetColorOut( bool bLeftOrTop = true ) const;
+ Color GetColorIn( bool bLeftOrTop = true ) const;
+ bool HasGapColor() const { return m_pColorGapFn != NULL; }
+ Color GetColorGap() const;
+
+ void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; }
+ /** Guess the style and width from the three lines widths values.
+
+ When the value of nStyle is SvxBorderLine::DOUBLE, the style set will be guessed
+ using the three values to match the best possible style among the following:
+ - SvxBorderLine::DOUBLE
+ - SvxBorderLine::THINTHICK_SMALLGAP
+ - SvxBorderLine::THINTHICK_MEDIUMGAP
+ - SvxBorderLine::THINTHICK_LARGEGAP
+ - SvxBorderLine::THICKTHIN_SMALLGAP
+ - SvxBorderLine::THICKTHIN_MEDIUMGAP
+ - SvxBorderLine::THICKTHIN_LARGEGAP
+
+ If no styles matches the width, then the width is set to 0.
+
+ There is one known case that could fit several styles: \a nIn = \a nDist = 0.75 pt,
+ \a nOut = 1.5 pt. This case fits SvxBorderLine::THINTHICK_SMALLGAP and
+ SvxBorderLine::THINTHICK_MEDIUMGAP with a 1.5 pt width and
+ SvxBorderLine::THINTHICK_LARGEGAP with a 0.75 pt width. The same case happens
+ also for thick-thin styles.
+
+ \param nStyle the border style used to guess the width.
+ \param nIn the width of the inner line in 1th pt
+ \param nOut the width of the outer line in 1th pt
+ \param nDist the width of the gap between the lines in 1th pt
+ */
+ void GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn = 0, sal_uInt16 nDist = 0 );
+
+ // TODO Hacky method to mirror lines in only a few cases
+ void SetMirrorWidths( bool bMirror = true ) { m_bMirrorWidths = bMirror; }
+ long GetWidth( ) const { return m_nWidth; }
+ sal_uInt16 GetOutWidth() const;
+ sal_uInt16 GetInWidth() const;
+ sal_uInt16 GetDistance() const;
+
+ SvxBorderStyle GetBorderLineStyle() const { return m_nStyle; }
+
+ void SetColor( const Color &rColor ) { aColor = rColor; }
+ void SetColorOutFn( Color (*pColorOutFn)( Color ) ) { m_pColorOutFn = pColorOutFn; }
+ void SetColorInFn( Color (*pColorInFn)( Color ) ) { m_pColorInFn = pColorInFn; }
+ void SetColorGapFn( Color (*pColorGapFn)( Color ) ) { m_pColorGapFn = pColorGapFn; }
+ void SetUseLeftTop( bool bUseLeftTop ) { m_bUseLeftTop = bUseLeftTop; }
+ void SetBorderLineStyle( SvxBorderStyle nNew );
+ void ScaleMetrics( long nMult, long nDiv );
+
+ sal_Bool operator==( const SvxBorderLine &rCmp ) const;
+
+ String GetValueString( SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit,
+ const IntlWrapper* pIntl,
+ sal_Bool bMetricStr = sal_False ) const;
+
+ bool HasPriority( const SvxBorderLine& rOtherLine ) const;
+
+ bool isEmpty() const {
+ return m_aWidthImpl.IsEmpty()
+ || m_nStyle == ::com::sun::star::table::BorderLineStyle::NONE
+ || m_nWidth == 0;
+ }
+ bool isDouble() const { return m_aWidthImpl.IsDouble(); }
+ sal_uInt16 GetScaledWidth() const { return GetOutWidth() + GetInWidth() + GetDistance(); }
+
+ static Color darkColor( Color aMain );
+ static Color lightColor( Color aMain );
+
+ static Color threeDLightColor( Color aMain );
+ static Color threeDMediumColor( Color aMain );
+ static Color threeDDarkColor( Color aMain );
+
+ static BorderWidthImpl getWidthImpl( SvxBorderStyle nStyle );
+ };
+
+// ============================================================================
+
+} // namespace editeng
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/boxitem.hxx b/include/editeng/boxitem.hxx
new file mode 100644
index 000000000000..256663c961e9
--- /dev/null
+++ b/include/editeng/boxitem.hxx
@@ -0,0 +1,226 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BOXITEM_HXX
+#define _SVX_BOXITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/editengdllapi.h>
+#include <com/sun/star/table/BorderLine2.hpp>
+
+
+// class SvxBoxItem ------------------------------------------------------
+
+/* [Description]
+
+ This item describes a border attribute
+ (all four edges and the inward distance)
+*/
+
+#define BOX_LINE_TOP ((sal_uInt16)0)
+#define BOX_LINE_BOTTOM ((sal_uInt16)1)
+#define BOX_LINE_LEFT ((sal_uInt16)2)
+#define BOX_LINE_RIGHT ((sal_uInt16)3)
+
+/**
+This version causes SvxBoxItem to store the 4 cell spacing distances separately
+when serializing to stream.
+*/
+#define BOX_4DISTS_VERSION ((sal_uInt16)1)
+/**
+This version causes SvxBoxItem to store the styles for its border lines when
+serializing to stream.
+*/
+#define BOX_BORDER_STYLE_VERSION ((sal_uInt16)2)
+
+class EDITENG_DLLPUBLIC SvxBoxItem : public SfxPoolItem
+{
+ editeng::SvxBorderLine *pTop,
+ *pBottom,
+ *pLeft,
+ *pRight;
+ sal_uInt16 nTopDist,
+ nBottomDist,
+ nLeftDist,
+ nRightDist;
+
+public:
+ TYPEINFO();
+
+ explicit SvxBoxItem( const sal_uInt16 nId );
+ SvxBoxItem( const SvxBoxItem &rCpy );
+ ~SvxBoxItem();
+ SvxBoxItem &operator=( const SvxBoxItem& rBox );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const editeng::SvxBorderLine* GetTop() const { return pTop; }
+ const editeng::SvxBorderLine* GetBottom() const { return pBottom; }
+ const editeng::SvxBorderLine* GetLeft() const { return pLeft; }
+ const editeng::SvxBorderLine* GetRight() const { return pRight; }
+
+ const editeng::SvxBorderLine* GetLine( sal_uInt16 nLine ) const;
+
+ //The Pointers are being copied!
+ void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
+
+ sal_uInt16 GetDistance( sal_uInt16 nLine ) const;
+ sal_uInt16 GetDistance() const;
+
+ void SetDistance( sal_uInt16 nNew, sal_uInt16 nLine );
+ inline void SetDistance( sal_uInt16 nNew );
+
+ // Line width plus Space plus inward distance
+ //bIgnoreLine = TRUE -> Also return distance, when no Line is set
+ sal_uInt16 CalcLineSpace( sal_uInt16 nLine, sal_Bool bIgnoreLine = sal_False ) const;
+ static com::sun::star::table::BorderLine2 SvxLineToLine( const editeng::SvxBorderLine* pLine, sal_Bool bConvert );
+ static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
+ static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, editeng::SvxBorderLine& rSvxLine, sal_Bool bConvert);
+};
+
+inline void SvxBoxItem::SetDistance( sal_uInt16 nNew )
+{
+ nTopDist = nBottomDist = nLeftDist = nRightDist = nNew;
+}
+
+// class SvxBoxInfoItem --------------------------------------------------
+
+/* [Description]
+
+ Another item for the border. This item has only limited functionality.
+ On one hand, the general Dialog is told by the item which options it
+ should offer. On the other hand, this attribute may be used to
+ transported the borderline for the inner horizontal and vertical lines.
+*/
+
+#define BOXINFO_LINE_HORI ((sal_uInt16)0)
+#define BOXINFO_LINE_VERT ((sal_uInt16)1)
+
+#define VALID_TOP 0x01
+#define VALID_BOTTOM 0x02
+#define VALID_LEFT 0x04
+#define VALID_RIGHT 0x08
+#define VALID_HORI 0x10
+#define VALID_VERT 0x20
+#define VALID_DISTANCE 0x40
+#define VALID_DISABLE 0x80
+
+class EDITENG_DLLPUBLIC SvxBoxInfoItem : public SfxPoolItem
+{
+ editeng::SvxBorderLine* pHori; //inner horizontal Line
+ editeng::SvxBorderLine* pVert; //inner vertical Line
+
+ bool mbEnableHor; /// true = Enable inner horizontal line.
+ bool mbEnableVer; /// true = Enable inner vertical line.
+
+ /*
+ Currently only for StarWriter: distance inward from SvxBoxItem. If the
+ distance is requested, then the field for the distance from the dialog be
+ activated. nDefDist is regarded as a default value. If any line is
+ turned on or will be turned on it must this distance be set to default.
+ bMinDist indicates whether the user can go below this value or not.
+ With NDIST is the current distance from the app transported back and
+ forth to the dialogue.
+ */
+
+ sal_Bool bDist :1; // TRUE, Unlock Distance.
+ sal_Bool bMinDist :1; // TRUE, Going below minimum Distance is prohibited
+
+ sal_uInt8 nValidFlags; // 0000 0000
+ // ³³³³ ³³³ÀÄ VALID_TOP
+ // ³³³³ ³³ÀÄÄ VALID_BOTTOM
+ // ³³³³ ³ÀÄÄÄ VALID_LEFT
+ // ³³³³ ÀÄÄÄÄ VALID_RIGHT
+ // ³³³ÀÄÄÄÄÄÄ VALID_HORI
+ // ³³ÀÄÄÄÄÄÄÄ VALID_VERT
+ // ³ÀÄÄÄÄÄÄÄÄ VALID_DIST
+ // ÀÄÄÄÄÄÄÄÄÄ VALID_DISABLE
+
+ sal_uInt16 nDefDist; // The default or minimum distance.
+
+public:
+ TYPEINFO();
+
+ explicit SvxBoxInfoItem( const sal_uInt16 nId );
+ SvxBoxInfoItem( const SvxBoxInfoItem &rCpy );
+ ~SvxBoxInfoItem();
+ SvxBoxInfoItem &operator=( const SvxBoxInfoItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const editeng::SvxBorderLine* GetHori() const { return pHori; }
+ const editeng::SvxBorderLine* GetVert() const { return pVert; }
+
+ //The Pointers are being copied!
+ void SetLine( const editeng::SvxBorderLine* pNew, sal_uInt16 nLine );
+
+ sal_Bool IsTable() const { return mbEnableHor && mbEnableVer; }
+ void SetTable( sal_Bool bNew ) { mbEnableHor = mbEnableVer = bNew; }
+
+ inline bool IsHorEnabled() const { return mbEnableHor; }
+ inline void EnableHor( bool bEnable ) { mbEnableHor = bEnable; }
+ inline bool IsVerEnabled() const { return mbEnableVer; }
+ inline void EnableVer( bool bEnable ) { mbEnableVer = bEnable; }
+
+ sal_Bool IsDist() const { return bDist; }
+ void SetDist( sal_Bool bNew ) { bDist = bNew; }
+ sal_Bool IsMinDist() const { return bMinDist; }
+ void SetMinDist( sal_Bool bNew ) { bMinDist = bNew; }
+ sal_uInt16 GetDefDist() const { return nDefDist; }
+ void SetDefDist( sal_uInt16 nNew ) { nDefDist = nNew; }
+
+ sal_Bool IsValid( sal_uInt8 nValid ) const
+ { return ( nValidFlags & nValid ) == nValid; }
+ void SetValid( sal_uInt8 nValid, sal_Bool bValid = sal_True )
+ { bValid ? ( nValidFlags |= nValid )
+ : ( nValidFlags &= ~nValid ); }
+ void ResetFlags();
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/brushitem.hxx b/include/editeng/brushitem.hxx
new file mode 100644
index 000000000000..069a3b7f636a
--- /dev/null
+++ b/include/editeng/brushitem.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BRSHITEM_HXX
+#define _SVX_BRSHITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <vcl/wall.hxx>
+#include <tools/link.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxBrushItem ----------------------------------------------------
+
+class Graphic;
+class GraphicObject;
+class CntWallpaperItem;
+
+#define BRUSH_GRAPHIC_VERSION ((sal_uInt16)0x0001)
+
+enum SvxGraphicPosition
+{
+ GPOS_NONE,
+ GPOS_LT, GPOS_MT, GPOS_RT,
+ GPOS_LM, GPOS_MM, GPOS_RM,
+ GPOS_LB, GPOS_MB, GPOS_RB,
+ GPOS_AREA, GPOS_TILED
+};
+
+#define PARA_DEST_PARA 0
+#define PARA_DEST_CHAR 1
+
+class SvxBrushItem_Impl;
+class EDITENG_DLLPUBLIC SvxBrushItem : public SfxPoolItem
+{
+ Color aColor;
+ SvxBrushItem_Impl* pImpl;
+ String* pStrLink;
+ String* pStrFilter;
+ SvxGraphicPosition eGraphicPos;
+ sal_Bool bLoadAgain;
+
+ void ApplyGraphicTransparency_Impl();
+ DECL_STATIC_LINK( SvxBrushItem, DoneHdl_Impl, void *);
+ // wird nur von Create benutzt
+ SvxBrushItem( SvStream& rStrm,
+ sal_uInt16 nVersion, sal_uInt16 nWhich );
+
+public:
+ TYPEINFO();
+
+ explicit SvxBrushItem( sal_uInt16 nWhich );
+ SvxBrushItem( const Color& rColor, sal_uInt16 nWhich );
+
+ SvxBrushItem( const Graphic& rGraphic,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const GraphicObject& rGraphicObj,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const String& rLink, const String& rFilter,
+ SvxGraphicPosition ePos, sal_uInt16 nWhich );
+ SvxBrushItem( const SvxBrushItem& );
+ SvxBrushItem( const CntWallpaperItem&, sal_uInt16 nWhich );
+
+ ~SvxBrushItem();
+
+public:
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ const Color& GetColor() const { return aColor; }
+ Color& GetColor() { return aColor; }
+ void SetColor( const Color& rCol) { aColor = rCol; }
+
+ void SetDoneLink( const Link& rLink );
+
+ SvxGraphicPosition GetGraphicPos() const { return eGraphicPos; }
+
+ void PurgeMedium() const;
+
+ const Graphic* GetGraphic() const;
+ const GraphicObject* GetGraphicObject() const;
+ const String* GetGraphicLink() const { return pStrLink; }
+ const String* GetGraphicFilter() const { return pStrFilter; }
+
+ void SetGraphicPos( SvxGraphicPosition eNew );
+ void SetGraphic( const Graphic& rNew );
+ void SetGraphicObject( const GraphicObject& rNewObj );
+ void SetGraphicLink( const String& rNew );
+ void SetGraphicFilter( const String& rNew );
+
+ SvxBrushItem& operator=( const SvxBrushItem& rItem);
+
+ static SvxGraphicPosition WallpaperStyle2GraphicPos( WallpaperStyle eStyle );
+ static WallpaperStyle GraphicPos2WallpaperStyle( SvxGraphicPosition ePos );
+};
+
+#endif // #ifndef _SVX_BRSHITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/bulletitem.hxx b/include/editeng/bulletitem.hxx
new file mode 100644
index 000000000000..345cf3ff7639
--- /dev/null
+++ b/include/editeng/bulletitem.hxx
@@ -0,0 +1,146 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BULITEM_HXX
+#define _SVX_BULITEM_HXX
+
+#include "editeng/editengdllapi.h"
+
+
+// define ----------------------------------------------------------------
+
+// Styles
+#define BS_ABC_BIG 0
+#define BS_ABC_SMALL 1
+#define BS_ROMAN_BIG 2
+#define BS_ROMAN_SMALL 3
+#define BS_123 4
+#define BS_NONE 5
+#define BS_BULLET 6
+#define BS_BMP 128
+
+// Justification
+#define BJ_HLEFT 0x01
+#define BJ_HRIGHT 0x02
+#define BJ_HCENTER 0x04
+#define BJ_VTOP 0x08
+#define BJ_VBOTTOM 0x10
+#define BJ_VCENTER 0x20
+
+// Valid-Bits
+// First, only the values that are changed by the dialogue ...
+#define VALID_FONTCOLOR 0x0001
+#define VALID_FONTNAME 0x0002
+#define VALID_SYMBOL 0x0004
+#define VALID_BITMAP 0x0008
+#define VALID_SCALE 0x0010
+#define VALID_START 0x0020
+#define VALID_STYLE 0x0040
+#define VALID_PREVTEXT 0x0080
+#define VALID_FOLLOWTEXT 0x0100
+#include <svl/poolitem.hxx>
+#include <vcl/font.hxx>
+#include <svtools/grfmgr.hxx>
+
+// class SvxBulletItem ---------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxBulletItem : public SfxPoolItem
+{
+ Font aFont;
+ GraphicObject* pGraphicObject;
+ String aPrevText;
+ String aFollowText;
+ sal_uInt16 nStart;
+ sal_uInt16 nStyle;
+ long nWidth;
+ sal_uInt16 nScale;
+ sal_Unicode cSymbol;
+ sal_uInt8 nJustify;
+ sal_uInt16 nValidMask; // Only temporary for GetAttribs / setAttribs,
+ // because of the large Bullets
+
+#ifdef _SVX_BULITEM_CXX
+ void SetDefaultFont_Impl();
+ void SetDefaults_Impl();
+#endif
+
+public:
+ TYPEINFO();
+
+ explicit SvxBulletItem( sal_uInt16 nWhich = 0 );
+ explicit SvxBulletItem( SvStream& rStrm, sal_uInt16 nWhich = 0 );
+ SvxBulletItem( const SvxBulletItem& );
+ ~SvxBulletItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVersion ) const;
+ virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
+
+ String GetFullText() const;
+ sal_Unicode GetSymbol() const { return cSymbol; }
+ String GetPrevText() const { return aPrevText; }
+ String GetFollowText() const { return aFollowText; }
+
+ sal_uInt16 GetStart() const { return nStart; }
+ long GetWidth() const { return nWidth; }
+ sal_uInt16 GetStyle() const { return nStyle; }
+ sal_uInt8 GetJustification() const { return nJustify; }
+ Font GetFont() const { return aFont; }
+ sal_uInt16 GetScale() const { return nScale; }
+
+ const GraphicObject& GetGraphicObject() const;
+ void SetGraphicObject( const GraphicObject& rGraphicObject );
+
+ void SetSymbol( sal_Unicode c) { cSymbol = c; }
+ void SetPrevText( const String& rStr) { aPrevText = rStr;}
+ void SetFollowText(const String& rStr) { aFollowText=rStr;}
+
+ void SetStart( sal_uInt16 nNew ) { nStart = nNew; }
+ void SetWidth( long nNew ) { nWidth = nNew; }
+ void SetStyle( sal_uInt16 nNew ) { nStyle = nNew; }
+ void SetJustification( sal_uInt8 nNew ) { nJustify = nNew; }
+ void SetFont( const Font& rNew) { aFont = rNew; }
+ void SetScale( sal_uInt16 nNew ) { nScale = nNew; }
+
+ virtual sal_uInt16 GetVersion(sal_uInt16 nFileVersion) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ static void StoreFont( SvStream&, const Font& );
+ static Font CreateFont( SvStream&, sal_uInt16 nVer );
+
+ sal_uInt16& GetValidMask() { return nValidMask; }
+ sal_uInt16 GetValidMask() const { return nValidMask; }
+ sal_uInt16 IsValid( sal_uInt16 nFlag ) const { return nValidMask & nFlag; }
+ void SetValid( sal_uInt16 nFlag, sal_Bool bValid )
+ {
+ if ( bValid )
+ nValidMask |= nFlag;
+ else
+ nValidMask &= ~nFlag;
+ }
+ void CopyValidProperties( const SvxBulletItem& rCopyFrom );
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charhiddenitem.hxx b/include/editeng/charhiddenitem.hxx
new file mode 100644
index 000000000000..651bdc240ef1
--- /dev/null
+++ b/include/editeng/charhiddenitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARHIDDENITEM_HXX
+#define _SVX_CHARHIDDENITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxCharHiddenItem -------------------------------------------------
+/* [Description]
+
+ This item marks text as hidden
+*/
+
+class EDITENG_DLLPUBLIC SvxCharHiddenItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxCharHiddenItem( const sal_Bool bHidden /*= sal_False*/, const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxCharHiddenItem& operator=(const SvxCharHiddenItem& rHidden) {
+ SetValue(rHidden.GetValue());
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx
new file mode 100644
index 000000000000..5bc6c589d02d
--- /dev/null
+++ b/include/editeng/charreliefitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARRELIEFITEM_HXX
+#define _SVX_CHARRELIEFITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <vcl/fntstyle.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharRotateItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character relief and has currently the values
+ emboss, relief.
+*/
+
+class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxCharReliefItem( FontRelief eValue /*= RELIEF_NONE*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxCharReliefItem& operator=( const SvxCharReliefItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charrotateitem.hxx b/include/editeng/charrotateitem.hxx
new file mode 100644
index 000000000000..7845ab69ccd8
--- /dev/null
+++ b/include/editeng/charrotateitem.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARROTATEITEM_HXX
+#define _SVX_CHARROTATEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharRotateItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character rotation value (0,1 degree). Currently
+ character can only be rotated 90,0 and 270,0 degrees.
+ The flag FitToLine defines only a UI-Information -
+ if true it must also create a SvxCharScaleItem.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxCharRotateItem : public SfxUInt16Item
+{
+ sal_Bool bFitToLine;
+public:
+ TYPEINFO();
+
+ SvxCharRotateItem( sal_uInt16 nValue /*= 0*/,
+ sal_Bool bFitIntoLine /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxCharRotateItem& operator=( const SvxCharRotateItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ SetFitToLine( rItem.IsFitToLine() );
+ return *this;
+ }
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ // our currently only degree values
+ void SetTopToBotton() { SetValue( 2700 ); }
+ void SetBottomToTop() { SetValue( 900 ); }
+ sal_Bool IsTopToBotton() const { return 2700 == GetValue(); }
+ sal_Bool IsBottomToTop() const { return 900 == GetValue(); }
+
+ sal_Bool IsFitToLine() const { return bFitToLine; }
+ void SetFitToLine( sal_Bool b ) { bFitToLine = b; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charscaleitem.hxx b/include/editeng/charscaleitem.hxx
new file mode 100644
index 000000000000..7d9b38761852
--- /dev/null
+++ b/include/editeng/charscaleitem.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CHARSCALEITEM_HXX
+#define _SVX_CHARSCALEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharScaleItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a character scaling factor as percent value.
+ A value of 100 is identical to 100% and means normal width
+ A value of 50 is identical to 50% and means 1/2 width.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxCharScaleWidthItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxCharScaleWidthItem( sal_uInt16 nValue /*= 100*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxCharScaleWidthItem& operator=(const SvxCharScaleWidthItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/charsetcoloritem.hxx b/include/editeng/charsetcoloritem.hxx
new file mode 100644
index 000000000000..6fc197fb1394
--- /dev/null
+++ b/include/editeng/charsetcoloritem.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CSCOITEM_HXX
+#define _SVX_CSCOITEM_HXX
+
+#include <tools/string.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxCharSetColorItem ---------------------------------------------
+
+/* [Description]
+
+ Is only needed internally in the reader of Writer.
+*/
+
+class EDITENG_DLLPUBLIC SvxCharSetColorItem : public SvxColorItem
+{
+ rtl_TextEncoding eFrom;
+public:
+ TYPEINFO();
+
+ explicit SvxCharSetColorItem( const sal_uInt16 nId );
+ SvxCharSetColorItem( const Color& aColor, const rtl_TextEncoding eFrom,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ inline rtl_TextEncoding& GetCharSet() { return eFrom; }
+ inline rtl_TextEncoding GetCharSet() const { return eFrom; }
+
+ inline SvxCharSetColorItem& operator=(const SvxCharSetColorItem& rColor)
+ {
+ SetValue( rColor.GetValue() );
+ eFrom = rColor.GetCharSet();
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/cmapitem.hxx b/include/editeng/cmapitem.hxx
new file mode 100644
index 000000000000..f7326758befc
--- /dev/null
+++ b/include/editeng/cmapitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CMAPITEM_HXX
+#define _SVX_CMAPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxCaseMapItem --------------------------------------------------
+
+/* [Description]
+
+ This item describe the font type (uppercase, small caps ,...).
+*/
+
+class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxCaseMapItem( const SvxCaseMap eMap /*= SVX_CASEMAP_NOT_MAPPED*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ // MS VC4.0 kommt durcheinander
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+
+ inline SvxCaseMapItem& operator=(const SvxCaseMapItem& rMap)
+ {
+ SetValue( rMap.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ SvxCaseMap GetCaseMap() const
+ { return (SvxCaseMap)GetValue(); }
+ void SetCaseMap( SvxCaseMap eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx
new file mode 100644
index 000000000000..954fcd3b6ba0
--- /dev/null
+++ b/include/editeng/colritem.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_COLRITEM_HXX
+#define _SVX_COLRITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/color.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxColorItem ----------------------------------------------------
+
+/* [Description]
+
+ This item describes a color.
+*/
+
+#define VERSION_USEAUTOCOLOR 1
+
+class EDITENG_DLLPUBLIC SvxColorItem : public SfxPoolItem
+{
+private:
+ Color mColor;
+
+public:
+ TYPEINFO();
+
+ explicit SvxColorItem( const sal_uInt16 nId );
+ SvxColorItem( const Color& aColor, const sal_uInt16 nId );
+ SvxColorItem( SvStream& rStrm, const sal_uInt16 nId );
+ SvxColorItem( const SvxColorItem& rCopy );
+ ~SvxColorItem();
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ inline SvxColorItem& operator=(const SvxColorItem& rColor)
+ {
+ SetValue( rColor.GetValue() );
+ return *this;
+ }
+
+ const Color& GetValue() const
+ {
+ return mColor;
+ }
+ void SetValue( const Color& rNewCol );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/contouritem.hxx b/include/editeng/contouritem.hxx
new file mode 100644
index 000000000000..316f21fc774e
--- /dev/null
+++ b/include/editeng/contouritem.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __EDITENG_CONTOUR_ITEM_HXX__
+#define __EDITENG_CONTOUR_ITEM_HXX__
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxContourItem --------------------------------------------------
+
+/* [Description]
+ This item describes, if contour is employed.
+*/
+
+class EDITENG_DLLPUBLIC SvxContourItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxContourItem( const sal_Bool bContoured /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxContourItem& operator=(const SvxContourItem& rCont)
+ {
+ SetValue(rCont.GetValue());
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx
new file mode 100644
index 000000000000..6628609e060e
--- /dev/null
+++ b/include/editeng/crossedoutitem.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_CRSDITEM_HXX
+#define _SVX_CRSDITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxCrossedOutItem -----------------------------------------------
+
+/* [Description]
+ This item describes, whether and how it is striked out.
+*/
+
+class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxCrossedOutItem( const FontStrikeout eSt /*= STRIKEOUT_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ // MS VC4.0 messes things up
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ inline SvxCrossedOutItem& operator=(const SvxCrossedOutItem& rCross)
+ {
+ SetValue( rCross.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontStrikeout GetStrikeout() const
+ { return (FontStrikeout)GetValue(); }
+ void SetStrikeout( FontStrikeout eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_CRSDITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editdata.hxx b/include/editeng/editdata.hxx
new file mode 100644
index 000000000000..9b6d9e7005c3
--- /dev/null
+++ b/include/editeng/editdata.hxx
@@ -0,0 +1,368 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// MyEDITDATA, wegen exportiertem EditData
+#ifndef _MyEDITDATA_HXX
+#define _MyEDITDATA_HXX
+
+#include <tools/string.hxx>
+#include "editeng/editengdllapi.h"
+
+class SfxItemSet;
+class SfxPoolItem;
+class SvParser;
+class SvxFieldItem;
+
+enum EETextFormat { EE_FORMAT_TEXT = 0x20, EE_FORMAT_RTF, EE_FORMAT_BIN = 0x31, EE_FORMAT_HTML, EE_FORMAT_XML };
+enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L };
+enum EESelectionMode { EE_SELMODE_STD, EE_SELMODE_TXTONLY, EE_SELMODE_HIDDEN };
+ // EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection
+ // only as long as your window (which the edit view works on) has the focus
+enum EESpellState { EE_SPELL_OK, EE_SPELL_NOLANGUAGE, EE_SPELL_LANGUAGENOTINSTALLED, EE_SPELL_NOSPELLER, EE_SPELL_ERRORFOUND };
+enum EVAnchorMode {
+ ANCHOR_TOP_LEFT, ANCHOR_VCENTER_LEFT, ANCHOR_BOTTOM_LEFT,
+ ANCHOR_TOP_HCENTER, ANCHOR_VCENTER_HCENTER, ANCHOR_BOTTOM_HCENTER,
+ ANCHOR_TOP_RIGHT, ANCHOR_VCENTER_RIGHT, ANCHOR_BOTTOM_RIGHT };
+
+#define EE_PARA_NOT_FOUND 0xFFFF
+#define EE_PARA_APPEND 0xFFFF
+#define EE_PARA_ALL 0xFFFF
+#define EE_INDEX_NOT_FOUND 0xFFFF
+
+EDITENG_DLLPUBLIC extern const size_t EE_APPEND;
+
+// Error messages for Read / Write Method
+#define EE_READWRITE_OK (SVSTREAM_OK)
+#define EE_READWRITE_WRONGFORMAT (SVSTREAM_ERRBASE_USER+1)
+#define EE_READWRITE_GENERALERROR (SVSTREAM_ERRBASE_USER+2)
+
+#define EDITUNDO_START 100
+#define EDITUNDO_REMOVECHARS 100
+#define EDITUNDO_CONNECTPARAS 101
+#define EDITUNDO_REMOVEFEATURE 102
+#define EDITUNDO_MOVEPARAGRAPHS 103
+#define EDITUNDO_INSERTFEATURE 104
+#define EDITUNDO_SPLITPARA 105
+#define EDITUNDO_INSERTCHARS 106
+#define EDITUNDO_DELCONTENT 107
+#define EDITUNDO_DELETE 108
+#define EDITUNDO_CUT 109
+#define EDITUNDO_PASTE 110
+#define EDITUNDO_INSERT 111
+#define EDITUNDO_SRCHANDREPL 112
+#define EDITUNDO_MOVEPARAS 113
+#define EDITUNDO_PARAATTRIBS 114
+#define EDITUNDO_ATTRIBS 115
+#define EDITUNDO_DRAGANDDROP 116
+#define EDITUNDO_READ 117
+#define EDITUNDO_STYLESHEET 118
+#define EDITUNDO_REPLACEALL 119
+#define EDITUNDO_STRETCH 120
+#define EDITUNDO_RESETATTRIBS 121
+#define EDITUNDO_INDENTBLOCK 122
+#define EDITUNDO_UNINDENTBLOCK 123
+#define EDITUNDO_MARKSELECTION 124
+#define EDITUNDO_TRANSLITERATE 125
+#define EDITUNDO_END 125
+
+#define EDITUNDO_USER 200
+
+class EditView;
+class EditEngine;
+class ImpEditView;
+class ImpEditEngine;
+class EditTextObject;
+class SfxStyleSheet;
+
+#define RGCHK_NONE 0 // No correction of ViusArea when scrolling
+#define RGCHK_NEG 1 // No negative ViusArea when scrolling
+#define RGCHK_PAPERSZ1 2 // VisArea must be within paper width, Text Size
+
+struct EPosition
+{
+ sal_uInt16 nPara;
+ xub_StrLen nIndex;
+
+ EPosition() :
+ nPara( EE_PARA_NOT_FOUND ),
+ nIndex( EE_INDEX_NOT_FOUND )
+ {
+ }
+
+ EPosition( sal_uInt16 nPara_, xub_StrLen nPos_ ) :
+ nPara( nPara_ ),
+ nIndex( nPos_ )
+ {
+ }
+};
+
+struct ESelection
+{
+ sal_uInt16 nStartPara;
+ xub_StrLen nStartPos;
+ sal_uInt16 nEndPara;
+ xub_StrLen nEndPos;
+
+ ESelection() : nStartPara( 0 ), nStartPos( 0 ), nEndPara( 0 ), nEndPos( 0 ) {}
+
+ ESelection( sal_uInt16 nStPara, xub_StrLen nStPos, sal_uInt16 nEPara, xub_StrLen nEPos ) :
+ nStartPara( nStPara ),
+ nStartPos( nStPos ),
+ nEndPara( nEPara ),
+ nEndPos( nEPos )
+ {
+ }
+
+ ESelection( sal_uInt16 nPara, xub_StrLen nPos ) :
+ nStartPara( nPara ),
+ nStartPos( nPos ),
+ nEndPara( nPara ),
+ nEndPos( nPos )
+ {
+ }
+
+ void Adjust();
+ sal_Bool IsEqual( const ESelection& rS ) const;
+ sal_Bool IsLess( const ESelection& rS ) const;
+ sal_Bool IsGreater( const ESelection& rS ) const;
+ sal_Bool IsZero() const;
+ sal_Bool HasRange() const;
+};
+
+inline sal_Bool ESelection::HasRange() const
+{
+ return ( nStartPara != nEndPara ) || ( nStartPos != nEndPos );
+}
+
+inline sal_Bool ESelection::IsZero() const
+{
+ return ( ( nStartPara == 0 ) && ( nStartPos == 0 ) &&
+ ( nEndPara == 0 ) && ( nEndPos == 0 ) );
+}
+
+inline sal_Bool ESelection::IsEqual( const ESelection& rS ) const
+{
+ return ( ( nStartPara == rS.nStartPara ) && ( nStartPos == rS.nStartPos ) &&
+ ( nEndPara == rS.nEndPara ) && ( nEndPos == rS.nEndPos ) );
+}
+
+inline sal_Bool ESelection::IsLess( const ESelection& rS ) const
+{
+ // The selection must be adjusted.
+ // => Only check if end of 'this' < Start of rS
+
+ if ( ( nEndPara < rS.nStartPara ) ||
+ ( ( nEndPara == rS.nStartPara ) && ( nEndPos < rS.nStartPos ) && !IsEqual( rS ) ) )
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
+
+inline sal_Bool ESelection::IsGreater( const ESelection& rS ) const
+{
+ // The selection must be adjusted.
+ // => Only check if end of 'this' < Start of rS
+
+ if ( ( nStartPara > rS.nEndPara ) ||
+ ( ( nStartPara == rS.nEndPara ) && ( nStartPos > rS.nEndPos ) && !IsEqual( rS ) ) )
+ {
+ return sal_True;
+ }
+ return sal_False;
+}
+
+inline void ESelection::Adjust()
+{
+ sal_Bool bSwap = sal_False;
+ if ( nStartPara > nEndPara )
+ bSwap = sal_True;
+ else if ( ( nStartPara == nEndPara ) && ( nStartPos > nEndPos ) )
+ bSwap = sal_True;
+
+ if ( bSwap )
+ {
+ sal_uInt16 nSPar = nStartPara; sal_uInt16 nSPos = nStartPos;
+ nStartPara = nEndPara; nStartPos = nEndPos;
+ nEndPara = nSPar; nEndPos = nSPos;
+ }
+}
+
+struct EDITENG_DLLPUBLIC EFieldInfo
+{
+ SvxFieldItem* pFieldItem;
+ String aCurrentText;
+ EPosition aPosition;
+
+ EFieldInfo();
+ EFieldInfo( const SvxFieldItem& rFieldItem, sal_uInt16 nPara, sal_uInt16 nPos );
+ ~EFieldInfo();
+
+ EFieldInfo( const EFieldInfo& );
+ EFieldInfo& operator= ( const EFieldInfo& );
+};
+
+// -----------------------------------------------------------------------
+
+enum ImportState {
+ RTFIMP_START, RTFIMP_END, // only pParser, nPara, nIndex
+ RTFIMP_NEXTTOKEN, RTFIMP_UNKNOWNATTR, // nToken+nTokenValue
+ RTFIMP_SETATTR, // pAttrs
+ RTFIMP_INSERTTEXT, // aText
+ RTFIMP_INSERTPARA, // -
+ HTMLIMP_START, HTMLIMP_END, // only pParser, nPara, nIndex
+ HTMLIMP_NEXTTOKEN, HTMLIMP_UNKNOWNATTR, // nToken
+ HTMLIMP_SETATTR, // pAttrs
+ HTMLIMP_INSERTTEXT, // aText
+ HTMLIMP_INSERTPARA, HTMLIMP_INSERTFIELD // -
+ };
+
+struct ImportInfo
+{
+ SvParser* pParser;
+ ESelection aSelection;
+ ImportState eState;
+
+ int nToken;
+ short nTokenValue;
+
+ String aText;
+
+ void* pAttrs; // RTF: SvxRTFItemStackType*, HTML: SfxItemSet*
+
+ ImportInfo( ImportState eState, SvParser* pPrsrs, const ESelection& rSel );
+ ~ImportInfo();
+};
+
+struct ParagraphInfos
+{
+ ParagraphInfos()
+ : nParaHeight( 0 )
+ , nLines( 0 )
+ , nFirstLineStartX( 0 )
+ , nFirstLineOffset( 0 )
+ , nFirstLineHeight( 0 )
+ , nFirstLineTextHeight ( 0 )
+ , nFirstLineMaxAscent( 0 )
+ , bValid( 0 )
+ {}
+ sal_uInt16 nParaHeight;
+ sal_uInt16 nLines;
+
+ sal_uInt16 nFirstLineStartX;
+
+ sal_uInt16 nFirstLineOffset;
+ sal_uInt16 nFirstLineHeight;
+ sal_uInt16 nFirstLineTextHeight;
+ sal_uInt16 nFirstLineMaxAscent;
+
+ sal_Bool bValid; // A query during formatting is not valid!
+};
+
+struct EECharAttrib
+{
+ const SfxPoolItem* pAttr;
+
+ sal_uInt16 nPara;
+ xub_StrLen nStart;
+ xub_StrLen nEnd;
+};
+
+struct MoveParagraphsInfo
+{
+ sal_uInt16 nStartPara;
+ sal_uInt16 nEndPara;
+ sal_uInt16 nDestPara;
+
+ MoveParagraphsInfo( sal_uInt16 nS, sal_uInt16 nE, sal_uInt16 nD )
+ { nStartPara = nS; nEndPara = nE; nDestPara = nD; }
+};
+
+#define EE_ACTION_PASTE 1
+#define EE_ACTION_DROP 2
+
+struct PasteOrDropInfos
+{
+ sal_uInt16 nAction;
+ sal_uInt16 nStartPara;
+ sal_uInt16 nEndPara;
+
+ PasteOrDropInfos() : nAction(0), nStartPara(0xFFFF), nEndPara(0xFFFF) {}
+};
+
+enum EENotifyType
+{
+ /// EditEngine text was modified
+ EE_NOTIFY_TEXTMODIFIED,
+
+ /// A paragraph was inserted into the EditEngine
+ EE_NOTIFY_PARAGRAPHINSERTED,
+
+ /// A paragraph was removed from the EditEngine
+ EE_NOTIFY_PARAGRAPHREMOVED,
+
+ /// Multiple paragraphs have been removed from the EditEngine
+ EE_NOTIFY_PARAGRAPHSMOVED,
+
+ /// The height of at least one paragraph has changed
+ EE_NOTIFY_TEXTHEIGHTCHANGED,
+
+ /// The view area of the EditEngine scrolled
+ EE_NOTIFY_TEXTVIEWSCROLLED,
+
+ /// The selection and/or the cursor position has changed
+ EE_NOTIFY_TEXTVIEWSELECTIONCHANGED,
+
+ /** Denotes the beginning of a collected amount of EditEngine
+ notification events. This event itself is not queued, but sent
+ immediately
+ */
+ EE_NOTIFY_BLOCKNOTIFICATION_START,
+
+ /** Denotes the end of a collected amount of EditEngine
+ notification events. After this event, the queue is empty, and
+ a high-level operation such as "insert paragraph" is finished
+ */
+ EE_NOTIFY_BLOCKNOTIFICATION_END,
+
+ /// Denotes the beginning of a high-level action triggered by a key press
+ EE_NOTIFY_INPUT_START,
+
+ /// Denotes the end of a high-level action triggered by a key press
+ EE_NOTIFY_INPUT_END
+};
+
+struct EENotify
+{
+ EENotifyType eNotificationType;
+ EditEngine* pEditEngine;
+ EditView* pEditView;
+
+ sal_uInt16 nParagraph; // only valid in PARAGRAPHINSERTED/EE_NOTIFY_PARAGRAPHREMOVED
+
+ sal_uInt16 nParam1;
+ sal_uInt16 nParam2;
+
+ EENotify( EENotifyType eType )
+ { eNotificationType = eType; pEditEngine = NULL; pEditView = NULL; nParagraph = EE_PARA_NOT_FOUND; nParam1 = 0; nParam2 = 0; }
+};
+
+#endif // _MyEDITDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
new file mode 100644
index 000000000000..83ba64342443
--- /dev/null
+++ b/include/editeng/editeng.hxx
@@ -0,0 +1,586 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// MyEDITENG, due to exported EditEng
+#ifndef _MyEDITENG_HXX
+#define _MyEDITENG_HXX
+
+#include <rtl/ref.hxx>
+#include <vector>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/i18n/WordType.hpp>
+#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+
+#include <rsc/rscsfx.hxx>
+#include <editeng/editdata.hxx>
+#include <i18nlangtag/lang.h>
+#include "editeng/editengdllapi.h"
+
+#include <tools/rtti.hxx> // due to typedef TypeId
+
+#include <editeng/eedata.hxx>
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+ }
+ namespace datatransfer {
+ class XTransferable;
+ }
+ namespace lang {
+ struct Locale;
+ }
+}}}
+
+namespace svx {
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+namespace svl { class IUndoManager; }
+namespace basegfx { class B2DPolyPolygon; }
+
+class ImpEditEngine;
+class EditView;
+class OutputDevice;
+class EditUndo;
+class SvxFont;
+class SfxItemPool;
+class SfxStyleSheet;
+class String;
+class SfxStyleSheetPool;
+class SvxSearchItem;
+class SvxFieldItem;
+class SvxCharSetColorItem;
+class SfxUndoAction;
+class MapMode;
+class Color;
+class Font;
+class KeyEvent;
+class PolyPolygon;
+class Size;
+class Point;
+class Rectangle;
+class SvStream;
+class Link;
+class OutputDevice;
+class Window;
+class SfxPoolItem;
+class SvxNumBulletItem;
+class SvxBulletItem;
+class SvxLRSpaceItem;
+class SvKeyValueIterator;
+class SvxForbiddenCharactersTable;
+class SvxNumberFormat;
+class FontList;
+class SvxFieldData;
+class ContentNode;
+class ParaPortion;
+class EditSelection;
+class EditPaM;
+class EditLine;
+class InternalEditStatus;
+class EditSelectionEngine;
+class EditDoc;
+struct PasteOrDropInfos;
+class Range;
+struct EPaM;
+class DeletedNodeInfo;
+class ParaPortionList;
+
+//////////////////////////////////////////////////////////////////////////////
+
+/** values for GetAttribs
+*/
+const sal_uInt8 EditEngineAttribs_All = 0; /// returns all attributes even when theire not set
+const sal_uInt8 EditEngineAttribs_HardAndPara = 1; /// returns all attributes set on paragraph and on portions
+const sal_uInt8 EditEngineAttribs_OnlyHard = 2; /// returns only attributes hard set on portions
+
+#define GETATTRIBS_STYLESHEET (sal_uInt8)0x01
+#define GETATTRIBS_PARAATTRIBS (sal_uInt8)0x02
+#define GETATTRIBS_CHARATTRIBS (sal_uInt8)0x04
+#define GETATTRIBS_ALL (sal_uInt8)0xFF
+
+class EDITENG_DLLPUBLIC EditEngine
+{
+ friend class EditView;
+ friend class ImpEditView;
+ friend class EditDbg;
+ friend class Outliner;
+
+public:
+ typedef std::vector<EditView*> ViewsType;
+
+private:
+ ImpEditEngine* pImpEditEngine;
+
+ EDITENG_DLLPRIVATE EditEngine( const EditEngine& );
+ EDITENG_DLLPRIVATE EditEngine& operator=( const EditEngine& );
+ EDITENG_DLLPRIVATE sal_uInt8 PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pView, Window* pFrameWin = NULL );
+
+ EDITENG_DLLPRIVATE void CursorMoved(ContentNode* pPrevNode);
+ EDITENG_DLLPRIVATE void CheckIdleFormatter();
+ EDITENG_DLLPRIVATE bool IsIdleFormatterActive() const;
+ EDITENG_DLLPRIVATE ParaPortion* FindParaPortion(ContentNode* pNode);
+ EDITENG_DLLPRIVATE const ParaPortion* FindParaPortion(ContentNode* pNode) const;
+ EDITENG_DLLPRIVATE const ParaPortion* GetPrevVisPortion(const ParaPortion* pCurPortion) const;
+
+ EDITENG_DLLPRIVATE com::sun::star::uno::Reference<
+ com::sun::star::datatransfer::XTransferable>
+ CreateTransferable(const EditSelection& rSelection);
+
+ EDITENG_DLLPRIVATE EditSelection InsertText(
+ com::sun::star::uno::Reference<com::sun::star::datatransfer::XTransferable >& rxDataObj,
+ const String& rBaseURL, const EditPaM& rPaM, bool bUseSpecial);
+
+ EDITENG_DLLPRIVATE EditPaM EndOfWord(
+ const EditPaM& rPaM, sal_Int16 nWordType = com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES);
+
+ EDITENG_DLLPRIVATE EditPaM GetPaM(const Point& aDocPos, bool bSmart = true);
+
+ EDITENG_DLLPRIVATE EditSelection SelectWord(
+ const EditSelection& rCurSelection,
+ sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES,
+ bool bAcceptStartOfWord = true);
+
+ EDITENG_DLLPRIVATE long GetXPos(
+ const ParaPortion* pParaPortion, const EditLine* pLine, sal_uInt16 nIndex, bool bPreferPortionStart = false) const;
+
+ EDITENG_DLLPRIVATE Range GetLineXPosStartEnd(
+ const ParaPortion* pParaPortion, const EditLine* pLine) const;
+
+ EDITENG_DLLPRIVATE sal_uInt16 GetOnePixelInRef() const;
+ EDITENG_DLLPRIVATE InternalEditStatus& GetInternalEditStatus();
+
+ EDITENG_DLLPRIVATE void HandleBeginPasteOrDrop(PasteOrDropInfos& rInfos);
+ EDITENG_DLLPRIVATE void HandleEndPasteOrDrop(PasteOrDropInfos& rInfos);
+ EDITENG_DLLPRIVATE bool HasText() const;
+ EDITENG_DLLPRIVATE const EditSelectionEngine& GetSelectionEngine() const;
+ EDITENG_DLLPRIVATE void SetInSelectionMode(bool b);
+
+protected:
+
+
+public:
+ EditEngine( SfxItemPool* pItemPool );
+ virtual ~EditEngine();
+
+ const SfxItemSet& GetEmptyItemSet();
+
+ void SetDefTab( sal_uInt16 nDefTab );
+
+ void SetRefDevice( OutputDevice* pRefDef );
+ OutputDevice* GetRefDevice() const;
+
+ void SetRefMapMode( const MapMode& rMapMode );
+ MapMode GetRefMapMode();
+
+ void SetUpdateMode( sal_Bool bUpdate );
+ sal_Bool GetUpdateMode() const;
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor() const;
+ Color GetAutoColor() const;
+ void EnableAutoColor( sal_Bool b );
+ void ForceAutoColor( sal_Bool b );
+ sal_Bool IsForceAutoColor() const;
+
+ void InsertView(EditView* pEditView, size_t nIndex = EE_APPEND);
+ EditView* RemoveView( EditView* pEditView );
+ EditView* RemoveView(size_t nIndex = EE_APPEND);
+ EditView* GetView(size_t nIndex = 0) const;
+ size_t GetViewCount() const;
+ sal_Bool HasView( EditView* pView ) const;
+ EditView* GetActiveView() const;
+ void SetActiveView(EditView* pView);
+
+ void SetPaperSize( const Size& rSize );
+ const Size& GetPaperSize() const;
+
+ void SetVertical( bool bVertical );
+ bool IsVertical() const;
+
+ void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
+
+ void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
+ EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
+
+ sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ LanguageType GetLanguage(const EditPaM& rPaM) const;
+ LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
+
+ void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode );
+ EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode );
+
+ void SetAsianCompressionMode( sal_uInt16 nCompression );
+
+ void SetKernAsianPunctuation( sal_Bool bEnabled );
+
+ void SetAddExtLeading( sal_Bool b );
+
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
+ void ClearPolygon();
+
+ const Size& GetMinAutoPaperSize() const;
+ void SetMinAutoPaperSize( const Size& rSz );
+
+ const Size& GetMaxAutoPaperSize() const;
+ void SetMaxAutoPaperSize( const Size& rSz );
+
+ OUString GetText( LineEnd eEnd = LINEEND_LF ) const;
+ String GetText( const ESelection& rSelection, const LineEnd eEnd = LINEEND_LF ) const;
+ sal_uInt32 GetTextLen() const;
+ sal_uInt32 GetTextHeight() const;
+ sal_uInt32 GetTextHeightNTP() const;
+ sal_uInt32 CalcTextWidth();
+
+ String GetText( sal_uInt16 nParagraph ) const;
+ xub_StrLen GetTextLen( sal_uInt16 nParagraph ) const;
+ sal_uInt32 GetTextHeight( sal_uInt16 nParagraph ) const;
+
+ sal_uInt16 GetParagraphCount() const;
+
+ sal_uInt16 GetLineCount( sal_uInt16 nParagraph ) const;
+ xub_StrLen GetLineLen( sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ sal_uInt32 GetLineHeight( sal_uInt16 nParagraph, sal_uInt16 nLine = 0 );
+ ParagraphInfos GetParagraphInfos( sal_uInt16 nPara );
+ sal_uInt16 FindParagraph( long nDocPosY );
+ EPosition FindDocPosition( const Point& rDocPos ) const;
+ Rectangle GetCharacterBounds( const EPosition& rPos ) const;
+
+ String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
+
+ ESelection GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const;
+
+ void Clear();
+ void SetText( const OUString& rStr );
+
+ EditTextObject* CreateTextObject();
+ EditTextObject* CreateTextObject( sal_uInt16 nPara, sal_uInt16 nParas = 1 );
+ EditTextObject* CreateTextObject( const ESelection& rESelection );
+ void SetText( const EditTextObject& rTextObject );
+
+ void RemoveParagraph( sal_uInt16 nPara );
+ void InsertParagraph( sal_uInt16 nPara, const EditTextObject& rTxtObj );
+ void InsertParagraph( sal_uInt16 nPara, const String& rText);
+
+ void SetText( sal_uInt16 nPara, const String& rText);
+
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual const SfxItemSet& GetParaAttribs( sal_uInt16 nPara ) const;
+
+ void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
+
+ SfxItemSet GetAttribs( sal_uInt16 nPara, sal_uInt16 nStart, sal_uInt16 nEnd, sal_uInt8 nFlags = 0xFF ) const;
+ SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All );
+
+ sal_Bool HasParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+ const SfxPoolItem& GetParaAttrib( sal_uInt16 nPara, sal_uInt16 nWhich );
+
+ Font GetStandardFont( sal_uInt16 nPara );
+ SvxFont GetStandardSvxFont( sal_uInt16 nPara );
+
+ void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+
+ void ShowParagraph( sal_uInt16 nParagraph, sal_Bool bShow = sal_True );
+
+ ::svl::IUndoManager&
+ GetUndoManager();
+ void UndoActionStart( sal_uInt16 nId );
+ void UndoActionStart(sal_uInt16 nId, const ESelection& rSel);
+ void UndoActionEnd( sal_uInt16 nId );
+ sal_Bool IsInUndo();
+
+ void EnableUndo( sal_Bool bEnable );
+ sal_Bool IsUndoEnabled();
+
+ /** returns the value last used for bTryMerge while calling ImpEditEngine::InsertUndo
+ This is currently used in a bad but needed hack to get undo actions merged in the
+ OutlineView in impress. Do not use it unless you want to sell your soul too! */
+ bool HasTriedMergeOnLastAddUndo() const;
+
+ void ClearModifyFlag();
+ void SetModified();
+ sal_Bool IsModified() const;
+
+ void SetModifyHdl( const Link& rLink );
+ Link GetModifyHdl() const;
+
+ sal_Bool IsInSelectionMode() const;
+
+ void StripPortions();
+ void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList );
+
+ long GetFirstLineStartX( sal_uInt16 nParagraph );
+ Point GetDocPosTopLeft( sal_uInt16 nParagraph );
+ Point GetDocPos( const Point& rPaperPos ) const;
+ sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
+
+ // StartDocPos corrresponds to VisArea.TopLeft().
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos );
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect, const Point& rStartDocPos, sal_Bool bClip );
+ void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
+
+// sal_uInt32: Error code of the stream.
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+ sal_uLong Write( SvStream& rOutput, EETextFormat );
+
+ void SetStatusEventHdl( const Link& rLink );
+ Link GetStatusEventHdl() const;
+
+ void SetNotifyHdl( const Link& rLink );
+ Link GetNotifyHdl() const;
+
+ void SetImportHdl( const Link& rLink );
+ Link GetImportHdl() const;
+
+ // Do not evaluate font formatting => For Outliner
+ sal_Bool IsFlatMode() const;
+ void SetFlatMode( sal_Bool bFlat );
+
+ void SetControlWord( sal_uInt32 nWord );
+ sal_uInt32 GetControlWord() const;
+
+ void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
+ void QuickMarkInvalid( const ESelection& rSel );
+ void QuickFormatDoc( sal_Bool bFull = sal_False );
+ void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ void QuickInsertLineBreak( const ESelection& rSel );
+ void QuickInsertText( const String& rText, const ESelection& rSel );
+ void QuickDelete( const ESelection& rSel );
+ void QuickMarkToBeRepainted( sal_uInt16 nPara );
+
+ void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
+ void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
+
+ void SetEditTextObjectPool( SfxItemPool* pPool );
+ SfxItemPool* GetEditTextObjectPool() const;
+
+ void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
+ SfxStyleSheetPool* GetStyleSheetPool();
+
+ void SetStyleSheet(const EditSelection& aSel, SfxStyleSheet* pStyle);
+ void SetStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pStyle );
+ const SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara ) const;
+ SfxStyleSheet* GetStyleSheet( sal_uInt16 nPara );
+
+ void SetWordDelimiters( const String& rDelimiters );
+ String GetWordDelimiters() const;
+
+ void EraseVirtualDevice();
+
+ void SetSpeller( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetSpeller();
+ void SetHyphenator( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator >& xHyph );
+
+ void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
+
+ void SetDefaultLanguage( LanguageType eLang );
+ LanguageType GetDefaultLanguage() const;
+
+ sal_Bool HasOnlineSpellErrors() const;
+ void CompleteOnlineSpelling();
+
+ sal_Bool ShouldCreateBigTextObject() const;
+
+ // For fast Pre-Test without view:
+ EESpellState HasSpellErrors();
+ sal_Bool HasText( const SvxSearchItem& rSearchItem );
+
+ //initialize sentence spelling
+ void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
+ //spell and return a sentence
+ bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView& rEditView );
+ //applies a changed sentence
+ void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
+
+ // for text conversion (see also HasSpellErrors)
+ sal_Bool HasConvertibleTextPortion( LanguageType nLang );
+ virtual sal_Bool ConvertNextDocument();
+
+ bool UpdateFields();
+ bool UpdateFieldsOnly();
+ void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
+
+ sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+
+ sal_Bool IsRightToLeft( sal_uInt16 nPara ) const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >
+ CreateTransferable( const ESelection& rSelection ) const;
+
+ // MT: Can't create new virtual functions like for ParagraphInserted/Deleted, musst be compatible in SRC638, change later...
+ void SetBeginMovingParagraphsHdl( const Link& rLink );
+ void SetEndMovingParagraphsHdl( const Link& rLink );
+ void SetBeginPasteOrDropHdl( const Link& rLink );
+ void SetEndPasteOrDropHdl( const Link& rLink );
+
+ virtual void PaintingFirstLine( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev );
+ virtual void ParagraphInserted( sal_uInt16 nNewParagraph );
+ virtual void ParagraphDeleted( sal_uInt16 nDeletedParagraph );
+ virtual void ParagraphConnected( sal_uInt16 nLeftParagraph, sal_uInt16 nRightParagraph );
+ virtual void ParaAttribsChanged( sal_uInt16 nParagraph );
+ virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
+ virtual void ParagraphHeightChanged( sal_uInt16 nPara );
+
+ virtual void DrawingText(
+ const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen, const sal_Int32* pDXArray,
+ const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet,
+ const ::com::sun::star::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ virtual void DrawingTab(
+ const Point& rStartPos, long nWidth, const String& rChar,
+ const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+ virtual String GetUndoComment( sal_uInt16 nUndoId ) const;
+ virtual sal_Bool FormattingParagraph( sal_uInt16 nPara );
+ virtual sal_Bool SpellNextDocument();
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
+
+ // to be overloaded if access to bullet information needs to be provided
+ virtual const SvxNumberFormat * GetNumberFormat( sal_uInt16 nPara ) const;
+
+ virtual Rectangle GetBulletArea( sal_uInt16 nPara );
+
+ static SfxItemPool* CreatePool( sal_Bool bLoadRefCounts = sal_True );
+ static SfxItemPool& GetGlobalItemPool();
+ static sal_Bool DoesKeyChangeText( const KeyEvent& rKeyEvent );
+ static sal_Bool DoesKeyMoveCursor( const KeyEvent& rKeyEvent );
+ static sal_Bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
+ static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const Font& rFont );
+ static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont );
+ static Font CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType );
+ static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
+ static sal_Bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
+ static sal_Bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable );
+
+ /** sets a link that is called at the beginning of a drag operation at an edit view */
+ void SetBeginDropHdl( const Link& rLink );
+ Link GetBeginDropHdl() const;
+
+ /** sets a link that is called at the end of a drag operation at an edit view */
+ void SetEndDropHdl( const Link& rLink );
+ Link GetEndDropHdl() const;
+
+ /// specifies if auto-correction should capitalize the first word or not (default is on)
+ void SetFirstWordCapitalization( sal_Bool bCapitalize );
+
+ EditDoc& GetEditDoc();
+ const EditDoc& GetEditDoc() const;
+
+ ParaPortionList& GetParaPortions();
+ const ParaPortionList& GetParaPortions() const;
+
+ bool IsFormatted() const;
+ bool IsImportHandlerSet() const;
+ bool IsImportRTFStyleSheetsSet() const;
+
+ void CallImportHandler(ImportInfo& rInfo);
+
+ void ParaAttribsToCharAttribs(ContentNode* pNode);
+
+ EditPaM CreateEditPaM(const EPaM& rEPaM);
+ EditPaM ConnectParagraphs(
+ ContentNode* pLeft, ContentNode* pRight, bool bBackward = false);
+
+ EditPaM InsertField(const EditSelection& rEditSelection, const SvxFieldItem& rFld);
+ EditPaM InsertText(const EditSelection& aCurEditSelection, const String& rStr);
+ EditSelection InsertText(const EditTextObject& rTextObject, const EditSelection& rSel);
+ EditPaM InsertParaBreak(
+ const EditSelection& rEditSelection, bool bKeepEndingAttribs = true);
+ EditPaM InsertLineBreak(const EditSelection& rEditSelection);
+
+ EditPaM CursorLeft(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
+ EditPaM CursorRight(
+ const EditPaM& rPaM, sal_uInt16 nCharacterIteratorMode = com::sun::star::i18n::CharacterIteratorMode::SKIPCELL);
+
+ void SeekCursor(
+ ContentNode* pNode, sal_uInt16 nPos, SvxFont& rFont, OutputDevice* pOut = NULL, sal_uInt16 nIgnoreWhich = 0);
+
+ EditPaM DeleteSelection(const EditSelection& rSel);
+
+ ESelection CreateESelection(const EditSelection& rSel);
+ EditSelection CreateSelection(const ESelection& rSel);
+
+ const SfxItemSet& GetBaseParaAttribs(sal_uInt16 nPara) const;
+ void SetParaAttribsOnly(sal_uInt16 nPara, const SfxItemSet& rSet);
+ void SetAttribs(const EditSelection& rSel, const SfxItemSet& rSet, sal_uInt8 nSpecial = 0);
+
+ String GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const;
+ EditPaM DeleteSelected(const EditSelection& rSel);
+
+ sal_uInt16 GetScriptType(const EditSelection& rSel) const;
+
+ void RemoveParaPortion(size_t nNode);
+
+ void SetCallParaInsertedOrDeleted(bool b);
+ bool IsCallParaInsertedOrDeleted() const;
+
+ void AppendDeletedNodeInfo(DeletedNodeInfo* pInfo);
+ void UpdateSelections();
+
+ void InsertContent(ContentNode* pNode, sal_uInt16 nPos);
+ EditPaM SplitContent(sal_uInt16 nNode, sal_uInt16 nSepPos);
+ EditPaM ConnectContents(sal_uInt16 nLeftNode, bool bBackward);
+
+ EditPaM InsertFeature(const EditSelection& rEditSelection, const SfxPoolItem& rItem);
+
+ EditSelection MoveParagraphs(const Range& rParagraphs, sal_uInt16 nNewPos, EditView* pCurView);
+
+ void RemoveCharAttribs(sal_uInt16 nPara, sal_uInt16 nWhich = 0, bool bRemoveFeatures = false);
+ void RemoveCharAttribs(const EditSelection& rSel, bool bRemoveParaAttribs, sal_uInt16 nWhich = 0);
+
+ ViewsType& GetEditViews();
+ const ViewsType& GetEditViews() const;
+
+ void SetUndoMode(bool b);
+ void FormatAndUpdate(EditView* pCurView = NULL);
+
+ bool Undo(EditView* pView);
+ bool Redo(EditView* pView);
+};
+
+#endif // _MyEDITENG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editengdllapi.h b/include/editeng/editengdllapi.h
new file mode 100644
index 000000000000..ce764e81fece
--- /dev/null
+++ b/include/editeng/editengdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_EDITENGDLLAPI_H
+#define INCLUDED_EDITENGDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(EDITENG_DLLIMPLEMENTATION)
+#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define EDITENG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define EDITENG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editerr.hxx b/include/editeng/editerr.hxx
new file mode 100644
index 000000000000..d262057763e7
--- /dev/null
+++ b/include/editeng/editerr.hxx
@@ -0,0 +1,30 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDIT_ERR_HRC
+#define _EDIT_ERR_HRC
+
+#include <tools/errcode.hxx>
+
+#define ERRCODE_SVX_LINGU_LANGUAGENOTEXISTS (2UL | ERRCODE_AREA_SVX)
+
+#define ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT (8UL | ERRCODE_AREA_SVX | \
+ ERRCODE_CLASS_READ )
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc
new file mode 100644
index 000000000000..7dbaae890a51
--- /dev/null
+++ b/include/editeng/editids.hrc
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDIT_SVXIDS_HRC
+#define _EDIT_SVXIDS_HRC
+
+#include <svl/solar.hrc>
+
+#define SID_ATTR_BRUSH ( SID_SVX_START + 1 )
+#define SID_ATTR_TABSTOP ( SID_SVX_START + 2 )
+#define SID_ATTR_TABSTOP_DEFAULTS ( SID_SVX_START + 3 )
+#define SID_ATTR_TABSTOP_POS ( SID_SVX_START + 4 )
+#define SID_ATTR_TABSTOP_OFFSET ( SID_SVX_START + 5 )
+#define SID_ATTR_CHAR ( SID_SVX_START + 6 )
+#define SID_ATTR_CHAR_FONT ( SID_SVX_START + 7 )
+#define SID_ATTR_CHAR_POSTURE ( SID_SVX_START + 8 )
+#define SID_ATTR_CHAR_WEIGHT ( SID_SVX_START + 9 )
+#define SID_ATTR_CHAR_SHADOWED ( SID_SVX_START + 10 )
+#define SID_ATTR_CHAR_WORDLINEMODE ( SID_SVX_START + 11 )
+#define SID_ATTR_CHAR_CONTOUR ( SID_SVX_START + 12 )
+#define SID_ATTR_CHAR_STRIKEOUT ( SID_SVX_START + 13 )
+#define SID_ATTR_CHAR_UNDERLINE ( SID_SVX_START + 14 )
+#define SID_ATTR_CHAR_FONTHEIGHT ( SID_SVX_START + 15 )
+#define SID_ATTR_CHAR_PROPSIZE ( SID_SVX_START + 16 )
+#define SID_ATTR_CHAR_COLOR ( SID_SVX_START + 17 )
+#define SID_ATTR_CHAR_KERNING ( SID_SVX_START + 18 )
+#define SID_ATTR_CHAR_CASEMAP ( SID_SVX_START + 19 )
+#define SID_ATTR_CHAR_LANGUAGE ( SID_SVX_START + 20 )
+#define SID_ATTR_CHAR_ESCAPEMENT ( SID_SVX_START + 21 )
+#define SID_ATTR_CHAR_FONTLIST ( SID_SVX_START + 22 )
+#define SID_ATTR_BORDER_OUTER ( SID_SVX_START + 24 )
+#define SID_ATTR_BORDER_SHADOW ( SID_SVX_START + 25 )
+#define SID_ATTR_PARA ( SID_SVX_START + 26 )
+#define SID_ATTR_PARA_ADJUST ( SID_SVX_START + 27 )
+#define SID_ATTR_PARA_ADJUST_LEFT ( SID_SVX_START + 28 )
+#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_SVX_START + 29 )
+#define SID_ATTR_PARA_ADJUST_CENTER ( SID_SVX_START + 30 )
+#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_SVX_START + 31 )
+#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_SVX_START + 32 )
+#define SID_ATTR_PARA_LINESPACE ( SID_SVX_START + 33 )
+#define SID_ATTR_PARA_LINESPACE_10 ( SID_SVX_START + 34 )
+#define SID_ATTR_PARA_LINESPACE_15 ( SID_SVX_START + 35 )
+#define SID_ATTR_PARA_LINESPACE_20 ( SID_SVX_START + 36 )
+#define SID_ATTR_PARA_PAGEBREAK ( SID_SVX_START + 37 )
+#define SID_ATTR_PARA_HYPHENZONE ( SID_SVX_START + 38 )
+#define SID_ATTR_PARA_SPLIT ( SID_SVX_START + 39 )
+#define SID_ATTR_PARA_ORPHANS ( SID_SVX_START + 40 )
+#define SID_ATTR_PARA_WIDOWS ( SID_SVX_START + 41 )
+#define SID_ATTR_PARA_ULSPACE ( SID_SVX_START + 42 )
+#define SID_ATTR_PARA_LRSPACE ( SID_SVX_START + 43 )
+#define SID_ATTR_LRSPACE ( SID_SVX_START + 48 )
+#define SID_ATTR_ULSPACE ( SID_SVX_START + 49 )
+#define SID_ATTR_CHAR_MAPTYPE ( SID_SVX_START + 64 )
+#define SID_ATTR_PARA_MODEL ( SID_SVX_START + 65 )
+#define SID_ATTR_PARA_KEEP ( SID_SVX_START + 66 )
+#define SID_ATTR_CHAR_AUTOKERN ( SID_SVX_START + 67 )
+#define SID_ATTR_PARA_BULLET ( SID_SVX_START + 250 )
+#define SID_ATTR_PARA_OUTLLEVEL ( SID_SVX_START + 300 )
+#define SID_FIELD ( SID_SVX_START + 363 )
+#define SID_ATTR_PARA_REGISTER ( SID_SVX_START + 413 )
+#define SID_ATTR_PARA_PAGENUM ( SID_SVX_START + 457 )
+#define SID_ATTR_PARA_NUMRULE ( SID_SVX_START + 587 )
+#define SID_ATTR_BRUSH_CHAR ( SID_SVX_START + 591 )
+#define SID_ATTR_NUMBERING_RULE ( SID_SVX_START + 855 )
+#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_SVX_START + 877 )
+#define SID_ATTR_CHAR_CJK_FONT ( SID_SVX_START + 887 )
+#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_SVX_START + 888 )
+#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_SVX_START + 889 )
+#define SID_ATTR_CHAR_CJK_POSTURE ( SID_SVX_START + 890 )
+#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_SVX_START + 891 )
+#define SID_ATTR_CHAR_CTL_FONT ( SID_SVX_START + 892 )
+#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_SVX_START + 893 )
+#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_SVX_START + 894 )
+#define SID_ATTR_CHAR_CTL_POSTURE ( SID_SVX_START + 895 )
+#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_SVX_START + 896 )
+#define SID_ATTR_CHAR_TWO_LINES ( SID_SVX_START + 897 )
+#define SID_ATTR_CHAR_CJK_RUBY ( SID_SVX_START + 898 )
+#define SID_ATTR_CHAR_EMPHASISMARK ( SID_SVX_START + 899 )
+#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_SVX_START + 900 )
+#define SID_ATTR_PARA_SCRIPTSPACE ( SID_SVX_START + 901 )
+#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_SVX_START + 902 )
+#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_SVX_START + 903 )
+#define SID_ATTR_CHAR_VERTICAL ( SID_SVX_START + 905 )
+#define SID_ATTR_CHAR_ROTATED ( SID_SVX_START + 910 )
+#define SID_ATTR_CHAR_SCALEWIDTH ( SID_SVX_START + 911 )
+#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_SVX_START + 919 )
+#define SID_ATTR_CHAR_RELIEF ( SID_SVX_START + 920 )
+#define SID_PARA_VERTALIGN ( SID_SVX_START + 925 )
+#define SID_ATTR_FRAMEDIRECTION ( SID_SVX_START + 944 )
+#define SID_ATTR_PARA_SNAPTOGRID ( SID_SVX_START + 945 )
+#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_SVX_START + 947 )
+#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_SVX_START + 950 )
+#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_SVX_START + 951 )
+#define SID_ATTR_CHAR_HIDDEN ( SID_SVX_START + 989 )
+#define SID_ATTR_CHAR_LATIN_FONT ( SID_SVX_START + 994 )
+#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_SVX_START + 995 )
+#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_SVX_START + 996 )
+#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_SVX_START + 997 )
+#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_SVX_START + 998 )
+#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_SVX_START + 1121 )
+#define SID_ATTR_CHAR_PREVIEW_FONT ( SID_SVX_START + 1122 )
+#define SID_ATTR_CHAR_ENDPREVIEW_FONT ( SID_SVX_START + 1123 )
+
+
+// this ID didn't exist prior to the svx split
+#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY_METHOD ( SID_EDIT_START + 69 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY_METHOD ( SID_EDIT_START + 70 )
+#define SID_ATTR_ALIGN_HOR_JUSTIFY ( SID_EDIT_START + 71 )
+#define SID_ATTR_ALIGN_VER_JUSTIFY ( SID_EDIT_START + 72 )
+
+/*
+// planned, but not doable: changing value of SIDs will break code that uses them for WhichRanges
+#define SID_PARA_VERTALIGN ( SID_EDIT_START )
+#define SID_ATTR_BORDER_OUTER ( SID_EDIT_START + 1 )
+#define SID_ATTR_BORDER_SHADOW ( SID_EDIT_START + 2 )
+#define SID_ATTR_BRUSH ( SID_EDIT_START + 3 )
+#define SID_ATTR_BRUSH_CHAR ( SID_EDIT_START + 4 )
+
+
+#define SID_FIELD ( SID_EDIT_START + 7 )
+#define SID_ATTR_FRAMEDIRECTION ( SID_EDIT_START + 8 )
+#define SID_ATTR_PARA ( SID_EDIT_START + 9 )
+#define SID_ATTR_PARA_ADJUST ( SID_EDIT_START + 10 )
+#define SID_ATTR_PARA_ADJUST_LEFT ( SID_EDIT_START + 11 )
+#define SID_ATTR_PARA_BULLET ( SID_EDIT_START + 12 )
+#define SID_ATTR_PARA_OUTLLEVEL ( SID_EDIT_START + 13 )
+#define SID_ATTR_PARA_REGISTER ( SID_EDIT_START + 14 )
+#define SID_ATTR_PARA_PAGENUM ( SID_EDIT_START + 15 )
+#define SID_ATTR_PARA_NUMRULE ( SID_EDIT_START + 16 )
+#define SID_ATTR_PARA_SCRIPTSPACE ( SID_EDIT_START + 17 )
+#define SID_ATTR_PARA_HANGPUNCTUATION ( SID_EDIT_START + 18 )
+#define SID_ATTR_PARA_FORBIDDEN_RULES ( SID_EDIT_START + 19 )
+#define SID_ATTR_PARA_SNAPTOGRID ( SID_EDIT_START + 20 )
+#define SID_ATTR_PARA_LRSPACE_VERTICAL ( SID_EDIT_START + 21 )
+#define SID_ATTR_PARA_LEFT_TO_RIGHT ( SID_EDIT_START + 22 )
+#define SID_ATTR_PARA_RIGHT_TO_LEFT ( SID_EDIT_START + 23 )
+#define SID_ATTR_PARA_OUTLINE_LEVEL ( SID_EDIT_START + 24 )
+#define SID_ATTR_PARA_ADJUST_RIGHT ( SID_EDIT_START + 25 )
+#define SID_ATTR_PARA_ADJUST_CENTER ( SID_EDIT_START + 26 )
+#define SID_ATTR_PARA_ADJUST_BLOCK ( SID_EDIT_START + 27 )
+#define SID_ATTR_PARA_ADJUST_BLOCKLINE ( SID_EDIT_START + 28 )
+#define SID_ATTR_PARA_LINESPACE ( SID_EDIT_START + 29 )
+#define SID_ATTR_PARA_LINESPACE_10 ( SID_EDIT_START + 30 )
+#define SID_ATTR_PARA_LINESPACE_15 ( SID_EDIT_START + 31 )
+#define SID_ATTR_PARA_LINESPACE_20 ( SID_EDIT_START + 32 )
+#define SID_ATTR_PARA_PAGEBREAK ( SID_EDIT_START + 33 )
+#define SID_ATTR_PARA_HYPHENZONE ( SID_EDIT_START + 34 )
+#define SID_ATTR_PARA_SPLIT ( SID_EDIT_START + 35 )
+#define SID_ATTR_PARA_ORPHANS ( SID_EDIT_START + 36 )
+#define SID_ATTR_PARA_WIDOWS ( SID_EDIT_START + 37 )
+#define SID_ATTR_PARA_ULSPACE ( SID_EDIT_START + 38 )
+#define SID_ATTR_PARA_LRSPACE ( SID_EDIT_START + 39 )
+#define SID_ATTR_PARA_MODEL ( SID_EDIT_START + 40 )
+#define SID_ATTR_PARA_KEEP ( SID_EDIT_START + 41 )
+#define SID_ATTR_NUMBERING_RULE ( SID_EDIT_START + 42 )
+#define SID_ATTR_LRSPACE ( SID_EDIT_START + 43 )
+#define SID_ATTR_ULSPACE ( SID_EDIT_START + 44 )
+#define SID_ATTR_TABSTOP ( SID_EDIT_START + 45 )
+#define SID_ATTR_TABSTOP_DEFAULTS ( SID_EDIT_START + 46 )
+#define SID_ATTR_TABSTOP_POS ( SID_EDIT_START + 47 )
+#define SID_ATTR_TABSTOP_OFFSET ( SID_EDIT_START + 48 )
+#define SID_ATTR_CHAR ( SID_EDIT_START + 49 )
+#define SID_ATTR_CHAR_FONT ( SID_EDIT_START + 50 )
+#define SID_ATTR_CHAR_POSTURE ( SID_EDIT_START + 51 )
+#define SID_ATTR_CHAR_WEIGHT ( SID_EDIT_START + 52 )
+#define SID_ATTR_CHAR_SHADOWED ( SID_EDIT_START + 53 )
+#define SID_ATTR_CHAR_WORDLINEMODE ( SID_EDIT_START + 54 )
+#define SID_ATTR_CHAR_CONTOUR ( SID_EDIT_START + 55 )
+#define SID_ATTR_CHAR_STRIKEOUT ( SID_EDIT_START + 56 )
+#define SID_ATTR_CHAR_UNDERLINE ( SID_EDIT_START + 57 )
+#define SID_ATTR_CHAR_FONTHEIGHT ( SID_EDIT_START + 58 )
+#define SID_ATTR_CHAR_PROPSIZE ( SID_EDIT_START + 59 )
+#define SID_ATTR_CHAR_COLOR ( SID_EDIT_START + 60 )
+#define SID_ATTR_CHAR_KERNING ( SID_EDIT_START + 61 )
+#define SID_ATTR_CHAR_CASEMAP ( SID_EDIT_START + 62 )
+#define SID_ATTR_CHAR_LANGUAGE ( SID_EDIT_START + 63 )
+#define SID_ATTR_CHAR_ESCAPEMENT ( SID_EDIT_START + 64 )
+#define SID_ATTR_CHAR_FONTLIST ( SID_EDIT_START + 65 )
+#define SID_ATTR_CHAR_MAPTYPE ( SID_EDIT_START + 66 )
+#define SID_ATTR_CHAR_AUTOKERN ( SID_EDIT_START + 67 )
+#define SID_ATTR_CHAR_OVERLINE ( SID_EDIT_START + 68 )
+#define SID_ATTR_CHAR_CHARSETCOLOR ( SID_EDIT_START + 69 )
+#define SID_ATTR_CHAR_CJK_FONT ( SID_EDIT_START + 70 )
+#define SID_ATTR_CHAR_CJK_FONTHEIGHT ( SID_EDIT_START + 71 )
+#define SID_ATTR_CHAR_CJK_LANGUAGE ( SID_EDIT_START + 72 )
+#define SID_ATTR_CHAR_CJK_POSTURE ( SID_EDIT_START + 73 )
+#define SID_ATTR_CHAR_CJK_WEIGHT ( SID_EDIT_START + 74 )
+#define SID_ATTR_CHAR_CTL_FONT ( SID_EDIT_START + 75 )
+#define SID_ATTR_CHAR_CTL_FONTHEIGHT ( SID_EDIT_START + 76 )
+#define SID_ATTR_CHAR_CTL_LANGUAGE ( SID_EDIT_START + 77 )
+#define SID_ATTR_CHAR_CTL_POSTURE ( SID_EDIT_START + 78 )
+#define SID_ATTR_CHAR_CTL_WEIGHT ( SID_EDIT_START + 79 )
+#define SID_ATTR_CHAR_TWO_LINES ( SID_EDIT_START + 80 )
+#define SID_ATTR_CHAR_CJK_RUBY ( SID_EDIT_START + 81 )
+#define SID_ATTR_CHAR_EMPHASISMARK ( SID_EDIT_START + 82 )
+#define SID_ATTR_CHAR_SCRIPTTYPE ( SID_EDIT_START + 83 )
+#define SID_ATTR_CHAR_VERTICAL ( SID_EDIT_START + 84 )
+#define SID_ATTR_CHAR_ROTATED ( SID_EDIT_START + 85 )
+#define SID_ATTR_CHAR_SCALEWIDTH ( SID_EDIT_START + 86 )
+#define SID_ATTR_CHAR_WIDTH_FIT_TO_LINE ( SID_EDIT_START + 87 )
+#define SID_ATTR_CHAR_RELIEF ( SID_EDIT_START + 88 )
+#define SID_ATTR_CHAR_HIDDEN ( SID_EDIT_START + 89 )
+#define SID_ATTR_CHAR_LATIN_FONT ( SID_EDIT_START + 90 )
+#define SID_ATTR_CHAR_LATIN_FONTHEIGHT ( SID_EDIT_START + 91 )
+#define SID_ATTR_CHAR_LATIN_LANGUAGE ( SID_EDIT_START + 92 )
+#define SID_ATTR_CHAR_LATIN_POSTURE ( SID_EDIT_START + 93 )
+#define SID_ATTR_CHAR_LATIN_WEIGHT ( SID_EDIT_START + 94 )
+*/
+
+#if 94 > (SID_EDIT_END-SID_EDIT_START)
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+#define SID_DRAW_TEXT_VERTICAL SID_ATTR_CHAR_VERTICAL
+
+#endif
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
new file mode 100644
index 000000000000..16bc0be626e5
--- /dev/null
+++ b/include/editeng/editobj.hxx
@@ -0,0 +1,130 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITOBJ_HXX
+#define _EDITOBJ_HXX
+
+#include <tools/stream.hxx>
+#include <tools/debug.hxx>
+#include <rsc/rscsfx.hxx>
+#include <svl/itemset.hxx>
+#include "svl/itempool.hxx"
+#include <editeng/eeitem.hxx>
+#include <editeng/editdata.hxx>
+#include "editeng/editengdllapi.h"
+#include "editeng/macros.hxx"
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+#include <vector>
+
+DBG_NAMEEX( EE_EditTextObject )
+
+class SfxItemPool;
+class SfxStyleSheetPool;
+class SvxFieldItem;
+class SvxFieldData;
+
+namespace editeng {
+
+class FieldUpdater;
+class FieldUpdaterImpl;
+
+}
+
+class EditTextObjectImpl;
+
+class EDITENG_DLLPUBLIC EditTextObject : public SfxItemPoolUser
+{
+ friend class EditTextObjectImpl;
+ friend class editeng::FieldUpdaterImpl;
+ friend class ImpEditEngine;
+
+ EditTextObjectImpl* mpImpl;
+
+ EDITENG_DLLPRIVATE EditTextObject& operator=( const EditTextObject& );
+
+ EditTextObject(); // disabled
+
+ EditTextObject( SfxItemPool* pPool );
+
+ void StoreData( SvStream& rStrm ) const;
+ void CreateData( SvStream& rStrm );
+
+public:
+ EditTextObject( const EditTextObject& r );
+ virtual ~EditTextObject();
+
+ sal_uInt16 GetUserType() const; // For OutlinerMode, it can however not save in compatible format
+ void SetUserType( sal_uInt16 n );
+
+ bool IsVertical() const;
+ void SetVertical( bool bVertical );
+
+ sal_uInt16 GetScriptType() const;
+
+ EditTextObject* Clone() const;
+
+ bool Store( SvStream& rOStream ) const;
+
+ static EditTextObject* Create(
+ SvStream& rIStream, SfxItemPool* pGlobalTextObjectPool = NULL );
+
+ size_t GetParagraphCount() const;
+
+ String GetText(size_t nPara) const;
+
+ void ClearPortionInfo();
+
+ bool HasOnlineSpellErrors() const;
+
+ void GetCharAttribs( sal_uInt16 nPara, std::vector<EECharAttrib>& rLst ) const;
+
+ bool RemoveCharAttribs( sal_uInt16 nWhich = 0 );
+
+ bool IsFieldObject() const;
+ const SvxFieldItem* GetField() const;
+ const SvxFieldData* GetFieldData(size_t nPara, size_t nPos, sal_Int32 nType) const;
+ bool HasField( sal_Int32 nType = com::sun::star::text::textfield::Type::UNSPECIFIED ) const;
+
+ const SfxItemSet& GetParaAttribs(size_t nPara) const;
+
+ void GetStyleSheet(size_t nPara, String& rName, SfxStyleFamily& eFamily) const;
+ void SetStyleSheet(size_t nPara, const String& rName, const SfxStyleFamily& eFamily);
+ bool ChangeStyleSheets(
+ const XubString& rOldName, SfxStyleFamily eOldFamily, const XubString& rNewName, SfxStyleFamily eNewFamily );
+ void ChangeStyleSheetName( SfxStyleFamily eFamily, const XubString& rOldName, const XubString& rNewName );
+
+ editeng::FieldUpdater GetFieldUpdater();
+
+ bool operator==( const EditTextObject& rCompare ) const;
+
+ // #i102062#
+ bool isWrongListEqual(const EditTextObject& rCompare) const;
+
+ virtual void ObjectInDestruction(const SfxItemPool& rSfxItemPool);
+
+#if DEBUG_EDIT_ENGINE
+ void Dump() const;
+#endif
+};
+
+#endif // _EDITOBJ_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editrids.hrc b/include/editeng/editrids.hrc
new file mode 100644
index 000000000000..04ec3b6eccc7
--- /dev/null
+++ b/include/editeng/editrids.hrc
@@ -0,0 +1,395 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDIT_RIDS_HRC
+#define _EDIT_RIDS_HRC
+
+#include <svl/solar.hrc>
+
+// strings also used in cui
+#define RID_SVXSTR_PAPERBIN_SETTINGS (RID_EDIT_START)
+#define RID_SVXSTR_PAPERBIN (RID_EDIT_START + 1)
+
+#define RID_OUTLUNDO_EXPAND (RID_EDIT_START + 2)
+#define RID_OUTLUNDO_COLLAPSE (RID_EDIT_START + 3)
+#define RID_OUTLUNDO_ATTR (RID_EDIT_START + 4)
+#define RID_OUTLUNDO_INSERT (RID_EDIT_START + 5)
+#define RID_OUTLUNDO_DEPTH (RID_EDIT_START + 6)
+#define RID_OUTLUNDO_HEIGHT (RID_EDIT_START + 7)
+
+// strings for items
+
+#define RID_SVXITEMS_FRMDIR_BEGIN (RID_EDIT_START + 9)
+#define RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP (RID_EDIT_START + 9)
+#define RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP (RID_EDIT_START + 10)
+#define RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT (RID_EDIT_START + 11)
+#define RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT (RID_EDIT_START + 12)
+#define RID_SVXITEMS_FRMDIR_ENVIRONMENT (RID_EDIT_START + 13)
+// RID_SVXITEMS_FRMDIR_END (RID_EDIT_START + 14)
+
+#define RID_SVXITEMS_TRUE (RID_EDIT_START + 15)
+#define RID_SVXITEMS_FALSE (RID_EDIT_START + 16)
+#define RID_SVXITEMS_BORDER_COMPLETE (RID_EDIT_START + 17)
+#define RID_SVXITEMS_BORDER_TOP (RID_EDIT_START + 18)
+#define RID_SVXITEMS_BORDER_BOTTOM (RID_EDIT_START + 19)
+#define RID_SVXITEMS_BORDER_LEFT (RID_EDIT_START + 20)
+#define RID_SVXITEMS_BORDER_RIGHT (RID_EDIT_START + 21)
+#define RID_SVXITEMS_BORDER_DISTANCE (RID_EDIT_START + 22)
+#define RID_SVXITEMS_BORDER_NONE (RID_EDIT_START + 23)
+
+#define RID_SVXITEMS_TRANSPARENT_TRUE (RID_EDIT_START + 24)
+#define RID_SVXITEMS_TRANSPARENT_FALSE (RID_EDIT_START + 25)
+#define RID_SVXITEMS_OPAQUE_TRUE (RID_EDIT_START + 26)
+#define RID_SVXITEMS_OPAQUE_FALSE (RID_EDIT_START + 27)
+
+#define RID_SVXITEMS_SHADOW_COMPLETE (RID_EDIT_START + 28)
+#define RID_SVXITEMS_GRAPHIC (RID_EDIT_START + 29)
+#define RID_SVXITEMS_LINES (RID_EDIT_START + 30)
+#define RID_SVXITEMS_ORPHANS_COMPLETE (RID_EDIT_START + 31)
+#define RID_SVXITEMS_WIDOWS_COMPLETE (RID_EDIT_START + 32)
+#define RID_SVXITEMS_PAGEMODEL_COMPLETE (RID_EDIT_START + 33)
+
+#define RID_SVXITEMS_SHADOWED_TRUE (RID_EDIT_START + 34)
+#define RID_SVXITEMS_SHADOWED_FALSE (RID_EDIT_START + 35)
+#define RID_SVXITEMS_AUTOKERN_TRUE (RID_EDIT_START + 36)
+#define RID_SVXITEMS_AUTOKERN_FALSE (RID_EDIT_START + 37)
+#define RID_SVXITEMS_WORDLINE_TRUE (RID_EDIT_START + 38)
+#define RID_SVXITEMS_WORDLINE_FALSE (RID_EDIT_START + 39)
+#define RID_SVXITEMS_CONTOUR_TRUE (RID_EDIT_START + 40)
+#define RID_SVXITEMS_CONTOUR_FALSE (RID_EDIT_START + 41)
+#define RID_SVXITEMS_NOLINEBREAK_TRUE (RID_EDIT_START + 42)
+#define RID_SVXITEMS_NOLINEBREAK_FALSE (RID_EDIT_START + 43)
+#define RID_SVXITEMS_NOHYPHEN_TRUE (RID_EDIT_START + 44)
+#define RID_SVXITEMS_NOHYPHEN_FALSE (RID_EDIT_START + 45)
+#define RID_SVXITEMS_FMTKEEP_TRUE (RID_EDIT_START + 46)
+#define RID_SVXITEMS_FMTKEEP_FALSE (RID_EDIT_START + 47)
+#define RID_SVXITEMS_FMTSPLIT_TRUE (RID_EDIT_START + 48)
+#define RID_SVXITEMS_FMTSPLIT_FALSE (RID_EDIT_START + 49)
+#define RID_SVXITEMS_PRINT_TRUE (RID_EDIT_START + 50)
+#define RID_SVXITEMS_PRINT_FALSE (RID_EDIT_START + 51)
+#define RID_SVXITEMS_PROT_POS_TRUE (RID_EDIT_START + 52)
+#define RID_SVXITEMS_PROT_POS_FALSE (RID_EDIT_START + 53)
+#define RID_SVXITEMS_PROT_SIZE_TRUE (RID_EDIT_START + 54)
+#define RID_SVXITEMS_PROT_SIZE_FALSE (RID_EDIT_START + 55)
+#define RID_SVXITEMS_PROT_CONTENT_TRUE (RID_EDIT_START + 56)
+#define RID_SVXITEMS_PROT_CONTENT_FALSE (RID_EDIT_START + 57)
+#define RID_SVXITEMS_ULSPACE_UPPER (RID_EDIT_START + 58)
+#define RID_SVXITEMS_ULSPACE_LOWER (RID_EDIT_START + 59)
+#define RID_SVXITEMS_LRSPACE_LEFT (RID_EDIT_START + 60)
+#define RID_SVXITEMS_LRSPACE_FLINE (RID_EDIT_START + 62)
+#define RID_SVXITEMS_LRSPACE_RIGHT (RID_EDIT_START + 63)
+#define RID_SVXITEMS_SIZE_WIDTH (RID_EDIT_START + 64)
+#define RID_SVXITEMS_SIZE_HEIGHT (RID_EDIT_START + 65)
+#define RID_SVXITEMS_PAGE_END_TRUE (RID_EDIT_START + 66)
+#define RID_SVXITEMS_PAGE_END_FALSE (RID_EDIT_START + 67)
+#define RID_SVXITEMS_HYPHEN_TRUE (RID_EDIT_START + 68)
+#define RID_SVXITEMS_HYPHEN_FALSE (RID_EDIT_START + 69)
+#define RID_SVXITEMS_HYPHEN_MINLEAD (RID_EDIT_START + 70)
+#define RID_SVXITEMS_HYPHEN_MINTRAIL (RID_EDIT_START + 71)
+#define RID_SVXITEMS_HYPHEN_MAX (RID_EDIT_START + 72)
+#define RID_SVXITEMS_HNGPNCT_OFF (RID_EDIT_START + 73)
+#define RID_SVXITEMS_HNGPNCT_ON (RID_EDIT_START + 74)
+#define RID_SVXITEMS_FORBIDDEN_RULE_OFF (RID_EDIT_START + 75)
+#define RID_SVXITEMS_FORBIDDEN_RULE_ON (RID_EDIT_START + 76)
+#define RID_SVXITEMS_SCRPTSPC_OFF (RID_EDIT_START + 77)
+#define RID_SVXITEMS_SCRPTSPC_ON (RID_EDIT_START + 78)
+#define RID_SVXITEMS_CHARSCALE_OFF (RID_EDIT_START + 79)
+#define RID_SVXITEMS_CHARSCALE (RID_EDIT_START + 80)
+#define RID_SVXITEMS_CHARROTATE_OFF (RID_EDIT_START + 81)
+#define RID_SVXITEMS_CHARROTATE (RID_EDIT_START + 82)
+#define RID_SVXITEMS_CHARROTATE_FITLINE (RID_EDIT_START + 83)
+
+#define RID_SVXITEMS_RELIEF_BEGIN (RID_EDIT_START + 85)
+#define RID_SVXITEMS_RELIEF_NONE (RID_EDIT_START + 85)
+#define RID_SVXITEMS_RELIEF_EMBOSSED (RID_EDIT_START + 86)
+#define RID_SVXITEMS_RELIEF_ENGRAVED (RID_EDIT_START + 87)
+// RID_SVXITEMS_RELIEF_END (RID_EDIT_START + 88)
+
+// HM_ERR
+#define RID_SVXSTR_HMERR_THESAURUS (RID_EDIT_START + 89)
+
+// enum FontEmphasisMark ---------------------------------------------------
+#define RID_SVXITEMS_EMPHASIS_BEGIN_STYLE (RID_EDIT_START + 90)
+#define RID_SVXITEMS_EMPHASIS_NONE_STYLE (RID_EDIT_START + 90)
+#define RID_SVXITEMS_EMPHASIS_DOT_STYLE (RID_EDIT_START + 91)
+#define RID_SVXITEMS_EMPHASIS_CIRCLE_STYLE (RID_EDIT_START + 92)
+#define RID_SVXITEMS_EMPHASIS_DISC_STYLE (RID_EDIT_START + 93)
+#define RID_SVXITEMS_EMPHASIS_ACCENT_STYLE (RID_EDIT_START + 94)
+
+#define RID_SVXITEMS_EMPHASIS_ABOVE_POS (RID_EDIT_START + 95)
+#define RID_SVXITEMS_EMPHASIS_BELOW_POS (RID_EDIT_START + 96)
+
+// enum ESCAPEMENT -------------------------------------------------------
+#define RID_SVXITEMS_ESCAPEMENT_BEGIN (RID_EDIT_START + 97)
+#define RID_SVXITEMS_ESCAPEMENT_OFF (RID_EDIT_START + 97)
+#define RID_SVXITEMS_ESCAPEMENT_SUPER (RID_EDIT_START + 98)
+#define RID_SVXITEMS_ESCAPEMENT_SUB (RID_EDIT_START + 99)
+#define RID_SVXITEMS_ESCAPEMENT_AUTO (RID_EDIT_START + 100)
+
+// enum CASEMAP ----------------------------------------------------------
+#define RID_SVXITEMS_CASEMAP_BEGIN (RID_EDIT_START + 101)
+#define RID_SVXITEMS_CASEMAP_NONE (RID_EDIT_START + 101)
+#define RID_SVXITEMS_CASEMAP_VERSALIEN (RID_EDIT_START + 102)
+#define RID_SVXITEMS_CASEMAP_GEMEINE (RID_EDIT_START + 103)
+#define RID_SVXITEMS_CASEMAP_TITEL (RID_EDIT_START + 104)
+#define RID_SVXITEMS_CASEMAP_KAPITAELCHEN (RID_EDIT_START + 105)
+
+#define RID_SVXITEMS_KERNING_COMPLETE (RID_EDIT_START + 106)
+#define RID_SVXITEMS_KERNING_EXPANDED (RID_EDIT_START + 107)
+#define RID_SVXITEMS_KERNING_CONDENSED (RID_EDIT_START + 108)
+
+#define RID_SVXITEMS_BLINK_TRUE (RID_EDIT_START + 109)
+#define RID_SVXITEMS_BLINK_FALSE (RID_EDIT_START + 110)
+
+#define RID_SVXITEMS_TWOLINES_OFF (RID_EDIT_START + 111)
+#define RID_SVXITEMS_TWOLINES (RID_EDIT_START + 112)
+
+// enum FontStrikeout ----------------------------------------------------
+#define RID_SVXITEMS_STRIKEOUT_BEGIN (RID_EDIT_START + 113)
+#define RID_SVXITEMS_STRIKEOUT_NONE (RID_EDIT_START + 113)
+#define RID_SVXITEMS_STRIKEOUT_SINGLE (RID_EDIT_START + 114)
+#define RID_SVXITEMS_STRIKEOUT_DOUBLE (RID_EDIT_START + 115)
+#define RID_SVXITEMS_STRIKEOUT_BOLD (RID_EDIT_START + 117)
+#define RID_SVXITEMS_STRIKEOUT_SLASH (RID_EDIT_START + 118)
+#define RID_SVXITEMS_STRIKEOUT_X (RID_EDIT_START + 119)
+
+// enum FontUnderline - used for overline --------------------------------
+#define RID_SVXITEMS_OL_BEGIN (RID_EDIT_START + 120)
+#define RID_SVXITEMS_OL_NONE (RID_EDIT_START + 120)
+#define RID_SVXITEMS_OL_SINGLE (RID_EDIT_START + 121)
+#define RID_SVXITEMS_OL_DOUBLE (RID_EDIT_START + 122)
+#define RID_SVXITEMS_OL_DOTTED (RID_EDIT_START + 123)
+#define RID_SVXITEMS_OL_DONTKNOW (RID_EDIT_START + 124)
+#define RID_SVXITEMS_OL_DASH (RID_EDIT_START + 125)
+#define RID_SVXITEMS_OL_LONGDASH (RID_EDIT_START + 126)
+#define RID_SVXITEMS_OL_DASHDOT (RID_EDIT_START + 127)
+#define RID_SVXITEMS_OL_DASHDOTDOT (RID_EDIT_START + 128)
+#define RID_SVXITEMS_OL_SMALLWAVE (RID_EDIT_START + 129)
+#define RID_SVXITEMS_OL_WAVE (RID_EDIT_START + 130)
+#define RID_SVXITEMS_OL_DOUBLEWAVE (RID_EDIT_START + 131)
+#define RID_SVXITEMS_OL_BOLD (RID_EDIT_START + 132)
+#define RID_SVXITEMS_OL_BOLDDOTTED (RID_EDIT_START + 133)
+#define RID_SVXITEMS_OL_BOLDDASH (RID_EDIT_START + 134)
+#define RID_SVXITEMS_OL_BOLDLONGDASH (RID_EDIT_START + 135)
+#define RID_SVXITEMS_OL_BOLDDASHDOT (RID_EDIT_START + 136)
+#define RID_SVXITEMS_OL_BOLDDASHDOTDOT (RID_EDIT_START + 137)
+#define RID_SVXITEMS_OL_BOLDWAVE (RID_EDIT_START + 138)
+
+// enum FontUnderline - used for underline -------------------------------
+#define RID_SVXITEMS_UL_BEGIN (RID_EDIT_START + 139)
+#define RID_SVXITEMS_UL_NONE (RID_EDIT_START + 139)
+#define RID_SVXITEMS_UL_SINGLE (RID_EDIT_START + 140)
+#define RID_SVXITEMS_UL_DOUBLE (RID_EDIT_START + 141)
+#define RID_SVXITEMS_UL_DOTTED (RID_EDIT_START + 142)
+#define RID_SVXITEMS_UL_DONTKNOW (RID_EDIT_START + 143)
+#define RID_SVXITEMS_UL_DASH (RID_EDIT_START + 144)
+#define RID_SVXITEMS_UL_LONGDASH (RID_EDIT_START + 145)
+#define RID_SVXITEMS_UL_DASHDOT (RID_EDIT_START + 146)
+#define RID_SVXITEMS_UL_DASHDOTDOT (RID_EDIT_START + 147)
+#define RID_SVXITEMS_UL_SMALLWAVE (RID_EDIT_START + 148)
+#define RID_SVXITEMS_UL_WAVE (RID_EDIT_START + 149)
+#define RID_SVXITEMS_UL_DOUBLEWAVE (RID_EDIT_START + 150)
+#define RID_SVXITEMS_UL_BOLD (RID_EDIT_START + 151)
+#define RID_SVXITEMS_UL_BOLDDOTTED (RID_EDIT_START + 152)
+#define RID_SVXITEMS_UL_BOLDDASH (RID_EDIT_START + 153)
+#define RID_SVXITEMS_UL_BOLDLONGDASH (RID_EDIT_START + 154)
+#define RID_SVXITEMS_UL_BOLDDASHDOT (RID_EDIT_START + 155)
+#define RID_SVXITEMS_UL_BOLDDASHDOTDOT (RID_EDIT_START + 156)
+#define RID_SVXITEMS_UL_BOLDWAVE (RID_EDIT_START + 157)
+
+// enum FontWeight -------------------------------------------------------
+#define RID_SVXITEMS_WEIGHT_BEGIN (RID_EDIT_START + 158)
+#define RID_SVXITEMS_WEIGHT_DONTKNOW (RID_EDIT_START + 158)
+#define RID_SVXITEMS_WEIGHT_THIN (RID_EDIT_START + 159)
+#define RID_SVXITEMS_WEIGHT_ULTRALIGHT (RID_EDIT_START + 160)
+#define RID_SVXITEMS_WEIGHT_LIGHT (RID_EDIT_START + 161)
+#define RID_SVXITEMS_WEIGHT_SEMILIGHT (RID_EDIT_START + 162)
+#define RID_SVXITEMS_WEIGHT_NORMAL (RID_EDIT_START + 163)
+#define RID_SVXITEMS_WEIGHT_MEDIUM (RID_EDIT_START + 164)
+#define RID_SVXITEMS_WEIGHT_SEMIBOLD (RID_EDIT_START + 165)
+#define RID_SVXITEMS_WEIGHT_BOLD (RID_EDIT_START + 166)
+#define RID_SVXITEMS_WEIGHT_ULTRABOLD (RID_EDIT_START + 167)
+#define RID_SVXITEMS_WEIGHT_BLACK (RID_EDIT_START + 168)
+
+// enum FontItalic -------------------------------------------------------
+#define RID_SVXITEMS_ITALIC_NONE (RID_EDIT_START + 206)
+#define RID_SVXITEMS_ITALIC_OBLIQUE (RID_EDIT_START + 207)
+#define RID_SVXITEMS_ITALIC_NORMAL (RID_EDIT_START + 208)
+
+// enum SvxAdjust -----------------------------------------------------------
+#define RID_SVXITEMS_ADJUST_BEGIN (RID_EDIT_START + 209)
+#define RID_SVXITEMS_ADJUST_LEFT (RID_EDIT_START + 209)
+#define RID_SVXITEMS_ADJUST_RIGHT (RID_EDIT_START + 210)
+#define RID_SVXITEMS_ADJUST_BLOCK (RID_EDIT_START + 211)
+#define RID_SVXITEMS_ADJUST_CENTER (RID_EDIT_START + 212)
+#define RID_SVXITEMS_ADJUST_BLOCKLINE (RID_EDIT_START + 213)
+
+#define RID_SVXITEMS_TAB_DECIMAL_CHAR (RID_EDIT_START + 214)
+#define RID_SVXITEMS_TAB_FILL_CHAR (RID_EDIT_START + 215)
+
+#define RID_SVXITEMS_TAB_ADJUST_BEGIN (RID_EDIT_START + 217)
+#define RID_SVXITEMS_TAB_ADJUST_LEFT (RID_EDIT_START + 217)
+#define RID_SVXITEMS_TAB_ADJUST_RIGHT (RID_EDIT_START + 218)
+#define RID_SVXITEMS_TAB_ADJUST_DECIMAL (RID_EDIT_START + 219)
+#define RID_SVXITEMS_TAB_ADJUST_CENTER (RID_EDIT_START + 220)
+#define RID_SVXITEMS_TAB_ADJUST_DEFAULT (RID_EDIT_START + 221)
+
+// enum SvxBreak ------------------------------------------------------------
+#define RID_SVXITEMS_BREAK_BEGIN (RID_EDIT_START + 222)
+#define RID_SVXITEMS_BREAK_NONE (RID_EDIT_START + 222)
+#define RID_SVXITEMS_BREAK_COLUMN_BEFORE (RID_EDIT_START + 223)
+#define RID_SVXITEMS_BREAK_COLUMN_AFTER (RID_EDIT_START + 224)
+#define RID_SVXITEMS_BREAK_COLUMN_BOTH (RID_EDIT_START + 225)
+#define RID_SVXITEMS_BREAK_PAGE_BEFORE (RID_EDIT_START + 226)
+#define RID_SVXITEMS_BREAK_PAGE_AFTER (RID_EDIT_START + 227)
+#define RID_SVXITEMS_BREAK_PAGE_BOTH (RID_EDIT_START + 228)
+
+// enum SvxShadowLocation ---------------------------------------------------
+#define RID_SVXITEMS_SHADOW_BEGIN (RID_EDIT_START + 229)
+#define RID_SVXITEMS_SHADOW_NONE (RID_EDIT_START + 229)
+#define RID_SVXITEMS_SHADOW_TOPLEFT (RID_EDIT_START + 230)
+#define RID_SVXITEMS_SHADOW_TOPRIGHT (RID_EDIT_START + 231)
+#define RID_SVXITEMS_SHADOW_BOTTOMLEFT (RID_EDIT_START + 232)
+#define RID_SVXITEMS_SHADOW_BOTTOMRIGHT (RID_EDIT_START + 233)
+
+// Border lines
+#define RID_SOLID (RID_EDIT_START + 234)
+#define RID_DOTTED (RID_EDIT_START + 235)
+#define RID_DASHED (RID_EDIT_START + 236)
+#define RID_DOUBLE (RID_EDIT_START + 237)
+#define RID_THINTHICK_SMALLGAP (RID_EDIT_START + 238)
+#define RID_THINTHICK_MEDIUMGAP (RID_EDIT_START + 239)
+#define RID_THINTHICK_LARGEGAP (RID_EDIT_START + 240)
+#define RID_THICKTHIN_SMALLGAP (RID_EDIT_START + 241)
+#define RID_THICKTHIN_MEDIUMGAP (RID_EDIT_START + 242)
+#define RID_THICKTHIN_LARGEGAP (RID_EDIT_START + 243)
+#define RID_EMBOSSED (RID_EDIT_START + 244)
+#define RID_ENGRAVED (RID_EDIT_START + 245)
+#define RID_OUTSET (RID_EDIT_START + 246)
+#define RID_INSET (RID_EDIT_START + 247)
+
+// Metric-Text
+#define RID_SVXITEMS_METRIC_MM (RID_EDIT_START + 250)
+#define RID_SVXITEMS_METRIC_CM (RID_EDIT_START + 251)
+#define RID_SVXITEMS_METRIC_INCH (RID_EDIT_START + 252)
+#define RID_SVXITEMS_METRIC_POINT (RID_EDIT_START + 253)
+#define RID_SVXITEMS_METRIC_TWIP (RID_EDIT_START + 254)
+#define RID_SVXITEMS_METRIC_PIXEL (RID_EDIT_START + 255)
+
+// enum ColorName -----------------------------------------------------------
+#define RID_SVXITEMS_COLOR_BEGIN (RID_EDIT_START + 256)
+#define RID_SVXITEMS_COLOR (RID_EDIT_START + 256)
+#define RID_SVXITEMS_COLOR_BLACK (RID_EDIT_START + 257)
+#define RID_SVXITEMS_COLOR_BLUE (RID_EDIT_START + 258)
+#define RID_SVXITEMS_COLOR_GREEN (RID_EDIT_START + 259)
+#define RID_SVXITEMS_COLOR_CYAN (RID_EDIT_START + 260)
+#define RID_SVXITEMS_COLOR_RED (RID_EDIT_START + 261)
+#define RID_SVXITEMS_COLOR_MAGENTA (RID_EDIT_START + 262)
+#define RID_SVXITEMS_COLOR_BROWN (RID_EDIT_START + 263)
+#define RID_SVXITEMS_COLOR_GRAY (RID_EDIT_START + 264)
+#define RID_SVXITEMS_COLOR_LIGHTGRAY (RID_EDIT_START + 265)
+#define RID_SVXITEMS_COLOR_LIGHTBLUE (RID_EDIT_START + 266)
+#define RID_SVXITEMS_COLOR_LIGHTGREEN (RID_EDIT_START + 267)
+#define RID_SVXITEMS_COLOR_LIGHTCYAN (RID_EDIT_START + 268)
+#define RID_SVXITEMS_COLOR_LIGHTRED (RID_EDIT_START + 269)
+#define RID_SVXITEMS_COLOR_LIGHTMAGENTA (RID_EDIT_START + 270)
+#define RID_SVXITEMS_COLOR_YELLOW (RID_EDIT_START + 271)
+#define RID_SVXITEMS_COLOR_WHITE (RID_EDIT_START + 272)
+#define RID_SVXITEMS_COLOR_MENUBAR (RID_EDIT_START + 273)
+#define RID_SVXITEMS_COLOR_MENUBARTEXT (RID_EDIT_START + 274)
+#define RID_SVXITEMS_COLOR_POPUPMENU (RID_EDIT_START + 275)
+#define RID_SVXITEMS_COLOR_POPUPMENUTEXT (RID_EDIT_START + 276)
+#define RID_SVXITEMS_COLOR_WINDOWTEXT (RID_EDIT_START + 277)
+#define RID_SVXITEMS_COLOR_WINDOWWORKSPACE (RID_EDIT_START + 278)
+#define RID_SVXITEMS_COLOR_HIGHLIGHT (RID_EDIT_START + 279)
+#define RID_SVXITEMS_COLOR_HIGHLIGHTTEXT (RID_EDIT_START + 280)
+#define RID_SVXITEMS_COLOR_3DTEXT (RID_EDIT_START + 281)
+#define RID_SVXITEMS_COLOR_3DFACE (RID_EDIT_START + 282)
+#define RID_SVXITEMS_COLOR_3DLIGHT (RID_EDIT_START + 283)
+#define RID_SVXITEMS_COLOR_3DSHADOW (RID_EDIT_START + 284)
+#define RID_SVXITEMS_COLOR_SCROLLBAR (RID_EDIT_START + 285)
+#define RID_SVXITEMS_COLOR_FIELD (RID_EDIT_START + 286)
+#define RID_SVXITEMS_COLOR_FIELDTEXT (RID_EDIT_START + 287)
+
+
+#define RID_SVXITEMS_PARASNAPTOGRID_ON (RID_EDIT_START + 288)
+#define RID_SVXITEMS_PARASNAPTOGRID_OFF (RID_EDIT_START + 289)
+
+#define RID_SVXITEMS_PARAVERTALIGN_AUTO (RID_EDIT_START + 290)
+#define RID_SVXITEMS_PARAVERTALIGN_BASELINE (RID_EDIT_START + 291)
+#define RID_SVXITEMS_PARAVERTALIGN_TOP (RID_EDIT_START + 292)
+#define RID_SVXITEMS_PARAVERTALIGN_CENTER (RID_EDIT_START + 293)
+#define RID_SVXITEMS_PARAVERTALIGN_BOTTOM (RID_EDIT_START + 294)
+
+#define RID_SVXITEMS_CHARHIDDEN_FALSE (RID_EDIT_START + 295)
+#define RID_SVXITEMS_CHARHIDDEN_TRUE (RID_EDIT_START + 296)
+
+// strings for error messsages in dictionary updates
+#define RID_SVXSTR_DIC_ERR_UNKNOWN (RID_EDIT_START + 297)
+#define RID_SVXSTR_DIC_ERR_FULL (RID_EDIT_START + 298)
+#define RID_SVXSTR_DIC_ERR_READONLY (RID_EDIT_START + 299)
+
+// ResIds fuer HM-QueryBoxen und Error-Strings
+#define RID_SVXQB_BW_CONTINUE (RID_EDIT_START + 300)
+#define RID_SVXQB_CONTINUE (RID_EDIT_START + 301)
+
+// EditEngine
+#define RID_EDITUNDO_DEL (RID_EDIT_START + 302)
+#define RID_EDITUNDO_MOVE (RID_EDIT_START + 303)
+#define RID_EDITUNDO_INSERT (RID_EDIT_START + 304)
+#define RID_EDITUNDO_REPLACE (RID_EDIT_START + 305)
+#define RID_EDITUNDO_SETATTRIBS (RID_EDIT_START + 306)
+#define RID_EDITUNDO_SETSTYLE (RID_EDIT_START + 307)
+#define RID_EDITUNDO_RESETATTRIBS (RID_EDIT_START + 308)
+#define RID_EDITUNDO_INDENT (RID_EDIT_START + 309)
+#define RID_EDITUNDO_TRANSLITERATE (RID_EDIT_START + 310)
+#define RID_MENU_SPELL (RID_EDIT_START + 311)
+#define RID_STR_PARAGRAPH (RID_EDIT_START + 312)
+#define RID_STR_WORD (RID_EDIT_START + 313)
+#define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION (RID_EDIT_START + 314)
+#define RID_SVXSTR_A11Y_IMAGEBULLET_NAME (RID_EDIT_START + 315)
+
+// enum SvxCellHorJustify
+#define RID_SVXITEMS_HORJUST_STANDARD (RID_EDIT_START + 316)
+#define RID_SVXITEMS_HORJUST_LEFT (RID_EDIT_START + 317)
+#define RID_SVXITEMS_HORJUST_CENTER (RID_EDIT_START + 318)
+#define RID_SVXITEMS_HORJUST_RIGHT (RID_EDIT_START + 319)
+#define RID_SVXITEMS_HORJUST_BLOCK (RID_EDIT_START + 320)
+#define RID_SVXITEMS_HORJUST_REPEAT (RID_EDIT_START + 321)
+
+// enum SvxCellVerJustify
+#define RID_SVXITEMS_VERJUST_STANDARD (RID_EDIT_START + 322)
+#define RID_SVXITEMS_VERJUST_TOP (RID_EDIT_START + 323)
+#define RID_SVXITEMS_VERJUST_CENTER (RID_EDIT_START + 324)
+#define RID_SVXITEMS_VERJUST_BOTTOM (RID_EDIT_START + 325)
+
+// enum SvxCellJustifyMethod
+#define RID_SVXITEMS_JUSTMETHOD_AUTO (RID_EDIT_START + 326)
+#define RID_SVXITEMS_JUSTMETHOD_DISTRIBUTE (RID_EDIT_START + 327)
+
+#if 327 > (RID_EDIT_END-RID_EDIT_START)
+#error Resource-Ueberlauf in #line, #file
+#endif
+
+
+
+#endif
+
+// ******************************************************************* EOF
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editstat.hxx b/include/editeng/editstat.hxx
new file mode 100644
index 000000000000..175267938c91
--- /dev/null
+++ b/include/editeng/editstat.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITSTAT_HXX
+#define _EDITSTAT_HXX
+
+#include <tools/string.hxx>
+#include <i18nlangtag/lang.h>
+
+#define EE_CNTRL_USECHARATTRIBS 0x00000001 // Use of hard character attributes
+#define EE_CNTRL_USEPARAATTRIBS 0x00000002 // Using paragraph attributes.
+#define EE_CNTRL_CRSRLEFTPARA 0x00000004 // Cursor is moved to another paragraph
+#define EE_CNTRL_DOIDLEFORMAT 0x00000008 // Formatting idle
+#define EE_CNTRL_PASTESPECIAL 0x00000010 // Allow PasteSpecial
+#define EE_CNTRL_AUTOINDENTING 0x00000020 // Automatic indenting
+#define EE_CNTRL_UNDOATTRIBS 0x00000040 // Undo for Attributes....
+#define EE_CNTRL_ONECHARPERLINE 0x00000080 // One character per line
+#define EE_CNTRL_NOCOLORS 0x00000100 // Engine: No Color
+#define EE_CNTRL_OUTLINER 0x00000200 // Special treatment Outliner/Outline mode
+#define EE_CNTRL_OUTLINER2 0x00000400 // Special treatment Outliner/Page
+#define EE_CNTRL_ALLOWBIGOBJS 0x00000800 // Portion info in text object
+#define EE_CNTRL_ONLINESPELLING 0x00001000 // During the edit Spelling
+#define EE_CNTRL_STRETCHING 0x00002000 // Stretch mode
+#define EE_CNTRL_MARKFIELDS 0x00004000 // Mark Fields with color
+#define EE_CNTRL_URLSFXEXECUTE 0x00008000 // !!!OLD!!!: SFX-URL-Execute.
+#define EE_CNTRL_RESTOREFONT 0x00010000 // Restore Font in OutDev
+#define EE_CNTRL_RTFSTYLESHEETS 0x00020000 // Use Stylesheets when imported
+//#define EE_CNTRL_NOREDLINES 0x00040000 // No RedLines when OnlineSpellError /* removed #i91949 */
+#define EE_CNTRL_AUTOCORRECT 0x00080000 // AutoCorrect
+#define EE_CNTRL_AUTOCOMPLETE 0x00100000 // AutoComplete
+#define EE_CNTRL_AUTOPAGESIZEX 0x00200000 // Adjust paper width to Text
+#define EE_CNTRL_AUTOPAGESIZEY 0x00400000 // Adjust paper height to Text
+#define EE_CNTRL_AUTOPAGESIZE (EE_CNTRL_AUTOPAGESIZEX|EE_CNTRL_AUTOPAGESIZEY)
+#define EE_CNTRL_TABINDENTING 0x00800000 // Indent with tab
+#define EE_CNTRL_FORMAT100 0x01000000 // Always format to 100%
+#define EE_CNTRL_ULSPACESUMMATION 0x02000000 // MS Compat: sum SA and SB, not maximum value
+#define EE_CNTRL_ULSPACEFIRSTPARA 0x04000000 // MS Compat: evaluate also at the first paragraph
+
+#define EV_CNTRL_AUTOSCROLL 0x00000001 // Auto scrolling horizontally
+#define EV_CNTRL_BIGSCROLL 0x00000002 // Scroll further to the cursor
+#define EV_CNTRL_ENABLEPASTE 0x00000004 // Enable Paste
+#define EV_CNTRL_SINGLELINEPASTE 0x00000008 // View: Paste in input line ...
+#define EV_CNTRL_OVERWRITE 0x00000010 // Overwrite mode
+#define EV_CNTRL_INVONEMORE 0x00000020 // Invalidate one pixel more
+#define EV_CNTRL_AUTOSIZEX 0x00000040 // Automatically adapt to text width
+#define EV_CNTRL_AUTOSIZEY 0x00000080 // Automatically adapt to Text width
+#define EV_CNTRL_AUTOSIZE (EV_CNTRL_AUTOSIZEX|EV_CNTRL_AUTOSIZEY)
+
+#define EE_STAT_HSCROLL 0x00000001
+#define EE_STAT_VSCROLL 0x00000002
+#define EE_STAT_CURSOROUT 0x00000004
+#define EE_STAT_CRSRMOVEFAIL 0x00000008
+#define EE_STAT_CRSRLEFTPARA 0x00000010
+#define EE_STAT_TEXTWIDTHCHANGED 0x00000020
+#define EE_STAT_TEXTHEIGHTCHANGED 0x00000040
+#define EE_STAT_WRONGWORDCHANGED 0x00000080
+// #define EE_STAT_MODIFIED 0x00000100
+
+/*
+ EE_STAT_CRSRLEFTPARA at the time cursor movement and the enter.
+*/
+
+inline void SetFlags( sal_uLong& rBits, const sal_uInt32 nMask, bool bOn )
+{
+ if ( bOn )
+ rBits |= nMask;
+ else
+ rBits &= ~nMask;
+}
+
+class EditStatus
+{
+protected:
+ sal_uLong nStatusBits;
+ sal_uLong nControlBits;
+ sal_uInt16 nPrevPara; // for EE_STAT_CRSRLEFTPARA
+
+public:
+ EditStatus() { nStatusBits = 0; nControlBits = 0; nPrevPara = 0xFFFF; }
+
+ void Clear() { nStatusBits = 0; }
+ void SetControlBits( sal_uLong nMask, bool bOn )
+ { SetFlags( nControlBits, nMask, bOn ); }
+
+ sal_uLong GetStatusWord() const { return nStatusBits; }
+ sal_uLong& GetStatusWord() { return nStatusBits; }
+
+ sal_uLong GetControlWord() const { return nControlBits; }
+ sal_uLong& GetControlWord() { return nControlBits; }
+
+ sal_uInt16 GetPrevParagraph() const { return nPrevPara; }
+ sal_uInt16& GetPrevParagraph() { return nPrevPara; }
+};
+
+#define SPELLCMD_IGNOREWORD 0x0001
+#define SPELLCMD_STARTSPELLDLG 0x0002
+#define SPELLCMD_ADDTODICTIONARY 0x0003
+#define SPELLCMD_WORDLANGUAGE 0x0004
+#define SPELLCMD_PARALANGUAGE 0x0005
+
+struct SpellCallbackInfo
+{
+ sal_uInt16 nCommand;
+ String aWord;
+ LanguageType eLanguage;
+
+ SpellCallbackInfo( sal_uInt16 nCMD, const String& rWord )
+ : aWord( rWord )
+ {
+ nCommand = nCMD;
+ eLanguage = LANGUAGE_DONTKNOW;
+ }
+
+ SpellCallbackInfo( sal_uInt16 nCMD, LanguageType eLang )
+ {
+ nCommand = nCMD;
+ eLanguage = eLang;
+ }
+};
+
+#endif // _EDITSTAT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editund2.hxx b/include/editeng/editund2.hxx
new file mode 100644
index 000000000000..2312aee93c79
--- /dev/null
+++ b/include/editeng/editund2.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDITUND2_HXX
+#define _EDITUND2_HXX
+
+#include "editeng/editengdllapi.h"
+#include <svl/undo.hxx>
+
+class EditEngine;
+
+class EDITENG_DLLPRIVATE EditUndoManager : public SfxUndoManager
+{
+ using SfxUndoManager::Undo;
+ using SfxUndoManager::Redo;
+
+ EditEngine* mpEditEngine;
+public:
+ EditUndoManager(EditEngine* pEE);
+
+ virtual sal_Bool Undo();
+ virtual sal_Bool Redo();
+};
+
+// -----------------------------------------------------------------------
+// EditUndo
+// ------------------------------------------------------------------------
+class EDITENG_DLLPUBLIC EditUndo : public SfxUndoAction
+{
+private:
+ sal_uInt16 nId;
+ EditEngine* mpEditEngine;
+
+public:
+ EditUndo(sal_uInt16 nI, EditEngine* pEE);
+ virtual ~EditUndo();
+
+ EditEngine* GetEditEngine();
+
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+
+ virtual sal_Bool CanRepeat(SfxRepeatTarget&) const;
+ virtual OUString GetComment() const;
+ virtual sal_uInt16 GetId() const;
+};
+
+#endif // _EDITUND2_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
new file mode 100644
index 000000000000..a2f5ce8a3d65
--- /dev/null
+++ b/include/editeng/editview.hxx
@@ -0,0 +1,247 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+// MyEDITVIEW, due to exported EditView
+#ifndef _MyEDITVIEW_HXX
+#define _MyEDITVIEW_HXX
+
+#include <com/sun/star/i18n/WordType.hpp>
+
+#include <rsc/rscsfx.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+
+class EditEngine;
+class ImpEditEngine;
+class ImpEditView;
+class SvxSearchItem;
+class SvxFieldItem;
+class Window;
+class Pointer;
+class Cursor;
+class KeyEvent;
+class MouseEvent;
+class DropEvent;
+class CommandEvent;
+class Rectangle;
+class Link;
+class Pair;
+class Point;
+class Range;
+class SvStream;
+class SvKeyValueIterator;
+class SfxStyleSheet;
+class Font;
+class FontList;
+class OutputDevice;
+
+#include <editeng/editdata.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include "editeng/editengdllapi.h"
+
+namespace com {
+namespace sun {
+namespace star {
+namespace datatransfer {
+ class XTransferable;
+}
+namespace linguistic2 {
+ class XSpellChecker1;
+ class XLanguageGuessing;
+}
+}}}
+
+class EDITENG_DLLPUBLIC EditView
+{
+ friend class EditEngine;
+ friend class ImpEditEngine;
+ friend class EditSelFunctionSet;
+
+public: // Needed for Undo
+ ImpEditView* GetImpEditView() const { return pImpEditView; }
+ ImpEditEngine* GetImpEditEngine() const;
+
+private:
+ ImpEditView* pImpEditView;
+ String aDicNameSingle;
+
+ EDITENG_DLLPRIVATE EditView( const EditView& );
+ EDITENG_DLLPRIVATE EditView& operator=( const EditView& );
+
+public:
+ EditView( EditEngine* pEng, Window* pWindow );
+ virtual ~EditView();
+
+ void SetEditEngine( EditEngine* pEditEngine );
+ EditEngine* GetEditEngine() const;
+
+ void SetWindow( Window* pWin );
+ Window* GetWindow() const;
+
+ void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
+ void Invalidate();
+ Pair Scroll( long nHorzScroll, long nVertScroll, sal_uInt8 nRangeCheck = RGCHK_NEG );
+
+ void ShowCursor( sal_Bool bGotoCursor = sal_True, sal_Bool bForceVisCursor = sal_True );
+ void HideCursor();
+
+ void SetSelectionMode( EESelectionMode eMode );
+
+ void SetReadOnly( sal_Bool bReadOnly );
+ sal_Bool IsReadOnly() const;
+
+ sal_Bool HasSelection() const;
+ ESelection GetSelection() const;
+ void SetSelection( const ESelection& rNewSel );
+ sal_Bool SelectCurrentWord( sal_Int16 nWordType = ::com::sun::star::i18n::WordType::ANYWORD_IGNOREWHITESPACES );
+
+ sal_Bool IsInsertMode() const;
+ void SetInsertMode( sal_Bool bInsert );
+
+ void ReplaceSelected( const String& rStr );
+ String GetSelected();
+ void DeleteSelected();
+
+ sal_uInt16 GetSelectedScriptType() const;
+
+ // VisArea position of the Output window.
+ // A size change also affects the VisArea
+ void SetOutputArea( const Rectangle& rRect );
+ const Rectangle& GetOutputArea() const;
+
+ // Document position.
+ // A size change also affects the VisArea
+ void SetVisArea( const Rectangle& rRect );
+ const Rectangle& GetVisArea() const;
+
+ const Pointer& GetPointer() const;
+
+ Cursor* GetCursor() const;
+
+ void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
+
+ sal_Bool PostKeyEvent( const KeyEvent& rKeyEvent, Window* pFrameWin = NULL );
+
+ sal_Bool MouseButtonUp( const MouseEvent& rMouseEvent );
+ sal_Bool MouseButtonDown( const MouseEvent& rMouseEvent );
+ sal_Bool MouseMove( const MouseEvent& rMouseEvent );
+ void Command( const CommandEvent& rCEvt );
+
+ void Cut();
+ void Copy();
+ void Paste();
+ void PasteSpecial();
+
+ void Undo();
+ void Redo();
+
+ // especially for Oliver Specht
+ Point GetWindowPosTopLeft( sal_uInt16 nParagraph );
+ void MoveParagraphs( Range aParagraphs, sal_uInt16 nNewPos );
+ void MoveParagraphs( long nDiff );
+
+ const SfxItemSet& GetEmptyItemSet();
+ SfxItemSet GetAttribs();
+ void SetAttribs( const SfxItemSet& rSet );
+ void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0 );
+ void RemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
+ void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs = sal_False );
+
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor() const;
+
+ void SetControlWord( sal_uInt32 nWord );
+ sal_uInt32 GetControlWord() const;
+
+ EditTextObject* CreateTextObject();
+ void InsertText( const EditTextObject& rTextObject );
+ void InsertText( ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > xDataObj, const String& rBaseURL, sal_Bool bUseSpecial );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > GetTransferable();
+
+ // An EditView, so that when TRUE the update will be free from flickering:
+ void SetEditEngineUpdateMode( sal_Bool bUpdate );
+ void ForceUpdate();
+
+ const SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheet* GetStyleSheet();
+
+ void SetAnchorMode( EVAnchorMode eMode );
+ EVAnchorMode GetAnchorMode() const;
+
+ void CompleteAutoCorrect( Window* pFrameWin = NULL );
+
+ EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
+ EESpellState StartThesaurus();
+ sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
+
+ // for text conversion
+ void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
+ sal_Bool HasConvertibleTextPortion( LanguageType nLang );
+
+ void TransliterateText( sal_Int32 nTransliterationMode );
+
+ sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
+ sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
+ void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
+
+ void InsertField( const SvxFieldItem& rFld );
+ const SvxFieldItem* GetFieldUnderMousePointer() const;
+ const SvxFieldItem* GetFieldUnderMousePointer( sal_uInt16& nPara, xub_StrLen& nPos ) const;
+ const SvxFieldItem* GetField( const Point& rPos, sal_uInt16* pnPara = NULL, xub_StrLen* pnPos = NULL ) const;
+
+ const SvxFieldItem* GetFieldAtSelection() const;
+
+ void SetInvalidateMore( sal_uInt16 nPixel );
+ sal_uInt16 GetInvalidateMore() const;
+
+ // grows or shrinks the font height for the current selection
+ void ChangeFontSize( bool bGrow, const FontList* pList );
+
+ static bool ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFontList );
+
+ String GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+
+ /** Tries to determine the language of 'rText', returning a matching known
+ locale if possible, or a fallback, or LANGUAGE_NONE if nothing found or
+ matched.
+
+ @param bIsParaText
+ If TRUE, rText is a paragraph and the language is obtained by
+ passing the text to xLangGuess.
+ IF FALSE, a language match is tried for, in order,
+ 1. the default document language (non-CTL, non-CJK, aka LATIN)
+ 2. the UI language (Tools->Options->LanguageSettings->Languages User Interface)
+ 3. the locale (Tools->Options->LanguageSettings->Languages Locale)
+ 4. en-US
+ If nothing matched, LANGUAGE_NONE is returned.
+ */
+ static LanguageType CheckLanguage(
+ const OUString &rText,
+ com::sun::star::uno::Reference< com::sun::star::linguistic2::XSpellChecker1 > xSpell,
+ com::sun::star::uno::Reference< com::sun::star::linguistic2::XLanguageGuessing > xLangGuess,
+ bool bIsParaText );
+};
+
+#endif // _MyEDITVIEW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/edtdlg.hxx b/include/editeng/edtdlg.hxx
new file mode 100644
index 000000000000..7c998dfa637b
--- /dev/null
+++ b/include/editeng/edtdlg.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDT_ABSTDLG_HXX
+#define _EDT_ABSTDLG_HXX
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <editeng/editengdllapi.h>
+#include <i18nlangtag/lang.h>
+#include <com/sun/star/uno/Reference.hxx>
+#include <vcl/abstdlg.hxx>
+#include <editeng/hangulhanja.hxx>
+
+namespace com { namespace sun { namespace star { namespace linguistic2
+{
+ class XThesaurus;
+ class XHyphenator;
+} } } }
+
+class Window;
+class ResId;
+class Link;
+class SvxSpellWrapper;
+
+class AbstractThesaurusDialog : public VclAbstractDialog
+{
+public:
+ virtual String GetWord() = 0;
+ virtual sal_uInt16 GetLanguage() const = 0;
+ virtual Window* GetWindow() = 0;
+};
+
+class AbstractHyphenWordDialog : public VclAbstractDialog
+{
+public:
+ virtual void SelLeft() = 0;
+ virtual void SelRight() = 0;
+ virtual Window* GetWindow() = 0;
+};
+
+class AbstractHangulHanjaConversionDialog : public VclAbstractTerminatedDialog
+{
+ public:
+ virtual void EnableRubySupport( bool _bVal ) = 0;
+ virtual void SetByCharacter( bool _bByCharacter ) = 0;
+ virtual void SetConversionDirectionState( bool _bTryBothDirections, editeng::HangulHanjaConversion::ConversionDirection _ePrimaryConversionDirection ) = 0;
+ virtual void SetConversionFormat( editeng::HangulHanjaConversion::ConversionFormat _eType ) = 0;
+ virtual void SetOptionsChangedHdl( const Link& _rHdl ) = 0;
+ virtual void SetIgnoreHdl( const Link& _rHdl ) = 0;
+ virtual void SetIgnoreAllHdl( const Link& _rHdl ) = 0;
+ virtual void SetChangeHdl( const Link& _rHdl ) = 0;
+ virtual void SetChangeAllHdl( const Link& _rHdl ) = 0;
+ virtual void SetClickByCharacterHdl( const Link& _rHdl ) = 0;
+ virtual void SetConversionFormatChangedHdl( const Link& _rHdl ) = 0;
+ virtual void SetFindHdl( const Link& _rHdl ) = 0;
+ virtual bool GetUseBothDirections() const= 0;
+ virtual editeng::HangulHanjaConversion::ConversionDirection GetDirection( editeng::HangulHanjaConversion::ConversionDirection _eDefaultDirection ) const = 0;
+ virtual void SetCurrentString(
+ const String& _rNewString,
+ const ::com::sun::star::uno::Sequence< OUString >& _rSuggestions,
+ bool _bOriginatesFromDocument = true )=0;
+ virtual String GetCurrentString( ) const =0;
+ virtual editeng::HangulHanjaConversion::ConversionFormat GetConversionFormat( ) const =0;
+ virtual void FocusSuggestion( )= 0;
+ virtual String GetCurrentSuggestion( ) const =0;
+};
+
+class EDITENG_DLLPUBLIC EditAbstractDialogFactory : virtual public VclAbstractDialogFactory
+{
+public:
+ virtual ~EditAbstractDialogFactory(); // needed for export of vtable
+ static EditAbstractDialogFactory* Create();
+ virtual AbstractThesaurusDialog* CreateThesaurusDialog( Window*, ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XThesaurus > xThesaurus,
+ const String &rWord, sal_Int16 nLanguage ) = 0;
+
+ virtual AbstractHyphenWordDialog* CreateHyphenWordDialog( Window*,
+ const String &rWord, LanguageType nLang,
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XHyphenator > &xHyphen,
+ SvxSpellWrapper* pWrapper ) = 0;
+ virtual AbstractHangulHanjaConversionDialog * CreateHangulHanjaConversionDialog( Window* _pParent,
+ editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ) = 0;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eedata.hxx b/include/editeng/eedata.hxx
new file mode 100644
index 000000000000..1332c56f4a54
--- /dev/null
+++ b/include/editeng/eedata.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EEDATA_HXX
+#define _EEDATA_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+// extended data definitions for EditEngine portion stripping (StripPortions()
+// support). These may be mapped to some primitive definitions from Drawinglayer
+// later.
+#include <vector>
+
+namespace EEngineData
+{
+ // spell checking wrong vector containing the redlining data
+ class WrongSpellClass
+ {
+ public:
+ sal_uInt32 nStart;
+ sal_uInt32 nEnd;
+
+ WrongSpellClass(sal_uInt32 nS, sal_uInt32 nE) : nStart(nS), nEnd(nE) {}
+ };
+
+ typedef std::vector< WrongSpellClass > WrongSpellVector;
+
+ // text marking vector containing the EOC, EOW and EOS TEXT definitions
+ enum TextMarkingType
+ {
+ EndOfCaracter = 0,
+ EndOfWord = 1,
+ EndOfSentence = 2
+ };
+
+ class TextMarkingClass
+ {
+ public:
+ TextMarkingType eType;
+ sal_uInt32 nIndex;
+
+ TextMarkingClass(TextMarkingType eT, sal_uInt32 nI) : eType(eT), nIndex(nI) {}
+ };
+
+ typedef std::vector< TextMarkingClass > TextMarkingVector;
+
+} // end of namespace EditEngine
+
+#endif // _EEDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx
new file mode 100644
index 000000000000..04ce68ce1ef5
--- /dev/null
+++ b/include/editeng/eeitem.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef EEITEM_HXX
+#define EEITEM_HXX
+
+#include <svl/solar.hrc>
+
+#define EE_ITEMS_START (OWN_ATTR_VALUE_END+1)
+
+// Paragraph attributes:
+#define EE_PARA_START (EE_ITEMS_START+0)
+#define EE_PARA_WRITINGDIR (EE_ITEMS_START+0)
+#define EE_PARA_XMLATTRIBS (EE_ITEMS_START+1)
+#define EE_PARA_HANGINGPUNCTUATION (EE_ITEMS_START+2)
+#define EE_PARA_FORBIDDENRULES (EE_ITEMS_START+3)
+#define EE_PARA_ASIANCJKSPACING (EE_ITEMS_START+4)
+#define EE_PARA_NUMBULLET (EE_ITEMS_START+5)
+#define EE_PARA_HYPHENATE (EE_ITEMS_START+6)
+#define EE_PARA_BULLETSTATE (EE_ITEMS_START+7)
+#define EE_PARA_OUTLLRSPACE (EE_ITEMS_START+8)
+#define EE_PARA_OUTLLEVEL (EE_ITEMS_START+9)
+#define EE_PARA_BULLET (EE_ITEMS_START+10)
+#define EE_PARA_LRSPACE (EE_ITEMS_START+11)
+#define EE_PARA_ULSPACE (EE_ITEMS_START+12)
+#define EE_PARA_SBL (EE_ITEMS_START+13)
+#define EE_PARA_JUST (EE_ITEMS_START+14)
+#define EE_PARA_TABS (EE_ITEMS_START+15)
+#define EE_PARA_JUST_METHOD (EE_ITEMS_START+16)
+#define EE_PARA_VER_JUST (EE_ITEMS_START+17)
+#define EE_PARA_END (EE_ITEMS_START+17)
+
+// Character attributes:
+#define EE_CHAR_START (EE_ITEMS_START+18)
+#define EE_CHAR_COLOR (EE_ITEMS_START+18)
+#define EE_CHAR_FONTINFO (EE_ITEMS_START+19)
+#define EE_CHAR_FONTHEIGHT (EE_ITEMS_START+20)
+#define EE_CHAR_FONTWIDTH (EE_ITEMS_START+21)
+#define EE_CHAR_WEIGHT (EE_ITEMS_START+22)
+#define EE_CHAR_UNDERLINE (EE_ITEMS_START+23)
+#define EE_CHAR_STRIKEOUT (EE_ITEMS_START+24)
+#define EE_CHAR_ITALIC (EE_ITEMS_START+25)
+#define EE_CHAR_OUTLINE (EE_ITEMS_START+26)
+#define EE_CHAR_SHADOW (EE_ITEMS_START+27)
+#define EE_CHAR_ESCAPEMENT (EE_ITEMS_START+28)
+#define EE_CHAR_PAIRKERNING (EE_ITEMS_START+29)
+#define EE_CHAR_KERNING (EE_ITEMS_START+30)
+#define EE_CHAR_WLM (EE_ITEMS_START+31)
+#define EE_CHAR_LANGUAGE (EE_ITEMS_START+32)
+#define EE_CHAR_LANGUAGE_CJK (EE_ITEMS_START+33)
+#define EE_CHAR_LANGUAGE_CTL (EE_ITEMS_START+34)
+#define EE_CHAR_FONTINFO_CJK (EE_ITEMS_START+35)
+#define EE_CHAR_FONTINFO_CTL (EE_ITEMS_START+36)
+#define EE_CHAR_FONTHEIGHT_CJK (EE_ITEMS_START+37)
+#define EE_CHAR_FONTHEIGHT_CTL (EE_ITEMS_START+38)
+#define EE_CHAR_WEIGHT_CJK (EE_ITEMS_START+39)
+#define EE_CHAR_WEIGHT_CTL (EE_ITEMS_START+40)
+#define EE_CHAR_ITALIC_CJK (EE_ITEMS_START+41)
+#define EE_CHAR_ITALIC_CTL (EE_ITEMS_START+42)
+#define EE_CHAR_EMPHASISMARK (EE_ITEMS_START+43)
+#define EE_CHAR_RELIEF (EE_ITEMS_START+44)
+#define EE_CHAR_RUBI_DUMMY (EE_ITEMS_START+45)
+#define EE_CHAR_XMLATTRIBS (EE_ITEMS_START+46)
+#define EE_CHAR_OVERLINE (EE_ITEMS_START+47)
+#define EE_CHAR_END (EE_ITEMS_START+47)
+
+
+#define EE_FEATURE_START (EE_ITEMS_START+48)
+#define EE_FEATURE_TAB (EE_ITEMS_START+48)
+#define EE_FEATURE_LINEBR (EE_ITEMS_START+49)
+#define EE_FEATURE_NOTCONV (EE_ITEMS_START+50)
+#define EE_FEATURE_FIELD (EE_ITEMS_START+51)
+#define EE_FEATURE_END (EE_ITEMS_START+51)
+
+#define EE_ITEMS_END (EE_ITEMS_START+51)
+
+#define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 )
+
+#endif // _EEITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eeitemid.hxx b/include/editeng/eeitemid.hxx
new file mode 100644
index 000000000000..8230387048ff
--- /dev/null
+++ b/include/editeng/eeitemid.hxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EEITEMID_HXX
+#define _EEITEMID_HXX
+
+#include <editeng/eeitem.hxx>
+
+#ifdef ITEMID_FONT
+#undef ITEMID_FONT
+#endif
+#ifdef ITEMID_FONTHEIGHT
+#undef ITEMID_FONTHEIGHT
+#endif
+#ifdef ITEMID_COLOR
+#undef ITEMID_COLOR
+#endif
+#ifdef ITEMID_WEIGHT
+#undef ITEMID_WEIGHT
+#endif
+#ifdef ITEMID_POSTURE
+#undef ITEMID_POSTURE
+#endif
+#ifdef ITEMID_SHADOWED
+#undef ITEMID_SHADOWED
+#endif
+#ifdef ITEMID_CONTOUR
+#undef ITEMID_CONTOUR
+#endif
+#ifdef ITEMID_CROSSEDOUT
+#undef ITEMID_CROSSEDOUT
+#endif
+#ifdef ITEMID_UNDERLINE
+#undef ITEMID_UNDERLINE
+#endif
+#ifdef ITEMID_OVERLINE
+#undef ITEMID_OVERLINE
+#endif
+#ifdef ITEMID_LANGUAGE
+#undef ITEMID_LANGUAGE
+#endif
+#ifdef ITEMID_ADJUST
+#undef ITEMID_ADJUST
+#endif
+#ifdef ITEMID_WORDLINEMODE
+#undef ITEMID_WORDLINEMODE
+#endif
+#ifdef ITEMID_CHARSETCOLOR
+#undef ITEMID_CHARSETCOLOR
+#endif
+#ifdef ITEMID_SEARCH
+#undef ITEMID_SEARCH
+#endif
+#ifdef ITEMID_BRUSH
+#undef ITEMID_BRUSH
+#endif
+
+// Character Attributes....
+#define ITEMID_FONT EE_CHAR_FONTINFO
+#define ITEMID_POSTURE EE_CHAR_ITALIC
+#define ITEMID_WEIGHT EE_CHAR_WEIGHT
+#define ITEMID_SHADOWED EE_CHAR_SHADOW
+#define ITEMID_CONTOUR EE_CHAR_OUTLINE
+#define ITEMID_CROSSEDOUT EE_CHAR_STRIKEOUT
+#define ITEMID_UNDERLINE EE_CHAR_UNDERLINE
+#define ITEMID_OVERLINE EE_CHAR_OVERLINE
+#define ITEMID_FONTHEIGHT EE_CHAR_FONTHEIGHT
+#define ITEMID_CHARSCALE_W EE_CHAR_FONTWIDTH
+#define ITEMID_COLOR EE_CHAR_COLOR
+#define ITEMID_WORDLINEMODE EE_CHAR_WLM
+#define ITEMID_PROPSIZE 0
+#define ITEMID_CHARSETCOLOR 0 // EE_FEATURE_NOTCONV
+#define ITEMID_CASEMAP 0
+#define ITEMID_LANGUAGE 0
+#define ITEMID_ESCAPEMENT EE_CHAR_ESCAPEMENT
+#define ITEMID_NOLINEBREAK 0
+#define ITEMID_NOHYPHENHERE 0
+#define ITEMID_AUTOKERN EE_CHAR_PAIRKERNING
+#define ITEMID_KERNING EE_CHAR_KERNING
+#define ITEMID_EMPHASISMARK EE_CHAR_EMPHASISMARK
+#define ITEMID_CHARRELIEF EE_CHAR_RELIEF
+
+// Paragraph Attributes
+#define ITEMID_SCRIPTSPACE EE_PARA_ASIANCJKSPACING
+#define ITEMID_ADJUST EE_PARA_JUST
+#define ITEMID_LINESPACING EE_PARA_SBL
+#define ITEMID_WIDOWS 0
+#define ITEMID_ORPHANS 0
+#define ITEMID_HYPHENZONE 0
+
+#define ITEMID_TABSTOP EE_PARA_TABS
+
+#define ITEMID_PAPERBIN 0
+#define ITEMID_LRSPACE EE_PARA_LRSPACE
+#define ITEMID_ULSPACE EE_PARA_ULSPACE
+#define ITEMID_FRAMEDIR EE_PARA_WRITINGDIR
+#define ITEMID_PRINT 0
+#define ITEMID_OPAQUE 0
+#define ITEMID_PROTECT 0
+#define ITEMID_BACKGROUND 0
+#define ITEMID_SHADOW 0
+#define ITEMID_MACRO 0
+#define ITEMID_BOX 0
+#define ITEMID_BOXINFO 0
+#define ITEMID_BRUSH 0
+
+#define ITEMID_FIELD EE_FEATURE_FIELD
+
+#define ITEMID_SEARCH 0
+
+#endif //_EEITEMID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/eerdll.hxx b/include/editeng/eerdll.hxx
new file mode 100644
index 000000000000..2d6ba34976fa
--- /dev/null
+++ b/include/editeng/eerdll.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EERDLL_HXX
+#define _EERDLL_HXX
+
+class GlobalEditData;
+
+#include <tools/resid.hxx>
+#include <tools/shl.hxx>
+#include <editeng/editengdllapi.h>
+
+class EDITENG_DLLPUBLIC EditResId: public ResId
+{
+public:
+ EditResId( sal_uInt16 nId );
+};
+
+class EditDLL
+{
+ ResMgr* pResMgr;
+ GlobalEditData* pGlobalData;
+
+public:
+ EditDLL();
+ ~EditDLL();
+
+ ResMgr* GetResMgr() const { return pResMgr; }
+ GlobalEditData* GetGlobalData() const { return pGlobalData; }
+ static EditDLL& Get();
+};
+
+#define EE_DLL() EditDLL::Get()
+
+#define EE_RESSTR(x) EditResId(x).toString()
+
+#endif //_EERDLL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/emphasismarkitem.hxx b/include/editeng/emphasismarkitem.hxx
new file mode 100644
index 000000000000..1be4b0a7ce7d
--- /dev/null
+++ b/include/editeng/emphasismarkitem.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_EMPHITEM_HXX
+#define _SVX_EMPHITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxEmphasisMarkItem ----------------------------------------------
+
+/* [Description]
+
+ This item describes the Font emphasis.
+*/
+
+class EDITENG_DLLPUBLIC SvxEmphasisMarkItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxEmphasisMarkItem( const FontEmphasisMark eVal /*= EMPHASISMARK_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxEmphasisMarkItem& operator=(const SvxEmphasisMarkItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontEmphasisMark GetEmphasisMark() const
+ { return (FontEmphasisMark)GetValue(); }
+ void SetEmphasisMark( FontEmphasisMark eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_EMPHITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/escapementitem.hxx b/include/editeng/escapementitem.hxx
new file mode 100644
index 000000000000..53fcb736f971
--- /dev/null
+++ b/include/editeng/escapementitem.hxx
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ESCPITEM_HXX
+#define _SVX_ESCPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxEscapementItem -----------------------------------------------
+
+#define DFLT_ESC_SUPER 33 // 1/3
+#define DFLT_ESC_SUB -33 // also 1/3 previously 8/100
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+/* [Description]
+
+ This item describes the writing position.
+*/
+
+class EDITENG_DLLPUBLIC SvxEscapementItem : public SfxEnumItemInterface
+{
+ short nEsc;
+ sal_uInt8 nProp;
+public:
+ TYPEINFO();
+
+ explicit SvxEscapementItem( const sal_uInt16 nId );
+ SvxEscapementItem( const SvxEscapement eEscape,
+ const sal_uInt16 nId );
+ SvxEscapementItem( const short nEsc, const sal_uInt8 nProp,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ inline void SetEscapement( const SvxEscapement eNew )
+ {
+ if( SVX_ESCAPEMENT_OFF == eNew )
+ nEsc = 0, nProp = 100;
+ else
+ if( SVX_ESCAPEMENT_SUPERSCRIPT == eNew )
+ nEsc = DFLT_ESC_SUPER, nProp = DFLT_ESC_PROP;
+ else
+ nEsc = DFLT_ESC_SUB, nProp = DFLT_ESC_PROP;
+ }
+ inline SvxEscapement GetEscapement() const { return static_cast< SvxEscapement >( GetEnumValue() ); }
+
+ inline short &GetEsc() { return nEsc; }
+ inline short GetEsc() const { return nEsc; }
+
+ inline sal_uInt8 &GetProp() { return nProp; }
+ inline sal_uInt8 GetProp() const { return nProp; }
+
+ inline SvxEscapementItem& operator=(const SvxEscapementItem& rEsc)
+ {
+ nEsc = rEsc.GetEsc();
+ nProp = rEsc.GetProp();
+ return *this;
+ }
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fhgtitem.hxx b/include/editeng/fhgtitem.hxx
new file mode 100644
index 000000000000..60f417428827
--- /dev/null
+++ b/include/editeng/fhgtitem.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FHGTITEM_HXX
+#define _SVX_FHGTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxFontHeightItem -----------------------------------------------
+
+// Warning: twips values
+
+/* [Description]
+
+ This item describes the font height
+*/
+
+#define FONTHEIGHT_16_VERSION ((sal_uInt16)0x0001)
+#define FONTHEIGHT_UNIT_VERSION ((sal_uInt16)0x0002)
+
+class EDITENG_DLLPUBLIC SvxFontHeightItem : public SfxPoolItem
+{
+ sal_uInt32 nHeight;
+ sal_uInt16 nProp; // default 100%
+ SfxMapUnit ePropUnit; // Percent, Twip, ...
+public:
+ TYPEINFO();
+
+ SvxFontHeightItem( const sal_uLong nSz /*= 240*/, const sal_uInt16 nPropHeight /*= 100*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nItemVersion) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ inline SvxFontHeightItem& operator=(const SvxFontHeightItem& rSize)
+ {
+ SetHeightValue( rSize.GetHeight() );
+ SetProp( rSize.GetProp(), ePropUnit );
+ return *this;
+ }
+
+ void SetHeight( sal_uInt32 nNewHeight, const sal_uInt16 nNewProp = 100,
+ SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE );
+
+ void SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
+ SfxMapUnit eUnit, SfxMapUnit eCoreUnit );
+
+ sal_uInt32 GetHeight() const { return nHeight; }
+
+ void SetHeightValue( sal_uInt32 nNewHeight )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nHeight = nNewHeight;
+ }
+
+ void SetProp( const sal_uInt16 nNewProp,
+ SfxMapUnit eUnit = SFX_MAPUNIT_RELATIVE )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nProp = nNewProp;
+ ePropUnit = eUnit;
+ }
+
+ sal_uInt16 GetProp() const { return nProp; }
+
+ SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fieldupdater.hxx b/include/editeng/fieldupdater.hxx
new file mode 100644
index 000000000000..8ddab5ecf91e
--- /dev/null
+++ b/include/editeng/fieldupdater.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __EDITENG_FIELDUPDATER_HXX__
+#define __EDITENG_FIELDUPDATER_HXX__
+
+#include "editengdllapi.h"
+
+class EditTextObject;
+
+namespace editeng {
+
+class FieldUpdaterImpl;
+
+/**
+ * Wrapper for EditTextObject to handle updating of fields without exposing
+ * the internals of EditTextObject structure.
+ */
+class EDITENG_DLLPUBLIC FieldUpdater
+{
+ FieldUpdaterImpl* mpImpl;
+
+ FieldUpdater(); // disabled
+public:
+ FieldUpdater(EditTextObject& rObj);
+ FieldUpdater(const FieldUpdater& r);
+ ~FieldUpdater();
+
+ /**
+ * Set a new table ID to all table fields.
+ *
+ * @param nTab new table ID
+ */
+ void updateTableFields(int nTab);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
new file mode 100644
index 000000000000..37f42a37c217
--- /dev/null
+++ b/include/editeng/flditem.hxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FLDITEM_HXX
+#define _SVX_FLDITEM_HXX
+
+#include <i18nlangtag/lang.h>
+#include <tools/time.hxx>
+#include <tools/date.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/pstm.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+#include <boost/noncopyable.hpp>
+
+namespace com { namespace sun { namespace star { namespace text {
+
+class XTextContent;
+
+}}}}
+
+class SvNumberFormatter;
+class MetaAction;
+
+// class SvxFieldItem ---------------------------------------------------
+
+
+
+class EDITENG_DLLPUBLIC SvxFieldData : public SvPersistBase
+{
+public:
+ static const sal_Int32 UNKNOWN_FIELD;
+
+ static SvxFieldData* Create(const com::sun::star::uno::Reference<com::sun::star::text::XTextContent>& xContent);
+
+ SV_DECL_PERSIST1( SvxFieldData, SvPersistBase, com::sun::star::text::textfield::Type::UNSPECIFIED)
+
+ SvxFieldData();
+ virtual ~SvxFieldData();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+ virtual MetaAction* createEndComment() const;
+};
+
+/**
+ * This item stores a field (SvxFieldData). The field is controlled by or
+ * belongs to the item. The field itself is determined by a derivation from
+ * SvxFieldData (RTTI)
+ */
+class EDITENG_DLLPUBLIC SvxFieldItem : public SfxPoolItem
+{
+private:
+ SvxFieldData* pField;
+
+ EDITENG_DLLPRIVATE SvxFieldItem( SvxFieldData* pField, const sal_uInt16 nId );
+
+public:
+ TYPEINFO();
+
+ SvxFieldItem( const SvxFieldData& rField, const sal_uInt16 nId );
+ SvxFieldItem( const SvxFieldItem& rItem );
+ ~SvxFieldItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ const SvxFieldData* GetField() const { return pField; }
+ static SvClassManager& GetClassManager();
+};
+
+// =================================================================
+// The following are the derivatives of SvxFieldData ...
+// =================================================================
+
+enum SvxDateType { SVXDATETYPE_FIX, SVXDATETYPE_VAR };
+enum SvxDateFormat { SVXDATEFORMAT_APPDEFAULT = 0, // Set as in App
+ SVXDATEFORMAT_SYSTEM, // Set as in System
+ SVXDATEFORMAT_STDSMALL,
+ SVXDATEFORMAT_STDBIG,
+ SVXDATEFORMAT_A, // 13.02.96
+ SVXDATEFORMAT_B, // 13.02.1996
+ SVXDATEFORMAT_C, // 13.Feb 1996
+ SVXDATEFORMAT_D, // 13.February 1996
+ SVXDATEFORMAT_E, // Tue, 13.February 1996
+ SVXDATEFORMAT_F // Tuesday, 13.February 1996
+ };
+
+class EDITENG_DLLPUBLIC SvxDateField : public SvxFieldData
+{
+ sal_uInt32 nFixDate;
+ SvxDateType eType;
+ SvxDateFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxDateField, SvxFieldData, com::sun::star::text::textfield::Type::DATE )
+
+ SvxDateField();
+ explicit SvxDateField( const Date& rDate,
+ SvxDateType eType = SVXDATETYPE_VAR,
+ SvxDateFormat eFormat = SVXDATEFORMAT_STDSMALL );
+
+ sal_uInt32 GetFixDate() const { return nFixDate; }
+ void SetFixDate( const Date& rDate ) { nFixDate = rDate.GetDate(); }
+
+ SvxDateType GetType() const { return eType; }
+ void SetType( SvxDateType eTp ) { eType = eTp; }
+
+ SvxDateFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxDateFormat eFmt ) { eFormat = eFmt; }
+
+ // If eLanguage==LANGUAGE_DONTKNOW the language/country
+ // used in number formatter initialization is taken.
+ OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static OUString GetFormatted( Date& rDate, SvxDateFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+
+enum SvxURLFormat { SVXURLFORMAT_APPDEFAULT = 0, // Set as in App
+ SVXURLFORMAT_URL, // Represent URL
+ SVXURLFORMAT_REPR // Constitute repraesentation
+ };
+
+class EDITENG_DLLPUBLIC SvxURLField : public SvxFieldData
+{
+private:
+ SvxURLFormat eFormat;
+ OUString aURL; // URL-Address
+ OUString aRepresentation; // What is shown
+ OUString aTargetFrame; // In what Frame
+
+public:
+ SV_DECL_PERSIST1( SvxURLField, SvxFieldData, com::sun::star::text::textfield::Type::URL )
+
+ SvxURLField();
+ SvxURLField( const OUString& rURL, const OUString& rRepres, SvxURLFormat eFmt = SVXURLFORMAT_URL );
+
+ const OUString& GetURL() const { return aURL; }
+ void SetURL( const OUString& rURL ) { aURL = rURL; }
+
+ const OUString& GetRepresentation() const { return aRepresentation; }
+ void SetRepresentation( const OUString& rRep ) { aRepresentation= rRep; }
+
+ const OUString& GetTargetFrame() const { return aTargetFrame; }
+ void SetTargetFrame( const OUString& rFrm ) { aTargetFrame = rFrm; }
+
+ SvxURLFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxURLFormat eFmt ) { eFormat = eFmt; }
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+class EDITENG_DLLPUBLIC SvxPageField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxPageField, SvxFieldData, com::sun::star::text::textfield::Type::PAGE )
+ SvxPageField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+class EDITENG_DLLPUBLIC SvxPagesField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxPagesField, SvxFieldData, com::sun::star::text::textfield::Type::PAGES )
+ SvxPagesField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+class EDITENG_DLLPUBLIC SvxTimeField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxTimeField, SvxFieldData, com::sun::star::text::textfield::Type::TIME )
+ SvxTimeField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+class EDITENG_DLLPUBLIC SvxFileField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxFileField, SvxFieldData, com::sun::star::text::textfield::Type::DOCINFO_TITLE )
+ SvxFileField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+class EDITENG_DLLPUBLIC SvxTableField : public SvxFieldData
+{
+ int mnTab;
+public:
+ SV_DECL_PERSIST1( SvxTableField, SvxFieldData, com::sun::star::text::textfield::Type::TABLE )
+ SvxTableField();
+ explicit SvxTableField(int nTab);
+
+ void SetTab(int nTab);
+ int GetTab() const;
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+
+enum SvxTimeType { SVXTIMETYPE_FIX, SVXTIMETYPE_VAR };
+enum SvxTimeFormat { SVXTIMEFORMAT_APPDEFAULT = 0, // Set as in App
+ SVXTIMEFORMAT_SYSTEM, // Set as in System
+ SVXTIMEFORMAT_STANDARD,
+ SVXTIMEFORMAT_24_HM, // 13:49
+ SVXTIMEFORMAT_24_HMS, // 13:49:38
+ SVXTIMEFORMAT_24_HMSH, // 13:49:38.78
+ SVXTIMEFORMAT_12_HM, // 01:49
+ SVXTIMEFORMAT_12_HMS, // 01:49:38
+ SVXTIMEFORMAT_12_HMSH, // 01:49:38.78
+ SVXTIMEFORMAT_AM_HM, // 01:49 PM
+ SVXTIMEFORMAT_AM_HMS, // 01:49:38 PM
+ SVXTIMEFORMAT_AM_HMSH // 01:49:38.78 PM
+ };
+
+class EDITENG_DLLPUBLIC SvxExtTimeField : public SvxFieldData
+{
+private:
+ sal_uInt32 nFixTime;
+ SvxTimeType eType;
+ SvxTimeFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxExtTimeField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_TIME )
+ SvxExtTimeField();
+ explicit SvxExtTimeField( const Time& rTime,
+ SvxTimeType eType = SVXTIMETYPE_VAR,
+ SvxTimeFormat eFormat = SVXTIMEFORMAT_STANDARD );
+
+ sal_uInt32 GetFixTime() const { return nFixTime; }
+ void SetFixTime( const Time& rTime ) { nFixTime = rTime.GetTime(); }
+
+ SvxTimeType GetType() const { return eType; }
+ void SetType( SvxTimeType eTp ) { eType = eTp; }
+
+ SvxTimeFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxTimeFormat eFmt ) { eFormat = eFmt; }
+
+ // If eLanguage==LANGUAGE_DONTKNOW the language/country
+ // used in number formatter initialization is taken.
+ OUString GetFormatted( SvNumberFormatter& rFormatter, LanguageType eLanguage ) const;
+ static OUString GetFormatted( Time& rTime, SvxTimeFormat eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+
+ virtual MetaAction* createBeginComment() const;
+};
+
+
+enum SvxFileType { SVXFILETYPE_FIX, SVXFILETYPE_VAR };
+enum SvxFileFormat { SVXFILEFORMAT_NAME_EXT = 0, // File name with Extension
+ SVXFILEFORMAT_FULLPATH, // full path
+ SVXFILEFORMAT_PATH, // only path
+ SVXFILEFORMAT_NAME // only file name
+ };
+
+
+
+class EDITENG_DLLPUBLIC SvxExtFileField : public SvxFieldData
+{
+private:
+ OUString aFile;
+ SvxFileType eType;
+ SvxFileFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxExtFileField, SvxFieldData, com::sun::star::text::textfield::Type::EXTENDED_FILE )
+ SvxExtFileField();
+ explicit SvxExtFileField( const OUString& rString,
+ SvxFileType eType = SVXFILETYPE_VAR,
+ SvxFileFormat eFormat = SVXFILEFORMAT_FULLPATH );
+
+ OUString GetFile() const { return aFile; }
+ void SetFile( const OUString& rString ) { aFile = rString; }
+
+ SvxFileType GetType() const { return eType; }
+ void SetType( SvxFileType eTp ) { eType = eTp; }
+
+ SvxFileFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxFileFormat eFmt ) { eFormat = eFmt; }
+
+ OUString GetFormatted() const;
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+
+enum SvxAuthorType { SVXAUTHORTYPE_FIX, SVXAUTHORTYPE_VAR };
+enum SvxAuthorFormat { SVXAUTHORFORMAT_FULLNAME = 0, // full name
+ SVXAUTHORFORMAT_NAME, // Only Last name
+ SVXAUTHORFORMAT_FIRSTNAME, // Only first name
+ SVXAUTHORFORMAT_SHORTNAME // Initials
+ };
+
+class EDITENG_DLLPUBLIC SvxAuthorField : public SvxFieldData
+{
+private:
+ OUString aName;
+ OUString aFirstName;
+ OUString aShortName;
+ SvxAuthorType eType;
+ SvxAuthorFormat eFormat;
+
+public:
+ SV_DECL_PERSIST1( SvxAuthorField, SvxFieldData, com::sun::star::text::textfield::Type::AUTHOR )
+ SvxAuthorField();
+ SvxAuthorField(
+ const OUString& rFirstName,
+ const OUString& rLastName,
+ const OUString& rShortName,
+ SvxAuthorType eType = SVXAUTHORTYPE_VAR,
+ SvxAuthorFormat eFormat = SVXAUTHORFORMAT_FULLNAME );
+
+ OUString GetName() const { return aName; }
+ void SetName( const OUString& rString ) { aName = rString; }
+
+ OUString GetFirstName() const { return aFirstName; }
+ void SetFirstName( const OUString& rString ) { aFirstName = rString; }
+
+ OUString GetShortName() const { return aShortName; }
+ void SetShortName( const OUString& rString ) { aShortName = rString; }
+
+ SvxAuthorType GetType() const { return eType; }
+ void SetType( SvxAuthorType eTp ) { eType = eTp; }
+
+ SvxAuthorFormat GetFormat() const { return eFormat; }
+ void SetFormat( SvxAuthorFormat eFmt ) { eFormat = eFmt; }
+
+ OUString GetFormatted() const;
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxHeaderField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxHeaderField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_HEADER )
+ SvxHeaderField();
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxFooterField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxFooterField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_FOOTER )
+ SvxFooterField();
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+/** this field is used as a placeholder for a header&footer in impress. The actual
+ value is stored at the page */
+class EDITENG_DLLPUBLIC SvxDateTimeField : public SvxFieldData
+{
+public:
+ SV_DECL_PERSIST1( SvxDateTimeField, SvxFieldData, com::sun::star::text::textfield::Type::PRESENTATION_DATE_TIME )
+ SvxDateTimeField();
+
+ static OUString GetFormatted( Date& rDate, Time& rTime, int eFormat, SvNumberFormatter& rFormatter, LanguageType eLanguage );
+
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==( const SvxFieldData& ) const;
+};
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/flstitem.hxx b/include/editeng/flstitem.hxx
new file mode 100644
index 000000000000..f298732e25e4
--- /dev/null
+++ b/include/editeng/flstitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FLSTITEM_HXX
+#define _SVX_FLSTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include "editeng/editengdllapi.h"
+
+// class SvxFontListItem -------------------------------------------------
+
+class FontList;
+
+/*
+ [Description]
+
+ This item serves as a transport medium for a font list. The font list is
+ not copied and not deleted!
+*/
+
+class EDITENG_DLLPUBLIC SvxFontListItem : public SfxPoolItem
+{
+private:
+ const FontList* pFontList;
+ com::sun::star::uno::Sequence< OUString > aFontNameSeq;
+
+public:
+ TYPEINFO();
+
+ SvxFontListItem( const FontList* pFontLst,
+ const sal_uInt16 nId );
+ SvxFontListItem( const SvxFontListItem& rItem );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ const FontList* GetFontList() const { return pFontList; }
+};
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fontitem.hxx b/include/editeng/fontitem.hxx
new file mode 100644
index 000000000000..e9d14755906e
--- /dev/null
+++ b/include/editeng/fontitem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FONTITEM_HXX
+#define _SVX_FONTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <tools/string.hxx>
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLUnitConverter;
+
+// class SvxFontItem -----------------------------------------------------
+
+/* [Description]
+
+ This item describes a Font.
+*/
+
+class EDITENG_DLLPUBLIC SvxFontItem : public SfxPoolItem
+{
+ String aFamilyName;
+ String aStyleName;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ rtl_TextEncoding eTextEncoding;
+
+ static sal_Bool bEnableStoreUnicodeNames;
+
+public:
+ TYPEINFO();
+
+ explicit SvxFontItem( const sal_uInt16 nId );
+ SvxFontItem( const FontFamily eFam, const String& rFamilyName,
+ const String& rStyleName,
+ const FontPitch eFontPitch /*= PITCH_DONTKNOW*/,
+ const rtl_TextEncoding eFontTextEncoding /*= RTL_TEXTENCODING_DONTKNOW*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ // Access methods:
+ void SetFamilyName( const String& rFamilyName ) { aFamilyName = rFamilyName; }
+ inline const String &GetFamilyName() const { return aFamilyName; }
+
+ void SetStyleName(const String &rStyleName ) { aStyleName = rStyleName; }
+ inline const String &GetStyleName() const { return aStyleName; }
+
+ void SetFamily( FontFamily _eFamily ) { eFamily = _eFamily; }
+ inline FontFamily GetFamily() const { return eFamily; }
+
+ void SetPitch(FontPitch _ePitch ) { ePitch = _ePitch; }
+ inline FontPitch GetPitch() const { return ePitch; }
+
+ void SetCharSet(rtl_TextEncoding _eEncoding) { eTextEncoding = _eEncoding; }
+
+ inline rtl_TextEncoding GetCharSet() const { return eTextEncoding; }
+
+ SvxFontItem& operator=(const SvxFontItem& rFont);
+
+ static void EnableStoreUnicodeNames( sal_Bool bEnable );
+
+};
+
+EDITENG_DLLPUBLIC void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian,
+ SvxFontItem& rComplex );
+
+#endif // #ifndef _SVX_FONTITEM_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/forbiddencharacterstable.hxx b/include/editeng/forbiddencharacterstable.hxx
new file mode 100644
index 000000000000..14556fd0ceda
--- /dev/null
+++ b/include/editeng/forbiddencharacterstable.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FORBIDDENCHARACTERSTABLE_HXX
+#define _FORBIDDENCHARACTERSTABLE_HXX
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
+#include "editeng/editengdllapi.h"
+#include <map>
+
+namespace com {
+namespace sun {
+namespace star {
+namespace uno {
+ class XComponentContext;
+}}}}
+
+class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject
+{
+public:
+ typedef std::map<sal_uInt16, com::sun::star::i18n::ForbiddenCharacters> Map;
+private:
+ Map maMap;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
+
+public:
+ SvxForbiddenCharactersTable( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext);
+ ~SvxForbiddenCharactersTable() {}
+
+ Map& GetMap() { return maMap; }
+ const com::sun::star::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault );
+ void SetForbiddenCharacters( sal_uInt16 nLanguage , const com::sun::star::i18n::ForbiddenCharacters& );
+ void ClearForbiddenCharacters( sal_uInt16 nLanguage );
+};
+
+#endif // _FORBIDDENCHARACTERSTABLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/forbiddenruleitem.hxx b/include/editeng/forbiddenruleitem.hxx
new file mode 100644
index 000000000000..2d15a3d00bf3
--- /dev/null
+++ b/include/editeng/forbiddenruleitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FORBIDDENRULEITEM_HXX
+#define _SVX_FORBIDDENRULEITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxForbiddenRuleItem -----------------------------------------
+
+/* [Description]
+
+ This item describe how to handle the last character of a line.
+*/
+
+class EDITENG_DLLPUBLIC SvxForbiddenRuleItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxForbiddenRuleItem( sal_Bool bOn /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ inline SvxForbiddenRuleItem& operator=(
+ const SvxForbiddenRuleItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/formatbreakitem.hxx b/include/editeng/formatbreakitem.hxx
new file mode 100644
index 000000000000..229e1d05f55f
--- /dev/null
+++ b/include/editeng/formatbreakitem.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BRKITEM_HXX
+#define _SVX_BRKITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxFmtBreakItem -------------------------------------------------
+
+/* [Description]
+
+ This item Describes a wrap-attribute
+ Automatic?, Page or column break, before or after?
+*/
+#define FMTBREAK_NOAUTO ((sal_uInt16)0x0001)
+
+class EDITENG_DLLPUBLIC SvxFmtBreakItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ inline SvxFmtBreakItem( const SvxBreak eBrk /*= SVX_BREAK_NONE*/,
+ const sal_uInt16 nWhich );
+ inline SvxFmtBreakItem( const SvxFmtBreakItem& rBreak );
+ inline SvxFmtBreakItem& operator=( const SvxFmtBreakItem& rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ // MS VC4.0 messes things up
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+ SvxBreak GetBreak() const { return SvxBreak( GetValue() ); }
+ void SetBreak( const SvxBreak eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+
+inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxBreak eBreak,
+ const sal_uInt16 _nWhich ) :
+ SfxEnumItem( _nWhich, (sal_uInt16)eBreak )
+{}
+
+inline SvxFmtBreakItem::SvxFmtBreakItem( const SvxFmtBreakItem& rBreak ) :
+ SfxEnumItem( rBreak )
+{}
+
+inline SvxFmtBreakItem& SvxFmtBreakItem::operator=(
+ const SvxFmtBreakItem& rBreak )
+{
+ SetValue( rBreak.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/frmdir.hxx b/include/editeng/frmdir.hxx
new file mode 100644
index 000000000000..f687c32c5610
--- /dev/null
+++ b/include/editeng/frmdir.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_FRMDIR_HXX
+#define _SVX_FRMDIR_HXX
+
+// ----------------------------------------------------------------------------
+
+/** Defines possible text directions in frames. */
+enum SvxFrameDirection
+{
+ /** Horizontal, from left to right, from top to bottom
+ (typical for western languages). */
+ FRMDIR_HORI_LEFT_TOP,
+
+ /** Horizontal, from right to left, from top to bottom
+ (typical for ararbic/hebrew languages). */
+ FRMDIR_HORI_RIGHT_TOP,
+
+ /** Vertical, from top to bottom, from right to left
+ (typical for asian languages). */
+ FRMDIR_VERT_TOP_RIGHT,
+
+ /** Vertical, from top to bottom, from left to right
+ (typical for mongol language). */
+ FRMDIR_VERT_TOP_LEFT,
+
+ /** Use the value from the environment, can only be used in frames. */
+ FRMDIR_ENVIRONMENT
+};
+
+// ----------------------------------------------------------------------------
+
+#endif // #ifndef _SVX_FRMDIR_HXX
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/frmdiritem.hxx b/include/editeng/frmdiritem.hxx
new file mode 100644
index 000000000000..6ea04dc66f09
--- /dev/null
+++ b/include/editeng/frmdiritem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FRMDIRITEM_HXX
+#define _SVX_FRMDIRITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/frmdir.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxFrameDirectionItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines a frame direction, which place the content inside
+ a frame. It exist different kind of directions which are used to the
+ layout text for Western, CJK and CTL languages.
+*/
+
+class EDITENG_DLLPUBLIC SvxFrameDirectionItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxFrameDirectionItem( SvxFrameDirection nValue /*= FRMDIR_HORI_LEFT_TOP*/,
+ sal_uInt16 nWhich );
+ virtual ~SvxFrameDirectionItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxFrameDirectionItem& operator=( const SvxFrameDirectionItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif // #ifndef _SVX_FRMDIRITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/fwdtitem.hxx b/include/editeng/fwdtitem.hxx
new file mode 100644
index 000000000000..73f897ffc06d
--- /dev/null
+++ b/include/editeng/fwdtitem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_FWDTITEM_HXX
+#define _SVX_FWDTITEM_HXX
+
+#include <svl/poolitem.hxx>
+
+
+// class SvxFontWidthItem -----------------------------------------------
+
+
+/* [Description]
+
+ This item describes the font width.
+*/
+
+class SvxFontWidthItem : public SfxPoolItem
+{
+ sal_uInt16 nWidth; // 0 = default
+ sal_uInt16 nProp; // default 100%
+public:
+ TYPEINFO();
+
+ SvxFontWidthItem( const sal_uInt16 nSz /*= 0*/,
+ const sal_uInt16 nPropWidth /*= 100*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ inline SvxFontWidthItem& operator=(const SvxFontWidthItem& rItem )
+ {
+ SetWidthValue( rItem.GetWidth() );
+ SetProp( rItem.GetProp() );
+ return *this;
+ }
+
+ void SetWidth( sal_uInt16 nNewWidth, const sal_uInt16 nNewProp = 100 )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nWidth = sal_uInt16(( (sal_uInt32)nNewWidth * nNewProp ) / 100 );
+ nProp = nNewProp;
+ }
+
+ sal_uInt16 GetWidth() const { return nWidth; }
+
+ void SetWidthValue( sal_uInt16 nNewWidth )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nWidth = nNewWidth;
+ }
+
+ void SetProp( const sal_uInt16 nNewProp )
+ {
+ DBG_ASSERT( GetRefCount() == 0, "SetValue() with pooled item" );
+ nProp = nNewProp;
+ }
+
+ sal_uInt16 GetProp() const { return nProp; }
+};
+
+
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hangulhanja.hxx b/include/editeng/hangulhanja.hxx
new file mode 100644
index 000000000000..014dc3e229a9
--- /dev/null
+++ b/include/editeng/hangulhanja.hxx
@@ -0,0 +1,288 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef SVX_HANGUL_HANJA_CONVERSION_HXX
+#define SVX_HANGUL_HANJA_CONVERSION_HXX
+
+#include <vcl/window.hxx>
+#include <memory>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include "editeng/editengdllapi.h"
+#include <i18nlangtag/mslangid.hxx>
+
+//.............................................................................
+namespace editeng
+{
+//.............................................................................
+
+ class HangulHanjaConversion_Impl;
+
+ //=========================================================================
+ //= HangulHanjaConversion
+ //=========================================================================
+ /** encapsulates Hangul-Hanja conversion functionality
+
+ <p>terminology:
+ <ul><li>A <b>text <em>portion</em></b> is some (potentially large) piece of text
+ which is to be analyzed for convertible sub-strings.</li>
+ <li>A <b>text <em>unit</em></b> is a sub string in a text portion, which is
+ to be converted as a whole.</li>
+ </ul>
+ For instance, you could have two independent selections within your document, which are then
+ two text portions. A text unit would be single Hangul/Hanja words within a portion, or even
+ single Hangul syllabills when "replace by character" is enabled.
+ </p>
+ */
+ class EDITENG_DLLPUBLIC HangulHanjaConversion
+ {
+ friend class HangulHanjaConversion_Impl;
+
+ public:
+ enum ReplacementAction
+ {
+ eExchange, // simply exchange one text with another
+ eReplacementBracketed, // keep the original, and put the replacement in brackets after it
+ eOriginalBracketed, // replace the original text, but put it in brackeds after the replacement
+ eReplacementAbove, // keep the original, and put the replacement text as ruby text above it
+ eOriginalAbove, // replace the original text, but put it as ruby text above it
+ eReplacementBelow, // keep the original, and put the replacement text as ruby text below it
+ eOriginalBelow // replace the original text, but put it as ruby text below it
+ };
+
+ enum ConversionType // does not specify direction...
+ {
+ eConvHangulHanja, // Korean Hangul/Hanja conversion
+ eConvSimplifiedTraditional // Chinese simplified / Chinese traditional conversion
+ };
+
+ // Note: conversion direction for eConvSimplifiedTraditional is
+ // specified by source language.
+ // This one is for Hangul/Hanja where source and target language
+ // are the same.
+ enum ConversionDirection
+ {
+ eHangulToHanja,
+ eHanjaToHangul
+ };
+
+ enum ConversionFormat
+ {
+ eSimpleConversion, // used for simplified / traditional Chinese as well
+ eHangulBracketed,
+ eHanjaBracketed,
+ eRubyHanjaAbove,
+ eRubyHanjaBelow,
+ eRubyHangulAbove,
+ eRubyHangulBelow
+ };
+
+ private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr< HangulHanjaConversion_Impl > m_pImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ // used to set initial values of m_pImpl object from saved ones
+ static bool m_bUseSavedValues; // defines if the followng two values should be used for initialization
+ static bool m_bTryBothDirectionsSave;
+ static ConversionDirection m_ePrimaryConversionDirectionSave;
+
+ // Forbidden and not implemented.
+ HangulHanjaConversion (const HangulHanjaConversion &);
+ HangulHanjaConversion & operator= (const HangulHanjaConversion &);
+
+ public:
+ HangulHanjaConversion(
+ Window* _pUIParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::lang::Locale& _rSourceLocale,
+ const ::com::sun::star::lang::Locale& _rTargetLocale,
+ const Font* _pTargetFont,
+ sal_Int32 nOptions,
+ bool _bIsInteractive
+ );
+
+ virtual ~HangulHanjaConversion( );
+
+ // converts the whole document
+ void ConvertDocument();
+
+ LanguageType GetSourceLanguage() const;
+ LanguageType GetTargetLanguage() const;
+ const Font * GetTargetFont() const;
+ sal_Int32 GetConversionOptions() const;
+ bool IsInteractive() const;
+
+ // chinese text conversion
+ static inline bool IsSimplified( LanguageType nLang );
+ static inline bool IsTraditional( LanguageType nLang );
+ static inline bool IsChinese( LanguageType nLang );
+
+ // used to specify that the conversion direction states from the
+ // last incarnation should be used as
+ // initial conversion direction for the next incarnation.
+ // (A hack used to transport a state information from
+ // one incarnation to the next. Used in Writers text conversion...)
+ static void SetUseSavedConversionDirectionState( bool bVal );
+ static bool IsUseSavedConversionDirectionState();
+
+ protected:
+ /** retrieves the next text portion which is to be analyzed
+
+ <p>pseudo-abstract, needs to be overridden</p>
+
+ @param _rNextPortion
+ upon return, this must contain the next text portion
+ @param _rLangOfPortion
+ upon return, this must contain the language for the found text portion.
+ (necessary for Chinese translation since there are 5 language variants
+ too look for even if the 'source' language usually is only 'simplified'
+ or 'traditional'.)
+ */
+ virtual void GetNextPortion(
+ OUString& /* [out] */ _rNextPortion,
+ LanguageType& /* [out] */ _rLangOfPortion,
+ bool /* [in] */ _bAllowImplicitChangesForNotConvertibleText ) = 0;
+
+ /** announces a new "current unit"
+
+ <p>This will be called whenever it is necessary to interactively ask the user for
+ a conversion. In such a case, a range within the current portion (see <member>GetNextPortion</member>)
+ is presented to the user for chosing a substitution. Additionally, this method is called,
+ so that derived classes can e.g. highlight this text range in a document view.</p>
+
+ <p>Note that the indexes are relative to the most recent replace action. See
+ <member>ReplaceUnit</member> for details.</p>
+
+ @param _nUnitStart
+ the start index of the unit
+
+ @param _nUnitEnd
+ the start index (exclusively!) of the unit.
+
+ @param _bAllowImplicitChangesForNotConvertibleText
+ allows implicit changes other than the text itself for the
+ text parts not being convertible.
+ Used for chinese translation to attribute all not convertible
+ text (e.g. western text, empty paragraphs, spaces, ...) to
+ the target language and target font of the conversion.
+ This is to ensure that after the conversion any new text entered
+ anywhere in the document will have the target language (of course
+ CJK Language only) and target font (CJK font only) set.
+
+ @see GetNextPortion
+ */
+ virtual void HandleNewUnit( const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd ) = 0;
+
+ /** replaces a text unit within a text portion with a new text
+
+ <p>pseudo-abstract, needs to be overridden</p>
+
+ <p>Note an important thing about the indicies: They are always relative to the <em>previous
+ call</em> of ReplaceUnit. This means whe you get a call to ReplaceUnit, and replace some text
+ in your document, than you have to remember the document position immediately <em>behind</em>
+ the changed text. In a next call to ReplaceUnit, an index of <em>0</em> will denote exactly
+ this position behind the previous replacement<br/>
+ The reaons for this is that this class here does not know anything about your document structure,
+ so after a replacement took place, it's impossible to address anything in the range from the
+ beginning of the portion up to the replaced text.<br/>
+ In the very first call to ReplaceUnit, an index of <em>0</em> denotes the very first position of
+ the current portion.</p>
+
+ <p>If the language of the text to be replaced is different from
+ the target language (as given by 'GetTargetLanguage') for example
+ when converting simplified Chinese from/to traditional Chinese
+ the language attribute of the new text has to be changed as well,
+ **and** the font is to be set to the default (document) font for
+ that language.</p>
+
+ @param _nUnitStart
+ the start index of the range to replace
+
+ @param _nUnitEnd
+ the end index (exclusively!) of the range to replace. E.g., an index
+ pair (4,5) indicates a range of length 1.
+
+ @param _rOrigText
+ the original text to be replaced (as returned by GetNextPortion).
+ Since in Chinese conversion the original text is needed as well
+ in order to only do the minimal necassry text changes and to keep
+ as much attributes as possible this is supplied here as well.
+
+ @param _rReplaceWith
+ The replacement text
+
+ @param _rOffsets
+ An sequence matching the indices (characters) of _rReplaceWith
+ to the indices of the characters in the original text they are
+ replacing.
+ This is necessary since some portions of the text may get
+ converted in portions of different length than the original.
+ The sequence will be empty if all conversions in the text are
+ of equal length. That is if always the character at index i in
+ _rOffsets is replacing the character at index i in the original
+ text for all valid index values of i.
+
+ @param _eAction
+ replacement action to take
+
+ @param pNewUnitLanguage
+ if the replacement unit is required to have a new language that
+ is specified here. If the language is to be left unchanged this
+ is the 0 pointer.
+ */
+ virtual void ReplaceUnit(
+ const sal_Int32 _nUnitStart, const sal_Int32 _nUnitEnd,
+ const OUString& _rOrigText,
+ const OUString& _rReplaceWith,
+ const ::com::sun::star::uno::Sequence< sal_Int32 > &_rOffsets,
+ ReplacementAction _eAction,
+ LanguageType *pNewUnitLanguage
+ ) = 0;
+
+ /** specifies if rubies are supported by the document implementing
+ this class.
+
+ @return
+ <TRUE/> if rubies are supported.
+ */
+ virtual bool HasRubySupport() const = 0;
+ };
+
+ bool HangulHanjaConversion::IsSimplified( LanguageType nLang )
+ {
+ return MsLangId::isSimplifiedChinese(nLang);
+ }
+
+ bool HangulHanjaConversion::IsTraditional( LanguageType nLang )
+ {
+ return MsLangId::isTraditionalChinese(nLang);
+ }
+
+ bool HangulHanjaConversion::IsChinese( LanguageType nLang )
+ {
+ return MsLangId::isChinese(nLang);
+ }
+//.............................................................................
+} // namespace svx
+//.............................................................................
+
+#endif // SVX_HANGUL_HANJA_CONVERSION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hngpnctitem.hxx b/include/editeng/hngpnctitem.hxx
new file mode 100644
index 000000000000..4454faab0b76
--- /dev/null
+++ b/include/editeng/hngpnctitem.hxx
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_HNGPNCTITEM_HXX
+#define _SVX_HNGPNCTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxHangingPunctuationItem -----------------------------------------
+
+/* [Description]
+
+ This item describe how to handle the last character of a line.
+*/
+
+class EDITENG_DLLPUBLIC SvxHangingPunctuationItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxHangingPunctuationItem( sal_Bool bOn /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ inline SvxHangingPunctuationItem& operator=(
+ const SvxHangingPunctuationItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/hyphenzoneitem.hxx b/include/editeng/hyphenzoneitem.hxx
new file mode 100644
index 000000000000..3f0682096772
--- /dev/null
+++ b/include/editeng/hyphenzoneitem.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_HYZNITEM_HXX
+#define _SVX_HYZNITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxHyphenZoneItem -----------------------------------------------
+
+/* [Description]
+
+ This item describes a hyphenation attribute (automatic?, number of
+ characters at the end of the line and start).
+*/
+
+class EDITENG_DLLPUBLIC SvxHyphenZoneItem : public SfxPoolItem
+{
+ sal_Bool bHyphen: 1;
+ sal_Bool bPageEnd: 1;
+ sal_uInt8 nMinLead;
+ sal_uInt8 nMinTrail;
+ sal_uInt8 nMaxHyphens;
+
+ friend SvStream & operator<<( SvStream & aS, SvxHyphenZoneItem & );
+
+public:
+ TYPEINFO();
+
+ SvxHyphenZoneItem( const sal_Bool bHyph /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ inline void SetHyphen( const sal_Bool bNew ) { bHyphen = bNew; }
+ inline sal_Bool IsHyphen() const { return bHyphen; }
+
+ inline void SetPageEnd( const sal_Bool bNew ) { bPageEnd = bNew; }
+ inline sal_Bool IsPageEnd() const { return bPageEnd; }
+
+ inline sal_uInt8 &GetMinLead() { return nMinLead; }
+ inline sal_uInt8 GetMinLead() const { return nMinLead; }
+
+ inline sal_uInt8 &GetMinTrail() { return nMinTrail; }
+ inline sal_uInt8 GetMinTrail() const { return nMinTrail; }
+
+ inline sal_uInt8 &GetMaxHyphens() { return nMaxHyphens; }
+ inline sal_uInt8 GetMaxHyphens() const { return nMaxHyphens; }
+
+ inline SvxHyphenZoneItem &operator=( const SvxHyphenZoneItem &rNew )
+ {
+ bHyphen = rNew.IsHyphen();
+ bPageEnd = rNew.IsPageEnd();
+ nMinLead = rNew.GetMinLead();
+ nMinTrail = rNew.GetMinTrail();
+ nMaxHyphens = rNew.GetMaxHyphens();
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/itemtype.hxx b/include/editeng/itemtype.hxx
new file mode 100644
index 000000000000..422cb3b9e22e
--- /dev/null
+++ b/include/editeng/itemtype.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ITEMTYPE_HXX
+#define _SVX_ITEMTYPE_HXX
+
+#include <editeng/editrids.hrc>
+#include <editeng/eerdll.hxx>
+
+// forward ---------------------------------------------------------------
+#include <tools/string.hxx>
+#include <tools/resid.hxx>
+#include <tools/bigint.hxx>
+#include <svl/poolitem.hxx>
+#include <tools/shl.hxx>
+#include "editeng/editengdllapi.h"
+
+class Color;
+class IntlWrapper;
+// static and prototypes -------------------------------------------------
+
+static const sal_Unicode cpDelim[] = { ',' , ' ', '\0' };
+
+EDITENG_DLLPUBLIC String GetSvxString( sal_uInt16 nId );
+EDITENG_DLLPUBLIC String GetMetricText( long nVal, SfxMapUnit eSrcUnit, SfxMapUnit eDestUnit, const IntlWrapper * pIntl );
+String GetColorString( const Color& rCol );
+EDITENG_DLLPUBLIC sal_uInt16 GetMetricId( SfxMapUnit eUnit );
+
+// -----------------------------------------------------------------------
+
+inline String GetBoolString( sal_Bool bVal )
+{
+ return EE_RESSTR(bVal ? RID_SVXITEMS_TRUE : RID_SVXITEMS_FALSE);
+}
+
+// -----------------------------------------------------------------------
+
+inline long Scale( long nVal, long nMult, long nDiv )
+{
+ BigInt aVal( nVal );
+ aVal *= nMult;
+ aVal += nDiv/2;
+ aVal /= nDiv;
+ return aVal;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx
new file mode 100644
index 000000000000..cfbdcff00a65
--- /dev/null
+++ b/include/editeng/justifyitem.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __EDITENG_JUSTIFYITEM_HXX__
+#define __EDITENG_JUSTIFYITEM_HXX__
+
+#include "editeng/editengdllapi.h"
+#include "editeng/svxenum.hxx"
+#include <svl/eitem.hxx>
+#include <sal/types.h>
+
+class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxHorJustifyItem( const sal_uInt16 nId );
+
+ SvxHorJustifyItem(
+ const SvxCellHorJustify eJustify /*= SVX_HOR_JUSTIFY_STANDARD*/,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxHorJustifyItem& operator=(const SvxHorJustifyItem& rHorJustify)
+ {
+ SetValue( rHorJustify.GetValue() );
+ return *this;
+ }
+};
+
+//------------------------------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxVerJustifyItem( const sal_uInt16 nId );
+
+ SvxVerJustifyItem(
+ const SvxCellVerJustify eJustify /*= SVX_VER_JUSTIFY_STANDARD*/,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ inline SvxVerJustifyItem& operator=(const SvxVerJustifyItem& rVerJustify)
+ {
+ SetValue( rVerJustify.GetValue() );
+ return *this;
+ }
+};
+
+//------------------------------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem
+{
+public:
+ SvxJustifyMethodItem(
+ const SvxCellJustifyMethod eMethod,
+ const sal_uInt16 nId );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual String GetValueText( sal_uInt16 nVal ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const;
+
+ SvxJustifyMethodItem& operator=(const SvxJustifyMethodItem& r);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/keepitem.hxx b/include/editeng/keepitem.hxx
new file mode 100644
index 000000000000..57e8fe022af4
--- /dev/null
+++ b/include/editeng/keepitem.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_KEEPITEM_HXX
+#define _SVX_KEEPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxFmtKeepItem ------------------------------------------------
+
+/* [Description]
+
+ This item describes a logical variable "keep paragraphs together?".
+*/
+
+class EDITENG_DLLPUBLIC SvxFmtKeepItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ inline SvxFmtKeepItem( const sal_Bool bKeep /*= sal_False*/,
+ const sal_uInt16 _nWhich );
+ inline SvxFmtKeepItem& operator=( const SvxFmtKeepItem& rSplit );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxFmtKeepItem::SvxFmtKeepItem( const sal_Bool bKeep, const sal_uInt16 _nWhich ) :
+ SfxBoolItem( _nWhich, bKeep )
+{}
+
+inline SvxFmtKeepItem& SvxFmtKeepItem::operator=( const SvxFmtKeepItem& rKeep )
+{
+ SetValue( rKeep.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/kernitem.hxx b/include/editeng/kernitem.hxx
new file mode 100644
index 000000000000..1b5f937afc01
--- /dev/null
+++ b/include/editeng/kernitem.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_KERNITEM_HXX
+#define _SVX_KERNITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxKerningItem --------------------------------------------------
+
+// Note: Twips value
+// Twips: 0 = no kerning
+
+/* [Description]
+
+ This item describes the kerning.
+*/
+
+class EDITENG_DLLPUBLIC SvxKerningItem : public SfxInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxKerningItem( const short nKern /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxKerningItem& operator=(const SvxKerningItem& rKern) {
+ SetValue( rKern.GetValue() );
+ return *this;
+ }
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx
new file mode 100644
index 000000000000..e1231cded21c
--- /dev/null
+++ b/include/editeng/langitem.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LANGITEM_HXX
+#define _SVX_LANGITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <i18nlangtag/lang.h>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxLanguageItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a Language.
+*/
+
+class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxLanguageItem( const LanguageType eLang /*= LANGUAGE_GERMAN*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ inline SvxLanguageItem& operator=(const SvxLanguageItem& rLang)
+ {
+ SetValue( rLang.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ LanguageType GetLanguage() const
+ { return (LanguageType)GetValue(); }
+ void SetLanguage( const LanguageType eLang )
+ { SetValue( (sal_uInt16)eLang ); }
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lcolitem.hxx b/include/editeng/lcolitem.hxx
new file mode 100644
index 000000000000..5b97c52d6c6d
--- /dev/null
+++ b/include/editeng/lcolitem.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LCOLITEM_HXX
+#define _SVX_LCOLITEM_HXX
+
+#include <editeng/colritem.hxx>
+#include <editeng/editengdllapi.h>
+
+/*
+ * Dummy item for ToolBox controller:
+ *
+ */
+
+class EDITENG_DLLPUBLIC SvxLineColorItem : public SvxColorItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxLineColorItem( const sal_uInt16 nId );
+ SvxLineColorItem( const SvxLineColorItem& rCopy );
+ ~SvxLineColorItem();
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * pIntlWrapper = 0 )
+ const;
+
+ inline SvxLineColorItem& operator=(const SvxLineColorItem& rColor)
+ { return (SvxLineColorItem&)SvxColorItem::
+ operator=((const SvxColorItem&)rColor); }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lineitem.hxx b/include/editeng/lineitem.hxx
new file mode 100644
index 000000000000..07ad4da38bc5
--- /dev/null
+++ b/include/editeng/lineitem.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_BOLNITEM_HXX
+#define _SVX_BOLNITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include "editeng/editengdllapi.h"
+
+
+
+// class SvxLineItem -----------------------------------------------------
+
+
+/*
+[Description]
+This Item transports a editeng::SvxBorderLine.
+*/
+
+namespace editeng {
+ class SvxBorderLine;
+}
+
+class EDITENG_DLLPUBLIC SvxLineItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxLineItem( const sal_uInt16 nId );
+ SvxLineItem( const SvxLineItem& rCpy );
+ ~SvxLineItem();
+ SvxLineItem &operator=( const SvxLineItem& rLine );
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const editeng::SvxBorderLine* GetLine () const { return pLine; }
+ void SetLine ( const editeng::SvxBorderLine *pNew );
+
+private:
+ editeng::SvxBorderLine* pLine;
+};
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
new file mode 100644
index 000000000000..a7e95ccb6e63
--- /dev/null
+++ b/include/editeng/lrspitem.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LRSPITEM_HXX
+#define _SVX_LRSPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxLRSpaceItem --------------------------------------------------
+
+/* [Description]
+
+ Left/Right margin and first line indent
+
+ SvxLRSpaceItem offers two interfaces for views from the left margin and
+ first line indent. The get methods return the member, with the layout also
+ as expected: the left edge shifts to the negative first line indent to the
+ left. The SetTxt/Gettxt methods assume that the left side represents the
+ 0 coordinate for the first line indent:
+
+ UI UI LAYOUT UI/TEXT UI/TEXT (Where?)
+ SetTxtLeft SetTxtFirst GetLeft GetTxtLeft GetTxtFirst (What?)
+ 500 -500 0 500 -500 (How much?)
+ 500 0 500 500 0
+ 500 +500 500 500 +500
+ 700 -500 200 700 -500
+*/
+
+#define LRSPACE_16_VERSION ((sal_uInt16)0x0001)
+#define LRSPACE_TXTLEFT_VERSION ((sal_uInt16)0x0002)
+#define LRSPACE_AUTOFIRST_VERSION ((sal_uInt16)0x0003)
+#define LRSPACE_NEGATIVE_VERSION ((sal_uInt16)0x0004)
+
+class EDITENG_DLLPUBLIC SvxLRSpaceItem : public SfxPoolItem
+{
+ short nFirstLineOfst; // First-line indent _always_ relative to nTxtLeft
+ long nTxtLeft; // We spend a sal_uInt16
+ long nLeftMargin; // nLeft or the negative first-line indent
+ long nRightMargin; // The unproblematic right edge
+
+ sal_uInt16 nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin;
+ sal_Bool bAutoFirst : 1; // Automatic calculation of the first line indent
+
+ void AdjustLeft(); // nLeftMargin and nTxtLeft are being adjusted.
+
+public:
+ TYPEINFO();
+
+ explicit SvxLRSpaceItem( const sal_uInt16 nId );
+ SvxLRSpaceItem( const long nLeft, const long nRight,
+ const long nTLeft /*= 0*/, const short nOfset /*= 0*/,
+ const sal_uInt16 nId );
+ inline SvxLRSpaceItem& operator=( const SvxLRSpaceItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ // Die "Layout-Schnittstelle":
+ inline void SetLeft ( const long nL, const sal_uInt16 nProp = 100 );
+ inline void SetRight( const long nR, const sal_uInt16 nProp = 100 );
+
+ // Query/direct setting of the absolute values
+ inline long GetLeft() const { return nLeftMargin; }
+ inline long GetRight() const { return nRightMargin;}
+ inline void SetLeftValue( const long nL ) { nTxtLeft = nLeftMargin = nL; }
+ inline void SetRightValue( const long nR ) { nRightMargin = nR; }
+ inline sal_Bool IsAutoFirst() const { return bAutoFirst; }
+ inline void SetAutoFirst( const sal_Bool bNew ) { bAutoFirst = bNew; }
+
+ // Query/Setting the percentage values
+ inline void SetPropLeft( const sal_uInt16 nProp = 100 )
+ { nPropLeftMargin = nProp; }
+ inline void SetPropRight( const sal_uInt16 nProp = 100 )
+ { nPropRightMargin = nProp;}
+ inline sal_uInt16 GetPropLeft() const { return nPropLeftMargin; }
+ inline sal_uInt16 GetPropRight() const { return nPropRightMargin;}
+
+ // The UI/text interface:
+ inline void SetTxtLeft( const long nL, const sal_uInt16 nProp = 100 );
+ inline long GetTxtLeft() const { return nTxtLeft; }
+
+ inline void SetTxtFirstLineOfst( const short nF, const sal_uInt16 nProp = 100 );
+ inline short GetTxtFirstLineOfst() const { return nFirstLineOfst; }
+ inline void SetPropTxtFirstLineOfst( const sal_uInt16 nProp = 100 )
+ { nPropFirstLineOfst = nProp; }
+ inline sal_uInt16 GetPropTxtFirstLineOfst() const
+ { return nPropFirstLineOfst; }
+ inline void SetTxtFirstLineOfstValue( const short nValue )
+ { nFirstLineOfst = nValue; }
+};
+
+inline SvxLRSpaceItem &SvxLRSpaceItem::operator=( const SvxLRSpaceItem &rCpy )
+{
+ nFirstLineOfst = rCpy.nFirstLineOfst;
+ nTxtLeft = rCpy.nTxtLeft;
+ nLeftMargin = rCpy.nLeftMargin;
+ nRightMargin = rCpy.nRightMargin;
+ nPropFirstLineOfst = rCpy.nPropFirstLineOfst;
+ nPropLeftMargin = rCpy.nPropLeftMargin;
+ nPropRightMargin = rCpy.nPropRightMargin;
+ bAutoFirst = rCpy.bAutoFirst;
+ return *this;
+}
+
+inline void SvxLRSpaceItem::SetLeft( const long nL, const sal_uInt16 nProp )
+{
+ nLeftMargin = (nL * nProp) / 100;
+ nTxtLeft = nLeftMargin;
+ nPropLeftMargin = nProp;
+}
+inline void SvxLRSpaceItem::SetRight( const long nR, const sal_uInt16 nProp )
+{
+ nRightMargin = (nR * nProp) / 100;
+ nPropRightMargin = nProp;
+}
+inline void SvxLRSpaceItem::SetTxtFirstLineOfst( const short nF,
+ const sal_uInt16 nProp )
+{
+ nFirstLineOfst = short((long(nF) * nProp ) / 100);
+ nPropFirstLineOfst = nProp;
+ AdjustLeft();
+}
+
+inline void SvxLRSpaceItem::SetTxtLeft( const long nL, const sal_uInt16 nProp )
+{
+ nTxtLeft = (nL * nProp) / 100;
+ nPropLeftMargin = nProp;
+ AdjustLeft();
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/lspcitem.hxx b/include/editeng/lspcitem.hxx
new file mode 100644
index 000000000000..de0a163e34e6
--- /dev/null
+++ b/include/editeng/lspcitem.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_LSPCITEM_HXX
+#define _SVX_LSPCITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxLineSpacingItem ----------------------------------------------
+
+/* [Description]
+ This item describes the distance between the lines.
+*/
+
+#define LINE_SPACE_DEFAULT_HEIGHT 200
+class EDITENG_DLLPUBLIC SvxLineSpacingItem : public SfxEnumItemInterface
+{
+ friend SvStream& operator<<( SvStream&, SvxLineSpacingItem& ); //$ ostream
+
+ short nInterLineSpace;
+ sal_uInt16 nLineHeight;
+ sal_uInt8 nPropLineSpace;
+ SvxLineSpace eLineSpace;
+ SvxInterLineSpace eInterLineSpace;
+
+public:
+ TYPEINFO();
+
+ // The writer relies on a default height of 200! Actually, I would
+ // initialize all values to 0, but who can ignore the consequences in
+ // writer? => Rather have a crooked vales as the default, but the
+ // programmer sees that there's something special happening.
+
+ SvxLineSpacingItem( sal_uInt16 nHeight /*= LINE_SPACE_DEFAULT_HEIGHT*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ // Methods to query and edit. InterlineSpace is added to the height.
+ inline short GetInterLineSpace() const { return nInterLineSpace; }
+ inline void SetInterLineSpace( const short nSpace )
+ {
+ nInterLineSpace = nSpace;
+ eInterLineSpace = SVX_INTER_LINE_SPACE_FIX;
+ }
+
+ // Determines the absolute or minimum row height.
+ inline sal_uInt16 GetLineHeight() const { return nLineHeight; }
+ inline void SetLineHeight( const sal_uInt16 nHeight )
+ {
+ nLineHeight = nHeight;
+ eLineSpace = SVX_LINE_SPACE_MIN;
+ }
+
+ // To increase or decrease the row height.
+ sal_uInt8 GetPropLineSpace() const { return nPropLineSpace; }
+ inline void SetPropLineSpace( const sal_uInt8 nProp )
+ {
+ nPropLineSpace = nProp;
+ eInterLineSpace = SVX_INTER_LINE_SPACE_PROP;
+ }
+
+ inline SvxLineSpace &GetLineSpaceRule() { return eLineSpace; }
+ inline SvxLineSpace GetLineSpaceRule() const { return eLineSpace; }
+
+ inline SvxInterLineSpace &GetInterLineSpaceRule() { return eInterLineSpace; }
+ inline SvxInterLineSpace GetInterLineSpaceRule() const { return eInterLineSpace; }
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/macros.hxx b/include/editeng/macros.hxx
new file mode 100644
index 000000000000..c667cfd6e8b8
--- /dev/null
+++ b/include/editeng/macros.hxx
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef __EDITENGINE_MACROS_HXX__
+#define __EDITENGINE_MACROS_HXX__
+
+#define DEBUG_EDIT_ENGINE 0
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/measfld.hxx b/include/editeng/measfld.hxx
new file mode 100644
index 000000000000..040560397dd0
--- /dev/null
+++ b/include/editeng/measfld.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDIT_MEASFIELD_HXX
+#define _EDIT_MEASFIELD_HXX
+
+#include <editeng/eeitem.hxx>
+
+#ifndef _FLDITEM_HXX
+#ifndef ITEMID_FIELD
+#include <editeng/editdata.hxx> /* this include is needed due to EE_FEATURE_FIELD */
+#define ITEMID_FIELD EE_FEATURE_FIELD /* is needed for #include <editeng/flditem.hxx> */
+#endif
+#include <editeng/flditem.hxx>
+#endif
+#include "editeng/editengdllapi.h"
+
+#include <com/sun/star/text/textfield/Type.hpp>
+
+class SdrMeasureObj;
+
+enum SdrMeasureFieldKind {SDRMEASUREFIELD_VALUE,SDRMEASUREFIELD_UNIT,SDRMEASUREFIELD_ROTA90BLANCS};
+
+class EDITENG_DLLPUBLIC SdrMeasureField: public SvxFieldData {
+ SdrMeasureFieldKind eMeasureFieldKind;
+public:
+ SV_DECL_PERSIST1(SdrMeasureField,SvxFieldData,com::sun::star::text::textfield::Type::MEASURE)
+ SdrMeasureField(): eMeasureFieldKind(SDRMEASUREFIELD_VALUE) {}
+ SdrMeasureField(SdrMeasureFieldKind eNewKind): eMeasureFieldKind(eNewKind) {}
+ virtual ~SdrMeasureField();
+ virtual SvxFieldData* Clone() const;
+ virtual int operator==(const SvxFieldData&) const;
+ SdrMeasureFieldKind GetMeasureFieldKind() const { return eMeasureFieldKind; }
+ void SetMeasureFieldKind(SdrMeasureFieldKind eNewKind) { eMeasureFieldKind=eNewKind; }
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#endif //_SVDFIELD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/memberids.hrc b/include/editeng/memberids.hrc
new file mode 100644
index 000000000000..1dbe7ba9da5f
--- /dev/null
+++ b/include/editeng/memberids.hrc
@@ -0,0 +1,185 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _EDT_UNOMID_HXX
+#define _EDT_UNOMID_HXX
+
+#include <svl/memberid.hrc>
+
+#define MID_LOCATION 0x3c
+#define MID_TRANSPARENT 0x4b
+#define MID_BG_COLOR 0x22
+#define MID_FLAGS 0x2e
+#define MID_DISTANCE 0x29
+#define MID_FG_COLOR 0x2c
+#define MID_OUTER_WIDTH 0x41
+#define MID_INNER_WIDTH 0x35
+#define MID_LINESPACE 0x3b
+#define MID_LINE_STYLE 0x90
+
+
+//NameOrIndex
+#define MID_NAME 16
+#define MID_GRAFURL 32
+
+// SvxPageModelItem
+#define MID_AUTO 1
+
+// SvxTabStop
+#define MID_TABSTOPS 0
+#define MID_STD_TAB 1
+
+//SvxHyphenZoneItem
+#define MID_IS_HYPHEN 0
+#define MID_HYPHEN_MIN_LEAD 1
+#define MID_HYPHEN_MIN_TRAIL 2
+#define MID_HYPHEN_MAX_HYPHENS 3
+
+// SvxBoxInfoItem
+#define MID_HORIZONTAL 1
+#define MID_VERTICAL 2
+#define MID_VALIDFLAGS 4
+
+//AdjustItem
+#define MID_PARA_ADJUST 0
+#define MID_LAST_LINE_ADJUST 1
+#define MID_EXPAND_SINGLE 2
+
+//SvxFontItem
+// Don't use 0 as it used for the whole struct
+#define MID_FONT_FAMILY_NAME 1
+#define MID_FONT_STYLE_NAME 2
+#define MID_FONT_FAMILY 3
+#define MID_FONT_CHAR_SET 4
+#define MID_FONT_PITCH 5
+
+// SvxCharReliefItem
+#define MID_RELIEF 0
+
+//SvxCharRotateItem
+#define MID_ROTATE 0
+#define MID_FITTOLINE 1
+
+//SvxExcapementItem
+#define MID_ESC 0
+#define MID_ESC_HEIGHT 1
+#define MID_AUTO_ESC 2
+
+//SvxFontWidthItem
+#define MID_FONTWIDTH 0
+#define MID_FONTWIDTH_PROP 1
+
+//SvxFontHeightItem
+#define MID_FONTHEIGHT 1
+#define MID_FONTHEIGHT_PROP 2
+#define MID_FONTHEIGHT_DIFF 3
+
+//SvxTextLineItem
+#define MID_TEXTLINED 0
+#define MID_TL_STYLE 1
+#define MID_TL_COLOR 2
+#define MID_TL_HASCOLOR 3
+
+//SvxCrossedOutItem
+#define MID_CROSSED_OUT 0
+#define MID_CROSS_OUT 1
+
+//SvxPostureItem
+#define MID_ITALIC 0
+#define MID_POSTURE 1
+
+//SvxBoolItem
+#define MID_BOLD 0
+#define MID_WEIGHT 1
+
+//SvxLanguageItem
+#define MID_LANG_INT 0
+#define MID_LANG_LOCALE 1
+
+//SvxEmphasisMarkItem
+#define MID_EMPHASIS 0
+
+//SvxTwoLinesItem
+#define MID_TWOLINES 0
+#define MID_START_BRACKET 1
+#define MID_END_BRACKET 2
+
+//ULSpaceItem
+#define MID_UP_MARGIN 3
+#define MID_LO_MARGIN 4
+#define MID_UP_REL_MARGIN 5
+#define MID_LO_REL_MARGIN 6
+#define MID_CTX_MARGIN 7
+
+//LRSpaceItem
+#define MID_L_MARGIN 4
+#define MID_R_MARGIN 5
+#define MID_L_REL_MARGIN 6
+#define MID_R_REL_MARGIN 7
+#define MID_FIRST_LINE_INDENT 8
+#define MID_FIRST_LINE_REL_INDENT 9
+#define MID_FIRST_AUTO 10
+#define MID_TXT_LMARGIN 11
+
+//ProtectItem
+#define MID_PROTECT_CONTENT 0
+#define MID_PROTECT_SIZE 1
+#define MID_PROTECT_POSITION 2
+
+//SvxBoxItem
+#define LEFT_BORDER 1
+#define RIGHT_BORDER 2
+#define TOP_BORDER 3
+#define BOTTOM_BORDER 4
+#define BORDER_DISTANCE 5
+#define LEFT_BORDER_DISTANCE 6
+#define RIGHT_BORDER_DISTANCE 7
+#define TOP_BORDER_DISTANCE 8
+#define BOTTOM_BORDER_DISTANCE 9
+#define MID_LEFT_BORDER 10
+#define MID_RIGHT_BORDER 11
+#define MID_TOP_BORDER 12
+#define MID_BOTTOM_BORDER 13
+#define LINE_STYLE 14
+#define LINE_WIDTH 15
+
+//BrushItem
+#define MID_BACK_COLOR 0
+#define MID_GRAPHIC_POSITION 1
+#define MID_GRAPHIC_LINK 2
+#define MID_GRAPHIC 3
+#define MID_GRAPHIC_TRANSPARENT 4
+#define MID_GRAPHIC_URL 5
+#define MID_GRAPHIC_FILTER 6
+#define MID_GRAPHIC_REPEAT 7
+#define MID_GRAPHIC_TRANSPARENCY 8
+#define MID_BACK_COLOR_R_G_B 9
+#define MID_BACK_COLOR_TRANSPARENCY 10
+
+//SvxFmtBreakItem
+#define MID_BREAK_BEFORE 0
+#define MID_BREAK_AFTER 1
+
+// SvxHorJustifyItem
+#define MID_HORJUST_HORJUST 0
+#define MID_HORJUST_ADJUST 1
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/mutxhelp.hxx b/include/editeng/mutxhelp.hxx
new file mode 100644
index 000000000000..14b36347b74d
--- /dev/null
+++ b/include/editeng/mutxhelp.hxx
@@ -0,0 +1,37 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_MUTXHELP_HXX
+#define _SVX_MUTXHELP_HXX
+
+#include <osl/mutex.hxx>
+
+class SvxMutexHelper
+{
+private:
+ ::osl::Mutex maMutex;
+
+public:
+ ::osl::Mutex& getMutex() { return maMutex; }
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/nhypitem.hxx b/include/editeng/nhypitem.hxx
new file mode 100644
index 000000000000..51942c318bbd
--- /dev/null
+++ b/include/editeng/nhypitem.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_NHYPITEM_HXX
+#define _SVX_NHYPITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxNoHyphenItem -------------------------------------------------
+class EDITENG_DLLPUBLIC SvxNoHyphenItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxNoHyphenItem( const sal_Bool bHyphen /*= sal_True*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxNoHyphenItem& operator=(const SvxNoHyphenItem& rNHH)
+ {
+ SetValue( rNHH.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/nlbkitem.hxx b/include/editeng/nlbkitem.hxx
new file mode 100644
index 000000000000..209b0539ba07
--- /dev/null
+++ b/include/editeng/nlbkitem.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_NLBKITEM_HXX
+#define _SVX_NLBKITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxNoLinebreakItem ----------------------------------------------
+class EDITENG_DLLPUBLIC SvxNoLinebreakItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxNoLinebreakItem( const sal_Bool bBreak /*= sal_True*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxNoLinebreakItem& operator=(const SvxNoLinebreakItem& rLB)
+ {
+ SetValue( rLB.GetValue() );
+ return *this;
+ }
+};
+
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/numdef.hxx b/include/editeng/numdef.hxx
new file mode 100644
index 000000000000..28f94d2d3ae5
--- /dev/null
+++ b/include/editeng/numdef.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#define SVX_MAX_NUM 10 // max. possible numbering level
+#define SVX_DEF_BULLET (0xF000 + 149)// Character for lists
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
new file mode 100644
index 000000000000..9f88e79de0ec
--- /dev/null
+++ b/include/editeng/numitem.hxx
@@ -0,0 +1,356 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_NUMITEM_HXX
+#define _SVX_NUMITEM_HXX
+
+#include <tools/link.hxx>
+#include <tools/string.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <tools/gen.hxx>
+#include <editeng/numdef.hxx>
+#include <tools/color.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <unotools/fontcvt.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvxBrushItem;
+class Font;
+class Graphic;
+class SvxNodeNum;
+namespace com{namespace sun{ namespace star{
+ namespace text{
+ class XNumberingFormatter;
+ }
+}}}
+
+// -----------------------------------------------------------------------
+//Feature-Flags (only sal_uInt16!)
+#define NUM_CONTINUOUS 0x0001 // consecutive numbers possible?
+#define NUM_CHAR_TEXT_DISTANCE 0x0002 // Distance Symbol<->Text?
+#define NUM_CHAR_STYLE 0x0004 // Character styles?
+#define NUM_BULLET_REL_SIZE 0x0008 // relative bullet size?
+#define NUM_BULLET_COLOR 0x0010 // Bullet color
+#define NUM_SYMBOL_ALIGNMENT 0x0040 // alignment to be shown in the options
+#define NUM_NO_NUMBERS 0x0080 // Numbering are not allowed
+#define NUM_ENABLE_LINKED_BMP 0x0100 // linked bitmaps are available
+#define NUM_ENABLE_EMBEDDED_BMP 0x0200 // embedded bitmaps are available
+
+#define SVX_NO_NUM 200 // Marker for no numbering
+#define SVX_NO_NUMLEVEL 0x20
+
+#define LINK_TOKEN 0x80 //indicate linked bitmaps - for use in dialog only
+class EDITENG_DLLPUBLIC SvxNumberType
+{
+ static sal_Int32 nRefCount;
+ static com::sun::star::uno::Reference<com::sun::star::text::XNumberingFormatter> xFormatter;
+
+ sal_Int16 nNumType;
+ sal_Bool bShowSymbol; // Also show Symbol ?
+
+public:
+ explicit SvxNumberType(sal_Int16 nType = com::sun::star::style::NumberingType::ARABIC);
+ SvxNumberType(const SvxNumberType& rType);
+ ~SvxNumberType();
+
+ String GetNumStr( sal_uLong nNo ) const;
+ String GetNumStr( sal_uLong nNo, const com::sun::star::lang::Locale& rLocale ) const;
+
+ void SetNumberingType(sal_Int16 nSet) {nNumType = nSet;}
+ sal_Int16 GetNumberingType() const {return nNumType;}
+
+ void SetShowSymbol(sal_Bool bSet) {bShowSymbol = bSet;}
+ sal_Bool IsShowSymbol()const{return bShowSymbol;}
+
+ sal_Bool IsTxtFmt() const
+ {
+ return com::sun::star::style::NumberingType::NUMBER_NONE != nNumType &&
+ com::sun::star::style::NumberingType::CHAR_SPECIAL != nNumType &&
+ com::sun::star::style::NumberingType::BITMAP != nNumType;
+ }
+};
+
+class EDITENG_DLLPUBLIC SvxNumberFormat : public SvxNumberType
+{
+public:
+ enum SvxNumPositionAndSpaceMode
+ {
+ LABEL_WIDTH_AND_POSITION,
+ LABEL_ALIGNMENT
+ };
+ enum LabelFollowedBy
+ {
+ LISTTAB,
+ SPACE,
+ NOTHING
+ };
+
+private:
+ OUString sPrefix;
+ OUString sSuffix;
+
+ SvxAdjust eNumAdjust;
+
+ sal_uInt8 nInclUpperLevels; // Take over numbers from the previous level.
+ sal_uInt16 nStart; // Start of counting
+
+ sal_Unicode cBullet; // Symbol
+ sal_uInt16 nBulletRelSize; // percentage size of bullets
+ Color nBulletColor; // Bullet color
+
+ // mode indicating, if the position and spacing of the list label is
+ // determined by the former attributes (nFirstLineOffset, nAbsLSpace,
+ // nLSpace and nCharTextDistance) called position and spacing via label
+ // width and position (LABEL_WIDTH_AND_POSITION) or by the new attributes
+ // (meLabelFollowedBy, mnListtabPos, mnFirstLineIndent and mnIndentAt)
+ // called position and spacing via label alignment.
+ // Note 1: Attribute <eNumAdjust> is relevant for both modes.
+ // Note 2: The values of the former attributes are treated as 0, if mode
+ // LABEL_ALIGNMENT is active.
+ SvxNumPositionAndSpaceMode mePositionAndSpaceMode;
+
+ short nFirstLineOffset; // First line indent
+ short nAbsLSpace; // Distance Border<->Number
+ short nLSpace; // relative to the previous indentation
+ short nCharTextDistance; // Distance Number<->Text
+
+ // specifies what follows the list label before the text of the first line
+ // of the list item starts
+ LabelFollowedBy meLabelFollowedBy;
+ // specifies an additional list tab stop position for meLabelFollowedBy = LISTTAB
+ long mnListtabPos;
+ // specifies the first line indent
+ long mnFirstLineIndent;
+ // specifies the indent before the text, e.g. in L2R-layout the left margin
+ long mnIndentAt;
+
+ SvxBrushItem* pGraphicBrush;
+ sal_Int16 eVertOrient; // vertical alignment of a bitmap
+
+ Size aGraphicSize; // Always! in 1/100 mm
+ Font* pBulletFont; // Pointer to the bullet font
+
+ String sCharStyleName; // Character Style
+
+ DECL_STATIC_LINK( SvxNumberFormat, GraphicArrived, void * );
+ virtual void NotifyGraphicArrived();
+public:
+ explicit SvxNumberFormat( sal_Int16 nNumberingType,
+ SvxNumPositionAndSpaceMode ePositionAndSpaceMode = LABEL_WIDTH_AND_POSITION );
+ SvxNumberFormat(const SvxNumberFormat& rFormat);
+ SvxNumberFormat( SvStream & rStream );
+
+ virtual ~SvxNumberFormat();
+
+ SvStream& Store(SvStream &rStream, FontToSubsFontConverter pConverter);
+ SvxNumberFormat* Create(SvStream& rStream );
+
+ SvxNumberFormat& operator=( const SvxNumberFormat& );
+ sal_Bool operator==( const SvxNumberFormat& ) const;
+ sal_Bool operator!=( const SvxNumberFormat& rFmt) const {return !(*this == rFmt);}
+
+ void SetNumAdjust(SvxAdjust eSet) {eNumAdjust = eSet;}
+ SvxAdjust GetNumAdjust() const {return eNumAdjust;}
+ void SetPrefix(const OUString& rSet) { sPrefix = rSet;}
+ const OUString& GetPrefix() const { return sPrefix;}
+ void SetSuffix(const OUString& rSet) { sSuffix = rSet;}
+ const OUString& GetSuffix() const { return sSuffix;}
+
+ void SetCharFmtName(const String& rSet){ sCharStyleName = rSet; }
+ virtual const String& GetCharFmtName()const;
+
+ void SetBulletFont(const Font* pFont);
+ const Font* GetBulletFont() const {return pBulletFont;}
+ void SetBulletChar(sal_Unicode cSet){cBullet = cSet;}
+ sal_Unicode GetBulletChar()const {return cBullet;}
+ void SetBulletRelSize(sal_uInt16 nSet) {nBulletRelSize = nSet;}
+ sal_uInt16 GetBulletRelSize() const { return nBulletRelSize;}
+ void SetBulletColor(Color nSet){nBulletColor = nSet;}
+ Color GetBulletColor()const {return nBulletColor;}
+
+ void SetIncludeUpperLevels( sal_uInt8 nSet ) { nInclUpperLevels = nSet;}
+ sal_uInt8 GetIncludeUpperLevels()const { return nInclUpperLevels;}
+ void SetStart(sal_uInt16 nSet) {nStart = nSet;}
+ sal_uInt16 GetStart() const {return nStart;}
+
+ virtual void SetGraphicBrush( const SvxBrushItem* pBrushItem, const Size* pSize = 0, const sal_Int16* pOrient = 0);
+ const SvxBrushItem* GetBrush() const {return pGraphicBrush;}
+ void SetGraphic( const String& rName );
+ virtual void SetVertOrient(sal_Int16 eSet);
+ virtual sal_Int16 GetVertOrient() const;
+ void SetGraphicSize(const Size& rSet) {aGraphicSize = rSet;}
+ const Size& GetGraphicSize() const {return aGraphicSize;}
+
+ SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const;
+ void SetPositionAndSpaceMode( SvxNumPositionAndSpaceMode ePositionAndSpaceMode );
+
+ void SetLSpace(short nSet) {nLSpace = nSet;}
+ short GetLSpace() const;
+ void SetAbsLSpace(short nSet) {nAbsLSpace = nSet;}
+ short GetAbsLSpace() const;
+ void SetFirstLineOffset(short nSet) { nFirstLineOffset = nSet;}
+ short GetFirstLineOffset() const;
+ void SetCharTextDistance(short nSet) { nCharTextDistance = nSet; }
+ short GetCharTextDistance() const;
+
+ void SetLabelFollowedBy( const LabelFollowedBy eLabelFollowedBy );
+ LabelFollowedBy GetLabelFollowedBy() const;
+ void SetListtabPos( const long nListtabPos );
+ long GetListtabPos() const;
+ void SetFirstLineIndent( const long nFirstLineIndent );
+ long GetFirstLineIndent() const;
+ void SetIndentAt( const long nIndentAt );
+ long GetIndentAt() const;
+
+ static Size GetGraphicSizeMM100(const Graphic* pGraphic);
+ static String CreateRomanString( sal_uLong nNo, sal_Bool bUpper );
+};
+
+enum SvxNumRuleType
+{
+ SVX_RULETYPE_NUMBERING,
+ SVX_RULETYPE_OUTLINE_NUMBERING,
+ SVX_RULETYPE_PRESENTATION_NUMBERING,
+ SVX_RULETYPE_END
+};
+
+class EDITENG_DLLPUBLIC SvxNumRule
+{
+ sal_uInt16 nLevelCount; // Number of supported levels
+ sal_uInt32 nFeatureFlags; // What is supported?
+ SvxNumRuleType eNumberingType; // Type of numbering
+ sal_Bool bContinuousNumbering; // sequential numbering
+
+ SvxNumberFormat* aFmts[SVX_MAX_NUM];
+ sal_Bool aFmtsSet[SVX_MAX_NUM]; // Flags indicating valid levels
+
+ static sal_Int32 nRefCount;
+ com::sun::star::lang::Locale aLocale;
+public:
+ SvxNumRule( sal_uLong nFeatures,
+ sal_uInt16 nLevels,
+ sal_Bool bCont,
+ SvxNumRuleType eType = SVX_RULETYPE_NUMBERING,
+ SvxNumberFormat::SvxNumPositionAndSpaceMode
+ eDefaultNumberFormatPositionAndSpaceMode
+ = SvxNumberFormat::LABEL_WIDTH_AND_POSITION );
+ SvxNumRule(const SvxNumRule& rCopy);
+ SvxNumRule(SvStream &rStream);
+ virtual ~SvxNumRule();
+
+ int operator==( const SvxNumRule& ) const;
+ int operator!=( const SvxNumRule& rRule ) const {return !(*this == rRule);}
+
+ SvxNumRule& operator=( const SvxNumRule& );
+
+ SvStream& Store(SvStream &rStream);
+ SvxNumRule* Create(SvStream &rStream);
+ const SvxNumberFormat* Get(sal_uInt16 nLevel)const;
+ const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const;
+ void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, sal_Bool bIsValid = sal_True);
+ void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat* pFmt);
+
+ sal_Bool IsContinuousNumbering()const
+ {return bContinuousNumbering;}
+ void SetContinuousNumbering(sal_Bool bSet)
+ {bContinuousNumbering = bSet;}
+
+ sal_uInt16 GetLevelCount() const {return nLevelCount;}
+ sal_Bool IsFeatureSupported(sal_uInt32 nFeature) const
+ {return 0 != (nFeatureFlags & nFeature);}
+ sal_uInt32 GetFeatureFlags() const {return nFeatureFlags;}
+ void SetFeatureFlag( sal_uInt32 nFlag, sal_Bool bSet = sal_True ) { if(bSet) nFeatureFlags |= nFlag; else nFeatureFlags &= ~nFlag; }
+
+ String MakeNumString( const SvxNodeNum&, sal_Bool bInclStrings = sal_True ) const;
+
+ SvxNumRuleType GetNumRuleType() const { return eNumberingType; }
+ void SetNumRuleType( const SvxNumRuleType& rType ) { eNumberingType = rType; }
+
+ sal_Bool UnLinkGraphics();
+};
+
+class EDITENG_DLLPUBLIC SvxNumBulletItem : public SfxPoolItem
+{
+ SvxNumRule* pNumRule;
+public:
+ explicit SvxNumBulletItem(SvxNumRule& rRule);
+ SvxNumBulletItem(SvxNumRule& rRule, sal_uInt16 nWhich );
+ SvxNumBulletItem(const SvxNumBulletItem& rCopy);
+ virtual ~SvxNumBulletItem();
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &rStream, sal_uInt16 nItemVersion) const;
+ sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual SvStream& Store(SvStream &rStream, sal_uInt16 nItemVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ SvxNumRule* GetNumRule() const {return pNumRule;}
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+class SvxNodeNum
+{
+ sal_uInt16 nLevelVal[ SVX_MAX_NUM ]; // Numbers of all levels
+ sal_uInt16 nSetValue; // predetermined number
+ sal_uInt8 nMyLevel; // Current Level
+ sal_Bool bStartNum; // Restart numbering
+
+public:
+ explicit inline SvxNodeNum( sal_uInt8 nLevel = SVX_NO_NUM, sal_uInt16 nSetVal = USHRT_MAX );
+ inline SvxNodeNum& operator=( const SvxNodeNum& rCpy );
+
+ sal_uInt8 GetLevel() const { return nMyLevel; }
+ void SetLevel( sal_uInt8 nVal ) { nMyLevel = nVal; }
+
+ sal_Bool IsStart() const { return bStartNum; }
+ void SetStart( sal_Bool bFlag = sal_True ) { bStartNum = bFlag; }
+
+ sal_uInt16 GetSetValue() const { return nSetValue; }
+ void SetSetValue( sal_uInt16 nVal ) { nSetValue = nVal; }
+
+ const sal_uInt16* GetLevelVal() const { return nLevelVal; }
+ sal_uInt16* GetLevelVal() { return nLevelVal; }
+};
+
+SvxNodeNum::SvxNodeNum( sal_uInt8 nLevel, sal_uInt16 nSetVal )
+ : nSetValue( nSetVal ), nMyLevel( nLevel ), bStartNum( sal_False )
+{
+ memset( nLevelVal, 0, sizeof( nLevelVal ) );
+}
+
+inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy )
+{
+ nSetValue = rCpy.nSetValue;
+ nMyLevel = rCpy.nMyLevel;
+ bStartNum = rCpy.bStartNum;
+
+ memcpy( nLevelVal, rCpy.nLevelVal, sizeof( nLevelVal ) );
+ return *this;
+}
+
+SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevel, SvxNumRuleType eType );
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/opaqitem.hxx b/include/editeng/opaqitem.hxx
new file mode 100644
index 000000000000..7780c4237c5d
--- /dev/null
+++ b/include/editeng/opaqitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_OPAQITEM_HXX
+#define _SVX_OPAQITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLUnitConverter;
+
+// class SvxOpaqueItem ---------------------------------------------------
+
+
+/* [Description]
+
+ This item describes a logical variable "Opaque yes or no."
+*/
+
+class EDITENG_DLLPUBLIC SvxOpaqueItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxOpaqueItem( const sal_uInt16 nId , const sal_Bool bOpa = sal_True );
+ inline SvxOpaqueItem &operator=( const SvxOpaqueItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxOpaqueItem::SvxOpaqueItem( const sal_uInt16 nId, const sal_Bool bOpa )
+ : SfxBoolItem( nId, bOpa )
+{}
+
+inline SvxOpaqueItem &SvxOpaqueItem::operator=( const SvxOpaqueItem &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/optitems.hxx b/include/editeng/optitems.hxx
new file mode 100644
index 000000000000..34970ebbc42c
--- /dev/null
+++ b/include/editeng/optitems.hxx
@@ -0,0 +1,102 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _EDITENG_OPTITEMS_HXX
+#define _EDITENG_OPTITEMS_HXX
+
+#include <svl/poolitem.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <editeng/editengdllapi.h>
+
+// forward ---------------------------------------------------------------
+namespace com { namespace sun { namespace star {
+namespace linguistic2{
+ class XSpellChecker1;
+}}}}
+
+
+// class SfxSpellCheckItem -----------------------------------------------
+
+class EDITENG_DLLPUBLIC SfxSpellCheckItem: public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ SfxSpellCheckItem( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xChecker,
+ sal_uInt16 nWhich );
+ SfxSpellCheckItem( const SfxSpellCheckItem& rItem );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetXSpellChecker() const { return xSpellCheck; }
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpellCheck;
+};
+
+
+// class SfxHyphenRegionItem ---------------------------------------------
+
+class EDITENG_DLLPUBLIC SfxHyphenRegionItem: public SfxPoolItem
+{
+ sal_uInt8 nMinLead;
+ sal_uInt8 nMinTrail;
+
+public:
+ TYPEINFO();
+
+ SfxHyphenRegionItem( const sal_uInt16 nId );
+ SfxHyphenRegionItem( const SfxHyphenRegionItem& rItem );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream& rStrm, sal_uInt16 nVer ) const;
+ virtual SvStream& Store( SvStream& rStrm, sal_uInt16 ) const;
+
+ inline sal_uInt8 &GetMinLead() { return nMinLead; }
+ inline sal_uInt8 GetMinLead() const { return nMinLead; }
+
+ inline sal_uInt8 &GetMinTrail() { return nMinTrail; }
+ inline sal_uInt8 GetMinTrail() const { return nMinTrail; }
+
+ inline SfxHyphenRegionItem& operator=( const SfxHyphenRegionItem& rNew )
+ {
+ nMinLead = rNew.GetMinLead();
+ nMinTrail = rNew.GetMinTrail();
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/orphitem.hxx b/include/editeng/orphitem.hxx
new file mode 100644
index 000000000000..60ef8520c677
--- /dev/null
+++ b/include/editeng/orphitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ORPHITEM_HXX
+#define _SVX_ORPHITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxOrphansItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the number of lines for the orphans system.
+*/
+
+class EDITENG_DLLPUBLIC SvxOrphansItem: public SfxByteItem
+{
+ friend SvStream & operator<<( SvStream & aS, SvxOrphansItem & );
+public:
+ TYPEINFO();
+
+ SvxOrphansItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxOrphansItem& operator=( const SvxOrphansItem& rOrphans )
+ {
+ SetValue( rOrphans.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
new file mode 100644
index 000000000000..e2f208e9b824
--- /dev/null
+++ b/include/editeng/outliner.hxx
@@ -0,0 +1,1001 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _OUTLINER_HXX
+#define _OUTLINER_HXX
+
+#include <tools/gen.hxx>
+#include <tools/string.hxx>
+
+#include <svl/brdcst.hxx>
+
+#include <editeng/editdata.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/color.hxx>
+#include <tools/contnr.hxx>
+#include <vcl/graph.hxx>
+#include <tools/link.hxx>
+#include <rsc/rscsfx.hxx>
+#include "editeng/editengdllapi.h"
+#include <com/sun/star/lang/Locale.hpp>
+
+#include <svtools/grfmgr.hxx>
+
+#include <tools/rtti.hxx> // due to typedef TypeId
+#include <vector>
+
+class OutlinerEditEng;
+class Outliner;
+class EditView;
+class EditUndo;
+class ParagraphList;
+class OutlinerParaObject;
+class SvStream;
+class SvxBulletItem;
+class SvxFont;
+class SvxSearchItem;
+class SvxFieldItem;
+class Window;
+class KeyEvent;
+class MouseEvent;
+class Pointer;
+class CommandEvent;
+class MapMode;
+class OutputDevice;
+class PolyPolygon;
+class SfxStyleSheetPool;
+class SfxStyleSheet;
+class SfxItemPool;
+class SfxItemSet;
+class SvxNumBulletItem;
+class SvxNumberFormat;
+class SvxLRSpaceItem;
+class EditEngine;
+class SvKeyValueIterator;
+class SvxForbiddenCharactersTable;
+
+namespace svl
+{
+ class IUndoManager;
+}
+
+#include <com/sun/star/uno/Reference.h>
+
+#include <rtl/ref.hxx>
+#include <editeng/svxfont.hxx>
+#include <editeng/eedata.hxx>
+#include <editeng/paragraphdata.hxx>
+
+class SvxFieldData;
+//////////////////////////////////////////////////////////////////////////////
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ class XSpellChecker1;
+ class XHyphenator;
+}}}}
+namespace svx{
+struct SpellPortion;
+typedef std::vector<SpellPortion> SpellPortions;
+}
+
+namespace basegfx { class B2DPolyPolygon; }
+
+// internal use only!
+#define PARAFLAG_DROPTARGET 0x1000
+#define PARAFLAG_DROPTARGET_EMPTY 0x2000
+#define PARAFLAG_HOLDDEPTH 0x4000
+#define PARAFLAG_SETBULLETTEXT 0x8000
+#define PARAFLAG_ISPAGE 0x0100
+
+// Undo-Action-Ids
+#define OLUNDO_DEPTH EDITUNDO_USER
+// #define OLUNDO_HEIGHT EDITUNDO_USER+1
+#define OLUNDO_EXPAND EDITUNDO_USER+2
+#define OLUNDO_COLLAPSE EDITUNDO_USER+3
+// #define OLUNDO_REMOVE EDITUNDO_USER+4
+#define OLUNDO_ATTR EDITUNDO_USER+5
+#define OLUNDO_INSERT EDITUNDO_USER+6
+// #define OLUNDO_MOVEPARAGRAPHS EDITUNDO_USER+7
+#define OLUNDO_CHECKPARA EDITUNDO_USER+8
+
+class Paragraph : protected ParagraphData
+{
+private:
+ friend class Outliner;
+ friend class ParagraphList;
+ friend class OutlinerView;
+ friend class OutlinerParaObject;
+ friend class OutlinerEditEng;
+ friend class OutlinerUndoCheckPara;
+ friend class OutlinerUndoChangeParaFlags;
+
+ Paragraph& operator=(const Paragraph& rPara );
+
+ sal_uInt16 nFlags;
+ OUString aBulText;
+ Size aBulSize;
+ sal_Bool bVisible;
+
+ sal_Bool IsVisible() const { return bVisible; }
+ void SetText( const OUString& rText ) { aBulText = rText; aBulSize.Width() = -1; }
+ void Invalidate() { aBulSize.Width() = -1; }
+ void SetDepth( sal_Int16 nNewDepth ) { nDepth = nNewDepth; aBulSize.Width() = -1; }
+ const OUString& GetText() const { return aBulText; }
+
+ Paragraph( sal_Int16 nDepth );
+ Paragraph( const Paragraph& );
+ Paragraph( const ParagraphData& );
+ ~Paragraph();
+
+ sal_Int16 GetDepth() const { return nDepth; }
+
+ sal_Int16 GetNumberingStartValue() const { return mnNumberingStartValue; }
+ void SetNumberingStartValue( sal_Int16 nNumberingStartValue );
+
+ sal_Bool IsParaIsNumberingRestart() const { return mbParaIsNumberingRestart; }
+ void SetParaIsNumberingRestart( sal_Bool bParaIsNumberingRestart );
+
+ void SetFlag( sal_uInt16 nFlag ) { nFlags |= nFlag; }
+ void RemoveFlag( sal_uInt16 nFlag ) { nFlags &= ~nFlag; }
+ bool HasFlag( sal_uInt16 nFlag ) const { return (nFlags & nFlag) != 0; }
+};
+
+struct ParaRange
+{
+ sal_uInt16 nStartPara;
+ sal_uInt16 nEndPara;
+
+ ParaRange( sal_uInt16 nS, sal_uInt16 nE ) { nStartPara = nS, nEndPara = nE; }
+
+ void Adjust();
+ sal_uInt16 Len() const { return 1 + ( ( nEndPara > nStartPara ) ? (nEndPara-nStartPara) : (nStartPara-nEndPara) ); }
+};
+
+inline void ParaRange::Adjust()
+{
+ if ( nStartPara > nEndPara )
+ {
+ sal_uInt16 nTmp = nStartPara;
+ nStartPara = nEndPara;
+ nEndPara = nTmp;
+ }
+}
+
+class EDITENG_DLLPUBLIC OutlinerView
+{
+ friend class Outliner;
+
+private:
+
+ Outliner* pOwner;
+ EditView* pEditView;
+
+ // Drag & Drop
+ sal_Bool bBeginDragAtMove_OLDMEMBER;
+ sal_Bool bInDragMode;
+ Point aDDStartPosRef;
+ Point aDDStartPosPix;
+ sal_uLong nDDStartPara;
+ sal_uLong nDDStartParaVisChildCount;
+ sal_uLong nDDCurPara;
+ sal_uInt16 nDDStartDepth;
+ sal_uInt16 nDDCurDepth;
+ sal_uInt16 nDDMaxDepth;
+ sal_Bool bDDChangingDepth;
+ sal_Bool bDDCursorVisible;
+ long* pHorTabArrDoc;
+ long nDDScrollLRBorderWidthWin; // Left Right
+ long nDDScrollTBBorderWidthWin; // Top Bottom
+ long nDDScrollLROffs;
+ long nDDScrollTDOffs;
+
+ void* pDummy;
+ sal_uLong nDummy;
+
+ enum MouseTarget {
+ MouseText = 0,
+ MouseBullet = 1,
+ MouseHypertext = 2, // Outside OutputArea
+ MouseOutside = 3, // Outside OutputArea
+ MouseDontKnow = 4
+ };
+ MouseTarget OLD_ePrevMouseTarget;
+
+#ifdef _OUTLINER_CXX
+
+ EDITENG_DLLPRIVATE void ImplExpandOrCollaps( sal_uInt16 nStartPara, sal_uInt16 nEndPara, sal_Bool bExpand );
+
+ EDITENG_DLLPRIVATE sal_uLong ImpCheckMousePos( const Point& rPosPixel, MouseTarget& reTarget);
+ EDITENG_DLLPRIVATE void ImpToggleExpand( Paragraph* pParentPara );
+ EDITENG_DLLPRIVATE ParaRange ImpGetSelectedParagraphs( sal_Bool bIncludeHiddenChildren );
+
+ EDITENG_DLLPRIVATE Pointer ImpGetMousePointer( MouseTarget eTarget );
+ EDITENG_DLLPRIVATE sal_uInt16 ImpInitPaste( sal_uLong& rStart );
+ EDITENG_DLLPRIVATE void ImpPasted( sal_uLong nStart, sal_uLong nPrevParaCount, sal_uInt16 nSize);
+ EDITENG_DLLPRIVATE sal_uInt16 ImpCalcSelectedPages( sal_Bool bIncludeFirstSelected );
+ EDITENG_DLLPRIVATE sal_Bool ImpIsIndentingPages();
+
+#endif
+
+public:
+ OutlinerView( Outliner* pOut, Window* pWindow );
+ virtual ~OutlinerView();
+
+ EditView& GetEditView() const { return *pEditView; }
+
+ void Scroll( long nHorzScroll, long nVertScroll );
+
+ void Paint( const Rectangle& rRect, OutputDevice* pTargetDevice = 0 );
+ sal_Bool PostKeyEvent( const KeyEvent& rKEvt, Window* pFrameWin = NULL );
+ sal_Bool MouseButtonDown( const MouseEvent& );
+ sal_Bool MouseButtonUp( const MouseEvent& );
+ sal_Bool MouseMove( const MouseEvent& );
+
+ void ShowCursor( sal_Bool bGotoCursor = sal_True );
+ void HideCursor();
+
+ Outliner* GetOutliner() const { return pOwner; }
+
+ void SetWindow( Window* pWindow );
+ Window* GetWindow() const;
+
+ void SetReadOnly( sal_Bool bReadOnly );
+ sal_Bool IsReadOnly() const;
+
+ void SetOutputArea( const Rectangle& rRect );
+ Rectangle GetOutputArea() const;
+
+ Rectangle GetVisArea() const;
+
+ void CreateSelectionList (std::vector<Paragraph*> &aSelList) ;
+
+ // Retruns the number of selected paragraphs
+ sal_uLong Select( Paragraph* pParagraph,
+ sal_Bool bSelect=sal_True,
+ sal_Bool bWChildren=sal_True);
+
+ String GetSelected() const;
+ void SelectRange( sal_uLong nFirst, sal_uInt16 nCount );
+ void SetAttribs( const SfxItemSet& );
+ void Indent( short nDiff );
+ void AdjustDepth( short nDX ); // Later replace with Indent!
+
+ sal_Bool AdjustHeight( long nDY );
+
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, EETextFormat eFormat, sal_Bool bSelect = sal_False, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+
+ void InsertText( const String& rNew, sal_Bool bSelect = sal_False );
+ void InsertText( const OutlinerParaObject& rParaObj );
+ void Expand();
+ void Collapse();
+ void ExpandAll();
+ void CollapseAll();
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor();
+
+ SfxItemSet GetAttribs();
+
+ void Cut();
+ void Copy();
+ void Paste();
+ void PasteSpecial();
+
+ const SfxStyleSheet* GetStyleSheet() const;
+ SfxStyleSheet* GetStyleSheet();
+
+ void SetControlWord( sal_uLong nWord );
+ sal_uLong GetControlWord() const;
+
+ void SetAnchorMode( EVAnchorMode eMode );
+ EVAnchorMode GetAnchorMode() const;
+
+ Pointer GetPointer( const Point& rPosPixel );
+ void Command( const CommandEvent& rCEvt );
+
+ EESpellState StartSpeller( sal_Bool bMultipleDoc = sal_False );
+ EESpellState StartThesaurus();
+ sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem );
+
+ // for text conversion
+ void StartTextConversion( LanguageType nSrcLang, LanguageType nDestLang, const Font *pDestFont, sal_Int32 nOptions, sal_Bool bIsInteractive, sal_Bool bMultipleDoc );
+
+ void TransliterateText( sal_Int32 nTransliterationMode );
+
+ ESelection GetSelection();
+
+ sal_uInt16 GetSelectedScriptType() const;
+
+ void SetVisArea( const Rectangle& rRect );
+ void SetSelection( const ESelection& );
+
+ void RemoveAttribs( sal_Bool bRemoveParaAttribs = sal_False, sal_uInt16 nWhich = 0, sal_Bool bKeepLanguages = sal_False );
+ void RemoveAttribsKeepLanguages( sal_Bool bRemoveParaAttribs );
+ sal_Bool HasSelection() const;
+
+ void InsertField( const SvxFieldItem& rFld );
+ const SvxFieldItem* GetFieldUnderMousePointer() const;
+ const SvxFieldItem* GetFieldAtSelection() const;
+
+ /** enables numbering for the selected paragraphs if the numbering of the first paragraph is off
+ or disables numbering for the selected paragraphs if the numbering of the first paragraph is on
+ */
+ void ToggleBullets();
+
+ /** enables numbering for the selected paragraphs that are not enabled and ignore all selected
+ paragraphs that already have numbering enabled.
+ */
+ void EnableBullets();
+
+ sal_Bool IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
+ sal_Bool IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
+ void ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
+
+ void SetInvalidateMore( sal_uInt16 nPixel );
+ sal_uInt16 GetInvalidateMore() const;
+
+ String GetSurroundingText() const;
+ Selection GetSurroundingTextSelection() const;
+};
+
+
+// some thesaurus functionality to avoid code duplication in different projects...
+bool EDITENG_DLLPUBLIC GetStatusValueForThesaurusFromContext( String &rStatusVal, LanguageType &rLang, const EditView &rEditView );
+void EDITENG_DLLPUBLIC ReplaceTextWithSynonym( EditView &rEditView, const String &rSynonmText );
+
+typedef ::std::vector< OutlinerView* > ViewList;
+
+class EDITENG_DLLPUBLIC DrawPortionInfo
+{
+public:
+ const Point& mrStartPos;
+ const String& mrText;
+ sal_uInt16 mnTextStart;
+ sal_uInt16 mnTextLen;
+ sal_uInt16 mnPara;
+ xub_StrLen mnIndex;
+ const SvxFont& mrFont;
+ const sal_Int32* mpDXArray;
+
+ const EEngineData::WrongSpellVector* mpWrongSpellVector;
+ const SvxFieldData* mpFieldData;
+ const ::com::sun::star::lang::Locale* mpLocale;
+ const Color maOverlineColor;
+ const Color maTextLineColor;
+
+ sal_uInt8 mnBiDiLevel;
+
+ bool mbFilled;
+ long mnWidthToFill;
+
+ // bitfield
+ unsigned mbEndOfLine : 1;
+ unsigned mbEndOfParagraph : 1;
+ unsigned mbEndOfBullet : 1;
+
+ sal_uInt8 GetBiDiLevel() const { return mnBiDiLevel; }
+ sal_Bool IsRTL() const { return mnBiDiLevel % 2 ? sal_True : sal_False; }
+
+ DrawPortionInfo(
+ const Point& rPos,
+ const String& rTxt,
+ sal_uInt16 nTxtStart,
+ sal_uInt16 nTxtLen,
+ const SvxFont& rFnt,
+ sal_uInt16 nPar,
+ xub_StrLen nIdx,
+ const sal_Int32* pDXArr,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ const ::com::sun::star::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor,
+ sal_uInt8 nBiDiLevel,
+ bool bFilled,
+ long nWidthToFill,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet)
+ : mrStartPos(rPos),
+ mrText(rTxt),
+ mnTextStart(nTxtStart),
+ mnTextLen(nTxtLen),
+ mnPara(nPar),
+ mnIndex(nIdx),
+ mrFont(rFnt),
+ mpDXArray(pDXArr),
+ mpWrongSpellVector(pWrongSpellVector),
+ mpFieldData(pFieldData),
+ mpLocale(pLocale),
+ maOverlineColor(rOverlineColor),
+ maTextLineColor(rTextLineColor),
+ mnBiDiLevel(nBiDiLevel),
+ mbFilled( bFilled ),
+ mnWidthToFill( nWidthToFill ),
+ mbEndOfLine(bEndOfLine),
+ mbEndOfParagraph(bEndOfParagraph),
+ mbEndOfBullet(bEndOfBullet)
+ {}
+};
+
+class EDITENG_DLLPUBLIC DrawBulletInfo
+{
+public:
+ const GraphicObject maBulletGraphicObject;
+ Point maBulletPosition;
+ Size maBulletSize;
+
+ DrawBulletInfo(
+ const GraphicObject& rBulletGraphicObject,
+ const Point& rBulletPosition,
+ const Size& rBulletSize)
+ : maBulletGraphicObject(rBulletGraphicObject),
+ maBulletPosition(rBulletPosition),
+ maBulletSize(rBulletSize)
+ {}
+};
+
+struct EDITENG_DLLPUBLIC PaintFirstLineInfo
+{
+ sal_uInt16 mnPara;
+ const Point& mrStartPos;
+ long mnBaseLineY;
+ const Point& mrOrigin;
+ short mnOrientation;
+ OutputDevice* mpOutDev;
+
+ PaintFirstLineInfo( sal_uInt16 nPara, const Point& rStartPos, long nBaseLineY, const Point& rOrigin, short nOrientation, OutputDevice* pOutDev )
+ : mnPara( nPara ), mrStartPos( rStartPos ), mnBaseLineY( nBaseLineY ), mrOrigin( rOrigin ), mnOrientation( nOrientation ), mpOutDev( pOutDev )
+ {}
+};
+
+class SdrPage;
+
+class EditFieldInfo
+{
+private:
+ Outliner* pOutliner;
+ const SvxFieldItem& rFldItem;
+
+ Color* pTxtColor;
+ Color* pFldColor;
+
+ String aRepresentation;
+
+ sal_uInt16 nPara;
+ xub_StrLen nPos;
+ sal_Bool bSimpleClick;
+
+ EditFieldInfo();
+ EditFieldInfo( const EditFieldInfo& );
+
+ SdrPage* mpSdrPage;
+
+public:
+ EditFieldInfo( Outliner* pOutl, const SvxFieldItem& rFItem, sal_uInt16 nPa, xub_StrLen nPo )
+ : rFldItem( rFItem )
+ {
+ pOutliner = pOutl;
+ nPara = nPa; nPos = nPo;
+ pTxtColor = 0; pFldColor = 0; bSimpleClick = sal_False;
+ mpSdrPage = 0;
+ }
+ ~EditFieldInfo()
+ {
+ delete pTxtColor;
+ delete pFldColor;
+ }
+
+ Outliner* GetOutliner() const { return pOutliner; }
+
+ const SvxFieldItem& GetField() const { return rFldItem; }
+
+ Color* GetTxtColor() const { return pTxtColor; }
+ void SetTxtColor( const Color& rColor )
+ { delete pTxtColor; pTxtColor = new Color( rColor ); }
+
+ Color* GetFldColor() const { return pFldColor; }
+ void SetFldColor( const Color& rColor )
+ { delete pFldColor; pFldColor = new Color( rColor ); }
+ void ClearFldColor()
+ { delete pFldColor; pFldColor = 0; }
+
+ sal_uInt16 GetPara() const { return nPara; }
+ xub_StrLen GetPos() const { return nPos; }
+
+ sal_Bool IsSimpleClick() const { return bSimpleClick; }
+ void SetSimpleClick( sal_Bool bSimple ) { bSimpleClick = bSimple; }
+
+ const String& GetRepresentation() const { return aRepresentation; }
+ String& GetRepresentation() { return aRepresentation; }
+ void SetRepresentation( const String& rStr ) { aRepresentation = rStr; }
+
+ void SetSdrPage( SdrPage* pPage ) { mpSdrPage = pPage; }
+ SdrPage* GetSdrPage() const { return mpSdrPage; }
+};
+
+struct EBulletInfo
+{
+ sal_Bool bVisible;
+ sal_uInt16 nType; // see SvxNumberType
+ String aText;
+ SvxFont aFont;
+ Graphic aGraphic;
+ sal_uInt16 nParagraph;
+ Rectangle aBounds;
+
+ EBulletInfo() : bVisible( sal_False ), nType( 0 ), nParagraph( EE_PARA_NOT_FOUND ) {}
+};
+
+#define OUTLINERMODE_DONTKNOW 0x0000
+#define OUTLINERMODE_TEXTOBJECT 0x0001
+#define OUTLINERMODE_TITLEOBJECT 0x0002
+#define OUTLINERMODE_OUTLINEOBJECT 0x0003
+#define OUTLINERMODE_OUTLINEVIEW 0x0004
+
+#define OUTLINERMODE_USERMASK 0x00FF
+
+#define OUTLINERMODE_SUBTITLE (0x0100|OUTLINERMODE_TEXTOBJECT)
+#define OUTLINERMODE_NOTE (0x0200|OUTLINERMODE_TEXTOBJECT)
+
+class EDITENG_DLLPUBLIC Outliner : public SfxBroadcaster
+{
+ friend class OutlinerView;
+ friend class OutlinerEditEng;
+ friend class OutlinerParaObject;
+ friend class OLUndoExpand;
+ friend class OutlinerUndoChangeDepth;
+ friend class OutlinerUndoCheckPara;
+ friend class OutlinerUndoChangeParaFlags;
+
+ OutlinerEditEng* pEditEngine;
+
+ ParagraphList* pParaList;
+ ViewList aViewList;
+
+ Paragraph* pHdlParagraph;
+ sal_uLong mnFirstSelPage;
+ Link aDrawPortionHdl;
+ Link aDrawBulletHdl;
+ Link aExpandHdl;
+ Link aParaInsertedHdl;
+ Link aParaRemovingHdl;
+ Link aDepthChangedHdl;
+ Link aWidthArrReqHdl;
+ Link aBeginMovingHdl;
+ Link aEndMovingHdl;
+ Link aIndentingPagesHdl;
+ Link aRemovingPagesHdl;
+ Link aFieldClickedHdl;
+ Link aCalcFieldValueHdl;
+ Link maPaintFirstLineHdl;
+ Link maBeginPasteOrDropHdl;
+ Link maEndPasteOrDropHdl;
+
+ sal_Int16 nDepthChangedHdlPrevDepth;
+ sal_uInt16 mnDepthChangeHdlPrevFlags;
+ sal_Int16 nMaxDepth;
+ const sal_Int16 nMinDepth;
+ sal_uInt16 nFirstPage;
+
+ sal_uInt16 nOutlinerMode;
+
+ sal_Bool bIsExpanding; // Only valid in Expand/Collaps-Hdl, reset
+ sal_Bool bFirstParaIsEmpty;
+ sal_Bool bBlockInsCallback;
+ sal_Bool bStrippingPortions;
+ sal_Bool bPasting;
+
+ sal_uLong nDummy;
+
+#ifdef _OUTLINER_CXX
+
+ DECL_LINK( ParaVisibleStateChangedHdl, Paragraph* );
+ DECL_LINK( BeginMovingParagraphsHdl, void* );
+ DECL_LINK( EndMovingParagraphsHdl, MoveParagraphsInfo* );
+ DECL_LINK( BeginPasteOrDropHdl, PasteOrDropInfos* );
+ DECL_LINK( EndPasteOrDropHdl, PasteOrDropInfos* );
+ DECL_LINK( EditEngineNotifyHdl, EENotify* );
+ void ImplCheckParagraphs( sal_uInt16 nStart, sal_uInt16 nEnd );
+ sal_Bool ImplHasBullet( sal_uInt16 nPara ) const;
+ Size ImplGetBulletSize( sal_uInt16 nPara );
+ sal_uInt16 ImplGetNumbering( sal_uInt16 nPara, const SvxNumberFormat* pParaFmt );
+ void ImplCalcBulletText( sal_uInt16 nPara, sal_Bool bRecalcLevel, sal_Bool bRecalcChildren );
+ String ImplGetBulletText( sal_uInt16 nPara );
+ void ImplCheckNumBulletItem( sal_uInt16 nPara );
+ void ImplInitDepth( sal_uInt16 nPara, sal_Int16 nDepth, sal_Bool bCreateUndo, sal_Bool bUndoAction = sal_False );
+ void ImplSetLevelDependendStyleSheet( sal_uInt16 nPara, SfxStyleSheet* pLevelStyle = NULL );
+
+ void ImplBlockInsertionCallbacks( sal_Bool b );
+
+ void ImplCheckStyleSheet( sal_uInt16 nPara, sal_Bool bReplaceExistingStyle );
+ void ImpRecalcBulletIndent( sal_uLong nPara );
+
+ const SvxBulletItem& ImpGetBullet( sal_uLong nPara, sal_uInt16& );
+ void ImpFilterIndents( sal_uLong nFirstPara, sal_uLong nLastPara );
+ bool ImpConvertEdtToOut( sal_uInt32 nPara, EditView* pView = 0 );
+
+ void ImpTextPasted( sal_uLong nStartPara, sal_uInt16 nCount );
+ long ImpCalcMaxBulletWidth( sal_uInt16 nPara, const SvxBulletItem& rBullet );
+ Font ImpCalcBulletFont( sal_uInt16 nPara ) const;
+ Rectangle ImpCalcBulletArea( sal_uInt16 nPara, sal_Bool bAdjust, sal_Bool bReturnPaperPos );
+ long ImpGetTextIndent( sal_uLong nPara );
+ sal_Bool ImpCanIndentSelectedPages( OutlinerView* pCurView );
+ sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView );
+ sal_Bool ImpCanDeleteSelectedPages( OutlinerView* pCurView, sal_uInt16 nFirstPage, sal_uInt16 nPages );
+
+ sal_uInt16 ImplGetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
+ void ImplCheckDepth( sal_Int16& rnDepth ) const;
+#endif
+
+protected:
+ void ParagraphInserted( sal_uInt16 nParagraph );
+ void ParagraphDeleted( sal_uInt16 nParagraph );
+ void ParaAttribsChanged( sal_uInt16 nParagraph );
+
+ virtual void StyleSheetChanged( SfxStyleSheet* pStyle );
+
+ void InvalidateBullet( Paragraph* pPara, sal_uLong nPara );
+ void PaintBullet( sal_uInt16 nPara, const Point& rStartPos,
+ const Point& rOrigin, short nOrientation,
+ OutputDevice* pOutDev );
+
+ // used by OutlinerEditEng. Allows Outliner objects to provide
+ // bullet access to the EditEngine.
+ virtual const SvxNumberFormat* GetNumberFormat( sal_uInt16 nPara ) const;
+
+public:
+
+ Outliner( SfxItemPool* pPool, sal_uInt16 nOutlinerMode );
+ virtual ~Outliner();
+
+ void Init( sal_uInt16 nOutlinerMode );
+ sal_uInt16 GetMode() const { return nOutlinerMode; }
+
+ void SetVertical( sal_Bool bVertical );
+ sal_Bool IsVertical() const;
+
+ void SetFixedCellHeight( sal_Bool bUseFixedCellHeight );
+
+ void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
+ EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
+
+ sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nPos ) const;
+
+ void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
+
+ void SetKernAsianPunctuation( sal_Bool bEnabled );
+
+ void SetAddExtLeading( sal_Bool b );
+
+ size_t InsertView( OutlinerView* pView, size_t nIndex = size_t(-1) );
+ OutlinerView* RemoveView( OutlinerView* pView );
+ OutlinerView* RemoveView( size_t nIndex );
+ OutlinerView* GetView( size_t nIndex ) const;
+ size_t GetViewCount() const;
+
+ Paragraph* Insert( const String& rText, sal_uLong nAbsPos = CONTAINER_APPEND, sal_Int16 nDepth = 0 );
+ void SetText( const OutlinerParaObject& );
+ void AddText( const OutlinerParaObject& );
+ void SetText( const String& rText, Paragraph* pParagraph );
+ String GetText( Paragraph* pPara, sal_uLong nParaCount=1 ) const;
+
+ OutlinerParaObject* CreateParaObject( sal_uInt16 nStartPara = 0, sal_uInt16 nParaCount = 0xFFFF ) const;
+
+ const SfxItemSet& GetEmptyItemSet() const;
+
+ void SetRefMapMode( const MapMode& );
+ MapMode GetRefMapMode() const;
+
+ void SetBackgroundColor( const Color& rColor );
+ Color GetBackgroundColor() const;
+
+ sal_Int16 GetMinDepth() const { return -1; }
+
+ void SetMaxDepth( sal_Int16 nDepth, sal_Bool bCheckParas = sal_False );
+ sal_Int16 GetMaxDepth() const { return nMaxDepth; }
+
+ void SetUpdateMode( sal_Bool bUpdate );
+ sal_Bool GetUpdateMode() const;
+
+ void Clear();
+
+ void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+
+ sal_uLong GetParagraphCount() const;
+ Paragraph* GetParagraph( sal_uLong nAbsPos ) const;
+
+ sal_Bool HasParent( Paragraph* pParagraph ) const;
+ sal_Bool HasChildren( Paragraph* pParagraph ) const;
+ sal_uLong GetChildCount( Paragraph* pParent ) const;
+ sal_Bool IsExpanded( Paragraph* pPara ) const;
+ Paragraph* GetParent( Paragraph* pParagraph ) const;
+ sal_uLong GetAbsPos( Paragraph* pPara );
+
+ sal_Int16 GetDepth( sal_uLong nPara ) const;
+ void SetDepth( Paragraph* pParagraph, sal_Int16 nNewDepth );
+
+ sal_Bool IsVisible( Paragraph* pPara ) const { return pPara->IsVisible(); }
+
+ void EnableUndo( sal_Bool bEnable );
+ sal_Bool IsUndoEnabled() const;
+ void UndoActionStart( sal_uInt16 nId );
+ void UndoActionEnd( sal_uInt16 nId );
+ void InsertUndo( EditUndo* pUndo );
+ sal_Bool IsInUndo();
+
+ void ClearModifyFlag();
+ sal_Bool IsModified() const;
+
+ Paragraph* GetHdlParagraph() const { return pHdlParagraph; }
+ sal_Bool IsExpanding() const { return bIsExpanding; }
+
+ virtual void ExpandHdl();
+ void SetExpandHdl( const Link& rLink ) { aExpandHdl = rLink; }
+ Link GetExpandHdl() const { return aExpandHdl; }
+
+ virtual void ParagraphInsertedHdl();
+ void SetParaInsertedHdl(const Link& rLink){aParaInsertedHdl=rLink;}
+ Link GetParaInsertedHdl() const { return aParaInsertedHdl; }
+
+ virtual void ParagraphRemovingHdl();
+ void SetParaRemovingHdl(const Link& rLink){aParaRemovingHdl=rLink;}
+ Link GetParaRemovingHdl() const { return aParaRemovingHdl; }
+
+ virtual void DepthChangedHdl();
+ void SetDepthChangedHdl(const Link& rLink){aDepthChangedHdl=rLink;}
+ Link GetDepthChangedHdl() const { return aDepthChangedHdl; }
+ sal_Int16 GetPrevDepth() const { return nDepthChangedHdlPrevDepth; }
+ sal_uInt16 GetPrevFlags() const { return mnDepthChangeHdlPrevFlags; }
+
+ virtual long RemovingPagesHdl( OutlinerView* );
+ void SetRemovingPagesHdl(const Link& rLink){aRemovingPagesHdl=rLink;}
+ Link GetRemovingPagesHdl() const { return aRemovingPagesHdl; }
+ virtual long IndentingPagesHdl( OutlinerView* );
+ void SetIndentingPagesHdl(const Link& rLink){aIndentingPagesHdl=rLink;}
+ Link GetIndentingPagesHdl() const { return aIndentingPagesHdl; }
+ // valid only in the two upper handlers
+ sal_uInt16 GetSelPageCount() const { return nDepthChangedHdlPrevDepth; }
+
+ // valid only in the two upper handlers
+ sal_uLong GetFirstSelPage() const { return mnFirstSelPage; }
+
+ void SetCalcFieldValueHdl(const Link& rLink ) { aCalcFieldValueHdl= rLink; }
+ Link GetCalcFieldValueHdl() const { return aCalcFieldValueHdl; }
+
+ void SetFieldClickedHdl(const Link& rLink ) { aFieldClickedHdl= rLink; }
+ Link GetFieldClickedHdl() const { return aFieldClickedHdl; }
+
+ void SetDrawPortionHdl(const Link& rLink){aDrawPortionHdl=rLink;}
+ Link GetDrawPortionHdl() const { return aDrawPortionHdl; }
+
+ void SetDrawBulletHdl(const Link& rLink){aDrawBulletHdl=rLink;}
+ Link GetDrawBulletHdl() const { return aDrawBulletHdl; }
+
+ void SetPaintFirstLineHdl(const Link& rLink) { maPaintFirstLineHdl = rLink; }
+ Link GetPaintFirstLineHdl() const { return maPaintFirstLineHdl; }
+
+ void SetModifyHdl( const Link& rLink );
+ Link GetModifyHdl() const;
+
+ void SetNotifyHdl( const Link& rLink );
+
+ void SetStatusEventHdl( const Link& rLink );
+ Link GetStatusEventHdl() const;
+
+ void Draw( OutputDevice* pOutDev, const Rectangle& rOutRect );
+ void Draw( OutputDevice* pOutDev, const Point& rStartPos, short nOrientation = 0 );
+
+ const Size& GetPaperSize() const;
+ void SetPaperSize( const Size& rSize );
+
+ void SetFirstPageNumber( sal_uInt16 n ) { nFirstPage = n; }
+ sal_uInt16 GetFirstPageNumber() const { return nFirstPage; }
+
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon );
+ void SetPolygon( const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::B2DPolyPolygon* pLinePolyPolygon);
+ void ClearPolygon();
+
+ const Size& GetMinAutoPaperSize() const;
+ void SetMinAutoPaperSize( const Size& rSz );
+
+ const Size& GetMaxAutoPaperSize() const;
+ void SetMaxAutoPaperSize( const Size& rSz );
+
+ void SetDefTab( sal_uInt16 nTab );
+
+ sal_Bool IsFlatMode() const;
+ void SetFlatMode( sal_Bool bFlat );
+
+ void EnableAutoColor( sal_Bool b );
+
+ void ForceAutoColor( sal_Bool b );
+ sal_Bool IsForceAutoColor() const;
+
+ EBulletInfo GetBulletInfo( sal_uInt16 nPara );
+
+ void SetWordDelimiters( const String& rDelimiters );
+ String GetWordDelimiters() const;
+ String GetWord( sal_uInt16 nPara, xub_StrLen nIndex );
+
+ void StripPortions();
+
+ virtual void DrawingText(
+ const Point& rStartPos, const String& rText, sal_uInt16 nTextStart, sal_uInt16 nTextLen,
+ const sal_Int32* pDXArray, const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ const EEngineData::WrongSpellVector* pWrongSpellVector,
+ const SvxFieldData* pFieldData,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ bool bEndOfBullet,
+ const ::com::sun::star::lang::Locale* pLocale,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ virtual void DrawingTab(
+ const Point& rStartPos, long nWidth, const String& rChar,
+ const SvxFont& rFont, sal_uInt16 nPara, xub_StrLen nIndex, sal_uInt8 nRightToLeft,
+ bool bEndOfLine,
+ bool bEndOfParagraph,
+ const Color& rOverlineColor,
+ const Color& rTextLineColor);
+
+ Size CalcTextSize();
+ Size CalcTextSizeNTP();
+
+ void SetStyleSheetPool( SfxStyleSheetPool* pSPool );
+ SfxStyleSheetPool* GetStyleSheetPool();
+
+ sal_Bool IsInSelectionMode() const;
+
+ void SetStyleSheet( sal_uLong nPara, SfxStyleSheet* pStyle );
+ SfxStyleSheet* GetStyleSheet( sal_uLong nPara );
+
+ void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& );
+ SfxItemSet GetParaAttribs( sal_uInt16 nPara );
+
+ void Remove( Paragraph* pPara, sal_uLong nParaCount );
+ sal_Bool Expand( Paragraph* );
+ sal_Bool Collapse( Paragraph* );
+
+ void SetParaFlag( Paragraph* pPara, sal_uInt16 nFlag );
+ bool HasParaFlag( const Paragraph* pPara, sal_uInt16 nFlag ) const;
+
+ // Returns an array containing the widths of the Bullet Indentations
+ // Last value must be -1. Is deleted by the outliner.
+ Link GetWidthArrReqHdl() const{ return aWidthArrReqHdl; }
+ void SetWidthArrReqHdl(const Link& rLink){aWidthArrReqHdl=rLink; }
+
+ void SetControlWord( sal_uLong nWord );
+ sal_uLong GetControlWord() const;
+
+ Link GetBeginMovingHdl() const { return aBeginMovingHdl; }
+ void SetBeginMovingHdl(const Link& rLink) {aBeginMovingHdl=rLink;}
+ Link GetEndMovingHdl() const {return aEndMovingHdl;}
+ void SetEndMovingHdl( const Link& rLink){aEndMovingHdl=rLink;}
+
+ sal_uLong GetLineCount( sal_uLong nParagraph ) const;
+ sal_uInt16 GetLineLen( sal_uLong nParagraph, sal_uInt16 nLine ) const;
+ sal_uLong GetLineHeight( sal_uLong nParagraph, sal_uLong nLine = 0 );
+
+ // nFormat must be a value from the enum EETextFormat (due to CLOOKS)
+ sal_uLong Read( SvStream& rInput, const String& rBaseURL, sal_uInt16, SvKeyValueIterator* pHTTPHeaderAttrs = NULL );
+
+ ::svl::IUndoManager&
+ GetUndoManager();
+
+ void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ void QuickInsertLineBreak( const ESelection& rSel );
+
+ // Only for EditEngine mode
+ void QuickInsertText( const String& rText, const ESelection& rSel );
+ void QuickDelete( const ESelection& rSel );
+ void QuickRemoveCharAttribs( sal_uInt16 nPara, sal_uInt16 nWhich = 0 );
+ void QuickFormatDoc( sal_Bool bFull = sal_False );
+
+ sal_Bool UpdateFields();
+ void RemoveFields( sal_Bool bKeepFieldText, TypeId aType = NULL );
+
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual void FieldSelected( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos, Color*& rTxtColor, Color*& rFldColor );
+
+ void SetSpeller( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpeller );
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetSpeller();
+ void SetHyphenator( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator >& xHyph );
+
+ void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> xForbiddenChars );
+
+ // Depricated
+ void SetDefaultLanguage( LanguageType eLang );
+ LanguageType GetDefaultLanguage() const;
+
+ void CompleteOnlineSpelling();
+
+ EESpellState HasSpellErrors();
+ sal_Bool HasText( const SvxSearchItem& rSearchItem );
+ virtual sal_Bool SpellNextDocument();
+
+ // for text conversion
+ sal_Bool HasConvertibleTextPortion( LanguageType nLang );
+ virtual sal_Bool ConvertNextDocument();
+
+ void SetEditTextObjectPool( SfxItemPool* pPool );
+ SfxItemPool* GetEditTextObjectPool() const;
+
+ void SetRefDevice( OutputDevice* pRefDev );
+ OutputDevice* GetRefDevice() const;
+
+ sal_uLong GetTextHeight() const;
+ sal_uLong GetTextHeight( sal_uLong nParagraph ) const;
+ Point GetDocPosTopLeft( sal_uLong nParagraph );
+ Point GetDocPos( const Point& rPaperPos ) const;
+ sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder = 0 );
+ sal_Bool IsTextPos( const Point& rPaperPos, sal_uInt16 nBorder, sal_Bool* pbBuuletPos );
+
+ void SetGlobalCharStretching( sal_uInt16 nX = 100, sal_uInt16 nY = 100 );
+ void GetGlobalCharStretching( sal_uInt16& rX, sal_uInt16& rY ) const;
+ void EraseVirtualDevice();
+
+ sal_Bool ShouldCreateBigTextObject() const;
+
+ const EditEngine& GetEditEngine() const { return *((EditEngine*)pEditEngine); }
+
+ // this is needed for StarOffice Api
+ void SetLevelDependendStyleSheet( sal_uInt16 nPara );
+
+ sal_uInt16 GetOutlinerMode() const { return nOutlinerMode & OUTLINERMODE_USERMASK; }
+
+ void StartSpelling(EditView& rEditView, sal_Bool bMultipleDoc);
+ // spell and return a sentence
+ bool SpellSentence(EditView& rEditView, ::svx::SpellPortions& rToFill, bool bIsGrammarChecking );
+ // put spell position to start of current sentence
+ void PutSpellingToSentenceStart( EditView& rEditView );
+ // applies a changed sentence
+ void ApplyChangedSentence(EditView& rEditView, const ::svx::SpellPortions& rNewPortions, bool bRecheck );
+
+ /** sets a link that is called at the beginning of a drag operation at an edit view */
+ void SetBeginDropHdl( const Link& rLink );
+
+ /** sets a link that is called at the end of a drag operation at an edit view */
+ void SetEndDropHdl( const Link& rLink );
+
+ /** sets a link that is called before a drop or paste operation. */
+ void SetBeginPasteOrDropHdl( const Link& rLink );
+ Link GetBeginPasteOrDropHdl() const { return maBeginPasteOrDropHdl; }
+
+ /** sets a link that is called after a drop or paste operation. */
+ void SetEndPasteOrDropHdl( const Link& rLink );
+ Link GetEndPasteOrDropHdl() const { return maEndPasteOrDropHdl; }
+
+ virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
+ virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
+
+ virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
+ virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/outlobj.hxx b/include/editeng/outlobj.hxx
new file mode 100644
index 000000000000..73eb9b5b96d5
--- /dev/null
+++ b/include/editeng/outlobj.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OUTLOBJ_HXX
+#define _OUTLOBJ_HXX
+
+//////////////////////////////////////////////////////////////////////////////
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <rsc/rscsfx.hxx>
+#include <editeng/paragraphdata.hxx>
+#include "editeng/editengdllapi.h"
+
+class EditTextObject;
+class ImplOutlinerParaObject;
+
+//////////////////////////////////////////////////////////////////////////////
+
+class EDITENG_DLLPUBLIC OutlinerParaObject
+{
+private:
+ ImplOutlinerParaObject* mpImplOutlinerParaObject;
+
+ void ImplMakeUnique();
+
+public:
+ // constructors/destructor
+ OutlinerParaObject(
+ const EditTextObject& rEditTextObject,
+ const ParagraphDataVector& rParagraphDataVector = ParagraphDataVector(),
+ bool bIsEditDoc = true);
+ OutlinerParaObject(const OutlinerParaObject& rCandidate);
+ ~OutlinerParaObject();
+
+ // assignment operator
+ OutlinerParaObject& operator=(const OutlinerParaObject& rCandidate);
+
+ // compare operator
+ bool operator==(const OutlinerParaObject& rCandidate) const;
+ bool operator!=(const OutlinerParaObject& rCandidate) const { return !operator==(rCandidate); }
+
+ // #i102062#
+ bool isWrongListEqual(const OutlinerParaObject& rCompare) const;
+
+ // outliner mode access
+ sal_uInt16 GetOutlinerMode() const;
+ void SetOutlinerMode(sal_uInt16 nNew);
+
+ // vertical access
+ bool IsVertical() const;
+ void SetVertical(bool bNew);
+
+ // data read access
+ sal_uInt32 Count() const;
+ sal_Int16 GetDepth(sal_uInt16 nPara) const;
+ const EditTextObject& GetTextObject() const;
+ bool IsEditDoc() const;
+ const ParagraphData& GetParagraphData(sal_uInt32 nIndex) const;
+
+ // portion info support
+ void ClearPortionInfo();
+
+ // StyleSheet support
+ bool ChangeStyleSheets(const OUString& rOldName, SfxStyleFamily eOldFamily,
+ const OUString& rNewName, SfxStyleFamily eNewFamily);
+ void ChangeStyleSheetName(SfxStyleFamily eFamily, const OUString& rOldName,
+ const OUString& rNewName);
+ void SetStyleSheets(sal_uInt16 nLevel, const OUString rNewName,
+ const SfxStyleFamily& rNewFamily);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paperinf.hxx b/include/editeng/paperinf.hxx
new file mode 100644
index 000000000000..2c53ca554122
--- /dev/null
+++ b/include/editeng/paperinf.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PAPERINF_HXX
+#define _SVX_PAPERINF_HXX
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <vcl/print.hxx>
+#include <vcl/mapmod.hxx>
+#include <editeng/svxenum.hxx>
+#include "editeng/editengdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+class Printer;
+class Size;
+class String;
+
+// class SvxPaperInfo -----------------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxPaperInfo
+{
+public:
+ static Size GetDefaultPaperSize( MapUnit eUnit = MAP_TWIP );
+ static Size GetPaperSize( Paper ePaper, MapUnit eUnit = MAP_TWIP );
+ static Size GetPaperSize( const Printer* pPrinter );
+ static Paper GetSvxPaper( const Size &rSize, MapUnit eUnit = MAP_TWIP, bool bSloppy = sal_False );
+ static long GetSloppyPaperDimension( long nSize, MapUnit eUnit = MAP_TWIP );
+ static String GetName( Paper ePaper );
+};
+
+// INLINE -----------------------------------------------------------------
+
+inline Size &Swap(Size &rSize)
+{
+ const long lVal = rSize.Width();
+ rSize.Width() = rSize.Height();
+ rSize.Height() = lVal;
+ return rSize;
+}
+
+inline Size &LandscapeSwap(Size &rSize)
+{
+ if ( rSize.Height() > rSize.Width() )
+ Swap( rSize );
+ return rSize;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paragraphdata.hxx b/include/editeng/paragraphdata.hxx
new file mode 100644
index 000000000000..81d12bb00a2f
--- /dev/null
+++ b/include/editeng/paragraphdata.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _PARAGRAPH_DATA_HXX
+#define _PARAGRAPH_DATA_HXX
+
+#include <tools/solar.h>
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+// Only for internal use, oder some kind like hPara for the few
+// functions where you need it outside ( eg. moving paragraphs... )
+//
+// Unfortunately NOT only local (formally in outliner.hxx), but also
+// used in outlobj.hxx. Moved to own header
+
+class ParagraphData
+{
+ friend class Paragraph;
+ friend class OutlinerParaObject;
+
+protected:
+ sal_Int16 nDepth;
+ sal_Int16 mnNumberingStartValue;
+ sal_Bool mbParaIsNumberingRestart;
+
+public:
+ ParagraphData( const ParagraphData& );
+ ParagraphData();
+
+ ParagraphData& operator=( const ParagraphData& );
+
+ // compare operator
+ bool operator==(const ParagraphData& rCandidate) const;
+
+ // data read access
+ sal_Int16 getDepth() const { return nDepth; }
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+typedef ::std::vector< ParagraphData > ParagraphDataVector;
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif // _PARAGRAPH_DATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/paravertalignitem.hxx b/include/editeng/paravertalignitem.hxx
new file mode 100644
index 000000000000..ab65b8994325
--- /dev/null
+++ b/include/editeng/paravertalignitem.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PARAVERTALIGNITEM_HXX
+#define _SVX_PARAVERTALIGNITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxParaVertAlignItem ----------------------------------------------
+
+/* [Description]
+
+ This item defines the character alignment in the lines of a paragraph.
+ Currently the alignment can be none (i.e. baseline), top, center or bottom.
+
+*/
+
+class EDITENG_DLLPUBLIC SvxParaVertAlignItem : public SfxUInt16Item
+{
+public:
+ enum { AUTOMATIC, BASELINE, TOP, CENTER, BOTTOM };
+ TYPEINFO();
+
+ SvxParaVertAlignItem( sal_uInt16 nValue /*= 0*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ inline SvxParaVertAlignItem& operator=( const SvxParaVertAlignItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pbinitem.hxx b/include/editeng/pbinitem.hxx
new file mode 100644
index 000000000000..38630c78f86c
--- /dev/null
+++ b/include/editeng/pbinitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PBINITEM_HXX
+#define _SVX_PBINITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// define ----------------------------------------------------------------
+
+#define PAPERBIN_PRINTER_SETTINGS ((sal_uInt8)0xFF)
+
+// class SvxPaperBinItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes selecting a paper tray of the printer.
+*/
+
+class EDITENG_DLLPUBLIC SvxPaperBinItem : public SfxByteItem
+{
+public:
+ TYPEINFO();
+
+ explicit inline SvxPaperBinItem( const sal_uInt16 nId ,
+ const sal_uInt8 nTray = PAPERBIN_PRINTER_SETTINGS );
+ inline SvxPaperBinItem &operator=( const SvxPaperBinItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxPaperBinItem::SvxPaperBinItem( const sal_uInt16 nId, const sal_uInt8 nT )
+ : SfxByteItem( nId, nT )
+{}
+
+inline SvxPaperBinItem &SvxPaperBinItem::operator=(
+ const SvxPaperBinItem &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pgrditem.hxx b/include/editeng/pgrditem.hxx
new file mode 100644
index 000000000000..9c4c47cce882
--- /dev/null
+++ b/include/editeng/pgrditem.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PGRDITEM_HXX
+#define _SVX_PGRDITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxParaGridItem -------------------------------------------------
+
+
+/* [Description]
+
+ Paragraph snap to grid
+*/
+
+class EDITENG_DLLPUBLIC SvxParaGridItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxParaGridItem( const sal_Bool bSnapToGrid /*= sal_True*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/pmdlitem.hxx b/include/editeng/pmdlitem.hxx
new file mode 100644
index 000000000000..55fee950d8f0
--- /dev/null
+++ b/include/editeng/pmdlitem.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PMDLITEM_HXX
+#define _SVX_PMDLITEM_HXX
+
+#include <svl/stritem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxPageModelItem ------------------------------------------------
+
+/* [Description]
+
+ This item contains a name of a page template.
+*/
+
+class EDITENG_DLLPUBLIC SvxPageModelItem : public SfxStringItem
+{
+private:
+ sal_Bool bAuto;
+
+public:
+ TYPEINFO();
+
+ explicit inline SvxPageModelItem( sal_uInt16 nWh );
+ inline SvxPageModelItem( const String& rModel, sal_Bool bA /*= sal_False*/,
+ sal_uInt16 nWh );
+ inline SvxPageModelItem& operator=( const SvxPageModelItem& rModel );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+ sal_Bool IsAuto() const { return bAuto; }
+};
+
+inline SvxPageModelItem::SvxPageModelItem( sal_uInt16 nWh )
+ : bAuto( sal_False )
+{
+ SetWhich( nWh );
+}
+
+inline SvxPageModelItem::SvxPageModelItem( const String& rModel, sal_Bool bA,
+ sal_uInt16 nWh ) :
+ SfxStringItem( nWh, rModel ),
+ bAuto( bA )
+{}
+
+inline SvxPageModelItem& SvxPageModelItem::operator=( const SvxPageModelItem& rModel )
+{
+ SetValue( rModel.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx
new file mode 100644
index 000000000000..e547d5a5e438
--- /dev/null
+++ b/include/editeng/postitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_POSTITEM_HXX
+#define _SVX_POSTITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxPostureItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the font setting (Italic)
+*/
+
+class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxPostureItem( const FontItalic ePost /*= ITALIC_NONE*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SwEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ inline SvxPostureItem& operator=(const SvxPostureItem& rPost) {
+ SetValue( rPost.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontItalic GetPosture() const
+ { return (FontItalic)GetValue(); }
+ void SetPosture( FontItalic eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_POSTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/prntitem.hxx b/include/editeng/prntitem.hxx
new file mode 100644
index 000000000000..050131953dc3
--- /dev/null
+++ b/include/editeng/prntitem.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PRNTITEM_HXX
+#define _SVX_PRNTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include "editeng/editengdllapi.h"
+
+
+
+// class SvxPrintItem ----------------------------------------------------
+
+
+/* [Description]
+
+ This item describes a logical variable "Print yes or no".
+*/
+
+
+class EDITENG_DLLPUBLIC SvxPrintItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit SvxPrintItem( const sal_uInt16 nId , const sal_Bool bPrt = sal_True );
+ inline SvxPrintItem &operator=( const SvxPrintItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxPrintItem::SvxPrintItem( const sal_uInt16 nId, const sal_Bool bPrt )
+ : SfxBoolItem( nId, bPrt )
+{}
+
+inline SvxPrintItem &SvxPrintItem::operator=( const SvxPrintItem &rCpy )
+{
+ SetValue( rCpy.GetValue() );
+ return *this;
+}
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/protitem.hxx b/include/editeng/protitem.hxx
new file mode 100644
index 000000000000..37f2bec77998
--- /dev/null
+++ b/include/editeng/protitem.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PROTITEM_HXX
+#define _SVX_PROTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLUnitConverter;
+
+// class SvxProtectItem --------------------------------------------------
+
+
+/* [Description]
+
+ This item describes, if content, size or position should be protected.
+*/
+
+class EDITENG_DLLPUBLIC SvxProtectItem : public SfxPoolItem
+{
+ sal_Bool bCntnt :1; // Content protected
+ sal_Bool bSize :1; // Size protected
+ sal_Bool bPos :1; // Position protected
+
+public:
+ TYPEINFO();
+
+ explicit inline SvxProtectItem( const sal_uInt16 nId );
+ inline SvxProtectItem &operator=( const SvxProtectItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+
+ sal_Bool IsCntntProtected() const { return bCntnt; }
+ sal_Bool IsSizeProtected() const { return bSize; }
+ sal_Bool IsPosProtected() const { return bPos; }
+ void SetCntntProtect( sal_Bool bNew ) { bCntnt = bNew; }
+ void SetSizeProtect ( sal_Bool bNew ) { bSize = bNew; }
+ void SetPosProtect ( sal_Bool bNew ) { bPos = bNew; }
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+inline SvxProtectItem::SvxProtectItem( const sal_uInt16 nId )
+ : SfxPoolItem( nId )
+{
+ bCntnt = bSize = bPos = sal_False;
+}
+
+inline SvxProtectItem &SvxProtectItem::operator=( const SvxProtectItem &rCpy )
+{
+ bCntnt = rCpy.IsCntntProtected();
+ bSize = rCpy.IsSizeProtected();
+ bPos = rCpy.IsPosProtected();
+ return *this;
+}
+
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/prszitem.hxx b/include/editeng/prszitem.hxx
new file mode 100644
index 000000000000..d89669d8eca2
--- /dev/null
+++ b/include/editeng/prszitem.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_PRSZITEM_HXX
+#define _SVX_PRSZITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxPropSizeItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes the relative Font Size.
+*/
+
+class EDITENG_DLLPUBLIC SvxPropSizeItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxPropSizeItem( const sal_uInt16 nPercent /*= 100*/,
+ const sal_uInt16 nID );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxPropSizeItem& operator=(const SvxPropSizeItem& rPropSize)
+ {
+ SetValue( rPropSize.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/rsiditem.hxx b/include/editeng/rsiditem.hxx
new file mode 100644
index 000000000000..e98fb8e4e129
--- /dev/null
+++ b/include/editeng/rsiditem.hxx
@@ -0,0 +1,43 @@
+/* -*- 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.
+ *
+ * Major Contributor(s):
+ * [ Copyright (C) 2009 Tzvetelina Tzeneva <tzvetelina@gmail.com> (initial developer) ]
+ */
+#ifndef _SVX_RSIDITEM_HXX
+#define _SVX_RSIDITEM_HXX
+
+#include <svl/intitem.hxx>
+#include "editeng/editengdllapi.h"
+
+//----------------------
+// SvxRsidItem
+//----------------------
+
+class EDITENG_DLLPUBLIC SvxRsidItem : public SfxUInt32Item
+{
+public:
+ TYPEINFO();
+
+ SvxRsidItem( sal_uInt32 nRsid, sal_uInt16 nId ) : SfxUInt32Item( nId, nRsid ) {}
+ SvxRsidItem( SvStream& rIn, sal_uInt16 nId ) : SfxUInt32Item( nId, rIn ) {}
+
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = NULL ) const;
+ virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif // _SVX_RSIDITEM_HXX
diff --git a/include/editeng/scriptspaceitem.hxx b/include/editeng/scriptspaceitem.hxx
new file mode 100644
index 000000000000..f58234baf042
--- /dev/null
+++ b/include/editeng/scriptspaceitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SRIPTSPACEITEM_HXX
+#define _SVX_SRIPTSPACEITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxScriptSpaceItem ----------------------------------------------
+
+/* [Description]
+
+ This item describe the script type of the selected text and is only
+ used for the user interface.
+*/
+
+class EDITENG_DLLPUBLIC SvxScriptSpaceItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxScriptSpaceItem( sal_Bool bOn /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ inline SvxScriptSpaceItem& operator=(const SvxScriptSpaceItem& rItem )
+ {
+ SetValue( rItem.GetValue() );
+ return *this;
+ }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/scripttypeitem.hxx b/include/editeng/scripttypeitem.hxx
new file mode 100644
index 000000000000..a50f82d9d951
--- /dev/null
+++ b/include/editeng/scripttypeitem.hxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SCRIPTTYPEITEM_HXX
+#define _SVX_SCRIPTTYPEITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <svl/languageoptions.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxScriptTypeItem ----------------------------------------------
+
+/* [Description]
+
+ This item describes the script type of the selected text and is only
+ used for the user interface.
+*/
+
+EDITENG_DLLPUBLIC sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
+sal_uInt16 GetItemScriptType( short nI18NType );
+short GetI18NScriptType( sal_uInt16 nItemType );
+
+class EDITENG_DLLPUBLIC SvxScriptTypeItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ explicit SvxScriptTypeItem( sal_uInt16 nType = SCRIPTTYPE_LATIN );
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+
+};
+
+class EDITENG_DLLPUBLIC SvxScriptSetItem : public SfxSetItem
+{
+public:
+ TYPEINFO();
+
+ SvxScriptSetItem( sal_uInt16 nSlotId, SfxItemPool& rPool );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 nVersion ) const;
+
+ static const SfxPoolItem* GetItemOfScriptSet( const SfxItemSet& rSet,
+ sal_uInt16 nWhich );
+ inline const SfxPoolItem* GetItemOfScriptSet( sal_uInt16 _nWhich ) const
+ { return SvxScriptSetItem::GetItemOfScriptSet( GetItemSet(), _nWhich ); }
+
+ static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript );
+
+ const SfxPoolItem* GetItemOfScript( sal_uInt16 nScript ) const;
+
+ void PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem );
+
+ static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex);
+
+ void GetWhichIds( sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex) const;
+
+ static void GetSlotIds( sal_uInt16 nSlotId, sal_uInt16& rLatin, sal_uInt16& rAsian,
+ sal_uInt16& rComplex );
+ inline void GetSlotIds( sal_uInt16& rLatin, sal_uInt16& rAsian,
+ sal_uInt16& rComplex ) const
+ { GetSlotIds( Which(), rLatin, rAsian, rComplex ); }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/shaditem.hxx b/include/editeng/shaditem.hxx
new file mode 100644
index 000000000000..e76c77a7ec4e
--- /dev/null
+++ b/include/editeng/shaditem.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SHADITEM_HXX
+#define _SVX_SHADITEM_HXX
+
+#include <tools/color.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxShadowItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the shadow attribute (color, width and position).
+*/
+
+#define SHADOW_TOP ((sal_uInt16)0)
+#define SHADOW_BOTTOM ((sal_uInt16)1)
+#define SHADOW_LEFT ((sal_uInt16)2)
+#define SHADOW_RIGHT ((sal_uInt16)3)
+
+class EDITENG_DLLPUBLIC SvxShadowItem : public SfxEnumItemInterface
+{
+ Color aShadowColor;
+ sal_uInt16 nWidth;
+ SvxShadowLocation eLocation;
+public:
+ TYPEINFO();
+
+ explicit SvxShadowItem( const sal_uInt16 nId ,
+ const Color *pColor = 0, const sal_uInt16 nWidth = 100 /*5pt*/,
+ const SvxShadowLocation eLoc = SVX_SHADOW_NONE );
+
+ inline SvxShadowItem& operator=( const SvxShadowItem& rFmtShadow );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const Color& GetColor() const { return aShadowColor;}
+ void SetColor( const Color &rNew ) { aShadowColor = rNew; }
+
+ sal_uInt16 GetWidth() const { return nWidth; }
+ SvxShadowLocation GetLocation() const { return eLocation; }
+
+ void SetWidth( sal_uInt16 nNew ) { nWidth = nNew; }
+ void SetLocation( SvxShadowLocation eNew ) { eLocation = eNew; }
+
+ // Calculate width of the shadow on the page.
+ sal_uInt16 CalcShadowSpace( sal_uInt16 nShadow ) const;
+
+ virtual sal_uInt16 GetValueCount() const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetEnumValue() const;
+ virtual void SetEnumValue( sal_uInt16 nNewVal );
+};
+
+inline SvxShadowItem &SvxShadowItem::operator=( const SvxShadowItem& rFmtShadow )
+{
+ aShadowColor = rFmtShadow.aShadowColor;
+ nWidth = rFmtShadow.GetWidth();
+ eLocation = rFmtShadow.GetLocation();
+ return *this;
+}
+
+#endif // #ifndef _SVX_SHADITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/shdditem.hxx b/include/editeng/shdditem.hxx
new file mode 100644
index 000000000000..d738a8794f5f
--- /dev/null
+++ b/include/editeng/shdditem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SHDDITEM_HXX
+#define _SVX_SHDDITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxShadowedItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes, whether and how it is shaded.
+*/
+
+class EDITENG_DLLPUBLIC SvxShadowedItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxShadowedItem( const sal_Bool bShadowed /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxShadowedItem& operator=(const SvxShadowedItem& rShadow) {
+ SetValue(rShadow.GetValue());
+ return *this;
+ }
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/sizeitem.hxx b/include/editeng/sizeitem.hxx
new file mode 100644
index 000000000000..df70d40c47cf
--- /dev/null
+++ b/include/editeng/sizeitem.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SIZEITEM_HXX
+#define _SVX_SIZEITEM_HXX
+
+#include <tools/gen.hxx>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+// class SvxSizeItem -----------------------------------------------------
+
+/* [Description]
+
+ This item describes a two-dimensional size.
+*/
+
+class EDITENG_DLLPUBLIC SvxSizeItem : public SfxPoolItem
+{
+
+ Size aSize;
+
+public:
+ TYPEINFO();
+
+ explicit SvxSizeItem( const sal_uInt16 nId );
+ SvxSizeItem( const sal_uInt16 nId, const Size& rSize);
+
+ inline SvxSizeItem& operator=( const SvxSizeItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ const Size& GetSize() const { return aSize; }
+ void SetSize(const Size& rSize) { aSize = rSize; }
+};
+
+inline SvxSizeItem& SvxSizeItem::operator=( const SvxSizeItem &rCpy )
+{
+ aSize = rCpy.aSize;
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/spltitem.hxx b/include/editeng/spltitem.hxx
new file mode 100644
index 000000000000..a7a0a9f0665c
--- /dev/null
+++ b/include/editeng/spltitem.hxx
@@ -0,0 +1,68 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SPLTITEM_HXX
+#define _SVX_SPLTITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxFmtSplitItem -------------------------------------------------
+
+/* [Description]
+
+ This item describes a logical variable "split paragraph yes or no".
+*/
+
+class EDITENG_DLLPUBLIC SvxFmtSplitItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+ ~SvxFmtSplitItem();
+
+ inline SvxFmtSplitItem( const sal_Bool bSplit /*= sal_True*/,
+ const sal_uInt16 nWh );
+ inline SvxFmtSplitItem& operator=( const SvxFmtSplitItem& rSplit );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+};
+
+inline SvxFmtSplitItem::SvxFmtSplitItem( const sal_Bool bSplit, const sal_uInt16 nWh ) :
+ SfxBoolItem( nWh, bSplit )
+{}
+
+inline SvxFmtSplitItem& SvxFmtSplitItem::operator=(
+ const SvxFmtSplitItem& rSplit )
+{
+ SetValue( rSplit.GetValue() );
+ return *this;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx
new file mode 100644
index 000000000000..d4c9b8da8732
--- /dev/null
+++ b/include/editeng/splwrap.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SPLWRAP_HXX
+#define _SVX_SPLWRAP_HXX
+
+#include <editeng/svxenum.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include "editeng/editengdllapi.h"
+
+// forward ---------------------------------------------------------------
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ class XDictionary;
+ class XSpellChecker1;
+ class XHyphenator;
+}}}}
+
+class Window;
+
+// misc functions ---------------------------------------------------------------
+
+void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText );
+
+/*--------------------------------------------------------------------
+ Description: The SpellWrapper
+ --------------------------------------------------------------------*/
+
+class EDITENG_DLLPUBLIC SvxSpellWrapper {
+private:
+ friend class SvxSpellCheckDialog;
+ friend class SvxHyphenWordDialog;
+ friend struct SvxHyphenWordDialog_Impl;
+
+ Window* pWin;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > xLast; // result of last spelling/hyphenation attempt
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph;
+ sal_uInt16 nOldLang; // Set Language, only call SetLanguage on changes
+ sal_Bool bOtherCntnt : 1; // set => Check special sections initially
+ sal_Bool bDialog : 1; // Is pWin the Svx...Dialog?
+ sal_Bool bHyphen : 1; // Split instead of spell checking
+ sal_Bool bAuto : 1; // AutoCorrect available?
+ sal_Bool bReverse : 1; // Reverse spell check
+ sal_Bool bStartDone : 1; // Beginning already corrected
+ sal_Bool bEndDone : 1; // End part already corrected
+ sal_Bool bStartChk : 1; // Examine the beginning
+ sal_Bool bRevAllowed : 1; // Reverse spell check prohibited
+ sal_Bool bAllRight : 1; // Record wrong words in the dedicated
+ // dictionary and do not start the dialog.
+
+ EDITENG_DLLPRIVATE sal_Bool SpellNext(); // select next area
+ sal_Bool FindSpellError(); // Check for errors (over areas)
+
+public:
+ SvxSpellWrapper( Window* pWn,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > &xSpellChecker,
+ const sal_Bool bStart = sal_False, const sal_Bool bIsAllRight = sal_False,
+ const sal_Bool bOther = sal_False, const sal_Bool bRevAllow = sal_True );
+ SvxSpellWrapper( Window* pWn,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > &xHyphenator,
+ const sal_Bool bStart = sal_False, const sal_Bool bOther = sal_False );
+
+ virtual ~SvxSpellWrapper();
+
+ static sal_Int16 CheckSpellLang(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell,
+ sal_Int16 nLang );
+ static sal_Int16 CheckHyphLang(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph,
+ sal_Int16 nLang );
+
+ static void ShowLanguageErrors();
+
+ void SpellDocument(); // Perform Spell Checking
+ inline sal_Bool IsStartDone(){ return bStartDone; }
+ inline sal_Bool IsEndDone(){ return bEndDone; }
+ inline sal_Bool IsReverse(){ return bReverse; }
+ inline sal_Bool IsDialog(){ return bDialog; } // SvxSpellCheckDialog OnScreen
+ inline sal_Bool IsHyphen(){ return bHyphen; } // Split instead of Spell check
+ inline void SetHyphen( const sal_Bool bNew = sal_True ){ bHyphen = bNew; }
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 >
+ GetXSpellChecker() { return xSpell; }
+ inline ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator >
+ GetXHyphenator() { return xHyph; }
+ inline sal_Bool IsAllRight() { return bAllRight; }
+ inline Window* GetWin() { return pWin; }
+ // can possibly be omitted in ONE_LINGU:
+ inline void SetOldLang( const sal_uInt16 nNew ){ nOldLang = nNew; }
+ // can possibly be omitted in ONE_LINGU:
+ inline void ChangeLanguage( const sal_uInt16 nNew ) // call SetLanguage if needed.
+ { if ( nNew != nOldLang ) { SetLanguage( nNew ); nOldLang = nNew; } }
+ inline void EnableAutoCorrect() { bAuto = sal_True; }
+
+protected:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface >
+ GetLast() { return xLast; }
+ void SetLast(const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &xNewLast)
+ { xLast = xNewLast; }
+ virtual sal_Bool SpellMore(); // examine further documents?
+ virtual sal_Bool HasOtherCnt(); // Are there any special areas?
+ virtual void SpellStart( SvxSpellArea eSpell ); // Preparing the area
+ virtual sal_Bool SpellContinue(); // Check Areas
+ // Result available through GetLast
+ virtual void ReplaceAll( const String &rNewText, sal_Int16 nLanguage ); //Replace word from the replace list
+ virtual void StartThesaurus( const String &rWord, sal_uInt16 nLang );
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary >
+ GetAllRightDic() const;
+ virtual void SpellEnd(); // Finish area
+ virtual void ScrollArea(); // Set ScrollArea
+ // Replace word
+ virtual void ChangeWord( const String& rNewWord, const sal_uInt16 nLang );
+ // Wort via Thesaurus ersetzen
+ virtual void ChangeThesWord( const String& rNewWord );
+ virtual void SetLanguage( const sal_uInt16 nLang ); // Change Language
+ virtual void AutoCorrect( const String& rAktStr, const String& rNewStr );
+ virtual void InsertHyphen( const sal_uInt16 nPos ); // Insert hyphen
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx
new file mode 100644
index 000000000000..4f54d8f2f11b
--- /dev/null
+++ b/include/editeng/svxacorr.hxx
@@ -0,0 +1,441 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef EE_SVXACORR_HXX
+#define EE_SVXACORR_HXX
+
+#include <com/sun/star/embed/XStorage.hpp>
+
+#include <o3tl/sorted_vector.hxx>
+#include <tools/rtti.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/time.hxx>
+#include <tools/date.hxx>
+#include <tools/string.hxx>
+#include <editeng/swafopt.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <map>
+#include <set>
+#include <boost/unordered_map.hpp>
+#include <boost/ptr_container/ptr_map.hpp>
+
+class CharClass;
+class SfxPoolItem;
+class SvxAutoCorrect;
+class SfxObjectShell;
+class SotStorageRef;
+class SotStorage;
+class Window;
+
+struct CompareSvStringsISortDtor
+{
+ bool operator()( String* const& lhs, String* const& rhs ) const
+ {
+ return lhs->CompareIgnoreCaseToAscii( *rhs ) == COMPARE_LESS;
+ }
+};
+
+class SvStringsISortDtor
+ : public o3tl::sorted_vector<String*, CompareSvStringsISortDtor>
+{
+public:
+ ~SvStringsISortDtor() { DeleteAndDestroyAll(); }
+};
+
+// Auto correct flags
+const long CptlSttSntnc = 0x00000001; // Capital letters at the beginning of a sentence
+const long CptlSttWrd = 0x00000002; // not two Capital letters at the beginning of a word
+const long AddNonBrkSpace = 0x00000004; // Add non breaking space before :;?!%
+const long ChgOrdinalNumber = 0x00000008; // Ordinal-Number 1st, 2nd,..
+const long ChgToEnEmDash = 0x00000010; // - -> Endash/Emdash
+const long ChgWeightUnderl = 0x00000020; // * -> Bold, _ -> Underscore
+const long SetINetAttr = 0x00000040; // Set INetAttribut
+const long Autocorrect = 0x00000080; // Call AutoCorrect
+const long ChgQuotes = 0x00000100; // replace double quotes
+const long SaveWordCplSttLst= 0x00000200; // Save Auto correction of Capital letter at beginning of sentence.
+const long SaveWordWrdSttLst= 0x00000400; // Save Auto correction of 2 Capital letter at beginning of word.
+const long IgnoreDoubleSpace= 0x00000800; // Ignore 2 Spaces
+const long ChgSglQuotes = 0x00001000; // Replace simple quotes
+const long CorrectCapsLock = 0x00002000; // Correct accidental use of cAPS LOCK key
+
+const long ChgWordLstLoad = 0x20000000; // Replacement list loaded
+const long CplSttLstLoad = 0x40000000; // Exception list for Capital letters Start loaded
+const long WrdSttLstLoad = 0x80000000; // Exception list for Word Start loaded
+
+// TODO: handle unicodes > U+FFFF and check users of this class
+
+// only a mapping class
+class EDITENG_DLLPUBLIC SvxAutoCorrDoc
+{
+public:
+ SvxAutoCorrDoc() {}
+ virtual ~SvxAutoCorrDoc();
+
+ virtual sal_Bool Delete( xub_StrLen nStt, xub_StrLen nEnd ) = 0;
+ virtual sal_Bool Insert( xub_StrLen nPos, const String& rTxt ) = 0;
+ virtual sal_Bool Replace( xub_StrLen nPos, const String& rTxt ) = 0;
+ virtual sal_Bool ReplaceRange( xub_StrLen nPos, xub_StrLen nLen, const String& rTxt ) = 0;
+
+ virtual sal_Bool SetAttr( xub_StrLen nStt, xub_StrLen nEnd, sal_uInt16 nSlotId,
+ SfxPoolItem& ) = 0;
+
+ virtual sal_Bool SetINetAttr( xub_StrLen nStt, xub_StrLen nEnd, const String& rURL ) = 0;
+
+ // Return the text of a previous paragraph. This must not be empty!
+ // If no paragraph exits or just an empty one, then return 0.
+ // The flag indicates:
+ // TRUE: before the normal insertion position (TRUE)
+ // FALSE: in which the corrected word was inserted.
+ // (Does not to have to be the same paragraph !!!!)
+ virtual const String* GetPrevPara( sal_Bool bAtNormalPos ) = 0;
+
+ virtual sal_Bool ChgAutoCorrWord( xub_StrLen& rSttPos, xub_StrLen nEndPos,
+ SvxAutoCorrect& rACorrect,
+ const String** ppPara ) = 0;
+ // Is called after the change of the signs by the functions
+ // - FnCptlSttWrd
+ // - FnCptlSttSntnc
+ // As an option, the words can then be inserted into the exception lists.
+ virtual void SaveCpltSttWord( sal_uLong nFlag, xub_StrLen nPos,
+ const String& rExceptWord,
+ sal_Unicode cChar );
+
+ // which language at the position?
+ virtual LanguageType GetLanguage( xub_StrLen nPos, sal_Bool bPrevPara = sal_False ) const;
+};
+
+
+class EDITENG_DLLPUBLIC SvxAutocorrWord
+{
+ String sShort, sLong;
+ sal_Bool bIsTxtOnly; // Is pure ASCII - Text
+public:
+ SvxAutocorrWord( const String& rS, const String& rL, sal_Bool bFlag = sal_True )
+ : sShort( rS ), sLong( rL ), bIsTxtOnly( bFlag )
+ {}
+
+ const String& GetShort() const { return sShort; }
+ const String& GetLong() const { return sLong; }
+ sal_Bool IsTextOnly() const { return bIsTxtOnly; }
+};
+
+struct CompareSvxAutocorrWordList
+{
+ bool operator()( SvxAutocorrWord* const& lhs, SvxAutocorrWord* const& rhs ) const;
+};
+
+typedef std::set<SvxAutocorrWord*, CompareSvxAutocorrWordList> SvxAutocorrWordList_Set;
+typedef ::boost::unordered_map< OUString, SvxAutocorrWord *,
+ OUStringHash > SvxAutocorrWordList_Hash;
+
+class EDITENG_DLLPUBLIC SvxAutocorrWordList
+{
+ // only one of these contains the data
+ mutable SvxAutocorrWordList_Set maSet;
+ mutable SvxAutocorrWordList_Hash maHash; // key is 'Short'
+
+ bool WordMatches(const SvxAutocorrWord *pFnd,
+ const String &rTxt,
+ xub_StrLen &rStt,
+ xub_StrLen nEndPos) const;
+public:
+ // free any objects still in the set
+ ~SvxAutocorrWordList();
+ void DeleteAndDestroyAll();
+ bool Insert(SvxAutocorrWord *pWord);
+ SvxAutocorrWord* FindAndRemove(SvxAutocorrWord *pWord);
+ void LoadEntry(String sWrong, String sRight, sal_Bool bOnlyTxt);
+ bool empty() const;
+
+ typedef std::vector<SvxAutocorrWord *> Content;
+ Content getSortedContent() const;
+
+ const SvxAutocorrWord* SearchWordsInList(const String& rTxt, xub_StrLen& rStt, xub_StrLen nEndPos) const;
+};
+
+class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists
+{
+ String sShareAutoCorrFile, sUserAutoCorrFile;
+ // If the AutoCorr file is newer
+ Date aModifiedDate;
+ Time aModifiedTime, aLastCheckTime;
+
+ SvStringsISortDtor* pCplStt_ExcptLst;
+ SvStringsISortDtor* pWrdStt_ExcptLst;
+ SvxAutocorrWordList* pAutocorr_List;
+ SvxAutoCorrect& rAutoCorrect;
+
+ long nFlags;
+
+ sal_Bool IsFileChanged_Imp();
+ void LoadXMLExceptList_Imp( SvStringsISortDtor*& rpLst,
+ const sal_Char* pStrmName,
+ SotStorageRef& rStg);
+ void SaveExceptList_Imp( const SvStringsISortDtor& rLst,
+ const sal_Char* pStrmName,
+ SotStorageRef& rStg,
+ sal_Bool bConvert = sal_False);
+
+ sal_Bool MakeBlocklist_Imp( SotStorage& rStg );
+ void RemoveStream_Imp( const String& rName );
+ void MakeUserStorage_Impl();
+
+public:
+ SvxAutoCorrectLanguageLists( SvxAutoCorrect& rParent,
+ const String& rShareAutoCorrectFile,
+ const String& rUserAutoCorrectFile);
+ ~SvxAutoCorrectLanguageLists();
+
+ // Load, Set, Get - the replacement list
+ SvxAutocorrWordList* LoadAutocorrWordList();
+ void SetAutocorrWordList( SvxAutocorrWordList* pList );
+ const SvxAutocorrWordList* GetAutocorrWordList();
+
+ // Load, Set, Get - the exception list for Capital letter at the
+ // beginning of a sentence
+ SvStringsISortDtor* LoadCplSttExceptList();
+ void SaveCplSttExceptList();
+ void SetCplSttExceptList( SvStringsISortDtor* pList );
+ SvStringsISortDtor* GetCplSttExceptList();
+ sal_Bool AddToCplSttExceptList(const String& rNew);
+
+ // Load, Set, Get the exception list for 2 Capital letters at the
+ // beginning of a word.
+ SvStringsISortDtor* LoadWrdSttExceptList();
+ void SaveWrdSttExceptList();
+ void SetWrdSttExceptList( SvStringsISortDtor* pList );
+ SvStringsISortDtor* GetWrdSttExceptList();
+ sal_Bool AddToWrdSttExceptList(const String& rNew);
+
+ // Save word substitutions:
+ // Store these directly in the storage. The word list is updated
+ // accordingly!
+ // - pure Text
+ sal_Bool PutText( const String& rShort, const String& rLong );
+ // - Text with attribution (only the SWG - SWG format!)
+ sal_Bool PutText( const String& rShort, SfxObjectShell& );
+ // - Deleting an entry
+ sal_Bool DeleteText( const String& rShort );
+ // - Make combined changes in one pass
+ sal_Bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries, std::vector<SvxAutocorrWord>& aDeleteEntries );
+};
+
+class EDITENG_DLLPUBLIC SvxAutoCorrect
+{
+ friend class SvxAutoCorrectLanguageLists;
+
+ String sShareAutoCorrFile, sUserAutoCorrFile;
+
+ SvxSwAutoFmtFlags aSwFlags; // StarWriter AutoFormat Flags
+
+ // all languages in a table
+ boost::ptr_map<LanguageType, SvxAutoCorrectLanguageLists>* pLangTable;
+ std::map<LanguageType, long> aLastFileTable;
+ CharClass* pCharClass;
+
+ bool bRunNext;
+
+ LanguageType eCharClassLang;
+
+ long nFlags;
+ sal_Unicode cStartDQuote, cEndDQuote, cStartSQuote, cEndSQuote,
+ cEmDash, cEnDash;
+
+
+ // private methods
+ SvxAutoCorrectLanguageLists& _GetLanguageList( LanguageType eLang );
+
+ void _GetCharClass( LanguageType eLang );
+
+protected:
+ // - Text with attribution (only the SWG - SWG format!)
+ // rShort is the stream name - encrypted!
+ virtual sal_Bool PutText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, SfxObjectShell& ,
+ String& );
+
+ // required language in the table add if possible only when the file exists
+ sal_Bool CreateLanguageFile(LanguageType eLang, sal_Bool bNewFile = sal_True);
+ // - Return the replacement text (only for SWG format, all others can be
+ // taken from the word list!)
+ // rShort is the stream name - encrypted!
+public:
+
+ sal_Unicode GetQuote( sal_Unicode cInsChar, sal_Bool bSttQuote,
+ LanguageType eLang ) const;
+ virtual sal_Bool GetLongText( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& rStg, const String& rFileName, const String& rShort, String& rLong );
+
+ TYPEINFO();
+
+ SvxAutoCorrect( const String& rShareAutocorrFile,
+ const String& rUserAutocorrFile );
+ SvxAutoCorrect( const SvxAutoCorrect& );
+ virtual ~SvxAutoCorrect();
+
+ // Execute an AutoCorrect.
+ // Returns what has been executed, according to the above flags
+ sal_uLong AutoCorrect( SvxAutoCorrDoc& rDoc, const String& rTxt,
+ xub_StrLen nPos, sal_Unicode cInsChar, sal_Bool bInsert, Window* pFrameWin = NULL );
+
+ // Return for the autotext expansion the previous word,
+ // AutoCorrect - corresponding algorithm
+ sal_Bool GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc, const String& rTxt,
+ xub_StrLen nPos, String& rWord ) const;
+
+ // Search for or or the words in the replacement table.
+ // rText - check in this text the words of the list
+ // rStt - the detected starting position
+ // nEnd - to check position - as of this item forward
+ // rLang - Input: in which language is searched
+ // Output: in which "language list" was it found
+ const SvxAutocorrWord* SearchWordsInList( const String& rTxt,
+ xub_StrLen& rStt, xub_StrLen nEndPos,
+ SvxAutoCorrDoc& rDoc,
+ LanguageType& rLang );
+
+ // Query/Set the Character for the Quote substitution
+ sal_Unicode GetStartSingleQuote() const { return cStartSQuote; }
+ sal_Unicode GetEndSingleQuote() const { return cEndSQuote; }
+ sal_Unicode GetStartDoubleQuote() const { return cStartDQuote; }
+ sal_Unicode GetEndDoubleQuote() const { return cEndDQuote; }
+
+ void SetStartSingleQuote( const sal_Unicode cStart ) { cStartSQuote = cStart; }
+ void SetEndSingleQuote( const sal_Unicode cEnd ) { cEndSQuote = cEnd; }
+ void SetStartDoubleQuote( const sal_Unicode cStart ) { cStartDQuote = cStart; }
+ void SetEndDoubleQuote( const sal_Unicode cEnd ) { cEndDQuote = cEnd; }
+
+ String GetQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
+ sal_Unicode cInsChar, sal_Bool bSttQuote );
+ void InsertQuote( SvxAutoCorrDoc& rDoc, xub_StrLen nInsPos,
+ sal_Unicode cInsChar, sal_Bool bSttQuote, sal_Bool bIns );
+
+ // Query/Set the name of the AutoCorrect file
+ // the default is "autocorr.dat"
+ String GetAutoCorrFileName( LanguageType eLang = LANGUAGE_SYSTEM,
+ sal_Bool bNewFile = sal_False,
+ sal_Bool bTstUserExist = sal_False ) const;
+
+ // Query/Set the current settings of AutoCorrect
+ long GetFlags() const { return nFlags; }
+ inline SvxSwAutoFmtFlags& GetSwFlags() { return aSwFlags;}
+ sal_Bool IsAutoCorrFlag( long nFlag ) const
+ { return nFlags & nFlag ? sal_True : sal_False; }
+ void SetAutoCorrFlag( long nFlag, sal_Bool bOn = sal_True );
+
+ // Load, Set, Get - the replacement list
+ SvxAutocorrWordList* LoadAutocorrWordList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).LoadAutocorrWordList(); }
+ const SvxAutocorrWordList* GetAutocorrWordList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).GetAutocorrWordList(); }
+
+ // Save word substitutions:
+ // Save these directly in the storage. The word list is updated
+ // accordingly!
+ // - pure Text
+ sal_Bool PutText( const String& rShort, const String& rLong, LanguageType eLang = LANGUAGE_SYSTEM );
+ // - Text with attribution (only in the SWG - SWG format!)
+ sal_Bool PutText( const String& rShort, SfxObjectShell& rShell,
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).PutText(rShort, rShell ); }
+
+ sal_Bool MakeCombinedChanges( std::vector<SvxAutocorrWord>& aNewEntries,
+ std::vector<SvxAutocorrWord>& aDeleteEntries,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+
+ // Load, Set, Get - the exception list for capital letters at the
+ // beginning of a sentence
+ void SaveCplSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM );
+ SvStringsISortDtor* LoadCplSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM)
+ { return _GetLanguageList( eLang ).LoadCplSttExceptList(); }
+ const SvStringsISortDtor* GetCplSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).GetCplSttExceptList(); }
+
+ // Adds a single word. The list will be immediately written to the file!
+ sal_Bool AddCplSttException( const String& rNew,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+
+ // Load, Set, Get the exception list for 2 Capital letters at the
+ // beginning of a word.
+ void SaveWrdSttExceptList( LanguageType eLang = LANGUAGE_SYSTEM );
+ SvStringsISortDtor* LoadWrdSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).LoadWrdSttExceptList(); }
+ const SvStringsISortDtor* GetWrdSttExceptList(
+ LanguageType eLang = LANGUAGE_SYSTEM )
+ { return _GetLanguageList( eLang ).GetWrdSttExceptList(); }
+ // Adds a single word. The list will be immediately written to the file!
+ sal_Bool AddWrtSttException( const String& rNew, LanguageType eLang = LANGUAGE_SYSTEM);
+
+ // Search through the Languages for the entry
+ sal_Bool FindInWrdSttExceptList( LanguageType eLang, const String& sWord );
+ sal_Bool FindInCplSttExceptList( LanguageType eLang, const String& sWord,
+ sal_Bool bAbbreviation = sal_False);
+
+ // Methods for the auto-correction
+ sal_Bool FnCptlSttWrd( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnChgOrdinalNumber( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnChgToEnEmDash( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnAddNonBrkSpace( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnSetINetAttr( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnChgWeightUnderl( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+ sal_Bool FnCptlSttSntnc( SvxAutoCorrDoc&, const String&, sal_Bool bNormalPos,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM);
+ bool FnCorrectCapsLock( SvxAutoCorrDoc&, const String&,
+ xub_StrLen nSttPos, xub_StrLen nEndPos,
+ LanguageType eLang = LANGUAGE_SYSTEM );
+
+ bool HasRunNext() { return bRunNext; }
+
+ static long GetDefaultFlags();
+
+// returns sal_True for characters where the function
+// 'SvxAutoCorrect::AutoCorrect' should be called.
+// (used to avoid occasional 'collisions' with (Thai) input-sequence-checking)
+ static sal_Bool IsAutoCorrectChar( sal_Unicode cChar );
+
+ sal_Bool NeedsHardspaceAutocorr( sal_Unicode cChar );
+
+ CharClass& GetCharClass( LanguageType eLang )
+ {
+ if( !pCharClass || eLang != eCharClassLang )
+ _GetCharClass( eLang );
+ return *pCharClass;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx
new file mode 100644
index 000000000000..2759bebcd0ea
--- /dev/null
+++ b/include/editeng/svxenum.hxx
@@ -0,0 +1,239 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SVXENUM_HXX
+#define _SVX_SVXENUM_HXX
+
+// -----------------------------------------------------------------------
+
+enum SvxCaseMap
+{
+ SVX_CASEMAP_NOT_MAPPED,
+ SVX_CASEMAP_VERSALIEN,
+ SVX_CASEMAP_GEMEINE,
+ SVX_CASEMAP_TITEL,
+ SVX_CASEMAP_KAPITAELCHEN,
+ SVX_CASEMAP_END
+};
+
+enum SvxEscapement
+{
+ SVX_ESCAPEMENT_OFF,
+ SVX_ESCAPEMENT_SUPERSCRIPT,
+ SVX_ESCAPEMENT_SUBSCRIPT,
+ SVX_ESCAPEMENT_END
+};
+
+enum SvxShadowLocation
+{
+ SVX_SHADOW_NONE,
+ SVX_SHADOW_TOPLEFT,
+ SVX_SHADOW_TOPRIGHT,
+ SVX_SHADOW_BOTTOMLEFT,
+ SVX_SHADOW_BOTTOMRIGHT,
+ SVX_SHADOW_END
+};
+
+enum SvxTabAdjust
+{
+ SVX_TAB_ADJUST_LEFT = 0,
+ SVX_TAB_ADJUST_RIGHT,
+ SVX_TAB_ADJUST_DECIMAL,
+ SVX_TAB_ADJUST_CENTER,
+ SVX_TAB_ADJUST_DEFAULT,
+ SVX_TAB_ADJUST_END
+};
+
+enum SvxLineSpace
+{
+ SVX_LINE_SPACE_AUTO,
+ SVX_LINE_SPACE_FIX,
+ SVX_LINE_SPACE_MIN,
+ SVX_LINE_SPACE_END
+};
+
+enum SvxInterLineSpace
+{
+ SVX_INTER_LINE_SPACE_OFF,
+ SVX_INTER_LINE_SPACE_PROP,
+ SVX_INTER_LINE_SPACE_FIX,
+ SVX_INTER_LINE_SPACE_END
+};
+
+enum SvxAdjust
+{
+ SVX_ADJUST_LEFT,
+ SVX_ADJUST_RIGHT,
+ SVX_ADJUST_BLOCK,
+ SVX_ADJUST_CENTER,
+ SVX_ADJUST_BLOCKLINE,
+ SVX_ADJUST_END
+};
+
+enum SvxSpecialLineSpace
+{
+ SVX_LINESPACE_USER,
+ SVX_LINESPACE_ONE_LINE,
+ SVX_LINESPACE_ONE_POINT_FIVE_LINES,
+ SVX_LINESPACE_TWO_LINES,
+ SVX_LINESPACE_END
+};
+
+enum SvxBreak
+{
+ SVX_BREAK_NONE,
+ SVX_BREAK_COLUMN_BEFORE,
+ SVX_BREAK_COLUMN_AFTER,
+ SVX_BREAK_COLUMN_BOTH,
+ SVX_BREAK_PAGE_BEFORE,
+ SVX_BREAK_PAGE_AFTER,
+ SVX_BREAK_PAGE_BOTH,
+ SVX_BREAK_END
+};
+
+enum SvxCellHorJustify
+{
+ SVX_HOR_JUSTIFY_STANDARD,
+ SVX_HOR_JUSTIFY_LEFT,
+ SVX_HOR_JUSTIFY_CENTER,
+ SVX_HOR_JUSTIFY_RIGHT,
+ SVX_HOR_JUSTIFY_BLOCK,
+ SVX_HOR_JUSTIFY_REPEAT
+};
+
+enum SvxCellJustifyMethod
+{
+ SVX_JUSTIFY_METHOD_AUTO,
+ SVX_JUSTIFY_METHOD_DISTRIBUTE
+};
+
+enum SvxCellVerJustify
+{
+ SVX_VER_JUSTIFY_STANDARD,
+ SVX_VER_JUSTIFY_TOP,
+ SVX_VER_JUSTIFY_CENTER,
+ SVX_VER_JUSTIFY_BOTTOM,
+ SVX_VER_JUSTIFY_BLOCK
+};
+
+enum SvxCellOrientation
+{
+ SVX_ORIENTATION_STANDARD,
+ SVX_ORIENTATION_TOPBOTTOM,
+ SVX_ORIENTATION_BOTTOMTOP,
+ SVX_ORIENTATION_STACKED
+};
+
+enum SvxDrawToolEnum
+{
+ SVX_SNAP_DRAW_SELECT,
+ //
+ SVX_SNAP_DRAW_LINE,
+ SVX_SNAP_DRAW_RECT,
+ SVX_SNAP_DRAW_ELLIPSE,
+ SVX_SNAP_DRAW_POLYGON_NOFILL,
+ SVX_SNAP_DRAW_BEZIER_NOFILL,
+ SVX_SNAP_DRAW_FREELINE_NOFILL,
+ SVX_SNAP_DRAW_ARC,
+ SVX_SNAP_DRAW_PIE,
+ SVX_SNAP_DRAW_CIRCLECUT,
+ SVX_SNAP_DRAW_TEXT,
+ SVX_SNAP_DRAW_TEXT_VERTICAL,
+ SVX_SNAP_DRAW_TEXT_MARQUEE,
+ SVX_SNAP_DRAW_CAPTION,
+ SVX_SNAP_DRAW_CAPTION_VERTICAL
+};
+
+enum SvxDrawAlignEnum
+{
+ SVX_OBJECT_ALIGN_LEFT,
+ SVX_OBJECT_ALIGN_CENTER,
+ SVX_OBJECT_ALIGN_RIGHT,
+ SVX_OBJECT_ALIGN_UP,
+ SVX_OBJECT_ALIGN_MIDDLE,
+ SVX_OBJECT_ALIGN_DOWN
+};
+
+enum SvxDrawBezierEnum
+{
+ SVX_BEZIER_MOVE,
+ SVX_BEZIER_INSERT,
+ SVX_BEZIER_DELETE,
+ SVX_BEZIER_CUTLINE,
+ SVX_BEZIER_CONVERT,
+ SVX_BEZIER_EDGE,
+ SVX_BEZIER_SMOOTH,
+ SVX_BEZIER_SYMMTR,
+ SVX_BEZIER_CLOSE,
+ SVX_BEZIER_ELIMINATE_POINTS
+};
+
+enum SvxSpellArea
+{
+ SVX_SPELL_BODY = 0,
+ SVX_SPELL_BODY_END,
+ SVX_SPELL_BODY_START,
+ SVX_SPELL_OTHER
+};
+
+enum SvxFrameAnchor
+{
+ SVX_FLY_AT_CNTNT, // Paragraph-based frame
+ SVX_FLY_IN_CNTNT, // Character-based frame
+ SVX_FLY_PAGE // Page-based frame
+};
+
+enum SvxExtNumType
+{
+ SVX_NUM_CHARS_UPPER_LETTER, // Counts from a-z, aa - az, ba - bz, ...
+ SVX_NUM_CHARS_LOWER_LETTER,
+ SVX_NUM_ROMAN_UPPER,
+ SVX_NUM_ROMAN_LOWER,
+ SVX_NUM_ARABIC,
+ SVX_NUM_NUMBER_NONE,
+ SVX_NUM_CHAR_SPECIAL, // Bullet
+ SVX_NUM_PAGEDESC, // Numbering from the page template
+ SVX_NUM_BITMAP,
+ SVX_NUM_CHARS_UPPER_LETTER_N, // Counts from a-z, aa-zz, aaa-zzz
+ SVX_NUM_CHARS_LOWER_LETTER_N,
+ SVX_NUM_TRANSLITERATION,
+ SVX_NUM_NATIVE_NUMBERING,
+ SVX_NUM_FULL_WIDTH_ARABIC,
+ SVX_NUM_CIRCLE_NUMBER,
+ SVX_NUM_NUMBER_LOWER_ZH,
+ SVX_NUM_NUMBER_UPPER_ZH,
+ SVX_NUM_NUMBER_UPPER_ZH_TW,
+ SVX_NUM_TIAN_GAN_ZH,
+ SVX_NUM_DI_ZI_ZH,
+ SVX_NUM_NUMBER_TRADITIONAL_JA,
+ SVX_NUM_AIU_FULLWIDTH_JA,
+ SVX_NUM_AIU_HALFWIDTH_JA,
+ SVX_NUM_IROHA_FULLWIDTH_JA,
+ SVX_NUM_IROHA_HALFWIDTH_JA
+};
+
+enum SvxCompareMode
+{
+ SVX_CMP_AUTO = 0,
+ SVX_CMP_BY_WORD,
+ SVX_CMP_BY_CHAR
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxfont.hxx b/include/editeng/svxfont.hxx
new file mode 100644
index 000000000000..858157453aa1
--- /dev/null
+++ b/include/editeng/svxfont.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_SVXFONT_HXX
+#define _SVX_SVXFONT_HXX
+
+#include <limits.h> // USHRT_MAX
+#include <editeng/svxenum.hxx>
+#include <i18nlangtag/lang.h>
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+// Percentage of height of lower case small capital letters compared to upper case letters
+// See i#1526# for full explanation
+#define SMALL_CAPS_PERCENTAGE 80
+
+class SvxDoCapitals;
+class OutputDevice;
+class Printer;
+class Point;
+class Rectangle;
+class Size;
+
+class EDITENG_DLLPUBLIC SvxFont : public Font
+{
+ LanguageType eLang; // Language
+ SvxCaseMap eCaseMap; // Text Markup
+ short nEsc; // Degree of Superscript/Subscript
+ sal_uInt8 nPropr; // Degree of reduction of the font height
+ short nKern; // Kerning in Pt
+
+public:
+ SvxFont();
+ SvxFont( const Font &rFont );
+ SvxFont( const SvxFont &rFont );
+
+ // Methods for Superscript/Subscript
+ inline short GetEscapement() const { return nEsc; }
+ inline void SetEscapement( const short nNewEsc ) { nEsc = nNewEsc; }
+
+ inline sal_uInt8 GetPropr() const { return nPropr; }
+ inline void SetPropr( const sal_uInt8 nNewPropr ) { nPropr = nNewPropr; }
+ inline void SetProprRel( const sal_uInt8 nNewPropr )
+ { SetPropr( (sal_uInt8)( (long)nNewPropr * (long)nPropr / 100L ) ); }
+
+ // Kerning
+ inline short GetFixKerning() const { return nKern; }
+ inline void SetFixKerning( const short nNewKern ) { nKern = nNewKern; }
+
+ inline SvxCaseMap GetCaseMap() const { return eCaseMap; }
+ inline void SetCaseMap( const SvxCaseMap eNew ) { eCaseMap = eNew; }
+
+ inline LanguageType GetLanguage() const { return eLang; }
+ inline void SetLanguage( const LanguageType eNewLan )
+ { eLang = eNewLan; Font::SetLanguage(eNewLan); }
+
+ // Is-Methods:
+ inline sal_Bool IsCaseMap() const { return SVX_CASEMAP_NOT_MAPPED != eCaseMap; }
+ inline sal_Bool IsCapital() const { return SVX_CASEMAP_KAPITAELCHEN == eCaseMap; }
+ inline sal_Bool IsKern() const { return 0 != nKern; }
+ inline sal_Bool IsEsc() const { return 0 != nEsc; }
+
+ // Consider Upper case, Lower case letters etc.
+ OUString CalcCaseMap(const OUString &rTxt) const;
+
+ // Handle upper case letters
+ void DoOnCapitals( SvxDoCapitals &rDo,
+ const sal_uInt16 nPartLen = USHRT_MAX ) const;
+
+ void SetPhysFont( OutputDevice *pOut ) const;
+ Font ChgPhysFont( OutputDevice *pOut ) const;
+
+ Size GetCapitalSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen) const;
+ void DrawCapital( OutputDevice *pOut, const Point &rPos, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
+
+ Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen ) const;
+
+ Size GetPhysTxtSize( const OutputDevice *pOut, const String &rTxt );
+
+ Size GetTxtSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
+
+ void QuickDrawText( OutputDevice *pOut, const Point &rPos, const String &rTxt,
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN, const sal_Int32* pDXArray = NULL ) const;
+
+ Size QuickGetTextSize( const OutputDevice *pOut, const String &rTxt,
+ const sal_uInt16 nIdx, const sal_uInt16 nLen, sal_Int32* pDXArray = NULL ) const;
+
+ void DrawPrev( OutputDevice* pOut, Printer* pPrinter,
+ const Point &rPos, const String &rTxt,
+ const sal_uInt16 nIdx = 0, const sal_uInt16 nLen = STRING_LEN ) const;
+
+ static void DrawArrow( OutputDevice &rOut, const Rectangle& rRect,
+ const Size& rSize, const Color& rCol, sal_Bool bLeft );
+ SvxFont& operator=( const SvxFont& rFont );
+ SvxFont& operator=( const Font& rFont );
+};
+
+#endif // #ifndef _SVX_SVXFONT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
new file mode 100644
index 000000000000..84c00a28634b
--- /dev/null
+++ b/include/editeng/svxrtf.hxx
@@ -0,0 +1,424 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVXRTF_HXX
+#define _SVXRTF_HXX
+
+#include <tools/string.hxx>
+#include <svl/itemset.hxx>
+#include <svtools/parrtf.hxx>
+
+#include <editeng/editengdllapi.h>
+
+#include <deque>
+#include <utility>
+#include <vector>
+#include "boost/ptr_container/ptr_map.hpp"
+#include "boost/ptr_container/ptr_vector.hpp"
+
+class Font;
+class Color;
+class Graphic;
+class DateTime;
+struct SvxRTFStyleType;
+class SvxRTFItemStackType;
+class SvxRTFItemStackList : public boost::ptr_vector<SvxRTFItemStackType> {};
+
+namespace com { namespace sun { namespace star {
+ namespace document {
+ class XDocumentProperties;
+ }
+ namespace util {
+ struct DateTime;
+ }
+} } }
+
+
+// Mapper-Classes for the various requirements on Document positions
+// Swg - NodePosition is a SwIndex, which is used internally
+// EditEngine - ULONG to list of paragraphs
+// .....
+
+class SvxNodeIdx
+{
+public:
+ virtual ~SvxNodeIdx() {}
+ virtual sal_uLong GetIdx() const = 0;
+ virtual SvxNodeIdx* Clone() const = 0; // Cloning itself
+};
+
+class SvxPosition
+{
+public:
+ virtual ~SvxPosition() {}
+
+ virtual sal_uLong GetNodeIdx() const = 0;
+ virtual xub_StrLen GetCntIdx() const = 0;
+
+ virtual SvxPosition* Clone() const = 0; // Cloning itself
+ virtual SvxNodeIdx* MakeNodeIdx() const = 0; // Cloning NodeIndex
+};
+
+
+typedef Color* ColorPtr;
+typedef std::deque< ColorPtr > SvxRTFColorTbl;
+typedef boost::ptr_map<short, Font> SvxRTFFontTbl;
+typedef boost::ptr_map<sal_uInt16, SvxRTFStyleType> SvxRTFStyleTbl;
+
+// SvxRTFItemStack can't be "std::stack< SvxRTFItemStackType* >" type, because
+// the methods are using operator[] in sw/source/filter/rtf/rtftbl.cxx file
+typedef std::deque< SvxRTFItemStackType* > SvxRTFItemStack;
+
+// own helper classes for the RTF Parser
+struct SvxRTFStyleType
+{
+ SfxItemSet aAttrSet; // the attributes of Style (+ derivate!)
+ String sName;
+ sal_uInt16 nBasedOn, nNext;
+ sal_Bool bBasedOnIsSet;
+ sal_uInt8 nOutlineNo;
+ sal_Bool bIsCharFmt;
+
+ SvxRTFStyleType( SfxItemPool& rPool, const sal_uInt16* pWhichRange );
+};
+
+
+// Here are the IDs for all character attributes, which can be detected by
+// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught
+// the SlotIds from POOL.
+struct RTFPlainAttrMapIds
+{
+ sal_uInt16 nCaseMap,
+ nBgColor,
+ nColor,
+ nContour,
+ nCrossedOut,
+ nEscapement,
+ nFont,
+ nFontHeight,
+ nKering,
+ nLanguage,
+ nPosture,
+ nShadowed,
+ nUnderline,
+ nOverline,
+ nWeight,
+ nWordlineMode,
+ nAutoKerning,
+ nCJKFont,
+ nCJKFontHeight,
+ nCJKLanguage,
+ nCJKPosture,
+ nCJKWeight,
+ nCTLFont,
+ nCTLFontHeight,
+ nCTLLanguage,
+ nCTLPosture,
+ nCTLWeight,
+ nEmphasis,
+ nTwoLines,
+ nCharScaleX,
+ nHorzVert,
+ nRuby,
+ nRelief,
+ nHidden
+ ;
+ RTFPlainAttrMapIds( const SfxItemPool& rPool );
+};
+
+// Here are the IDs for all paragraph attributes, which can be detected by
+// SvxParser and can be set in a SfxItemSet. The IDs are set correctly throught
+// the SlotIds from POOL.
+struct RTFPardAttrMapIds
+{
+ sal_uInt16 nLinespacing,
+ nAdjust,
+ nTabStop,
+ nHyphenzone,
+ nLRSpace,
+ nULSpace,
+ nBrush,
+ nBox,
+ nShadow,
+ nOutlineLvl,
+ nSplit,
+ nKeep,
+ nFontAlign,
+ nScriptSpace,
+ nHangPunct,
+ nForbRule,
+ nDirection
+ ;
+ RTFPardAttrMapIds( const SfxItemPool& rPool );
+};
+
+
+
+// -----------------------------------------------------------------------
+
+
+class EDITENG_DLLPUBLIC SvxRTFParser : public SvRTFParser
+{
+ SvStream &rStrm;
+ SvxRTFColorTbl aColorTbl;
+ SvxRTFFontTbl aFontTbl;
+ SvxRTFStyleTbl aStyleTbl;
+ SvxRTFItemStack aAttrStack;
+ SvxRTFItemStackList aAttrSetList;
+
+ std::vector<sal_uInt16> aPlainMap;
+ std::vector<sal_uInt16> aPardMap;
+ std::vector<sal_uInt16> aWhichMap;
+ String sBaseURL;
+
+ SvxPosition* pInsPos;
+ SfxItemPool* pAttrPool;
+ Color* pDfltColor;
+ Font* pDfltFont;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> m_xDocProps;
+ SfxItemSet *pRTFDefaults;
+
+ long nVersionNo;
+ int nDfltFont;
+
+ sal_Bool bNewDoc : 1; // sal_False - Reading in an existing
+ sal_Bool bNewGroup : 1; // sal_True - there was an opening parenthesis
+ sal_Bool bIsSetDfltTab : 1; // sal_True - DefTab was loaded
+ sal_Bool bChkStyleAttr : 1; // sal_True - StyleSheets are evaluated
+ sal_Bool bCalcValue : 1; // sal_True - Twip values adapt to App
+ sal_Bool bPardTokenRead : 1; // sal_True - Token \pard was detected
+ sal_Bool bReadDocInfo : 1; // sal_True - DocInfo to read
+ sal_Bool bIsLeftToRightDef : 1; // sal_True - in LeftToRight char run def.
+ // sal_False - in RightToLeft char run def.
+ sal_Bool bIsInReadStyleTab : 1; // sal_True - in ReadStyleTable
+
+ void ClearColorTbl();
+ void ClearFontTbl();
+ void ClearStyleTbl();
+ void ClearAttrStack();
+
+ SvxRTFItemStackType* _GetAttrSet( int bCopyAttr=sal_False ); // Create new ItemStackType:s
+ void _ClearStyleAttr( SvxRTFItemStackType& rStkType );
+
+ // Sets all the attributes that are different from the current
+ void SetAttrSet( SfxItemSet& rAttrSet, SvxPosition& rSttPos );
+ void SetAttrSet( SvxRTFItemStackType &rSet );
+ void SetDefault( int nToken, int nValue );
+
+ // Excecute pard / plain
+ void RTFPardPlain( int bPard, SfxItemSet** ppSet );
+
+ void BuildWhichTbl();
+
+ enum RTF_CharTypeDef
+ {
+ NOTDEF_CHARTYPE,
+ LOW_CHARTYPE,
+ HIGH_CHARTYPE,
+ DOUBLEBYTE_CHARTYPE
+ };
+
+ // set latin/asian/complex character attributes
+ void SetScriptAttr(
+ RTF_CharTypeDef eType, SfxItemSet& rSet, SfxPoolItem& rItem );
+
+protected:
+ virtual void EnterEnvironment();
+ virtual void LeaveEnvironment();
+ virtual void ResetPard();
+ virtual void InsertPara() = 0;
+
+
+ String& DelCharAtEnd( String& rStr, const sal_Unicode cDel );
+
+ // is called for each token that is recognized in CallParser
+ virtual void NextToken( int nToken );
+
+ virtual void ReadBitmapData();
+ virtual void ReadOLEData();
+
+ void ReadStyleTable();
+ void ReadColorTable();
+ void ReadFontTable();
+ void ReadAttr( int nToken, SfxItemSet* pSet );
+ void ReadTabAttr( int nToken, SfxItemSet& rSet );
+
+ // Read Document-Info
+ ::com::sun::star::util::DateTime GetDateTimeStamp( );
+ String& GetTextToEndGroup( String& rStr );
+ virtual void ReadInfo( const sal_Char* pChkForVerNo = 0 );
+
+ inline SfxItemSet& GetAttrSet();
+ // no text yet inserted? (SttPos from the top stack entry!)
+ int IsAttrSttPos();
+ void AttrGroupEnd(); // edit the current, delete from stack
+ void SetAllAttrOfStk(); // end all Attr. and set it into doc
+
+
+ virtual void InsertText() = 0;
+ virtual void MovePos( int bForward = sal_True ) = 0;
+ virtual void SetEndPrevPara( SvxNodeIdx*& rpNodePos,
+ xub_StrLen& rCntPos )=0;
+ virtual void SetAttrInDoc( SvxRTFItemStackType &rSet );
+ // for Tokens, which are not evaluated in ReadAttr
+ virtual void UnknownAttrToken( int nToken, SfxItemSet* pSet );
+
+ // if no-one would like to have any twips
+ virtual void CalcValue();
+
+ SvxRTFParser( SfxItemPool& rAttrPool,
+ SvStream& rIn,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::document::XDocumentProperties> i_xDocProps,
+ int bReadNewDoc = sal_True );
+ virtual ~SvxRTFParser();
+
+ int IsNewDoc() const { return bNewDoc; }
+ void SetNewDoc( int bFlag ) { bNewDoc = bFlag; }
+ int IsNewGroup() const { return bNewGroup; }
+ void SetNewGroup( int bFlag ) { bNewGroup = bFlag; }
+ int IsChkStyleAttr() const { return bChkStyleAttr; }
+ void SetChkStyleAttr( int bFlag ) { bChkStyleAttr = bFlag; }
+ int IsCalcValue() const { return bCalcValue; }
+ void SetCalcValue( int bFlag ) { bCalcValue = bFlag; }
+ int IsPardTokenRead() const { return bPardTokenRead; }
+ void SetPardTokenRead( int bFlag ) { bPardTokenRead = bFlag; }
+ int IsReadDocInfo() const { return bReadDocInfo; }
+ void SetReadDocInfo( int bFlag ) { bReadDocInfo = bFlag; }
+
+ // Query/Set the current insert position
+ SvxPosition& GetInsPos() const { return *pInsPos; }
+ void SetInsPos( const SvxPosition& rNew );
+
+ long GetVersionNo() const { return nVersionNo; }
+
+ // Query/Set the mapping IDs for the Pard/Plain attributes
+ //(Set: It is noted in the pointers, which thus does not create a copy)
+ void AddPardAttr( sal_uInt16 nWhich ) { aPardMap.push_back( nWhich ); }
+ void AddPlainAttr( sal_uInt16 nWhich ) { aPlainMap.push_back( nWhich ); }
+
+ SvxRTFStyleTbl& GetStyleTbl() { return aStyleTbl; }
+ SvxRTFItemStack& GetAttrStack() { return aAttrStack; }
+ SvxRTFColorTbl& GetColorTbl() { return aColorTbl; }
+ SvxRTFFontTbl& GetFontTbl() { return aFontTbl; }
+
+ const String& GetBaseURL() const { return sBaseURL; }
+
+public:
+
+ virtual SvParserState CallParser();
+
+ inline const Color& GetColor( size_t nId ) const;
+ const Font& GetFont( sal_uInt16 nId ); // Changes the dflt Font
+
+ virtual int IsEndPara( SvxNodeIdx* pNd, xub_StrLen nCnt ) const = 0;
+
+ // to det a different attribute pool. May only be done prior to CallParser!
+ // The maps are not generated anew!
+ void SetAttrPool( SfxItemPool* pNewPool ) { pAttrPool = pNewPool; }
+ // to set different WhichIds for a different pool.
+ RTFPardAttrMapIds& GetPardMap()
+ { return (RTFPardAttrMapIds&)*aPardMap.begin(); }
+ RTFPlainAttrMapIds& GetPlainMap()
+ { return (RTFPlainAttrMapIds&)*aPlainMap.begin(); }
+ // to be able to assign them from the outside as for example table cells
+ void ReadBorderAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False );
+ void ReadBackgroundAttr( int nToken, SfxItemSet& rSet, int bTableDef=sal_False );
+
+ // for asynchronous read from the SvStream
+ virtual void Continue( int nToken );
+
+ // get RTF default ItemSets. Must be used by pard/plain tokens or in
+ // reset of Style-Items
+ const SfxItemSet& GetRTFDefaults();
+ virtual bool UncompressableStackEntry(const SvxRTFItemStackType &rSet) const;
+};
+
+// The stack for the attributes:
+// this class may only be used by SvxRTFParser!
+class EDITENG_DLLPUBLIC SvxRTFItemStackType
+{
+ friend class SvxRTFParser;
+
+ SfxItemSet aAttrSet;
+ SvxNodeIdx *pSttNd, *pEndNd;
+ xub_StrLen nSttCnt, nEndCnt;
+ SvxRTFItemStackList* pChildList;
+ sal_uInt16 nStyleNo;
+
+ SvxRTFItemStackType( SfxItemPool&, const sal_uInt16* pWhichRange,
+ const SvxPosition& );
+
+ void Add( SvxRTFItemStackType* );
+ void Compress( const SvxRTFParser& );
+
+public:
+ SvxRTFItemStackType( const SvxRTFItemStackType&, const SvxPosition&,
+ int bCopyAttr = sal_False );
+ ~SvxRTFItemStackType();
+ //cmc, I'm very suspicios about SetStartPos, it doesn't change
+ //its children's starting position, and the implementation looks
+ //bad, consider this deprecated.
+ void SetStartPos( const SvxPosition& rPos );
+
+ void MoveFullNode(const SvxNodeIdx &rOldNode,
+ const SvxNodeIdx &rNewNode);
+
+ sal_uLong GetSttNodeIdx() const { return pSttNd->GetIdx(); }
+ sal_uLong GetEndNodeIdx() const { return pEndNd->GetIdx(); }
+
+ const SvxNodeIdx& GetSttNode() const { return *pSttNd; }
+ const SvxNodeIdx& GetEndNode() const { return *pEndNd; }
+
+ xub_StrLen GetSttCnt() const { return nSttCnt; }
+ xub_StrLen GetEndCnt() const { return nEndCnt; }
+
+ SfxItemSet& GetAttrSet() { return aAttrSet; }
+ const SfxItemSet& GetAttrSet() const { return aAttrSet; }
+
+ sal_uInt16 StyleNo() const { return nStyleNo; }
+
+ void SetRTFDefaults( const SfxItemSet& rDefaults );
+};
+
+
+// ----------- Inline Implementations --------------
+
+inline const Color& SvxRTFParser::GetColor( size_t nId ) const
+{
+ ColorPtr pColor = (ColorPtr)pDfltColor;
+ if( nId < aColorTbl.size() )
+ pColor = aColorTbl[ nId ];
+ return *pColor;
+}
+
+inline SfxItemSet& SvxRTFParser::GetAttrSet()
+{
+ SvxRTFItemStackType* pTmp;
+ if( bNewGroup || 0 == ( pTmp = aAttrStack.empty() ? 0 : aAttrStack.back()) )
+ pTmp = _GetAttrSet();
+ return pTmp->aAttrSet;
+}
+
+
+#endif
+ //_SVXRTF_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/swafopt.hxx b/include/editeng/swafopt.hxx
new file mode 100644
index 000000000000..684a1838c731
--- /dev/null
+++ b/include/editeng/swafopt.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef EE_SVXSWAFOPT_HXX
+#define EE_SVXSWAFOPT_HXX
+
+#include <o3tl/sorted_vector.hxx>
+
+#include <tools/string.hxx>
+
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+class SmartTagMgr;
+
+namespace editeng {
+
+class EDITENG_DLLPUBLIC IAutoCompleteString
+{
+private:
+ String m_String;
+public:
+ explicit IAutoCompleteString(String const& rString) : m_String(rString) {}
+ virtual ~IAutoCompleteString() {}
+ String const& GetAutoCompleteString() const { return m_String; }
+};
+
+struct CompareAutoCompleteString
+{
+ bool operator()(IAutoCompleteString *const& lhs,
+ IAutoCompleteString *const& rhs) const
+ {
+ return lhs->GetAutoCompleteString().CompareIgnoreCaseToAscii(
+ rhs->GetAutoCompleteString()) == COMPARE_LESS;
+ }
+};
+
+class SortedAutoCompleteStrings
+ : public o3tl::sorted_vector<IAutoCompleteString*, CompareAutoCompleteString>
+{
+public:
+ ~SortedAutoCompleteStrings() { DeleteAndDestroyAll(); }
+};
+
+} // namespace editeng
+
+// Class of options for AutoFormat
+struct EDITENG_DLLPUBLIC SvxSwAutoFmtFlags
+{
+ Font aBulletFont;
+ Font aByInputBulletFont;
+ /// only valid inside the Dialog!!!
+ const editeng::SortedAutoCompleteStrings * m_pAutoCompleteList;
+ SmartTagMgr* pSmartTagMgr;
+
+ sal_Unicode cBullet;
+ sal_Unicode cByInputBullet;
+
+ sal_uInt16 nAutoCmpltWordLen, nAutoCmpltListLen;
+ sal_uInt16 nAutoCmpltExpandKey;
+
+ sal_uInt8 nRightMargin;
+
+ sal_Bool bAutoCorrect : 1;
+ sal_Bool bCptlSttSntnc : 1;
+ sal_Bool bCptlSttWrd : 1;
+ sal_Bool bChkFontAttr : 1;
+
+ sal_Bool bChgUserColl : 1;
+ sal_Bool bChgEnumNum : 1;
+
+ sal_Bool bAFmtByInput : 1;
+ sal_Bool bDelEmptyNode : 1;
+ sal_Bool bSetNumRule : 1;
+
+ sal_Bool bChgOrdinalNumber : 1;
+ sal_Bool bChgToEnEmDash : 1;
+ sal_Bool bAddNonBrkSpace : 1;
+ sal_Bool bChgWeightUnderl : 1;
+ sal_Bool bSetINetAttr : 1;
+
+ sal_Bool bSetBorder : 1;
+ sal_Bool bCreateTable : 1;
+ sal_Bool bReplaceStyles : 1;
+ sal_Bool bDummy : 1;
+
+ sal_Bool bWithRedlining : 1;
+
+ sal_Bool bRightMargin : 1;
+
+ sal_Bool bAutoCompleteWords : 1;
+ sal_Bool bAutoCmpltCollectWords : 1;
+ sal_Bool bAutoCmpltEndless : 1;
+// -- under NT here starts a new long
+ sal_Bool bAutoCmpltAppendBlanc : 1;
+ sal_Bool bAutoCmpltShowAsTip : 1;
+
+ sal_Bool bAFmtDelSpacesAtSttEnd : 1;
+ sal_Bool bAFmtDelSpacesBetweenLines : 1;
+ sal_Bool bAFmtByInpDelSpacesAtSttEnd : 1;
+ sal_Bool bAFmtByInpDelSpacesBetweenLines : 1;
+
+ sal_Bool bAutoCmpltKeepList : 1;
+
+ // some dummies for any new options
+ sal_Bool bDummy6 : 1,
+ bDummy7 : 1,
+ bDummy8 : 1
+ ;
+
+ SvxSwAutoFmtFlags();
+ SvxSwAutoFmtFlags( const SvxSwAutoFmtFlags& rAFFlags ) { *this = rAFFlags; }
+ SvxSwAutoFmtFlags& operator=( const SvxSwAutoFmtFlags& );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/tstpitem.hxx b/include/editeng/tstpitem.hxx
new file mode 100644
index 000000000000..f8eca761395b
--- /dev/null
+++ b/include/editeng/tstpitem.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_TSPTITEM_HXX
+#define _SVX_TSPTITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/svxenum.hxx>
+#include <editeng/editengdllapi.h>
+#include <o3tl/sorted_vector.hxx>
+
+// class SvxTabStop ------------------------------------------------------
+
+#define SVX_TAB_DEFCOUNT 10
+#define SVX_TAB_DEFDIST 1134 // 2cm in twips
+#define SVX_TAB_NOTFOUND USHRT_MAX
+#define cDfltDecimalChar (sal_Unicode(0x00)) // Get from IntlWrapper
+#define cDfltFillChar (sal_Unicode(' '))
+
+class EDITENG_DLLPUBLIC SvxTabStop
+{
+private:
+ sal_Int32 nTabPos;
+
+ SvxTabAdjust eAdjustment;
+ mutable sal_Unicode m_cDecimal;
+ sal_Unicode cFill;
+
+ EDITENG_DLLPRIVATE friend SvStream& operator<<( SvStream&, SvxTabStop& );
+
+ void fillDecimal() const;
+
+public:
+ SvxTabStop();
+ explicit SvxTabStop( const sal_Int32 nPos,
+ const SvxTabAdjust eAdjst = SVX_TAB_ADJUST_LEFT,
+ const sal_Unicode cDec = cDfltDecimalChar,
+ const sal_Unicode cFil = cDfltFillChar );
+
+ sal_Int32& GetTabPos() { return nTabPos; }
+ sal_Int32 GetTabPos() const { return nTabPos; }
+
+ SvxTabAdjust& GetAdjustment() { return eAdjustment; }
+ SvxTabAdjust GetAdjustment() const { return eAdjustment; }
+
+ sal_Unicode& GetDecimal() { fillDecimal(); return m_cDecimal; }
+ sal_Unicode GetDecimal() const { fillDecimal(); return m_cDecimal; }
+
+ sal_Unicode& GetFill() { return cFill; }
+ sal_Unicode GetFill() const { return cFill; }
+
+ String GetValueString() const;
+
+ // the "old" operator==()
+ sal_Bool IsEqual( const SvxTabStop& rTS ) const
+ {
+ return ( nTabPos == rTS.nTabPos &&
+ eAdjustment == rTS.eAdjustment &&
+ m_cDecimal == rTS.m_cDecimal &&
+ cFill == rTS.cFill );
+ }
+
+ // For the SortedArray:
+ sal_Bool operator==( const SvxTabStop& rTS ) const
+ { return nTabPos == rTS.nTabPos; }
+ sal_Bool operator <( const SvxTabStop& rTS ) const
+ { return nTabPos < rTS.nTabPos; }
+
+ SvxTabStop& operator=( const SvxTabStop& rTS )
+ {
+ nTabPos = rTS.nTabPos;
+ eAdjustment = rTS.eAdjustment;
+ m_cDecimal = rTS.m_cDecimal;
+ cFill = rTS.cFill;
+ return *this;
+ }
+};
+
+// class SvxTabStopItem --------------------------------------------------
+
+typedef o3tl::sorted_vector<SvxTabStop> SvxTabStopArr;
+
+/* [Description]
+
+ This item describes a list of TabStops.
+*/
+
+class EDITENG_DLLPUBLIC SvxTabStopItem : public SfxPoolItem
+{
+ SvxTabStopArr maTabStops;
+
+public:
+ TYPEINFO();
+
+ explicit SvxTabStopItem( sal_uInt16 nWhich );
+ SvxTabStopItem( const sal_uInt16 nTabs,
+ const sal_uInt16 nDist,
+ const SvxTabAdjust eAdjst /*= SVX_TAB_ADJUST_DEFAULT*/,
+ sal_uInt16 nWhich );
+ SvxTabStopItem( const SvxTabStopItem& rTSI );
+
+ // Returns index of the tab or TAB_NOTFOUND
+ sal_uInt16 GetPos( const SvxTabStop& rTab ) const;
+
+ // Returns index of the tab at nPos, or TAB_NOTFOUND
+ sal_uInt16 GetPos( const sal_Int32 nPos ) const;
+
+ // unprivatized:
+ sal_uInt16 Count() const { return maTabStops.size(); }
+ bool Insert( const SvxTabStop& rTab );
+ void Insert( const SvxTabStopItem* pTabs, sal_uInt16 nStart = 0,
+ sal_uInt16 nEnd = USHRT_MAX );
+ void Remove( SvxTabStop& rTab )
+ { maTabStops.erase( rTab ); }
+ void Remove( const sal_uInt16 nPos, const sal_uInt16 nLen = 1 )
+ { maTabStops.erase( maTabStops.begin() + nPos, maTabStops.begin() + nPos + nLen ); }
+
+ // Assignment operator, equality operator (caution: expensive!)
+ SvxTabStopItem& operator=( const SvxTabStopItem& rTSI );
+
+ // this is already included in SfxPoolItem declaration
+ //int operator!=( const SvxTabStopItem& rTSI ) const
+ // { return !( operator==( rTSI ) ); }
+
+ const SvxTabStop& operator[]( const sal_uInt16 nPos ) const
+ { return maTabStops[nPos]; }
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream&, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream& , sal_uInt16 nItemVersion ) const;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/twolinesitem.hxx b/include/editeng/twolinesitem.hxx
new file mode 100644
index 000000000000..dfdddde4b54b
--- /dev/null
+++ b/include/editeng/twolinesitem.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_TWOLINESITEM_HXX
+#define _SVX_TWOLINESITEM_HXX
+
+#include <sal/types.h>
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+class EDITENG_DLLPUBLIC SvxTwoLinesItem : public SfxPoolItem
+{
+ sal_Unicode cStartBracket, cEndBracket;
+ sal_Bool bOn;
+public:
+ TYPEINFO();
+ SvxTwoLinesItem( sal_Bool bOn /*= sal_True*/,
+ sal_Unicode nStartBracket /*= 0*/,
+ sal_Unicode nEndBracket /*= 0*/,
+ sal_uInt16 nId );
+ SvxTwoLinesItem( const SvxTwoLinesItem& rAttr );
+ virtual ~SvxTwoLinesItem();
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+ virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16 nVer) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nIVer) const;
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper* pIntl = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFFVer ) const;
+
+ SvxTwoLinesItem& operator=( const SvxTwoLinesItem& rCpy )
+ {
+ SetValue( rCpy.GetValue() );
+ SetStartBracket( rCpy.GetStartBracket() );
+ SetEndBracket( rCpy.GetEndBracket() );
+ return *this;
+ }
+
+ sal_Bool GetValue() const { return bOn; }
+ void SetValue( sal_Bool bFlag ) { bOn = bFlag; }
+
+ sal_Unicode GetStartBracket() const { return cStartBracket; }
+ void SetStartBracket( sal_Unicode c ) { cStartBracket = c; }
+
+ sal_Unicode GetEndBracket() const { return cEndBracket; }
+ void SetEndBracket( sal_Unicode c ) { cEndBracket = c; }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/txtrange.hxx b/include/editeng/txtrange.hxx
new file mode 100644
index 000000000000..700db5760ad1
--- /dev/null
+++ b/include/editeng/txtrange.hxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _MyTXTRANGE_HXX
+#define _MyTXTRANGE_HXX
+
+#include "editeng/editengdllapi.h"
+#include "tools/solar.h"
+#include "tools/gen.hxx"
+
+#include <deque>
+
+class PolyPolygon;
+class Rectangle;
+
+namespace basegfx {
+ class B2DPolyPolygon;
+}
+
+typedef std::deque<long>* LongDqPtr;
+
+/*************************************************************************
+|*
+|* class TextRanger
+|*
+*************************************************************************/
+class EDITENG_DLLPUBLIC TextRanger
+{
+ //! The RangeCache class is used to cache the result of a single range calculation.
+ struct RangeCache
+ {
+ Range range; //!< Range for which we calculated results.
+ std::deque<long> results; //!< Calculated results for the range.
+ RangeCache(const Range& rng) : range(rng) {};
+ };
+ std::deque<RangeCache> mRangeCache; //!< Cached range calculations.
+ PolyPolygon *mpPolyPolygon; // Surface polygon
+ PolyPolygon *mpLinePolyPolygon; // Line polygon
+ Rectangle *pBound; // Comprehensive rectangle
+ sal_uInt16 nCacheSize; // Cache-Size
+ sal_uInt16 nRight; // Distance Contour-Text
+ sal_uInt16 nLeft; // Distance Text-Contour
+ sal_uInt16 nUpper; // Distance Contour-Text
+ sal_uInt16 nLower; // Distance Text-Contour
+ sal_uInt32 nPointCount; // Number of polygon points
+ sal_Bool bSimple : 1; // Just outside edge
+ sal_Bool bInner : 1; // TRUE: Objekt inline (EditEngine);
+ // FALSE: Objekt flow (StarWriter);
+ sal_Bool bVertical :1; // for vertical writing mode
+ sal_Bool bFlag3 :1;
+ sal_Bool bFlag4 :1;
+ sal_Bool bFlag5 :1;
+ sal_Bool bFlag6 :1;
+ sal_Bool bFlag7 :1;
+ TextRanger( const TextRanger& ); // not implemented
+ const Rectangle& _GetBoundRect();
+public:
+ TextRanger( const basegfx::B2DPolyPolygon& rPolyPolygon,
+ const basegfx::B2DPolyPolygon* pLinePolyPolygon,
+ sal_uInt16 nCacheSize, sal_uInt16 nLeft, sal_uInt16 nRight,
+ sal_Bool bSimple, sal_Bool bInner, sal_Bool bVert = sal_False );
+ ~TextRanger();
+ LongDqPtr GetTextRanges( const Range& rRange );
+ sal_uInt16 GetRight() const { return nRight; }
+ sal_uInt16 GetLeft() const { return nLeft; }
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ sal_uInt32 GetPointCount() const { return nPointCount; }
+ sal_Bool IsSimple() const { return bSimple; }
+ sal_Bool IsInner() const { return bInner; }
+ sal_Bool IsVertical() const { return bVertical; }
+ sal_Bool HasBorder() const { return nRight || nLeft; }
+ const PolyPolygon& GetPolyPolygon() const { return *mpPolyPolygon; }
+ const PolyPolygon* GetLinePolygon() const { return mpLinePolyPolygon; }
+ const Rectangle& GetBoundRect()
+ { return pBound ? static_cast< const Rectangle& >(*pBound) : _GetBoundRect(); }
+ void SetUpper( sal_uInt16 nNew ){ nUpper = nNew; }
+ void SetLower( sal_uInt16 nNew ){ nLower = nNew; }
+ void SetVertical( sal_Bool bNew );
+ sal_Bool IsFlag3() const { return bFlag3; }
+ void SetFlag3( sal_Bool bNew ) { bFlag3 = bNew; }
+ sal_Bool IsFlag4() const { return bFlag4; }
+ void SetFlag4( sal_Bool bNew ) { bFlag4 = bNew; }
+ sal_Bool IsFlag5() const { return bFlag5; }
+ void SetFlag5( sal_Bool bNew ) { bFlag5 = bNew; }
+ sal_Bool IsFlag6() const { return bFlag6; }
+ void SetFlag6( sal_Bool bNew ) { bFlag6 = bNew; }
+ sal_Bool IsFlag7() const { return bFlag7; }
+ void SetFlag7( sal_Bool bNew ) { bFlag7 = bNew; }
+};
+
+
+
+#endif // _TXTRANGE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx
new file mode 100644
index 000000000000..7d1a88dfa81a
--- /dev/null
+++ b/include/editeng/udlnitem.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_UDLNITEM_HXX
+#define _SVX_UDLNITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <vcl/vclenum.hxx>
+#include <tools/color.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxTextLineItem ------------------------------------------------
+
+/* Value container for underline and overline font effects */
+
+class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem
+{
+ Color mColor;
+public:
+ TYPEINFO();
+
+ SvxTextLineItem( const FontUnderline eSt,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ // MS VC4.0 messes things up
+ void SetValue( sal_uInt16 nNewVal )
+ {SfxEnumItem::SetValue(nNewVal); }
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ inline SvxTextLineItem& operator=(const SvxTextLineItem& rTextLine)
+ {
+ SetValue( rTextLine.GetValue() );
+ SetColor( rTextLine.GetColor() );
+ return *this;
+ }
+
+ // enum cast
+ FontUnderline GetLineStyle() const
+ { return (FontUnderline)GetValue(); }
+ void SetLineStyle( FontUnderline eNew )
+ { SetValue((sal_uInt16) eNew); }
+
+ const Color& GetColor() const { return mColor; }
+ void SetColor( const Color& rCol ) { mColor = rCol; }
+};
+
+// class SvxUnderlineItem ------------------------------------------------
+
+/* Value container for underline font effects */
+
+class EDITENG_DLLPUBLIC SvxUnderlineItem : public SvxTextLineItem
+{
+public:
+ TYPEINFO();
+
+ SvxUnderlineItem( const FontUnderline eSt,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+};
+
+// class SvxOverlineItem ------------------------------------------------
+
+/* Value container for overline font effects */
+
+class EDITENG_DLLPUBLIC SvxOverlineItem : public SvxTextLineItem
+{
+public:
+ TYPEINFO();
+
+ SvxOverlineItem( const FontUnderline eSt,
+ const sal_uInt16 nId );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+};
+
+#endif // #ifndef _SVX_UDLNITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/ulspitem.hxx b/include/editeng/ulspitem.hxx
new file mode 100644
index 000000000000..f57c01bb3d3f
--- /dev/null
+++ b/include/editeng/ulspitem.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_ULSPITEM_HXX
+#define _SVX_ULSPITEM_HXX
+
+#include <svl/poolitem.hxx>
+#include <editeng/editengdllapi.h>
+
+
+// class SvxULSpaceItem --------------------------------------------------
+
+/* [Description]
+
+ This item describes the Upper- and Lower space of a page or paragraph.
+*/
+
+#define ULSPACE_16_VERSION ((sal_uInt16)0x0001)
+
+class EDITENG_DLLPUBLIC SvxULSpaceItem : public SfxPoolItem
+{
+ sal_uInt16 nUpper; // Upper space
+ sal_uInt16 nLower; // Lower space
+ sal_Bool bContext; // Contextual spacing?
+ sal_uInt16 nPropUpper, nPropLower; // relative or absolute (=100%)
+public:
+ TYPEINFO();
+
+ explicit SvxULSpaceItem( const sal_uInt16 nId );
+ SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
+ const sal_uInt16 nId );
+ inline SvxULSpaceItem& operator=( const SvxULSpaceItem &rCpy );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion ) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual bool ScaleMetrics( long nMult, long nDiv );
+ virtual bool HasMetrics() const;
+
+ inline void SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp = 100 );
+ inline void SetLower( const sal_uInt16 nL, const sal_uInt16 nProp = 100 );
+
+ void SetUpperValue( const sal_uInt16 nU ) { nUpper = nU; }
+ void SetLowerValue( const sal_uInt16 nL ) { nLower = nL; }
+ void SetContextValue( const sal_Bool bC ) { bContext = bC; }
+ void SetPropUpper( const sal_uInt16 nU ) { nPropUpper = nU; }
+ void SetPropLower( const sal_uInt16 nL ) { nPropLower = nL; }
+
+ sal_uInt16 GetUpper() const { return nUpper; }
+ sal_uInt16 GetLower() const { return nLower; }
+ sal_Bool GetContext() const { return bContext; }
+ sal_uInt16 GetPropUpper() const { return nPropUpper; }
+ sal_uInt16 GetPropLower() const { return nPropLower; }
+};
+
+inline SvxULSpaceItem &SvxULSpaceItem::operator=( const SvxULSpaceItem &rCpy )
+{
+ nUpper = rCpy.GetUpper();
+ nLower = rCpy.GetLower();
+ bContext = rCpy.GetContext();
+ nPropUpper = rCpy.GetPropUpper();
+ nPropLower = rCpy.GetPropLower();
+ return *this;
+}
+
+inline void SvxULSpaceItem::SetUpper( const sal_uInt16 nU, const sal_uInt16 nProp )
+{
+ nUpper = sal_uInt16((sal_uInt32(nU) * nProp ) / 100); nPropUpper = nProp;
+}
+inline void SvxULSpaceItem::SetLower( const sal_uInt16 nL, const sal_uInt16 nProp )
+{
+ nLower = sal_uInt16((sal_uInt32(nL) * nProp ) / 100); nPropLower = nProp;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedhlp.hxx b/include/editeng/unoedhlp.hxx
new file mode 100644
index 000000000000..25cf36f17356
--- /dev/null
+++ b/include/editeng/unoedhlp.hxx
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOEDHLP_HXX
+#define _SVX_UNOEDHLP_HXX
+
+#include <memory>
+#include <tools/solar.h>
+#include <vcl/textdata.hxx>
+#include <svl/hint.hxx>
+#include <tools/gen.hxx>
+#include "editeng/editengdllapi.h"
+
+struct EENotify;
+class EditEngine;
+
+#define EDITSOURCE_HINT_PARASMOVED 20
+#define EDITSOURCE_HINT_SELECTIONCHANGED 21
+
+/** Extends TextHint by two additional parameters which are necessary
+ for the EDITSOURCE_HINT_PARASMOVED hint. TextHint's value in this
+ case denotes the destination position, the two parameters the
+ start and the end of the moved paragraph range.
+ */
+class EDITENG_DLLPUBLIC SvxEditSourceHint : public TextHint
+{
+private:
+ sal_uLong mnStart;
+ sal_uLong mnEnd;
+
+public:
+ TYPEINFO();
+ SvxEditSourceHint( sal_uLong nId );
+ SvxEditSourceHint( sal_uLong nId, sal_uLong nValue, sal_uLong nStart=0, sal_uLong nEnd=0 );
+
+ sal_uLong GetValue() const;
+ sal_uLong GetStartValue() const;
+ sal_uLong GetEndValue() const;
+};
+
+/** Helper class for common functionality in edit sources
+ */
+class EDITENG_DLLPUBLIC SvxEditSourceHelper
+{
+public:
+
+ /** Translates EditEngine notifications into broadcastable hints
+
+ @param aNotify
+ Notification object send by the EditEngine.
+
+ @return the translated hint
+ */
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ static ::std::auto_ptr<SfxHint> EENotification2Hint( EENotify* aNotify );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ /** Calculate attribute run for EditEngines
+
+ Please note that the range returned is half-open: [nStartIndex,nEndIndex)
+
+ @param nStartIndex
+ Herein, the start index of the range of similar attributes is returned
+
+ @param nEndIndex
+ Herein, the end index (exclusive) of the range of similar attributes is returned
+
+ @param rEE
+ The EditEngine to query for attributes
+
+ @param nPara
+ The paragraph the following index value is to be interpreted in
+
+ @param nIndex
+ The character index from which the range of similar attributed characters is requested
+
+ @return sal_True, if the range has been successfully determined
+ */
+ static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex );
+
+ /** Convert point from edit engine to user coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given point appropriately,
+ if vertical writing is on.
+
+ @param rPoint
+ Point to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed point
+ */
+ static Point EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical );
+
+ /** Convert point from user to edit engine coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given point appropriately,
+ if vertical writing is on.
+
+ @param rPoint
+ Point to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed point
+ */
+ static Point UserSpaceToEE( const Point& rPoint, const Size& rEESize, bool bIsVertical );
+
+ /** Convert rect from edit engine to user coordinate space
+
+ As the edit engine internally keeps vertical text unrotated,
+ all internal edit engine methods return their stuff unrotated,
+ too. This method rotates and shifts given rect appropriately,
+ if vertical writing is on.
+
+ @param rRect
+ Rectangle to transform
+
+ @param rEESize
+ Paper size of the edit engine
+
+ @param bIsVertical
+ Whether output text is vertical or not
+
+ @return the possibly transformed rect
+ */
+ static Rectangle EEToUserSpace( const Rectangle& rRect, const Size& rEESize, bool bIsVertical );
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedprx.hxx b/include/editeng/unoedprx.hxx
new file mode 100644
index 000000000000..c6e067a6a633
--- /dev/null
+++ b/include/editeng/unoedprx.hxx
@@ -0,0 +1,176 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOEDPRX_HXX
+#define _SVX_UNOEDPRX_HXX
+
+#include <memory>
+#include <svl/brdcst.hxx>
+#include <editeng/unoedsrc.hxx>
+
+#include <editeng/editdata.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvxAccessibleTextAdapter : public SvxTextForwarder
+{
+public:
+ SvxAccessibleTextAdapter();
+ virtual ~SvxAccessibleTextAdapter();
+
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ virtual sal_uInt16 CalcEditEngineIndex( sal_uInt16 nPara, sal_Int32 nLogicalIndex );
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+
+ virtual sal_Bool IsValid() const;
+
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ // (not needed for accessibility, only for new import API)
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+
+ void SetForwarder( SvxTextForwarder& );
+ sal_Bool HaveImageBullet( sal_uInt16 nPara ) const;
+ sal_Bool HaveTextBullet( sal_uInt16 nPara ) const;
+
+ /** Query whether all text in given selection is editable
+
+ @return sal_True if every character in the given selection can
+ be changed, and sal_False if e.g. a field or a bullet is
+ contained therein.
+ */
+ sal_Bool IsEditable( const ESelection& rSelection );
+
+private:
+ SvxTextForwarder* mrTextForwarder;
+};
+
+class SvxAccessibleTextEditViewAdapter : public SvxEditViewForwarder
+{
+public:
+
+ SvxAccessibleTextEditViewAdapter();
+ virtual ~SvxAccessibleTextEditViewAdapter();
+
+ // SvxViewForwarder interface
+ virtual sal_Bool IsValid() const;
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
+
+ // SvxEditViewForwarder interface
+ virtual sal_Bool GetSelection( ESelection& rSelection ) const;
+ virtual sal_Bool SetSelection( const ESelection& rSelection );
+ virtual sal_Bool Copy();
+ virtual sal_Bool Cut();
+ virtual sal_Bool Paste();
+
+ void SetForwarder( SvxEditViewForwarder&, SvxAccessibleTextAdapter& );
+
+private:
+ SvxEditViewForwarder* mrViewForwarder;
+ SvxAccessibleTextAdapter* mrTextForwarder;
+};
+
+class EDITENG_DLLPUBLIC SvxEditSourceAdapter : public SvxEditSource
+{
+public:
+ SvxEditSourceAdapter();
+ ~SvxEditSourceAdapter();
+
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ SvxAccessibleTextAdapter* GetTextForwarderAdapter(); // covariant return types don't work on MSVC
+ virtual SvxViewForwarder* GetViewForwarder();
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+ SvxAccessibleTextEditViewAdapter* GetEditViewForwarderAdapter( sal_Bool bCreate = sal_False ); // covariant return types don't work on MSVC
+ virtual void UpdateData();
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ void SetEditSource( ::std::auto_ptr< SvxEditSource > pAdaptee );
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ sal_Bool IsValid() const;
+
+private:
+ // declared, but not defined
+ SvxEditSourceAdapter( const SvxEditSourceAdapter& );
+ SvxEditSourceAdapter& operator= ( const SvxEditSourceAdapter& );
+
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr< SvxEditSource > mpAdaptee;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ SvxAccessibleTextAdapter maTextAdapter;
+ SvxAccessibleTextEditViewAdapter maEditViewAdapter;
+
+ mutable SfxBroadcaster maDummyBroadcaster;
+
+ sal_Bool mbEditSourceValid;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoedsrc.hxx b/include/editeng/unoedsrc.hxx
new file mode 100644
index 000000000000..9e5bba23e56b
--- /dev/null
+++ b/include/editeng/unoedsrc.hxx
@@ -0,0 +1,540 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOEDSRC_HXX
+#define _SVX_UNOEDSRC_HXX
+
+#include <com/sun/star/accessibility/TextSegment.hpp>
+
+#include <tools/solar.h>
+#include <i18nlangtag/lang.h>
+#include <tools/gen.hxx>
+#include <vcl/mapmod.hxx>
+#include <tools/string.hxx>
+#include <tools/color.hxx>
+#include <svl/poolitem.hxx>
+#include <svl/itempool.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <list>
+
+struct ESelection;
+struct EFieldInfo;
+struct EBulletInfo;
+class OutputDevice;
+class String;
+class SfxItemSet;
+class SvxTextForwarder;
+class SvxViewForwarder;
+class SvxEditViewForwarder;
+class SvxFieldItem;
+class SfxBroadcaster;
+class SvxUnoTextRangeBase;
+
+typedef std::list< SvxUnoTextRangeBase* > SvxUnoTextRangeBaseList;
+
+/** Wrapper class for unified EditEngine/Outliner access
+
+ This class wraps a textual object, which might or might not
+ contain an EditEngine/Outliner. Is used e.g. for filling an
+ EditEngine with the content of a cell, note page or page template.
+*/
+class EDITENG_DLLPUBLIC SvxEditSource
+{
+public:
+ virtual ~SvxEditSource();
+
+ /// Returns a new reference to the same object. This is a shallow copy
+ virtual SvxEditSource* Clone() const = 0;
+
+ /** Query the text forwarder
+
+ @return the text forwarder, or NULL if the underlying object is dead
+ */
+ virtual SvxTextForwarder* GetTextForwarder() = 0;
+
+ /** Query the view forwarder
+
+ @return the view forwarder, or NULL if the underlying object
+ is dead, or if no view is available
+
+ @derive default implementation provided, overriding is optional
+ */
+ virtual SvxViewForwarder* GetViewForwarder();
+
+ /** Query the edit view forwarder
+
+ @param bCreate
+ Determines whether an EditView should be created, if there is
+ none active. If set to sal_True, and the underlying object is
+ not in EditMode, the text forwarder changes and the object is
+ set to EditMode.
+
+ @return the edit view forwarder, or NULL if the underlying
+ object is dead, or if no view is available (if bCreate is
+ sal_False, NULL is also returned if the object is not in
+ EditMode)
+
+ @derive default implementation provided, overriding is optional
+
+ @attention If this method is called with bCreate equal to
+ sal_True, all previously returned text forwarder can become
+ invalid
+ */
+ virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = sal_False );
+
+ /// Write back data to model
+ virtual void UpdateData() = 0;
+
+ /** Returns broadcaster the underlying edit engine's events are sent from
+
+ @derive default implementation provided, overriding is optional
+ */
+ virtual SfxBroadcaster& GetBroadcaster() const;
+
+ /** adds the given SvxUnoTextRangeBase to the text object
+ capsulated by this SvxEditSource. This allows the text
+ object to inform all created text ranges about changes
+ and also allows to re use already created instances.
+ All SvxUnoTextRangeBase must remove itself with
+ removeRange() before theire deleted. */
+ virtual void addRange( SvxUnoTextRangeBase* pNewRange );
+
+ /** removes the given SvxUnoTextRangeBase from the text
+ object capsulated by this SvxEditSource. This text range
+ will not be informed any longer of changes on the underlying
+ text and will also not re used anymore. */
+ virtual void removeRange( SvxUnoTextRangeBase* pOldRange );
+
+ /** returns a const list of all text ranges that are registered
+ for the underlying text object. */
+ virtual const SvxUnoTextRangeBaseList& getRanges() const;
+};
+
+
+/** Contains an EditEngine or an Outliner and unifies access to them.
+
+ The EditEngine-UNO objects use this class only. To reflect changes
+ not only in the EditEngine, but also in the model data, call
+ SvxEditSource::UpdateData(). This copies back the data to the model's
+ EditTextObject/OutlinerParaObject.
+ */
+class EDITENG_DLLPUBLIC SvxTextForwarder
+{
+public:
+ virtual ~SvxTextForwarder();
+
+ virtual sal_uInt16 GetParagraphCount() const = 0;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const = 0;
+ virtual String GetText( const ESelection& rSel ) const = 0;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const = 0;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const = 0;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet ) = 0;
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich ) = 0;
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const = 0;
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const = 0;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const = 0;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel ) = 0;
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel ) = 0;
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel ) = 0;
+ virtual void QuickInsertLineBreak( const ESelection& rSel ) = 0;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor ) = 0;
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos ) = 0;
+
+ virtual SfxItemPool* GetPool() const = 0;
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr() = 0;
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph() = 0;
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet ) = 0;
+
+ // XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource) = 0;
+
+ /** Query state of forwarder
+
+ @return sal_False, if no longer valid
+ */
+ virtual sal_Bool IsValid() const = 0;
+
+ /** Query language of character at given position on the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query language in
+
+ @param nIndex[0 .. m-1]
+ Index of character to query language of
+ */
+ virtual LanguageType GetLanguage( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Query number of fields in the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query field number in
+ */
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const = 0;
+
+ /** Query information for given field number in the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query field info in
+
+ @param nField[0 .. m-1]
+ Index of field to query information of
+ */
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const = 0;
+
+ /** Query information regarding bullets for given paragraph on the underlying edit engine
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query bullet info on
+ */
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const = 0;
+
+ /** Query the bounding rectangle of the given character
+
+ @param nPara[0 .. n]
+ Index of paragraph to query the bounds in. <p>The virtual
+ character after the last character of the represented text,
+ i.e. the one at position n is a special case. Because it does
+ not represent an existing character its bounding box is
+ defined in relation to preceding characters. It should be
+ rougly equivalent to the bounding box of some character when
+ inserted at the end of the text. Its height typically being
+ the maximal height of all the characters in the text or the
+ height of the preceding character, its width being at least
+ one pixel so that the bounding box is not degenerate.<br>
+
+ @param nIndex[0 .. m-1]
+ Index of character to query the bounds of
+
+ @return rectangle in logical coordinates, relative to upper
+ left corner of text. The coordinates returned here are to be
+ interpreted in the map mode given by GetMapMode().
+ */
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Query the bounding rectangle of the given paragraph
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query the bounds of
+
+ @return rectangle in logical coordinates, relative to upper
+ left corner of text. The coordinates returned here are to be
+ interpreted in the map mode given by GetMapMode().
+ */
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const = 0;
+
+ /** Query the map mode of the underlying EditEngine/Outliner
+
+ @return the map mode used on the EditEngine/Outliner. The
+ values returned by GetParaBounds() and GetCharBounds() are to
+ be interpreted in this map mode, the point given to
+ GetIndexAtPoint() is interpreted in this map mode.
+ */
+ virtual MapMode GetMapMode() const = 0;
+
+ /** Query the reference output device of the underlying EditEngine/Outliner
+
+ @return the OutputDevice used from the EditEngine/Outliner to
+ format the text. It should be used when performing e.g. font
+ calculations, since this is usually a printer with fonts and
+ resolution different from the screen.
+ */
+ virtual OutputDevice* GetRefDevice() const = 0;
+
+ /** Query paragraph and character index of the character at the
+ given point. Returns sal_True on success, sal_False otherwise
+
+ @param rPoint
+ Point to query text position of. Is interpreted in logical
+ coordinates, relativ to the upper left corner of the text, and
+ in the map mode given by GetMapMode()
+
+ @param rPara[0 .. n-1]
+ Index of paragraph the point is within
+
+ @param rIndex[0 .. m-1]
+ Index of character the point is over
+
+ @return sal_True, if the point is over any text and both rPara and rIndex are valid
+
+ */
+ virtual sal_Bool GetIndexAtPoint( const Point& rPoint, sal_uInt16& rPara, sal_uInt16& rIndex ) const = 0;
+
+ /** Get the start and the end index of the word at the given index
+
+ An index value on a word leads from the first character of
+ that word up to and including the last space before the next
+ word. The index values returned do not contain any leading or
+ trailing white-space. If the input indices are invalid,
+ sal_False is returned.
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to start the search in
+
+ @param nIndex[0 .. m-1]
+ Index of character to query the search on
+
+ @param rStart
+ Start index (in the same paragraph)
+
+ @param rEnd
+ End index (in the same paragraph), this point to the last
+ character still contained in the query
+
+ @return sal_True, if the result is non-empty
+ */
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& rStart, sal_uInt16& rEnd ) const = 0;
+
+ /** Query range of similar attributes
+
+ Please note that the range returned is half-open: [nStartIndex,nEndIndex)
+
+ @param nStartIndex
+ Herein, the start index of the range of similar attributes is returned
+
+ @param nEndIndex
+ Herein, the end index (exclusive) of the range of similar attributes is returned
+
+ @param nIndex
+ The character index from which the range of similar attributed characters is requested
+
+ @return sal_True, if the range has been successfully determined
+ */
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Query number of lines in the formatted paragraph
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query number of lines in
+
+ @return number of lines in given paragraph
+
+ */
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const = 0;
+
+ /** Query line length
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nLine[0 .. m-1]
+ Index of line in paragraph to query line length of
+
+ */
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const = 0;
+
+ /** Query bounds of line in paragraph
+
+ @param rStart [output param; 0 .. text_len]
+ The index in the paragraph text that belongs to the chara at the start of the line
+
+ @param rEnd [output param; 0 .. text_len]
+ The index in the paragraph text that follows the last chara in the line
+
+ @param nParagraph[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nLine[0 .. m-1]
+ Index of line in paragraph to query line length of
+
+ */
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const = 0;
+
+ /** Query the line number for a index in the paragraphs text
+
+ @param nPara[0 .. n-1]
+ Index of paragraph to query line length in
+
+ @param nIndex[0 .. m-1]
+ Index of of the chara in the paragraph text
+
+ @returns [0 .. k-1]
+ The line number of the chara in the paragraph
+ */
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+
+ /** Delete given text range and reformat text
+
+ @param rSelection
+ The text range to be deleted
+
+ @return sal_True if text has been successfully deleted
+ */
+ virtual sal_Bool Delete( const ESelection& rSelection ) = 0;
+
+ /** Insert/Replace given text in given range and reformat text
+
+ @param rText
+ Text to insert/replace
+
+ @param rSel
+ Selection where text should be replaced. The empty selection inserts
+
+ @return sal_True if text has been successfully inserted
+ */
+ virtual sal_Bool InsertText( const String& rText, const ESelection& rSel ) = 0;
+
+ /** Updates the formatting
+
+ @see EditEngine::QuickFormatDoc() for details
+
+ @return sal_True if text have been successfully reformatted
+ */
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False ) = 0;
+
+ /** Get the outline depth of given paragraph
+
+ @param nPara
+ Index of the paragraph to query the depth of
+
+ @return the outline level of the given paragraph. The range is
+ [0,n), where n is the maximal outline level.
+ */
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const = 0;
+
+ /** Set the outline depth of given paragraph
+
+ @param nPara
+ Index of the paragraph to set the depth of
+
+ @param nNewDepth
+ The depth to set on the given paragraph. The range is
+ [0,n), where n is the maximal outline level.
+
+ @return sal_True, if depth could be successfully set. Reasons for
+ failure are e.g. the text does not support outline level
+ (EditEngine), or the depth range is exceeded.
+ */
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth ) = 0;
+
+ virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
+ virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
+
+ virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
+ virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+};
+
+/** Encapsulates the document view for the purpose of unified
+ EditEngine/Outliner access.
+
+ This one has to be different from the SvxEditViewForwarder, since
+ the latter is only valid in edit mode.
+ */
+class EDITENG_DLLPUBLIC SvxViewForwarder
+{
+public:
+ virtual ~SvxViewForwarder();
+
+ /** Query state of forwarder
+
+ @return sal_False, if no longer valid
+ */
+ virtual sal_Bool IsValid() const = 0;
+
+ /** Query visible area of the view containing the text
+
+ @return the visible rectangle of the text, i.e. the part of
+ the EditEngine or Outliner that is currently on screen. The
+ values are already in screen coordinates (pixel), and have to
+ be relative to the EditEngine/Outliner's upper left corner.
+ */
+ virtual Rectangle GetVisArea() const = 0;
+
+ /** Convert from logical, EditEngine-relative coordinates to screen coordinates
+
+ @param rPoint
+ Point in logical, EditEngine-relative coordinates.
+
+ @param rMapMode
+ The map mode to interpret the coordinates in.
+
+ @return the point in screen coordinates
+ */
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const = 0;
+
+ /** Convert from screen to logical, EditEngine-relative coordinates
+
+ @param rPoint
+ Point in screen coordinates
+
+ @param rMapMode
+ The map mode to interpret the coordinates in.
+
+ @return the point in logical coordinates.
+ */
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const = 0;
+
+};
+
+
+/** Encapsulates EditView and OutlinerView for the purpose of unified
+ EditEngine/Outliner access
+ */
+class SvxEditViewForwarder : public SvxViewForwarder
+{
+public:
+
+ /** Query current selection.
+
+ @param rSelection
+ Contains the current selection after method call
+
+ @return sal_False, if there is no view or no selection (the empty selection _is_ a selection)
+
+ */
+ virtual sal_Bool GetSelection( ESelection& rSelection ) const = 0;
+
+ /** Set selection in view.
+
+ @param rSelection
+ The selection to set
+
+ @return sal_False, if there is no view or selection is invalid
+ */
+ virtual sal_Bool SetSelection( const ESelection& rSelection ) = 0;
+
+ /** Copy current selection to clipboard.
+
+ @return sal_False if no selection or no view (the empty selection _is_ a selection)
+ */
+ virtual sal_Bool Copy() = 0;
+
+ /** Cut current selection to clipboard.
+
+ @eturn sal_False if no selection or no view (the empty selection _is_ a selection)
+ */
+ virtual sal_Bool Cut() = 0;
+
+ /** Paste clipboard into current selection.
+
+ @return sal_False if no view or no selection (the empty selection _is_ a selection)
+ */
+ virtual sal_Bool Paste() = 0;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofdesc.hxx b/include/editeng/unofdesc.hxx
new file mode 100644
index 000000000000..711affaf2c1e
--- /dev/null
+++ b/include/editeng/unofdesc.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_UNOFDESC_HXX
+#define SVX_UNOFDESC_HXX
+
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <svl/itemset.hxx>
+#include <vcl/font.hxx>
+#include "editeng/editengdllapi.h"
+
+class EDITENG_DLLPUBLIC SvxUnoFontDescriptor
+{
+public:
+ static void ConvertToFont( const ::com::sun::star::awt::FontDescriptor& rDesc, Font& rFont );
+ static void ConvertFromFont( const Font& rFont, ::com::sun::star::awt::FontDescriptor& rDesc );
+
+ static void FillItemSet( const ::com::sun::star::awt::FontDescriptor& rDesc, SfxItemSet& rSet );
+ static void FillFromItemSet( const SfxItemSet& rSet, ::com::sun::star::awt::FontDescriptor& rDesc );
+
+ static void setPropertyToDefault( SfxItemSet& rSet );
+ static ::com::sun::star::uno::Any getPropertyDefault( SfxItemPool* pPool );
+
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofield.hxx b/include/editeng/unofield.hxx
new file mode 100644
index 000000000000..d496e7217efc
--- /dev/null
+++ b/include/editeng/unofield.hxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFIELD_HXX
+#define _SVX_UNOFIELD_HXX
+
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/text/textfield/Type.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/component.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <comphelper/servicehelper.hxx>
+
+#include <editeng/mutxhelp.hxx>
+
+class SvxUnoFieldData_Impl;
+class SfxItemPropertySet;
+class SvxFieldData;
+
+com::sun::star::uno::Reference< com::sun::star::uno::XInterface > EDITENG_DLLPUBLIC SAL_CALL SvxUnoTextCreateTextField(
+ const OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+class EDITENG_DLLPUBLIC SvxUnoTextField : public SvxMutexHelper,
+ public ::cppu::OComponentHelper,
+ public ::com::sun::star::text::XTextField,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::lang::XUnoTunnel
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > mxAnchor;
+ const SfxItemPropertySet* mpPropSet;
+ sal_Int32 mnServiceId;
+ SvxUnoFieldData_Impl* mpImpl;
+
+protected:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > maTypeSequence;
+
+public:
+ SvxUnoTextField( sal_Int32 nServiceId ) throw();
+ SvxUnoTextField( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pFieldData ) throw();
+ virtual ~SvxUnoTextField() throw();
+
+ // Internal
+ SvxFieldData* CreateFieldData() const throw();
+ void SetAnchor( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xAnchor ) { mxAnchor = xAnchor; }
+
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextField
+ virtual OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTextContent
+ virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ // XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unofored.hxx b/include/editeng/unofored.hxx
new file mode 100644
index 000000000000..5c88119f3a8f
--- /dev/null
+++ b/include/editeng/unofored.hxx
@@ -0,0 +1,93 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFORED_HXX
+#define _SVX_UNOFORED_HXX
+
+#include <editeng/editeng.hxx>
+#include <editeng/unoedsrc.hxx>
+#include "editeng/editengdllapi.h"
+
+// SvxEditEngineForwarder - SvxTextForwarder for EditEngine
+
+class EDITENG_DLLPUBLIC SvxEditEngineForwarder : public SvxTextForwarder
+{
+private:
+ EditEngine& rEditEngine;
+
+public:
+ SvxEditEngineForwarder( EditEngine& rEngine );
+ virtual ~SvxEditEngineForwarder();
+
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = EditEngineAttribs_All ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+ virtual sal_Bool IsValid() const;
+
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoforou.hxx b/include/editeng/unoforou.hxx
new file mode 100644
index 000000000000..68ee89160944
--- /dev/null
+++ b/include/editeng/unoforou.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOFOROU_HXX
+#define _SVX_UNOFOROU_HXX
+
+#include <editeng/unoedsrc.hxx>
+#include "editeng/editengdllapi.h"
+
+#include <editeng/editdata.hxx>
+
+class Outliner;
+
+// SvxOutlinerForwarder - SvxTextForwarder for Outliner
+
+class EDITENG_DLLPUBLIC SvxOutlinerForwarder : public SvxTextForwarder
+{
+private:
+ Outliner& rOutliner;
+ sal_Bool bOutlinerText;
+
+ /** this pointer may be null or point to an item set for the attribs of
+ the selection maAttribsSelection */
+ mutable SfxItemSet* mpAttribsCache;
+
+ /** if we have a chached attribute item set, this is the selection of it */
+ mutable ESelection maAttribCacheSelection;
+
+ /** this pointer may be null or point to an item set for the paragraph
+ mnParaAttribsCache */
+ mutable SfxItemSet* mpParaAttribsCache;
+
+ /** if we have a cached para attribute item set, this is the paragraph of it */
+ mutable sal_uInt16 mnParaAttribsCache;
+
+public:
+ SvxOutlinerForwarder( Outliner& rOutl, sal_Bool bOutlText = sal_False );
+ virtual ~SvxOutlinerForwarder();
+
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ virtual sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ virtual sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+
+ virtual sal_Bool IsValid() const;
+
+ Outliner& GetOutliner() const { return rOutliner; }
+
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+ virtual sal_Int16 GetNumberingStartValue( sal_uInt16 nPara );
+ virtual void SetNumberingStartValue( sal_uInt16 nPara, sal_Int16 nNumberingStartValue );
+
+ virtual sal_Bool IsParaIsNumberingRestart( sal_uInt16 nPara );
+ virtual void SetParaIsNumberingRestart( sal_uInt16 nPara, sal_Bool bParaIsNumberingRestart );
+
+ /* this method flushes internal caches for this forwarder */
+ void flushCache();
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx
new file mode 100644
index 000000000000..584eb367f5a1
--- /dev/null
+++ b/include/editeng/unoipset.hxx
@@ -0,0 +1,78 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOIPSET_HXX_
+#define _SVX_UNOIPSET_HXX_
+
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "editeng/editengdllapi.h"
+#include <svl/itemprop.hxx>
+#include <vector>
+
+class SdrItemPool;
+class SfxItemSet;
+class SvxShape;
+struct SvxIDPropertyCombine;
+
+#define SFX_METRIC_ITEM (0x40)
+
+class EDITENG_DLLPUBLIC SvxItemPropertySet
+{
+ SfxItemPropertyMap m_aPropertyMap;
+ mutable com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> m_xInfo;
+ const SfxItemPropertyMapEntry* _pMap;
+ ::std::vector< SvxIDPropertyCombine* > aCombineList;
+ sal_Bool mbConvertTwips;
+ SfxItemPool& mrItemPool;
+
+public:
+ SvxItemPropertySet( const SfxItemPropertyMapEntry *pMap, SfxItemPool& rPool, sal_Bool bConvertTwips = sal_False );
+ ~SvxItemPropertySet();
+
+ // Methods, which work directly with the ItemSet
+ ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap, const SfxItemSet& rSet, bool bSearchInParent, bool bDontConvertNegativeValues ) const;
+ void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal, SfxItemSet& rSet, bool bDontConvertNegativeValues ) const;
+
+ // Methods that use Any instead
+ ::com::sun::star::uno::Any getPropertyValue( const SfxItemPropertySimpleEntry* pMap ) const;
+ void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& rVal ) const;
+
+ sal_Bool AreThereOwnUsrAnys() const { return ( aCombineList.empty() ? sal_False : sal_True ); }
+ ::com::sun::star::uno::Any* GetUsrAnyForID(sal_uInt16 nWID) const;
+ void AddUsrAnyForID(const ::com::sun::star::uno::Any& rAny, sal_uInt16 nWID);
+ void ClearAllUsrAny();
+
+ com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > getPropertySetInfo() const;
+ const SfxItemPropertyMapEntry* getPropertyMapEntries() const {return _pMap;}
+ const SfxItemPropertyMap* getPropertyMap()const { return &m_aPropertyMap;}
+ const SfxItemPropertySimpleEntry* getPropertyMapEntry(const OUString &rName) const;
+
+ static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > getPropertySetInfo( const SfxItemPropertyMapEntry* pMap );
+};
+
+/** converts the given any with a metric to 100th/mm if needed */
+EDITENG_DLLPUBLIC void SvxUnoConvertToMM( const SfxMapUnit eSourceMapUnit, com::sun::star::uno::Any & rMetric ) throw();
+
+/** converts the given any with a metric from 100th/mm to the given metric if needed */
+EDITENG_DLLPUBLIC void SvxUnoConvertFromMM( const SfxMapUnit eDestinationMapUnit, com::sun::star::uno::Any & rMetric ) throw();
+
+#endif // _SVX_UNOIPSET_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx
new file mode 100644
index 000000000000..09f570228f95
--- /dev/null
+++ b/include/editeng/unolingu.hxx
@@ -0,0 +1,192 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _UNO_LINGU_HXX
+#define _UNO_LINGU_HXX
+
+#include <i18nlangtag/lang.h>
+#include <tools/string.hxx>
+#include <com/sun/star/util/Language.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp>
+#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
+#include <com/sun/star/linguistic2/XHyphenator.hpp>
+#include <com/sun/star/linguistic2/XThesaurus.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "editeng/editengdllapi.h"
+
+class LinguMgrExitLstnr;
+
+class Window;
+
+///////////////////////////////////////////////////////////////////////////
+
+class EDITENG_DLLPUBLIC LinguMgr
+{
+ friend class LinguMgrExitLstnr;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > xHyph;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > xThes;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > xProp;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > xIgnoreAll;
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > xChangeAll;
+
+ static LinguMgrExitLstnr *pExitLstnr;
+ static sal_Bool bExiting;
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > GetSpell();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > GetHyph();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > GetThes();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDicList();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetProp();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetStandard();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetIgnoreAll();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetChangeAll();
+
+ // disallow access to copy-constructor and assignment-operator
+ LinguMgr(const LinguMgr &);
+ LinguMgr & operator = (const LinguMgr &);
+
+public:
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > GetSpellChecker();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > GetHyphenator();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > GetThesaurus();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > GetLinguPropertySet();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr();
+
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetStandardDic();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
+ static ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > GetChangeAllList();
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ class XHyphenatedWord;
+}}}}
+
+
+struct SvxAlternativeSpelling
+{
+ String aReplacement;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > xHyphWord;
+ sal_Int16 nChangedPos,
+ nChangedLength;
+ sal_Bool bIsAltSpelling;
+
+ inline SvxAlternativeSpelling();
+};
+
+inline SvxAlternativeSpelling::SvxAlternativeSpelling() :
+ nChangedPos(-1), nChangedLength(-1), bIsAltSpelling(sal_False)
+{
+}
+
+
+EDITENG_DLLPUBLIC SvxAlternativeSpelling SvxGetAltSpelling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > & rHyphWord );
+
+
+///////////////////////////////////////////////////////////////////////////
+
+class EDITENG_DLLPUBLIC SvxDicListChgClamp
+{
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList;
+
+ // disallow access to copy-constructor and assignment-operator
+ EDITENG_DLLPRIVATE SvxDicListChgClamp(const SvxDicListChgClamp &);
+ EDITENG_DLLPRIVATE SvxDicListChgClamp & operator = (const SvxDicListChgClamp &);
+
+public:
+ SvxDicListChgClamp( ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList );
+ ~SvxDicListChgClamp();
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+//TODO: remove those functions or make them inline
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSpellChecker1 > SvxGetSpellChecker();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenator > SvxGetHyphenator();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XThesaurus > SvxGetThesaurus();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > SvxGetDictionaryList();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SvxGetLinguPropertySet();
+//TODO: remove argument or provide SvxGetIgnoreAllList with the same one
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > SvxGetOrCreatePosDic(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList );
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > SvxGetIgnoreAllList();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionary > SvxGetChangeAllList();
+
+///////////////////////////////////////////////////////////////////////////
+// misc functions
+//
+
+EDITENG_DLLPUBLIC short SvxDicError( Window *pParent, sal_Int16 nError );
+
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unonames.hxx b/include/editeng/unonames.hxx
new file mode 100644
index 000000000000..3a5984452773
--- /dev/null
+++ b/include/editeng/unonames.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+// Common across fields
+#define UNO_TC_PROP_ANCHOR "Anchor"
+#define UNO_TC_PROP_TEXTFIELD_TYPE "TextFieldType"
+#define UNO_TC_PROP_IS_FIXED "IsFixed"
+#define UNO_TC_PROP_CURRENT_PRESENTATION "CurrentPresentation"
+
+// Date & Time
+#define UNO_TC_PROP_IS_DATE "IsDate"
+#define UNO_TC_PROP_DATE_TIME "DateTime"
+#define UNO_TC_PROP_NUMFORMAT "NumberFormat"
+
+// URL
+#define UNO_TC_PROP_URL_FORMAT "Format"
+#define UNO_TC_PROP_URL_REPRESENTATION "Representation"
+#define UNO_TC_PROP_URL_TARGET "TargetFrame"
+#define UNO_TC_PROP_URL "URL"
+
+// Table
+#define UNO_TC_PROP_TABLE_POSITION "TablePosition"
+
+// File
+#define UNO_TC_PROP_FILE_FORMAT "FileFormat"
+
+// Author
+#define UNO_TC_PROP_AUTHOR_CONTENT "Content"
+#define UNO_TC_PROP_AUTHOR_FORMAT "AuthorFormat"
+#define UNO_TC_PROP_AUTHOR_FULLNAME "FullName"
+
+// Measure
+#define UNO_TC_PROP_MEASURE_KIND "Kind"
+
+#define UNO_TR_PROP_SELECTION "Selection"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unonrule.hxx b/include/editeng/unonrule.hxx
new file mode 100644
index 000000000000..985e3e9193bb
--- /dev/null
+++ b/include/editeng/unonrule.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNONRULE_HXX
+#define _SVX_UNONRULE_HXX
+
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/ucb/XAnyCompare.hpp>
+#include "editeng/editengdllapi.h"
+#include <cppuhelper/implbase5.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/util/XCloneable.hpp>
+#include <editeng/numitem.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule( const SvxNumRule* pRule ) throw();
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > SvxCreateNumRule() throw();
+const SvxNumRule& SvxGetNumRule( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > xRule ) throw( ::com::sun::star::lang::IllegalArgumentException );
+EDITENG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XAnyCompare > SvxCreateNumRuleCompare() throw();
+
+class SvxUnoNumberingRules : public ::cppu::WeakAggImplHelper5< com::sun::star::container::XIndexReplace, com::sun::star::ucb::XAnyCompare,
+ com::sun::star::lang::XUnoTunnel, com::sun::star::util::XCloneable, com::sun::star::lang::XServiceInfo >
+{
+private:
+ SvxNumRule maRule;
+public:
+ SvxUnoNumberingRules( const SvxNumRule& rRule ) throw();
+ virtual ~SvxUnoNumberingRules() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoNumberingRules )
+
+ //XIndexReplace
+ virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const com::sun::star::uno::Any& Element ) throw(
+ com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::IndexOutOfBoundsException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ //XIndexAccess
+ virtual sal_Int32 SAL_CALL getCount() throw(com::sun::star::uno::RuntimeException) ;
+ virtual com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) throw(com::sun::star::lang::IndexOutOfBoundsException,
+ com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
+
+ //XElementAccess
+ virtual com::sun::star::uno::Type SAL_CALL getElementType() throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(com::sun::star::uno::RuntimeException);
+
+ // XAnyCompare
+ virtual sal_Int16 SAL_CALL compare( const com::sun::star::uno::Any& Any1, const com::sun::star::uno::Any& Any2 ) throw(com::sun::star::uno::RuntimeException);
+
+ // XCloneable
+ virtual com::sun::star::uno::Reference< com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) throw(com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(com::sun::star::uno::RuntimeException);
+ virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(com::sun::star::uno::RuntimeException);
+
+ // internal
+ com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getNumberingRuleByIndex( sal_Int32 nIndex) const throw();
+ void setNumberingRuleByIndex( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rProperties, sal_Int32 nIndex) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException );
+
+ static sal_Int16 Compare( const com::sun::star::uno::Any& rAny1, const com::sun::star::uno::Any& rAny2 );
+
+ const SvxNumRule& getNumRule() const { return maRule; }
+};
+
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unopracc.hxx b/include/editeng/unopracc.hxx
new file mode 100644
index 000000000000..c2d3fdc746f3
--- /dev/null
+++ b/include/editeng/unopracc.hxx
@@ -0,0 +1,66 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOPRACC_HXX
+#define _SVX_UNOPRACC_HXX
+
+#include <editeng/unotext.hxx>
+
+
+class SvxEditSource;
+
+/** Wraps SvxUnoTextRangeBase and provides us with the text properties
+
+ Inherits from SvxUnoTextRangeBase and provides XPropertySet and
+ XMultiPropertySet interfaces. Just set the selection to the
+ required text range and return a reference to a XPropertySet.
+ */
+class SvxAccessibleTextPropertySet : public SvxUnoTextRangeBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakObject
+{
+public:
+ SvxAccessibleTextPropertySet( const SvxEditSource*, const SvxItemPropertySet* );
+ virtual ~SvxAccessibleTextPropertySet() throw();
+
+ // XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
+
+ // uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceName
+ OUString SAL_CALL getServiceName() throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx
new file mode 100644
index 000000000000..38ba3bdb4961
--- /dev/null
+++ b/include/editeng/unoprnms.hxx
@@ -0,0 +1,372 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOPRNMS_HXX
+#define _SVX_UNOPRNMS_HXX
+
+#define UNO_NAME_SHAPE_SIZE "Size"
+#define UNO_NAME_SHAPE_POSITION "Position"
+
+#define UNO_NAME_CHAR_COLOR "CharColor"
+#define UNO_NAME_CHAR_FONT "CharFont"
+#define UNO_NAME_CHAR_HEIGHT "CharHeight"
+#define UNO_NAME_CHAR_POSTURE "CharPosture"
+#define UNO_NAME_CHAR_SHADOWED "CharShadowed"
+#define UNO_NAME_CHAR_UNDERLINE "CharUnderline"
+#define UNO_NAME_CHAR_WEIGHT "CharWeight"
+
+#define UNO_NAME_FILLSTYLE "FillStyle"
+#define UNO_NAME_FILLCOLOR "FillColor"
+#define UNO_NAME_FILLGRADIENT "FillGradient"
+#define UNO_NAME_FILLHATCH "FillHatch"
+#define UNO_NAME_FILLBITMAP "FillBitmap"
+#define UNO_NAME_FILLBACKGROUND "FillBackground"
+#define UNO_NAME_FILLCOLOR_2 "FillColor2"
+
+#define UNO_NAME_EDGEKIND "EdgeKind"
+#define UNO_NAME_EDGELINE1DELTA "EdgeLine1Delta"
+#define UNO_NAME_EDGELINE2DELTA "EdgeLine2Delta"
+#define UNO_NAME_EDGELINE3DELTA "EdgeLine3Delta"
+#define UNO_NAME_EDGENODE1HORZDIST "EdgeNode1HorzDist"
+#define UNO_NAME_EDGENODE1VERTDIST "EdgeNode1VertDist"
+#define UNO_NAME_EDGENODE2HORZDIST "EdgeNode2HorzDist"
+#define UNO_NAME_EDGENODE2VERTDIST "EdgeNode2VertDist"
+
+#define UNO_NAME_FILLBMP_OFFSET_X "FillBitmapOffsetX"
+#define UNO_NAME_FILLBMP_OFFSET_Y "FillBitmapOffsetY"
+#define UNO_NAME_FILLBMP_POSITION_OFFSET_X "FillBitmapPositionOffsetX"
+#define UNO_NAME_FILLBMP_POSITION_OFFSET_Y "FillBitmapPositionOffsetY"
+#define UNO_NAME_FILLBMP_RECTANGLE_POINT "FillBitmapRectanglePoint"
+#define UNO_NAME_FILLBMP_TILE "FillBitmapTile"
+#define UNO_NAME_FILLBMP_STRETCH "FillBitmapStretch"
+#define UNO_NAME_FILLBMP_LOGICAL_SIZE "FillBitmapLogicalSize"
+#define UNO_NAME_FILLBMP_SIZE_X "FillBitmapSizeX"
+#define UNO_NAME_FILLBMP_SIZE_Y "FillBitmapSizeY"
+#define UNO_NAME_FILL_TRANSPARENCE "FillTransparence"
+#define UNO_NAME_FILLBMP_MODE "FillBitmapMode"
+
+#define UNO_NAME_FILL_GRADIENT_STYLE "FillGradientStyle"
+#define UNO_NAME_FILL_GRADIENT_START_COLOR "FillGradientStartColor"
+#define UNO_NAME_FILL_GRADIENT_END_COLOR "FillGradientEndColor"
+#define UNO_NAME_FILL_GRADIENT_ANGLE "FillGradientAngle"
+#define UNO_NAME_FILL_GRADIENT_BORDER "FillGradientBorder"
+#define UNO_NAME_FILL_GRADIENT_OFFSET_X "FillGradientOffsetX"
+#define UNO_NAME_FILL_GRADIENT_OFFSET_Y "FillGradientOffsetY"
+#define UNO_NAME_FILL_GRADIENT_START_INTENSITY "FillGradientStartIntensity"
+#define UNO_NAME_FILL_GRADIENT_END_INTENSITY "FillGradientEndIntensity"
+#define UNO_NAME_FILL_GRADIENT_STEPS "FillGradientSteps"
+
+#define UNO_NAME_FILL_HATCH_STYLE "FillHatchStyle"
+#define UNO_NAME_FILL_HATCH_COLOR "FillHatchColor"
+#define UNO_NAME_FILL_HATCH_DISTANCE "FillHatchDistance"
+#define UNO_NAME_FILL_HATCH_ANGLE "FillHatchAngle"
+
+#define UNO_NAME_LINESTYLE "LineStyle"
+#define UNO_NAME_LINEDASH "LineDash"
+#define UNO_NAME_LINEWIDTH "LineWidth"
+#define UNO_NAME_LINECOLOR "LineColor"
+#define UNO_NAME_LINEJOINT "LineJoint"
+#define UNO_NAME_LINESTART "LineStart"
+#define UNO_NAME_LINEEND "LineEnd"
+#define UNO_NAME_LINESTARTWIDTH "LineStartWidth"
+#define UNO_NAME_LINEENDWIDTH "LineEndWidth"
+#define UNO_NAME_LINESTARTCENTER "LineStartCenter"
+#define UNO_NAME_LINEENDCENTER "LineEndCenter"
+#define UNO_NAME_LINETRANSPARENCE "LineTransparence"
+#define UNO_NAME_LINECAP "LineCap"
+
+#define UNO_NAME_SHADOW "Shadow"
+#define UNO_NAME_SHADOWCOLOR "ShadowColor"
+#define UNO_NAME_SHADOWXDIST "ShadowXDistance"
+#define UNO_NAME_SHADOWYDIST "ShadowYDistance"
+#define UNO_NAME_SHADOWTRANSPARENCE "ShadowTransparence"
+
+#define UNO_NAME_EDGERADIUS "CornerRadius"
+
+#define UNO_NAME_TEXT_MINFRAMEHEIGHT "TextMinimumFrameHeight"
+#define UNO_NAME_TEXT_AUTOGROWHEIGHT "TextAutoGrowHeight"
+#define UNO_NAME_TEXT_FITTOSIZE "TextFitToSize"
+#define UNO_NAME_TEXT_LEFTDIST "TextLeftDistance"
+#define UNO_NAME_TEXT_RIGHTDIST "TextRightDistance"
+#define UNO_NAME_TEXT_UPPERDIST "TextUpperDistance"
+#define UNO_NAME_TEXT_LOWERDIST "TextLowerDistance"
+#define UNO_NAME_TEXT_VERTADJUST "TextVerticalAdjust"
+#define UNO_NAME_TEXT_MAXFRAMEHEIGHT "TextMaximumFrameHeight"
+#define UNO_NAME_TEXT_MINFRAMEWIDTH "TextMinimumFrameWidth"
+#define UNO_NAME_TEXT_MAXFRAMEWIDTH "TextMaximumFrameWidth"
+#define UNO_NAME_TEXT_AUTOGROWWIDTH "TextAutoGrowWidth"
+#define UNO_NAME_TEXT_HORZADJUST "TextHorizontalAdjust"
+#define UNO_NAME_TEXT_ANIKIND "TextAnimationKind"
+#define UNO_NAME_TEXT_ANIDIRECTION "TextAnimationDirection"
+#define UNO_NAME_TEXT_ANISTARTINSIDE "TextAnimationStartInside"
+#define UNO_NAME_TEXT_ANISTOPINSIDE "TextAnimationStopInside"
+#define UNO_NAME_TEXT_ANICOUNT "TextAnimationCount"
+#define UNO_NAME_TEXT_ANIDELAY "TextAnimationDelay"
+#define UNO_NAME_TEXT_ANIAMOUNT "TextAnimationAmount"
+#define UNO_NAME_TEXT_CONTOURFRAME "TextContourFrame"
+#define UNO_NAME_TEXT_WRITINGMODE "TextWritingMode"
+#define UNO_NAME_TEXT_FONTINDEPENDENTLINESPACING "FontIndependentLineSpacing"
+#define UNO_NAME_TEXT_WORDWRAP "TextWordWrap"
+
+#define UNO_NAME_MEASUREKIND "MeasureKind"
+#define UNO_NAME_MEASURETEXTHPOS "MeasureTextHorizontalPosition"
+#define UNO_NAME_MEASURETEXTVPOS "MeasureTextVerticalPosition"
+#define UNO_NAME_MEASURELINEDIST "MeasureLineDistance"
+#define UNO_NAME_MEASUREHELPLINEOVERHANG "MeasureHelpLineOverhang"
+#define UNO_NAME_MEASUREHELPLINEDIST "MeasureHelpLineDistance"
+#define UNO_NAME_MEASUREHELPLINE1LEN "MeasureHelpLine1Length"
+#define UNO_NAME_MEASUREHELPLINE2LEN "MeasureHelpLine2Length"
+#define UNO_NAME_MEASUREBELOWREFEDGE "MeasureBelowReferenceEdge"
+#define UNO_NAME_MEASURETEXTROTA90 "MeasureTextRotate90"
+#define UNO_NAME_MEASURETEXTUPSIDEDOWN "MeasureTextUpsideDown"
+#define UNO_NAME_MEASUREOVERHANG "MeasureOverhang"
+#define UNO_NAME_MEASUREUNIT "MeasureUnit"
+#define UNO_NAME_MEASURESCALE "MeasureScale"
+#define UNO_NAME_MEASURESHOWUNIT "MeasureShowUnit"
+#define UNO_NAME_MEASUREFORMATSTRING "MeasureFormatString"
+#define UNO_NAME_MEASURETEXTAUTOANGLE "MeasureTextAutoAngle"
+#define UNO_NAME_MEASURETEXTAUTOANGLEVIEW "MeasureTextAutoAngleView"
+#define UNO_NAME_MEASURETEXTISFIXEDANGLE "MeasureTextIsFixedAngle"
+#define UNO_NAME_MEASURETEXTFIXEDANGLE "MeasureTextFixedAngle"
+
+#define UNO_NAME_CIRCKIND "CircleKind"
+#define UNO_NAME_CIRCSTARTANGLE "CircleStartAngle"
+#define UNO_NAME_CIRCENDANGLE "CircleEndAngle"
+
+#define UNO_NAME_POLYGONKIND "PolygonKind"
+#define UNO_NAME_POLYPOLYGON "PolyPolygon"
+#define UNO_NAME_POLYPOLYGONBEZIER "PolyPolygonBezier"
+#define UNO_NAME_POLYGON "Polygon"
+
+#define UNO_NAME_MISC_OBJ_ZORDER "ZOrder"
+#define UNO_NAME_MISC_OBJ_MOVEPROTECT "MoveProtect"
+#define UNO_NAME_MISC_OBJ_SIZEPROTECT "SizeProtect"
+#define UNO_NAME_MISC_OBJ_PRINTABLE "Printable"
+#define UNO_NAME_MISC_OBJ_LAYERID "LayerID"
+#define UNO_NAME_MISC_OBJ_LAYERNAME "LayerName"
+#define UNO_NAME_MISC_OBJ_NAME "Name"
+#define UNO_NAME_MISC_OBJ_ROTATEANGLE "RotateAngle"
+#define UNO_NAME_MISC_OBJ_SHEARANGLE "ShearAngle"
+#define UNO_NAME_MISC_OBJ_ROTATION_POINT_X "RotationPointX"
+#define UNO_NAME_MISC_OBJ_ROTATION_POINT_Y "RotationPointY"
+#define UNO_NAME_MISC_OBJ_FRAMERECT "FrameRect"
+#define UNO_NAME_MISC_OBJ_BOUNDRECT "BoundRect"
+
+// #i68101#
+#define UNO_NAME_MISC_OBJ_TITLE "Title"
+#define UNO_NAME_MISC_OBJ_DESCRIPTION "Description"
+
+#define UNO_NAME_GRAPHOBJ_FILLBITMAP "GraphicObjectFillBitmap"
+#define UNO_NAME_GRAPHOBJ_GRAFURL "GraphicURL"
+#define UNO_NAME_GRAPHOBJ_REPLACEMENTGRAFURL "ReplacementGraphicURL"
+#define UNO_NAME_GRAPHOBJ_GRAFSTREAMURL "GraphicStreamURL"
+#define UNO_NAME_GRAPHOBJ_URLPREFIX "vnd.sun.star.GraphicObject:"
+#define UNO_NAME_GRAPHOBJ_URLPKGPREFIX "vnd.sun.star.Package:"
+#define UNO_NAME_GRAPHOBJ_GRAPHIC "Graphic"
+
+#define UNO_NAME_OLE2_METAFILE "MetaFile"
+#define UNO_NAME_OLE2_PERSISTNAME "PersistName"
+
+#define UNO_NAME_3D_SCENE_PERSPECTIVE "D3DScenePerspective"
+#define UNO_NAME_3D_SCENE_DISTANCE "D3DSceneDistance"
+#define UNO_NAME_3D_SCENE_FOCAL_LENGTH "D3DSceneFocalLength"
+#define UNO_NAME_3D_SCENE_TWO_SIDED_LIGHTING "D3DSceneTwoSidedLighting"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_1 "D3DSceneLightColor1"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_2 "D3DSceneLightColor2"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_3 "D3DSceneLightColor3"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_4 "D3DSceneLightColor4"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_5 "D3DSceneLightColor5"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_6 "D3DSceneLightColor6"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_7 "D3DSceneLightColor7"
+#define UNO_NAME_3D_SCENE_LIGHTCOLOR_8 "D3DSceneLightColor8"
+#define UNO_NAME_3D_SCENE_LIGHTON_1 "D3DSceneLightOn1"
+#define UNO_NAME_3D_SCENE_LIGHTON_2 "D3DSceneLightOn2"
+#define UNO_NAME_3D_SCENE_LIGHTON_3 "D3DSceneLightOn3"
+#define UNO_NAME_3D_SCENE_LIGHTON_4 "D3DSceneLightOn4"
+#define UNO_NAME_3D_SCENE_LIGHTON_5 "D3DSceneLightOn5"
+#define UNO_NAME_3D_SCENE_LIGHTON_6 "D3DSceneLightOn6"
+#define UNO_NAME_3D_SCENE_LIGHTON_7 "D3DSceneLightOn7"
+#define UNO_NAME_3D_SCENE_LIGHTON_8 "D3DSceneLightOn8"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_1 "D3DSceneLightDirection1"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_2 "D3DSceneLightDirection2"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_3 "D3DSceneLightDirection3"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_4 "D3DSceneLightDirection4"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_5 "D3DSceneLightDirection5"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_6 "D3DSceneLightDirection6"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_7 "D3DSceneLightDirection7"
+#define UNO_NAME_3D_SCENE_LIGHTDIRECTION_8 "D3DSceneLightDirection8"
+#define UNO_NAME_3D_SCENE_AMBIENTCOLOR "D3DSceneAmbientColor"
+#define UNO_NAME_3D_SCENE_SHADOW_SLANT "D3DSceneShadowSlant"
+#define UNO_NAME_3D_SCENE_SHADE_MODE "D3DSceneShadeMode"
+
+#define UNO_NAME_3D_DOUBLE_SIDED "D3DDoubleSided"
+#define UNO_NAME_3D_NORMALS_KIND "D3DNormalsKind"
+#define UNO_NAME_3D_NORMALS_INVERT "D3DNormalsInvert"
+#define UNO_NAME_3D_TEXTURE_PROJ_X "D3DTextureProjectionX"
+#define UNO_NAME_3D_TEXTURE_PROJ_Y "D3DTextureProjectionY"
+#define UNO_NAME_3D_SHADOW_3D "D3DShadow3D"
+#define UNO_NAME_3D_MAT_COLOR "D3DMaterialColor"
+#define UNO_NAME_3D_MAT_EMISSION "D3DMaterialEmission"
+#define UNO_NAME_3D_MAT_SPECULAR "D3DMaterialSpecular"
+#define UNO_NAME_3D_MAT_SPECULAR_INTENSITY "D3DMaterialSpecularIntensity"
+#define UNO_NAME_3D_TEXTURE_KIND "D3DTextureKind"
+#define UNO_NAME_3D_TEXTURE_MODE "D3DTextureMode"
+#define UNO_NAME_3D_TEXTURE_FILTER "D3DTextureFilter"
+
+// #i28528#
+// Added extra Item (Bool) for chart2 to be able to show reduced line geometry
+#define UNO_NAME_3D_REDUCED_LINE_GEOMETRY "D3DReducedLineGeometry"
+
+#define UNO_NAME_3D_HORZ_SEGS "D3DHorizontalSegments"
+#define UNO_NAME_3D_VERT_SEGS "D3DVerticalSegments"
+
+#define UNO_NAME_3D_PERCENT_DIAGONAL "D3DPercentDiagonal"
+#define UNO_NAME_3D_BACKSCALE "D3DBackscale"
+#define UNO_NAME_3D_LATHE_END_ANGLE "D3DEndAngle"
+
+#define UNO_NAME_3D_EXTRUDE_DEPTH "D3DDepth"
+
+#define UNO_NAME_3D_TRANSFORM_MATRIX "D3DTransformMatrix"
+#define UNO_NAME_3D_CAMERA_GEOMETRY "D3DCameraGeometry"
+#define UNO_NAME_3D_POS "D3DPosition"
+#define UNO_NAME_3D_SIZE "D3DSize"
+#define UNO_NAME_3D_POS_IS_CENTER "D3DPositionIsCenter"
+#define UNO_NAME_3D_POLYPOLYGON3D "D3DPolyPolygon3D"
+#define UNO_NAME_3D_NORMALSPOLYGON3D "D3DNormalsPolygon3D"
+#define UNO_NAME_3D_TEXTUREPOLYGON3D "D3DTexturePolygon3D"
+#define UNO_NAME_3D_LINEONLY "D3DLineOnly"
+
+// New 3D properties which are possible for lathe and extrude 3d objects
+#define UNO_NAME_3D_SMOOTH_NORMALS "D3DSmoothNormals"
+#define UNO_NAME_3D_SMOOTH_LIDS "D3DSmoothLids"
+#define UNO_NAME_3D_CHARACTER_MODE "D3DCharacterMode"
+#define UNO_NAME_3D_CLOSE_FRONT "D3DCloseFront"
+#define UNO_NAME_3D_CLOSE_BACK "D3DCloseBack"
+
+#define UNO_NAME_NUMBERING "NumberingIsNumber"
+#define UNO_NAME_NUMBERING_RULES "NumberingRules"
+#define UNO_NAME_NUMBERING_LEVEL "NumberingLevel"
+
+#define UNO_NAME_NRULE_NUMBERINGTYPE "NumberingType"
+#define UNO_NAME_NRULE_PREFIX "Prefix"
+#define UNO_NAME_NRULE_SUFFIX "Suffix"
+#define UNO_NAME_NRULE_BULLETID "BulletId"
+#define UNO_NAME_NRULE_BULLET_COLOR "BulletColor"
+#define UNO_NAME_NRULE_BULLET_RELSIZE "BulletRelSize"
+#define UNO_NAME_NRULE_BULLET_FONT "BulletFont"
+#define UNO_NAME_NRULE_GRAPHICURL "GraphicURL"
+#define UNO_NAME_NRULE_START_WITH "StartWith"
+#define UNO_NAME_NRULE_LEFT_MARGIN "LeftMargin"
+#define UNO_NAME_NRULE_FIRST_LINE_OFFSET "FirstLineOffset"
+#define UNO_NAME_NRULE_ADJUST "Adjust"
+
+#define UNO_NAME_EDIT_FONT_DESCRIPTOR "FontDescriptor"
+#define UNO_NAME_EDIT_FONT_STYLENAME "FontStyleName"
+
+#define UNO_NAME_EDIT_PARA_ADJUST "ParaAdjust"
+#define UNO_NAME_EDIT_PARA_BMARGIN "ParaBottomMargin"
+#define UNO_NAME_EDIT_PARA_LASTLINEADJ "ParaLastLineAdjust"
+#define UNO_NAME_EDIT_PARA_LMARGIN "ParaLeftMargin"
+#define UNO_NAME_EDIT_PARA_LRPARAMARGIN "ParaLeftRightParaMargin"
+#define UNO_NAME_EDIT_PARA_LINESPACING "ParaLineSpacing"
+#define UNO_NAME_EDIT_PARA_RMARGIN "ParaRightMargin"
+#define UNO_NAME_EDIT_PARA_TAPSTOPS "ParaTabStops"
+#define UNO_NAME_EDIT_PARA_TBMARGIN "ParaTopBottomMargin"
+#define UNO_NAME_EDIT_PARA_TMARGIN "ParaTopMargin"
+#define UNO_NAME_EDIT_PARA_IS_HYPHEN "ParaIsHyphenation"
+#define UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION "ParaIsHangingPunctuation"
+#define UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE "ParaIsCharacterDistance"
+#define UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES "ParaIsForbiddenRules"
+#define UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT "ParaFirstLineIndent"
+
+#define UNO_NAME_EDIT_CHAR_HEIGHT "CharHeight"
+#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName"
+#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME "CharFontStyleName"
+#define UNO_NAME_EDIT_CHAR_FONTFAMILY "CharFontFamily"
+#define UNO_NAME_EDIT_CHAR_FONTCHARSET "CharFontCharSet"
+#define UNO_NAME_EDIT_CHAR_FONTPITCH "CharFontPitch"
+#define UNO_NAME_EDIT_CHAR_POSTURE "CharPosture"
+#define UNO_NAME_EDIT_CHAR_WEIGHT "CharWeight"
+#define UNO_NAME_EDIT_CHAR_LOCALE "CharLocale"
+
+#define UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN "CharHeightAsian"
+#define UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN "CharFontNameAsian"
+#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN "CharFontStyleNameAsian"
+#define UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN "CharFontFamilyAsian"
+#define UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN "CharFontCharSetAsian"
+#define UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN "CharFontPitchAsian"
+#define UNO_NAME_EDIT_CHAR_POSTURE_ASIAN "CharPostureAsian"
+#define UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN "CharWeightAsian"
+#define UNO_NAME_EDIT_CHAR_LOCALE_ASIAN "CharLocaleAsian"
+
+#define UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX "CharHeightComplex"
+#define UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX "CharFontNameComplex"
+#define UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX "CharFontStyleNameComplex"
+#define UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX "CharFontFamilyComplex"
+#define UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX "CharFontCharSetComplex"
+#define UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX "CharFontPitchComplex"
+#define UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX "CharPostureComplex"
+#define UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX "CharWeightComplex"
+#define UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX "CharLocaleComplex"
+
+#define UNO_NAME_EDIT_CHAR_COLOR "CharColor"
+#define UNO_NAME_EDIT_CHAR_CROSSEDOUT "CharCrossedOut"
+#define UNO_NAME_EDIT_CHAR_STRIKEOUT "CharStrikeout"
+#define UNO_NAME_EDIT_CHAR_ESCAPEMENT "CharEscapement"
+#define UNO_NAME_EDIT_CHAR_FONTNAME "CharFontName"
+#define UNO_NAME_EDIT_CHAR_SHADOWED "CharShadowed"
+#define UNO_NAME_EDIT_CHAR_UNDERLINE "CharUnderline"
+#define UNO_NAME_EDIT_CHAR_OVERLINE "CharOverline"
+
+#define UNO_NAME_BITMAP "Bitmap"
+
+#define UNO_NAME_LINKDISPLAYNAME "LinkDisplayName"
+#define UNO_NAME_LINKDISPLAYBITMAP "LinkDisplayBitmap"
+
+#define UNO_NAME_GRAPHIC_LUMINANCE "AdjustLuminance"
+#define UNO_NAME_GRAPHIC_CONTRAST "AdjustContrast"
+#define UNO_NAME_GRAPHIC_RED "AdjustRed"
+#define UNO_NAME_GRAPHIC_GREEN "AdjustGreen"
+#define UNO_NAME_GRAPHIC_BLUE "AdjustBlue"
+#define UNO_NAME_GRAPHIC_GAMMA "Gamma"
+#define UNO_NAME_GRAPHIC_TRANSPARENCY "Transparency"
+#define UNO_NAME_GRAPHIC_COLOR_MODE "GraphicColorMode"
+#define UNO_NAME_GRAPHIC_GRAPHICCROP "GraphicCrop"
+
+#define UNO_NAME_CUSTOMSHAPE_ADJUSTMENT "CustomShapeAdjustment"
+
+// The following properties are obsolete and can eventually be removed
+#define UNO_NAME_EDIT_FONT_COLOR "FontColor"
+#define UNO_NAME_EDIT_FONT_ESCAPEMENT "FontEscapement"
+#define UNO_NAME_EDIT_FONT_HEIGHT "FontHeight"
+#define UNO_NAME_EDIT_FONT_SHADOWED "FontShadowed"
+#define UNO_NAME_EDIT_FONT_SLANT "FontSlant"
+#define UNO_NAME_EDIT_FONT_STRIKEOUT "FontStrikeout"
+#define UNO_NAME_EDIT_FONT_UNDERLINE "FontUnderline"
+#define UNO_NAME_EDIT_FONT_WEIGHT "FontWeight"
+#define UNO_NAME_EDIT_CHAR_STYLE "CharStyle"
+#define UNO_NAME_EDIT_FONT_FAMILY "FontFamily"
+#define UNO_NAME_EDIT_FONT_NAME "FontName"
+#define UNO_NAME_EDIT_FONT_CHARSET "FontCharset"
+// End of the obsolete properties
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
new file mode 100644
index 000000000000..b5a5e02a8c1b
--- /dev/null
+++ b/include/editeng/unotext.hxx
@@ -0,0 +1,661 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOTEXT_HXX
+#define _SVX_UNOTEXT_HXX
+
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextRangeMover.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/text/XTextRangeCompare.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/text/XTextAppend.hpp>
+#include <com/sun/star/text/XTextCopy.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <cppuhelper/interfacecontainer.h>
+#include <cppuhelper/weak.hxx>
+#include <cppuhelper/weakagg.hxx>
+#include <osl/diagnose.hxx>
+#include <osl/mutex.hxx>
+#include <comphelper/servicehelper.hxx>
+#include <tools/link.hxx>
+#include <svl/itemprop.hxx>
+#include <svl/itemset.hxx>
+#include <svl/itempool.hxx>
+#include <svl/solar.hrc>
+#include <editeng/editdata.hxx>
+#include <editeng/unoedsrc.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/editengdllapi.h>
+#include <editeng/memberids.hrc>
+
+class SvxItemPropertySet;
+
+#ifndef SEQTYPE
+ #if defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)
+ #define SEQTYPE(x) (new ::com::sun::star::uno::Type( x ))
+ #else
+ #define SEQTYPE(x) &(x)
+ #endif
+#endif
+
+#define WID_FONTDESC OWN_ATTR_VALUE_START
+#define WID_NUMLEVEL OWN_ATTR_VALUE_START+1
+#define WID_PORTIONTYPE OWN_ATTR_VALUE_START+2
+#define WID_NUMBERINGSTARTVALUE OWN_ATTR_VALUE_START+3
+#define WID_PARAISNUMBERINGRESTART OWN_ATTR_VALUE_START+4
+
+#define SVX_UNOEDIT_NUMBERING_PROPERTIE \
+ {MAP_CHAR_LEN(UNO_NAME_NUMBERING_RULES), EE_PARA_NUMBULLET, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace>*)0), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_NUMBERING), EE_PARA_BULLETSTATE,&::getBooleanCppuType(), 0, 0 }
+
+#define SVX_UNOEDIT_OUTLINER_PROPERTIES \
+ SVX_UNOEDIT_NUMBERING_PROPERTIE, \
+ {MAP_CHAR_LEN(UNO_NAME_NUMBERING_LEVEL), WID_NUMLEVEL, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
+ {MAP_CHAR_LEN("NumberingStartValue"), WID_NUMBERINGSTARTVALUE, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
+ {MAP_CHAR_LEN("ParaIsNumberingRestart"), WID_PARAISNUMBERINGRESTART, &::getBooleanCppuType(), 0, 0 }
+
+#define SVX_UNOEDIT_CHAR_PROPERTIES \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT), EE_CHAR_FONTHEIGHT, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { MAP_CHAR_LEN("CharScaleWidth"), EE_CHAR_FONTWIDTH, &::getCppuType((const sal_Int16*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME), EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME),EE_CHAR_FONTINFO, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH), EE_CHAR_FONTINFO, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE), EE_CHAR_ITALIC, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT), EE_CHAR_WEIGHT, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE), EE_CHAR_LANGUAGE, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_COLOR), EE_CHAR_COLOR, &::getCppuType((const sal_Int32*)0), 0, 0 }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_ESCAPEMENT), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int16*)0), 0, MID_ESC }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_UNDERLINE), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
+ { MAP_CHAR_LEN("CharUnderlineColor"), EE_CHAR_UNDERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
+ { MAP_CHAR_LEN("CharUnderlineHasColor"), EE_CHAR_UNDERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_OVERLINE), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int16*)0), 0, MID_TL_STYLE }, \
+ { MAP_CHAR_LEN("CharOverlineColor"), EE_CHAR_OVERLINE, &::getCppuType((const sal_Int32*)0), 0, MID_TL_COLOR }, \
+ { MAP_CHAR_LEN("CharOverlineHasColor"), EE_CHAR_OVERLINE, &::getBooleanCppuType(), 0, MID_TL_HASCOLOR } , \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_CROSSEDOUT), EE_CHAR_STRIKEOUT, &::getBooleanCppuType(), 0, MID_CROSSED_OUT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_STRIKEOUT), EE_CHAR_STRIKEOUT, &::getCppuType((const sal_Int16*)0), 0, MID_CROSS_OUT}, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_SHADOWED), EE_CHAR_SHADOW, &::getBooleanCppuType(), 0, 0 }, \
+ { MAP_CHAR_LEN("CharContoured"), EE_CHAR_OUTLINE, &::getBooleanCppuType(), 0, 0 }, \
+ { MAP_CHAR_LEN("CharEscapementHeight"), EE_CHAR_ESCAPEMENT, &::getCppuType((const sal_Int8*)0), 0, MID_ESC_HEIGHT },\
+ { MAP_CHAR_LEN("CharAutoKerning"), EE_CHAR_PAIRKERNING,&::getBooleanCppuType(), 0, 0 } , \
+ { MAP_CHAR_LEN("CharKerning"), EE_CHAR_KERNING, &::getCppuType((const sal_Int16*)0) , 0, 0 }, \
+ { MAP_CHAR_LEN("CharWordMode"), EE_CHAR_WLM, &::getBooleanCppuType(), 0, 0 }, \
+ { MAP_CHAR_LEN("CharEmphasis"), EE_CHAR_EMPHASISMARK,&::getCppuType((const sal_Int16*)0), 0, MID_EMPHASIS},\
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_ASIAN), EE_CHAR_FONTHEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_ASIAN), EE_CHAR_FONTINFO_CJK, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_ASIAN), EE_CHAR_ITALIC_CJK, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_ASIAN), EE_CHAR_WEIGHT_CJK, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_ASIAN), EE_CHAR_LANGUAGE_CJK, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_HEIGHT_COMPLEX), EE_CHAR_FONTHEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_FONTHEIGHT|CONVERT_TWIPS }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTNAME_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_FAMILY_NAME },\
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTSTYLENAME_COMPLEX),EE_CHAR_FONTINFO_CTL, &::getCppuType((const OUString*)0), 0, MID_FONT_STYLE_NAME }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTFAMILY_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_FAMILY }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTCHARSET_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_CHAR_SET }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_FONTPITCH_COMPLEX), EE_CHAR_FONTINFO_CTL, &::getCppuType((const sal_Int16*)0), 0, MID_FONT_PITCH }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX), EE_CHAR_ITALIC_CTL, &::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX), EE_CHAR_WEIGHT_CTL, &::getCppuType((const float*)0), 0, MID_WEIGHT }, \
+ { MAP_CHAR_LEN(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX), EE_CHAR_LANGUAGE_CTL, &::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
+ { MAP_CHAR_LEN("CharRelief" ), EE_CHAR_RELIEF, &::getCppuType((const sal_Int16*)0), 0, MID_RELIEF }
+
+#define SVX_UNOEDIT_FONT_PROPERTIES \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_FONT_DESCRIPTOR), WID_FONTDESC, &::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0), 0, MID_FONT_FAMILY_NAME }
+
+#define SVX_UNOEDIT_PARA_PROPERTIES \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_ADJUST), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_PARA_ADJUST }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_BMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_LO_MARGIN|SFX_METRIC_ITEM }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HYPHEN), EE_PARA_HYPHENATE, &::getBooleanCppuType(), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LASTLINEADJ), EE_PARA_JUST, &::getCppuType((const sal_Int16*)0), 0, MID_LAST_LINE_ADJUST }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_TXT_LMARGIN|SFX_METRIC_ITEM }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_LINESPACING), EE_PARA_SBL, &::getCppuType((const ::com::sun::star::style::LineSpacing*)0), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_RMARGIN), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_R_MARGIN|SFX_METRIC_ITEM }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TAPSTOPS), EE_PARA_TABS, SEQTYPE(::getCppuType((const ::com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >*)0)), 0, 0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_TMARGIN), EE_PARA_ULSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_UP_MARGIN|SFX_METRIC_ITEM },\
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_FIRST_LINE_INDENT), EE_PARA_LRSPACE, &::getCppuType((const sal_Int32*)0), 0, MID_FIRST_LINE_INDENT|SFX_METRIC_ITEM}, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION),EE_PARA_HANGINGPUNCTUATION, &::getBooleanCppuType(), 0 ,0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_CHARACTER_DISTANCE), EE_PARA_ASIANCJKSPACING, &::getBooleanCppuType(), 0 ,0 }, \
+ {MAP_CHAR_LEN(UNO_NAME_EDIT_PARA_IS_FORBIDDEN_RULES), EE_PARA_FORBIDDENRULES, &::getBooleanCppuType(), 0 ,0 },\
+ {MAP_CHAR_LEN("WritingMode"), EE_PARA_WRITINGDIR, &::getCppuType((const sal_Int16*)0), 0, 0 }
+
+class SvxEditSource;
+class SvxTextForwarder;
+class SvxFieldItem;
+class SvxTextEditSource;
+class SvxFieldData;
+struct ESelection;
+
+EDITENG_DLLPUBLIC void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
+EDITENG_DLLPUBLIC void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw();
+
+// ====================================================================
+// This class implements a SvxEditSource and SvxTextForwarder and does
+// nothing otherwise
+// ====================================================================
+
+class SvxDummyTextSource : public SvxEditSource, public SvxTextForwarder
+{
+public:
+
+ // SvxEditSource
+ virtual ~SvxDummyTextSource();
+ virtual SvxEditSource* Clone() const;
+ virtual SvxTextForwarder* GetTextForwarder();
+ virtual void UpdateData();
+
+ // SvxTextForwarder
+ virtual sal_uInt16 GetParagraphCount() const;
+ virtual sal_uInt16 GetTextLen( sal_uInt16 nParagraph ) const;
+ virtual String GetText( const ESelection& rSel ) const;
+ virtual SfxItemSet GetAttribs( const ESelection& rSel, sal_Bool bOnlyHardAttrib = 0 ) const;
+ virtual SfxItemSet GetParaAttribs( sal_uInt16 nPara ) const;
+ virtual void SetParaAttribs( sal_uInt16 nPara, const SfxItemSet& rSet );
+ virtual void RemoveAttribs( const ESelection& rSelection, sal_Bool bRemoveParaAttribs, sal_uInt16 nWhich );
+ virtual void GetPortions( sal_uInt16 nPara, std::vector<sal_uInt16>& rList ) const;
+
+ sal_uInt16 GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const;
+ sal_uInt16 GetItemState( sal_uInt16 nPara, sal_uInt16 nWhich ) const;
+
+ virtual SfxItemPool* GetPool() const;
+
+ virtual void QuickInsertText( const String& rText, const ESelection& rSel );
+ virtual void QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel );
+ virtual void QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel );
+ virtual void QuickInsertLineBreak( const ESelection& rSel );
+
+ virtual XubString CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rpTxtColor, Color*& rpFldColor );
+ virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16 nPara, xub_StrLen nPos );
+
+ virtual sal_Bool IsValid() const;
+
+ virtual void SetNotifyHdl( const Link& );
+ virtual LanguageType GetLanguage( sal_uInt16, sal_uInt16 ) const;
+ virtual sal_uInt16 GetFieldCount( sal_uInt16 nPara ) const;
+ virtual EFieldInfo GetFieldInfo( sal_uInt16 nPara, sal_uInt16 nField ) const;
+ virtual EBulletInfo GetBulletInfo( sal_uInt16 nPara ) const;
+ virtual Rectangle GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual Rectangle GetParaBounds( sal_uInt16 nPara ) const;
+ virtual MapMode GetMapMode() const;
+ virtual OutputDevice* GetRefDevice() const;
+ virtual sal_Bool GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
+ virtual sal_Bool GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
+ virtual sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_uInt16 GetLineCount( sal_uInt16 nPara ) const;
+ virtual sal_uInt16 GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+ virtual void GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
+ virtual sal_uInt16 GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+ virtual sal_Bool Delete( const ESelection& );
+ virtual sal_Bool InsertText( const String&, const ESelection& );
+ virtual sal_Bool QuickFormatDoc( sal_Bool bFull=sal_False );
+ virtual sal_Int16 GetDepth( sal_uInt16 nPara ) const;
+ virtual sal_Bool SetDepth( sal_uInt16 nPara, sal_Int16 nNewDepth );
+
+ virtual const SfxItemSet* GetEmptyItemSetPtr();
+
+ // implementation functions for XParagraphAppend and XTextPortionAppend
+ virtual void AppendParagraph();
+ virtual xub_StrLen AppendTextPortion( sal_uInt16 nPara, const String &rText, const SfxItemSet &rSet );
+ //XTextCopy
+ virtual void CopyText(const SvxTextForwarder& rSource);
+};
+
+namespace accessibility
+{
+ class AccessibleEditableTextPara;
+}
+
+// ====================================================================
+class EDITENG_DLLPUBLIC SvxUnoTextRangeBase : public ::com::sun::star::text::XTextRange,
+ public ::com::sun::star::beans::XPropertySet,
+ public ::com::sun::star::beans::XMultiPropertySet,
+ public ::com::sun::star::beans::XMultiPropertyStates,
+ public ::com::sun::star::beans::XPropertyState,
+ public ::com::sun::star::lang::XServiceInfo,
+ public ::com::sun::star::text::XTextRangeCompare,
+ public ::com::sun::star::lang::XUnoTunnel,
+ private osl::DebugBase<SvxUnoTextRangeBase>
+
+{
+ friend class SvxUnoTextRangeEnumeration;
+ friend class ::accessibility::AccessibleEditableTextPara;
+
+protected:
+ SvxEditSource* mpEditSource;
+ ESelection maSelection;
+ const SvxItemPropertySet* mpPropSet;
+
+ virtual void SAL_CALL _setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL _getPropertyValue( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL _setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues, sal_Int32 nPara = -1 ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL _getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, sal_Int32 nPara = -1 ) throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL _getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ // returns true if property found or false if unknown property
+ virtual sal_Bool _getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::beans::PropertyState& rState);
+
+ virtual void SAL_CALL _setPropertyToDefault( const OUString& PropertyName, sal_Int32 nPara = -1 ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void _setPropertyToDefault( SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara ) throw( ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException );
+ void SetEditSource( SvxEditSource* _pEditSource ) throw();
+
+ virtual void getPropertyValue( const SfxItemPropertySimpleEntry* pMap, com::sun::star::uno::Any& rAny, const SfxItemSet& rSet ) throw(::com::sun::star::beans::UnknownPropertyException );
+ virtual void setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const com::sun::star::uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::IllegalArgumentException );
+
+public:
+ SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw();
+ virtual ~SvxUnoTextRangeBase() throw();
+
+ // Internal
+ const ESelection& GetSelection() const throw() { CheckSelection( ((SvxUnoTextRangeBase*)this)->maSelection, mpEditSource->GetTextForwarder() ); return maSelection; };
+ void SetSelection( const ESelection& rSelection ) throw();
+
+ virtual void CollapseToStart(void) throw();
+ virtual void CollapseToEnd(void) throw();
+ virtual sal_Bool IsCollapsed(void) throw();
+ virtual sal_Bool GoLeft(sal_Int16 nCount, sal_Bool Expand) throw();
+ virtual sal_Bool GoRight(sal_Int16 nCount, sal_Bool Expand) throw();
+ virtual void GotoStart(sal_Bool Expand) throw();
+ virtual void GotoEnd(sal_Bool Expand) throw();
+
+ //const SfxItemPropertyMapEntry* getPropertyMapEntries() const throw() { return maPropSet.getPropertyMapEntries(); }
+ const SvxItemPropertySet* getPropertySet() const throw() { return mpPropSet; }
+ SvxEditSource* GetEditSource() const throw() { return mpEditSource; }
+
+ static sal_Bool SetPropertyValueHelper( const SfxItemSet& rOldSet, const SfxItemPropertySimpleEntry* pMap, const ::com::sun::star::uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL );
+ static sal_Bool GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, ::com::sun::star::uno::Any& aAny, const ESelection* pSelection = NULL, SvxEditSource* pEditSource = NULL ) throw( ::com::sun::star::uno::RuntimeException );
+
+ void attachField( const SvxFieldData* pData ) throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextRangeBase )
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XMultiPropertyStates
+ //virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XTextRangeCompare
+ virtual ::sal_Int16 SAL_CALL compareRegionStarts( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL compareRegionEnds( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR1, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xR2 ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
+};
+
+// ====================================================================
+
+class SvxUnoTextBase;
+class EDITENG_DLLPUBLIC SvxUnoTextRange : public SvxUnoTextRangeBase,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+ friend class SvxUnoTextRangeEnumeration;
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
+ sal_Bool mbPortion;
+
+public:
+ SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion = sal_False ) throw();
+ virtual ~SvxUnoTextRange() throw();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+class EDITENG_DLLPUBLIC SvxUnoTextBase : public SvxUnoTextRangeBase,
+ public ::com::sun::star::text::XTextAppend,
+ public ::com::sun::star::text::XTextCopy,
+ public ::com::sun::star::container::XEnumerationAccess,
+ public ::com::sun::star::text::XTextRangeMover,
+ public ::com::sun::star::lang::XTypeProvider
+{
+protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > xParentText;
+
+public:
+ SvxUnoTextBase( ) throw();
+ SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
+ SvxUnoTextBase( const SvxUnoTextBase& rText ) throw();
+ virtual ~SvxUnoTextBase() throw();
+
+ UNO3_GETIMPLEMENTATION_DECL( SvxUnoTextBase )
+
+ ESelection InsertField( const SvxFieldItem& rField ) throw();
+ static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getStaticTypes() throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > createTextCursorBySelection( const ESelection& rSel );
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XSimpleText
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursor( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL createTextCursorByRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& aTextPosition ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XText
+ virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent, sal_Bool bAbsorb ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >& xContent ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextRangeMover
+ virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Int16 nParagraphs ) throw(::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::text::XParagraphAppend (new import API)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraph( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL finishParagraphInsert( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xInsertPosition ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::text::XTextPortionAppend (new import API)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL appendTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL insertTextPortion( const OUString& Text, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& CharacterAndParagraphProperties, const com::sun::star::uno::Reference< com::sun::star::text::XTextRange>& rTextRange ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ // com::sun::star::text::XTextCopy
+ virtual void SAL_CALL copyText( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCopy >& xSource ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+ static ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ) SAL_THROW(());
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+class EDITENG_DLLPUBLIC SvxUnoText : public SvxUnoTextBase,
+ public ::cppu::OWeakAggObject
+{
+public:
+ SvxUnoText( ) throw();
+ SvxUnoText( const SvxItemPropertySet* _pSet ) throw();
+ SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > xParent ) throw();
+ SvxUnoText( const SvxUnoText& rText ) throw();
+ virtual ~SvxUnoText() throw();
+
+ // Internal
+ static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
+ virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+
+class SvxUnoTextContentEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+ SvxEditSource* mpEditSource;
+ sal_uInt16 mnNextParagraph;
+ const SvxUnoTextBase& mrText;
+
+public:
+ SvxUnoTextContentEnumeration( const SvxUnoTextBase& _rText ) throw();
+ virtual ~SvxUnoTextContentEnumeration() throw();
+
+ // ::com::sun::star::container::XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+#include <com/sun/star/text/XTextContent.hpp>
+
+class SvxUnoTextContent : public SvxUnoTextRangeBase,
+ public ::com::sun::star::text::XTextContent,
+ public ::com::sun::star::container::XEnumerationAccess,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+ friend class SvxUnoTextContentEnumeration;
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+ sal_uInt16 mnParagraph;
+ const SvxUnoTextBase& mrParentText;
+
+ // for xComponent
+ ::osl::Mutex maDisposeContainerMutex;
+ ::cppu::OInterfaceContainerHelper maDisposeListeners;
+ bool mbDisposing;
+
+protected:
+ using SvxUnoTextRangeBase::setPropertyValue;
+ using SvxUnoTextRangeBase::getPropertyValue;
+
+public:
+ SvxUnoTextContent( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw();
+ SvxUnoTextContent( const SvxUnoTextContent& rContent ) throw();
+ virtual ~SvxUnoTextContent() throw();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextContent -> ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xTextRange ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getAnchor( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XComponent
+ virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XEnumerationAccess
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL createEnumeration( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::container::XElementAccess
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertySet
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ // XMultiPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::beans::XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< OUString >& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+
+class SvxUnoTextRangeEnumeration : public ::cppu::WeakAggImplHelper1< ::com::sun::star::container::XEnumeration >
+{
+private:
+ SvxEditSource* mpEditSource;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+ const SvxUnoTextBase& mrParentText;
+ sal_uInt16 mnParagraph;
+ std::vector<sal_uInt16>* mpPortions;
+ sal_uInt16 mnNextPortion;
+
+public:
+ SvxUnoTextRangeEnumeration( const SvxUnoTextBase& rText, sal_uInt16 nPara ) throw();
+ virtual ~SvxUnoTextRangeEnumeration() throw();
+
+ // ::com::sun::star::container::XEnumeration
+ virtual sal_Bool SAL_CALL hasMoreElements( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement( ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+// ====================================================================
+
+class EDITENG_DLLPUBLIC SvxUnoTextCursor : public SvxUnoTextRangeBase,
+ public ::com::sun::star::text::XTextCursor,
+ public ::com::sun::star::lang::XTypeProvider,
+ public ::cppu::OWeakAggObject
+{
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxParentText;
+
+public:
+ SvxUnoTextCursor( const SvxUnoTextBase& rText ) throw();
+ SvxUnoTextCursor( const SvxUnoTextCursor& rCursor ) throw();
+ virtual ~SvxUnoTextCursor() throw();
+
+ // ::com::sun::star::uno::XInterface
+ virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ // ::com::sun::star::text::XTextRange
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setString( const OUString& aString ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getStart() throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL getEnd() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::text::XTextCursor -> ::com::sun::star::text::XTextRange
+ virtual void SAL_CALL collapseToStart( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL collapseToEnd( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isCollapsed( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goLeft( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL goRight( sal_Int16 nCount, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoStart( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoEnd( sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL gotoRange( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >& xRange, sal_Bool bExpand ) throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // ::com::sun::star::lang::XTypeProvider
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
+
+};
+
+EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet();
+EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap();
+EDITENG_DLLPUBLIC const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet();
+EDITENG_DLLPUBLIC const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap();
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/unoviwou.hxx b/include/editeng/unoviwou.hxx
new file mode 100644
index 000000000000..24031f93c847
--- /dev/null
+++ b/include/editeng/unoviwou.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_UNOVIWOU_HXX
+#define _SVX_UNOVIWOU_HXX
+
+#include <editeng/unoedsrc.hxx>
+#include <editeng/editengdllapi.h>
+
+class OutlinerView;
+
+/// Specialization for Draw/Impress
+class EDITENG_DLLPUBLIC SvxDrawOutlinerViewForwarder : public SvxEditViewForwarder
+{
+private:
+ OutlinerView& mrOutlinerView;
+ Point maTextShapeTopLeft;
+
+ EDITENG_DLLPRIVATE Point GetTextOffset() const;
+
+public:
+ explicit SvxDrawOutlinerViewForwarder( OutlinerView& rOutl );
+ SvxDrawOutlinerViewForwarder( OutlinerView& rOutl, const Point& rShapePosTopLeft );
+ virtual ~SvxDrawOutlinerViewForwarder();
+
+ virtual sal_Bool IsValid() const;
+
+ virtual Rectangle GetVisArea() const;
+ virtual Point LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const;
+ virtual Point PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const;
+
+ virtual sal_Bool GetSelection( ESelection& rSelection ) const;
+ virtual sal_Bool SetSelection( const ESelection& rSelection );
+ virtual sal_Bool Copy();
+ virtual sal_Bool Cut();
+ virtual sal_Bool Paste();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx
new file mode 100644
index 000000000000..b10d74361dc8
--- /dev/null
+++ b/include/editeng/wghtitem.hxx
@@ -0,0 +1,76 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WGHTITEM_HXX
+#define _SVX_WGHTITEM_HXX
+
+#include <vcl/vclenum.hxx>
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxWeightItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the font weight.
+*/
+
+class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem
+{
+public:
+ TYPEINFO();
+
+ SvxWeightItem( const FontWeight eWght /*= WEIGHT_NORMAL*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem + SfxEnumItem
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+ virtual OUString GetValueTextByPos( sal_uInt16 nPos ) const;
+ virtual sal_uInt16 GetValueCount() const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual int HasBoolValue() const;
+ virtual sal_Bool GetBoolValue() const;
+ virtual void SetBoolValue( sal_Bool bVal );
+
+ inline SvxWeightItem& operator=(const SvxWeightItem& rWeight) {
+ SetValue( rWeight.GetValue() );
+ return *this;
+ }
+
+ // enum cast
+ FontWeight GetWeight() const
+ { return (FontWeight)GetValue(); }
+ void SetWeight( FontWeight eNew )
+ { SetValue( (sal_uInt16)eNew ); }
+};
+
+#endif // #ifndef _SVX_WGHTITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/widwitem.hxx b/include/editeng/widwitem.hxx
new file mode 100644
index 000000000000..8602702a00f7
--- /dev/null
+++ b/include/editeng/widwitem.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WIDWITEM_HXX
+#define _SVX_WIDWITEM_HXX
+
+#include <svl/intitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxWidowsItem ---------------------------------------------------
+
+/* [Description]
+
+ This item describes the number of lines for the widows control.
+*/
+
+class EDITENG_DLLPUBLIC SvxWidowsItem: public SfxByteItem
+{
+ friend SvStream & operator<<( SvStream & aS, SvxWidowsItem & );
+public:
+ TYPEINFO();
+
+ SvxWidowsItem( const sal_uInt8 nL /*= 0*/, const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create( SvStream &, sal_uInt16 ) const;
+ virtual SvStream& Store( SvStream & , sal_uInt16 nItemVersion ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxWidowsItem& operator=( const SvxWidowsItem& rWidows )
+ {
+ SetValue( rWidows.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/writingmodeitem.hxx b/include/editeng/writingmodeitem.hxx
new file mode 100644
index 000000000000..c1ad81587f42
--- /dev/null
+++ b/include/editeng/writingmodeitem.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WRITINGMODEITEM_HXX
+#define _SVX_WRITINGMODEITEM_HXX
+
+#include <com/sun/star/text/WritingMode.hpp>
+#include <svl/intitem.hxx>
+#include "editeng/editengdllapi.h"
+
+// class SvxWritingModeItem ----------------------------------------------
+
+class EDITENG_DLLPUBLIC SvxWritingModeItem : public SfxUInt16Item
+{
+public:
+ TYPEINFO();
+
+ SvxWritingModeItem( ::com::sun::star::text::WritingMode eValue /*= com::sun::star::text::WritingMode_LR_TB*/,
+ sal_uInt16 nWhich /*= SDRATTR_TEXTDIRECTION*/ );
+ virtual ~SvxWritingModeItem();
+
+ SvxWritingModeItem& operator=( const SvxWritingModeItem& rItem );
+
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream & rStrm, sal_uInt16 nIVer) const;
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const;
+ virtual int operator==( const SfxPoolItem& ) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText,
+ const IntlWrapper * = 0 ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+};
+
+#endif // #ifndef _SVX_WRITINGMODEITEM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/wrlmitem.hxx b/include/editeng/wrlmitem.hxx
new file mode 100644
index 000000000000..b74b2f406a71
--- /dev/null
+++ b/include/editeng/wrlmitem.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _SVX_WRLMITEM_HXX
+#define _SVX_WRLMITEM_HXX
+
+#include <svl/eitem.hxx>
+#include <editeng/editengdllapi.h>
+
+class SvXMLUnitConverter;
+
+// class SvxWordLineModeItem ---------------------------------------------
+
+/* [Description]
+
+ This item describes, whether underlined and strikethrough is limited
+ to word boundaries.
+*/
+
+class EDITENG_DLLPUBLIC SvxWordLineModeItem : public SfxBoolItem
+{
+public:
+ TYPEINFO();
+
+ SvxWordLineModeItem( const sal_Bool bWordLineMode /*= sal_False*/,
+ const sal_uInt16 nId );
+
+ // "pure virtual Methods" from SfxPoolItem
+ virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const;
+ virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const;
+ virtual SvStream& Store(SvStream &, sal_uInt16 nItemVersion) const;
+
+ virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresMetric,
+ OUString &rText, const IntlWrapper * = 0 ) const;
+
+ inline SvxWordLineModeItem& operator=( const SvxWordLineModeItem& rWLM )
+ {
+ SetValue( rWLM.GetValue() );
+ return *this;
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/editeng/xmlcnitm.hxx b/include/editeng/xmlcnitm.hxx
new file mode 100644
index 000000000000..d361ab79c8d0
--- /dev/null
+++ b/include/editeng/xmlcnitm.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_XMLCNITM_HXX
+#define _SVX_XMLCNITM_HXX
+
+#include <svl/poolitem.hxx>
+#include "editeng/editengdllapi.h"
+
+class SvXMLNamespaceMap;
+
+//============================================================================
+
+class SvXMLAttrContainerData;
+
+class EDITENG_DLLPUBLIC SvXMLAttrContainerItem: public SfxPoolItem
+{
+ SvXMLAttrContainerData *pImpl;
+
+public:
+ TYPEINFO();
+
+ SvXMLAttrContainerItem( sal_uInt16 nWhich = 0 );
+ SvXMLAttrContainerItem( const SvXMLAttrContainerItem& );
+ virtual ~SvXMLAttrContainerItem();
+
+ virtual int operator==( const SfxPoolItem& ) const;
+ using SfxPoolItem::Compare;
+ virtual int Compare( const SfxPoolItem &rWith ) const;
+
+ virtual SfxItemPresentation GetPresentation(
+ SfxItemPresentation ePresentation,
+ SfxMapUnit eCoreMetric,
+ SfxMapUnit ePresentationMetric,
+ OUString &rText,
+ const IntlWrapper *pIntlWrapper = 0 ) const;
+
+ virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const;
+
+ virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const;
+ virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 );
+
+ virtual SfxPoolItem *Clone( SfxItemPool * = 0) const
+ { return new SvXMLAttrContainerItem( *this ); }
+
+ sal_Bool AddAttr( const OUString& rLName,
+ const OUString& rValue );
+ sal_Bool AddAttr( const OUString& rPrefix,
+ const OUString& rNamespace,
+ const OUString& rLName,
+ const OUString& rValue );
+
+ sal_uInt16 GetAttrCount() const;
+ OUString GetAttrNamespace( sal_uInt16 i ) const;
+ OUString GetAttrPrefix( sal_uInt16 i ) const;
+ const OUString& GetAttrLName( sal_uInt16 i ) const;
+ const OUString& GetAttrValue( sal_uInt16 i ) const;
+
+ sal_uInt16 GetFirstNamespaceIndex() const;
+ sal_uInt16 GetNextNamespaceIndex( sal_uInt16 nIdx ) const;
+ const OUString& GetNamespace( sal_uInt16 i ) const;
+ const OUString& GetPrefix( sal_uInt16 i ) const;
+};
+
+#endif // _SVX_XMLCNITM_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/dllapi.h b/include/filter/dllapi.h
new file mode 100644
index 000000000000..9b94621feedf
--- /dev/null
+++ b/include/filter/dllapi.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FILTER_DLLAPI_H
+#define _FILTER_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined FILTER_DLLIMPLEMENTATION
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#if defined UNX && ! defined MACOS
+#define FILTER_PLUGIN_PUBLIC FILTER_DLLPUBLIC
+#else
+#define FILTER_PLUGIN_PUBLIC SAL_DLLPRIVATE
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/countryid.hxx b/include/filter/msfilter/countryid.hxx
new file mode 100644
index 000000000000..b70f649b05c3
--- /dev/null
+++ b/include/filter/msfilter/countryid.hxx
@@ -0,0 +1,311 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+// ============================================================================
+
+#ifndef INCLUDED_SVX_COUNTRYID_HXX
+#define INCLUDED_SVX_COUNTRYID_HXX
+
+#include <sal/types.h>
+#include <i18nlangtag/lang.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+// ----------------------------------------------------------------------------
+
+namespace msfilter {
+
+// Windows Country IDs ========================================================
+
+/** Represents a Windows country ID.
+
+ The country IDs used in Windows are equal to the international calling
+ code of each country, i.e. the code 353 represents Ireland (+353).
+
+ ATTENTION: These country codes are not supposed to be used anywhere in core
+ structures! They shall ONLY be used in the import/export filters for
+ Microsoft Office documents!
+ */
+typedef sal_uInt16 CountryId;
+
+const CountryId COUNTRY_DONTKNOW = 0;
+const CountryId COUNTRY_USA = 1;
+const CountryId COUNTRY_DOMINICAN_REPUBLIC = 1; // NANP
+const CountryId COUNTRY_GUAM = 1; // NANP
+const CountryId COUNTRY_JAMAICA = 1; // NANP
+const CountryId COUNTRY_PUERTO_RICO = 1; // NANP
+const CountryId COUNTRY_TRINIDAD_Y_TOBAGO = 1; // NANP
+const CountryId COUNTRY_CANADA = 2;
+const CountryId COUNTRY_RUSSIA = 7;
+const CountryId COUNTRY_KAZAKHSTAN = 7; // no own ID
+const CountryId COUNTRY_TATARSTAN = 7; // no own ID
+const CountryId COUNTRY_EGYPT = 20;
+const CountryId COUNTRY_SOUTH_AFRICA = 27;
+const CountryId COUNTRY_GREECE = 30;
+const CountryId COUNTRY_NETHERLANDS = 31;
+const CountryId COUNTRY_BELGIUM = 32;
+const CountryId COUNTRY_FRANCE = 33;
+const CountryId COUNTRY_SPAIN = 34;
+const CountryId COUNTRY_HUNGARY = 36;
+const CountryId COUNTRY_ITALY = 39;
+const CountryId COUNTRY_ROMANIA = 40;
+const CountryId COUNTRY_SWITZERLAND = 41;
+const CountryId COUNTRY_AUSTRIA = 43;
+const CountryId COUNTRY_UNITED_KINGDOM = 44;
+const CountryId COUNTRY_DENMARK = 45;
+const CountryId COUNTRY_SWEDEN = 46;
+const CountryId COUNTRY_NORWAY = 47;
+const CountryId COUNTRY_POLAND = 48;
+const CountryId COUNTRY_GERMANY = 49;
+const CountryId COUNTRY_PERU = 51;
+const CountryId COUNTRY_MEXICO = 52;
+const CountryId COUNTRY_CUBA = 53;
+const CountryId COUNTRY_ARGENTINIA = 54;
+const CountryId COUNTRY_BRAZIL = 55;
+const CountryId COUNTRY_CHILE = 56;
+const CountryId COUNTRY_COLOMBIA = 57;
+const CountryId COUNTRY_VENEZUELA = 58;
+const CountryId COUNTRY_MALAYSIA = 60;
+const CountryId COUNTRY_AUSTRALIA = 61;
+const CountryId COUNTRY_INDONESIA = 62;
+const CountryId COUNTRY_PHILIPPINES = 63;
+const CountryId COUNTRY_NEW_ZEALAND = 64;
+const CountryId COUNTRY_SINGAPORE = 65;
+const CountryId COUNTRY_THAILAND = 66;
+const CountryId COUNTRY_JAPAN = 81;
+const CountryId COUNTRY_SOUTH_KOREA = 82;
+const CountryId COUNTRY_VIET_NAM = 84;
+const CountryId COUNTRY_PR_CHINA = 86;
+const CountryId COUNTRY_TIBET = 86; // no own ID
+const CountryId COUNTRY_TURKEY = 90;
+const CountryId COUNTRY_INDIA = 91;
+const CountryId COUNTRY_PAKISTAN = 92;
+const CountryId COUNTRY_AFGHANISTAN = 93;
+const CountryId COUNTRY_SRI_LANKA = 94;
+const CountryId COUNTRY_MYANMAR = 95;
+const CountryId COUNTRY_MOROCCO = 212;
+const CountryId COUNTRY_ALGERIA = 213;
+const CountryId COUNTRY_TUNISIA = 216;
+const CountryId COUNTRY_LIBYA = 218;
+const CountryId COUNTRY_GAMBIA = 220;
+const CountryId COUNTRY_SENEGAL = 221;
+const CountryId COUNTRY_MAURITANIA = 222;
+const CountryId COUNTRY_MALI = 223;
+const CountryId COUNTRY_GUINEA = 224;
+const CountryId COUNTRY_COTE_D_IVOIRE = 225;
+const CountryId COUNTRY_BURKINA_FARSO = 226;
+const CountryId COUNTRY_NIGER = 227;
+const CountryId COUNTRY_TOGO = 228;
+const CountryId COUNTRY_BENIN = 229;
+const CountryId COUNTRY_MAURITIUS = 230;
+const CountryId COUNTRY_LIBERIA = 231;
+const CountryId COUNTRY_SIERRA_LEONE = 232;
+const CountryId COUNTRY_GHANA = 233;
+const CountryId COUNTRY_NIGERIA = 234;
+const CountryId COUNTRY_CHAD = 235;
+const CountryId COUNTRY_CENTRAL_AFR_REP = 236;
+const CountryId COUNTRY_CAMEROON = 237;
+const CountryId COUNTRY_CAPE_VERDE = 238;
+const CountryId COUNTRY_SAO_TOME = 239;
+const CountryId COUNTRY_EQUATORIAL_GUINEA = 240;
+const CountryId COUNTRY_GABON = 241;
+const CountryId COUNTRY_CONGO = 242;
+const CountryId COUNTRY_ZAIRE = 243;
+const CountryId COUNTRY_ANGOLA = 244;
+const CountryId COUNTRY_GUINEA_BISSAU = 245;
+const CountryId COUNTRY_DIEGO_GARCIA = 246;
+const CountryId COUNTRY_ASCENSION_ISLAND = 247;
+const CountryId COUNTRY_SEYCHELLES = 248;
+const CountryId COUNTRY_SUDAN = 249;
+const CountryId COUNTRY_RWANDA = 250;
+const CountryId COUNTRY_ETHIOPIA = 251;
+const CountryId COUNTRY_SOMALIA = 252;
+const CountryId COUNTRY_DJIBOUTI = 253;
+const CountryId COUNTRY_KENYA = 254;
+const CountryId COUNTRY_TANZANIA = 255;
+const CountryId COUNTRY_UGANDA = 256;
+const CountryId COUNTRY_BURUNDI = 257;
+const CountryId COUNTRY_MOZAMBIQUE = 258;
+const CountryId COUNTRY_ZANZIBAR = 259;
+const CountryId COUNTRY_ZAMBIA = 260;
+const CountryId COUNTRY_MADAGASKAR = 261;
+const CountryId COUNTRY_REUNION = 262;
+const CountryId COUNTRY_ZIMBABWE = 263;
+const CountryId COUNTRY_NAMIBIA = 264;
+const CountryId COUNTRY_MALAWI = 265;
+const CountryId COUNTRY_LESOTHO = 266;
+const CountryId COUNTRY_BOTSWANA = 267;
+const CountryId COUNTRY_SWAZILAND = 268;
+const CountryId COUNTRY_COMOROS_MAYOTTE = 269;
+const CountryId COUNTRY_ST_HELENA = 290;
+const CountryId COUNTRY_ERITREA = 291;
+const CountryId COUNTRY_ARUBA = 297;
+const CountryId COUNTRY_FAEROE_ISLANDS = 298;
+const CountryId COUNTRY_GREEN_ISLAND = 299;
+const CountryId COUNTRY_GIBRALTAR = 350;
+const CountryId COUNTRY_PORTUGAL = 351;
+const CountryId COUNTRY_LUXEMBOURG = 352;
+const CountryId COUNTRY_IRELAND = 353;
+const CountryId COUNTRY_ICELAND = 354;
+const CountryId COUNTRY_ALBANIA = 355;
+const CountryId COUNTRY_MALTA = 356;
+const CountryId COUNTRY_CYPRUS = 357;
+const CountryId COUNTRY_FINLAND = 358;
+const CountryId COUNTRY_BULGARIA = 359;
+const CountryId COUNTRY_LITHUANIA = 370;
+const CountryId COUNTRY_LATVIA = 371;
+const CountryId COUNTRY_ESTONIA = 372;
+const CountryId COUNTRY_MOLDOVA = 373;
+const CountryId COUNTRY_ARMENIA = 374;
+const CountryId COUNTRY_BELARUS = 375;
+const CountryId COUNTRY_ANDORRA = 376;
+const CountryId COUNTRY_MONACO = 377;
+const CountryId COUNTRY_SAN_MARINO = 378;
+const CountryId COUNTRY_VATICAN_CITY = 379;
+const CountryId COUNTRY_UKRAINE = 380;
+const CountryId COUNTRY_SERBIA = 381;
+const CountryId COUNTRY_CROATIA = 385;
+const CountryId COUNTRY_SLOVENIA = 386;
+const CountryId COUNTRY_BOSNIA = 387;
+const CountryId COUNTRY_MACEDONIA = 389;
+const CountryId COUNTRY_CZECH = 420;
+const CountryId COUNTRY_SLOVAK = 421;
+const CountryId COUNTRY_LIECHTENSTEIN = 423;
+const CountryId COUNTRY_FALKLAND_ISLANDS = 500;
+const CountryId COUNTRY_BELIZE = 501;
+const CountryId COUNTRY_GUATEMALA = 502;
+const CountryId COUNTRY_EL_SALVADOR = 503;
+const CountryId COUNTRY_HONDURAS = 504;
+const CountryId COUNTRY_NICARAGUA = 505;
+const CountryId COUNTRY_COSTA_RICA = 506;
+const CountryId COUNTRY_PANAMA = 507;
+const CountryId COUNTRY_ST_PIERRE = 508;
+const CountryId COUNTRY_HAITI = 509;
+const CountryId COUNTRY_GUADELOUPE = 590;
+const CountryId COUNTRY_BOLIVIA = 591;
+const CountryId COUNTRY_GUYANA = 592;
+const CountryId COUNTRY_ECUADOR = 593;
+const CountryId COUNTRY_FRENCH_GUIANA = 594;
+const CountryId COUNTRY_PARAGUAY = 595;
+const CountryId COUNTRY_MARTINIQUE = 596;
+const CountryId COUNTRY_SURINAME = 597;
+const CountryId COUNTRY_URUGUAY = 598;
+const CountryId COUNTRY_NETHERL_ANTILLES = 599;
+const CountryId COUNTRY_EAST_TIMOR = 670;
+const CountryId COUNTRY_ANTARCTICA = 672;
+const CountryId COUNTRY_BRUNEI_DARUSSALAM = 673;
+const CountryId COUNTRY_NARUPU = 674;
+const CountryId COUNTRY_PAPUA_NEW_GUINEA = 675;
+const CountryId COUNTRY_TONGA = 676;
+const CountryId COUNTRY_SOLOMON_ISLANDS = 677;
+const CountryId COUNTRY_VANUATU = 678;
+const CountryId COUNTRY_FIJI = 679;
+const CountryId COUNTRY_PALAU = 680;
+const CountryId COUNTRY_WALLIS_AND_FUTUNA = 681;
+const CountryId COUNTRY_COOK_ISLANDS = 682;
+const CountryId COUNTRY_NIUE_ISLAND = 683;
+const CountryId COUNTRY_AMERICAN_SAMOA = 684;
+const CountryId COUNTRY_WESTERN_SAMOA = 685;
+const CountryId COUNTRY_KIRIBATI = 686;
+const CountryId COUNTRY_NEW_CALEDONIA = 687;
+const CountryId COUNTRY_TUVALU = 688;
+const CountryId COUNTRY_FRENCH_POLYNESIA = 689;
+const CountryId COUNTRY_TOKELAU = 690;
+const CountryId COUNTRY_MICRONESIA = 691;
+const CountryId COUNTRY_MARSHALL_ISLANDS = 692;
+const CountryId COUNTRY_NORTH_KOREA = 850;
+const CountryId COUNTRY_HONG_KONG = 852;
+const CountryId COUNTRY_MACAU = 853;
+const CountryId COUNTRY_CAMBODIA = 855;
+const CountryId COUNTRY_LAOS = 856;
+const CountryId COUNTRY_BANGLADESH = 880;
+const CountryId COUNTRY_TAIWAN = 886;
+const CountryId COUNTRY_MALDIVES = 960;
+const CountryId COUNTRY_LEBANON = 961;
+const CountryId COUNTRY_JORDAN = 962;
+const CountryId COUNTRY_SYRIA = 963;
+const CountryId COUNTRY_IRAQ = 964;
+const CountryId COUNTRY_KUWAIT = 965;
+const CountryId COUNTRY_SAUDI_ARABIA = 966;
+const CountryId COUNTRY_YEMEN = 967;
+const CountryId COUNTRY_OMAN = 968;
+const CountryId COUNTRY_PALESTINE = 970;
+const CountryId COUNTRY_UAE = 971;
+const CountryId COUNTRY_ISRAEL = 972;
+const CountryId COUNTRY_BAHRAIN = 973;
+const CountryId COUNTRY_QATAR = 974;
+const CountryId COUNTRY_BHUTAN = 975;
+const CountryId COUNTRY_MONGOLIA = 976;
+const CountryId COUNTRY_NEPAL = 977;
+const CountryId COUNTRY_IRAN = 981;
+const CountryId COUNTRY_TAJIKISTAN = 992;
+const CountryId COUNTRY_TURKMENISTAN = 993;
+const CountryId COUNTRY_AZERBAIJAN = 994;
+const CountryId COUNTRY_GEORGIA = 995;
+const CountryId COUNTRY_KYRGYZSTAN = 996;
+const CountryId COUNTRY_UZBEKISTAN = 998;
+
+// Country ID <-> Language type conversion ====================================
+
+/** Converts a language type to a Windows country ID.
+
+ The function regards the sub type of the passed language, and tries to
+ return the appropriate country, i.e. COUNTRY_IRELAND for
+ LANGUAGE_ENGLISH_EIRE.
+
+ A few countries do not have an own associated country ID. Most of these
+ countries are mapped to another related country, i.e. Kazakhstan is
+ mapped to Russia.
+
+ If no country can be found, the value COUNTRY_DONTKNOW will be returned.
+
+ @param eLanguage
+ A language type, defined in tools/lang.hxx.
+
+ @return
+ The best Windows country ID for the passed language type, or
+ COUNTRY_DONTKNOW on error.
+ */
+MSFILTER_DLLPUBLIC CountryId ConvertLanguageToCountry( LanguageType eLanguage );
+
+/** Converts a Windows country ID to a language type.
+
+ The function returns the most used language for the passed country
+ (hopefully), i.e. LANGUAGE_ENGLISH_EIRE for COUNTRY_IRELAND.
+
+ If the passed country ID is not valid, the value LANGUAGE_DONTKNOW will be
+ returned.
+
+ @param eCountry
+ A Windows country ID, defined above.
+
+ @return
+ The most used language type in the passed country, or LANGUAGE_DONTKNOW
+ on error.
+ */
+MSFILTER_DLLPUBLIC LanguageType ConvertCountryToLanguage( CountryId eCountry );
+
+// ============================================================================
+
+} // namespace svx
+
+// ============================================================================
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffpropset.hxx b/include/filter/msfilter/dffpropset.hxx
new file mode 100644
index 000000000000..e4e9e90a5a6e
--- /dev/null
+++ b/include/filter/msfilter/dffpropset.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _DFFPROPSET_HXX
+#define _DFFPROPSET_HXX
+
+#include <tools/solar.h>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <filter/msfilter/dffrecordheader.hxx>
+#include <tools/stream.hxx>
+#include <vector>
+
+struct DffPropFlags
+{
+ sal_uInt8 bSet : 1;
+ sal_uInt8 bComplex : 1;
+ sal_uInt8 bBlip : 1;
+ sal_uInt8 bSoftAttr : 1;
+};
+
+struct DffPropSetEntry
+{
+ DffPropFlags aFlags;
+ sal_uInt16 nComplexIndexOrFlagsHAttr;
+ sal_uInt32 nContent;
+};
+
+class MSFILTER_DLLPUBLIC DffPropSet
+{
+ private:
+ DffPropSetEntry* mpPropSetEntries;
+ std::vector< sal_uInt32 > maOffsets;
+
+ void ReadPropSet( SvStream&, bool );
+
+ public:
+ explicit DffPropSet();
+ ~DffPropSet();
+
+ inline sal_Bool IsProperty( sal_uInt32 nRecType ) const { return ( mpPropSetEntries[ nRecType & 0x3ff ].aFlags.bSet ); };
+ sal_Bool IsHardAttribute( sal_uInt32 nId ) const;
+ sal_uInt32 GetPropertyValue( sal_uInt32 nId, sal_uInt32 nDefault = 0 ) const;
+ /** Returns a boolean property by its real identifier. */
+ bool GetPropertyBool( sal_uInt32 nId, bool bDefault = false ) const;
+ /** Returns a string property. */
+ OUString GetPropertyString( sal_uInt32 nId, SvStream& rStrm ) const;
+ sal_Bool SeekToContent( sal_uInt32 nRecType, SvStream& rSt ) const;
+ void InitializePropSet( sal_uInt16 nPropSetType ) const;
+
+ friend SvStream& operator>>( SvStream& rIn, DffPropSet& rPropSet );
+ friend SvStream& operator|=( SvStream& rIn, DffPropSet& rPropSet );
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/dffrecordheader.hxx b/include/filter/msfilter/dffrecordheader.hxx
new file mode 100644
index 000000000000..ca2fcc368c46
--- /dev/null
+++ b/include/filter/msfilter/dffrecordheader.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _DFFRECORDHEADER_HXX
+#define _DFFRECORDHEADER_HXX
+
+#include <tools/solar.h>
+#include <tools/stream.hxx>
+#include <filter/msfilter/msfilterdllapi.h>
+#include <svx/msdffdef.hxx>
+
+class MSFILTER_DLLPUBLIC DffRecordHeader
+{
+public:
+ sal_uInt8 nRecVer; // may be DFF_PSFLAG_CONTAINER
+ sal_uInt16 nRecInstance;
+ sal_uInt16 nImpVerInst;
+ sal_uInt16 nRecType;
+ sal_uInt32 nRecLen;
+ sal_uLong nFilePos;
+
+ DffRecordHeader() : nRecVer(0), nRecInstance(0), nImpVerInst(0),
+ nRecType(0), nRecLen(0), nFilePos(0) {}
+ bool IsContainer() const { return nRecVer == DFF_PSFLAG_CONTAINER; }
+ sal_uLong GetRecBegFilePos() const { return nFilePos; }
+ sal_uLong GetRecEndFilePos() const
+ { return nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen; }
+ bool SeekToEndOfRecord(SvStream& rIn) const
+ {
+ sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE + nRecLen;
+ return nPos == rIn.Seek(nPos);
+ }
+ bool SeekToContent(SvStream& rIn) const
+ {
+ sal_Size nPos = nFilePos + DFF_COMMON_RECORD_HEADER_SIZE;
+ return nPos == rIn.Seek(nPos);
+ }
+ bool SeekToBegOfRecord(SvStream& rIn) const
+ {
+ return nFilePos == rIn.Seek(nFilePos);
+ }
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>(SvStream& rIn, DffRecordHeader& rRec);
+};
+
+#endif
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx
new file mode 100644
index 000000000000..b57d269d30b0
--- /dev/null
+++ b/include/filter/msfilter/escherex.hxx
@@ -0,0 +1,1721 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVX_ESCHEREX_HXX
+#define _SVX_ESCHEREX_HXX
+
+#include <memory>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <tools/solar.h>
+#include <tools/gen.hxx>
+#include <tools/stream.hxx>
+#include <com/sun/star/uno/Reference.h>
+#include <svtools/grfmgr.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Rectangle.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/PropertyState.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/Hatch.hpp>
+#include <svx/msdffdef.hxx>
+#include "filter/msfilter/msfilterdllapi.h"
+
+ /*Record Name FBT-Value Instance Contents Wrd Exl PPt Ver*/
+// In the Microsoft documentation the naming scheme is msofbt... instead of ESCHER_...
+#define ESCHER_DggContainer 0xF000 /* per-document data X X X */
+#define ESCHER_Dgg 0xF006 /* an FDGG and several FIDCLs X X X 0 */
+#define ESCHER_CLSID 0xF016 /* the CLSID of the application that put the data on the clipboard C C C 0 */
+#define ESCHER_OPT 0xF00B /* count of properties the document-wide default shape properties X X X 3 */
+#define ESCHER_ColorMRU 0xF11A /* count of colors the colors in the MRU swatch X X X 0 */
+#define ESCHER_SplitMenuColors 0xF11E /* count of colors the colors in the top-level split menus X X X 0 */
+#define ESCHER_BstoreContainer 0xF001 /* count of BLIPs all images in the document (JPEGs, metafiles, etc.) X X X */
+#define ESCHER_BSE 0xF007 /* BLIP type an FBSE (one per BLIP) X X X 2 */
+#define ESCHER_BlipFirst 0xF018 /* range of fbts reserved for various kinds of BLIPs X X X */
+#define ESCHER_BlipLast 0xF117 /* range of fbts reserved for various kinds of BLIPs X X X */
+
+#define ESCHER_DgContainer 0xF002 /* per-sheet/page/slide data X X X */
+#define ESCHER_Dg 0xF008 /* drawing ID an FDG X X X 0 */
+#define ESCHER_RegroupItems 0xF118 /* count of regroup entries several FRITs X X X 0 */
+#define ESCHER_ColorScheme 0xF120 /* count of colors the colors of the source host's color scheme C C 0 */
+#define ESCHER_SpgrContainer 0xF003 /* several SpContainers, the first of which is the group shape itself X X X */
+#define ESCHER_SpContainer 0xF004 /* a shape X X X */
+#define ESCHER_Spgr 0xF009 /* an FSPGR; only present if the shape is a group shape X X X 1 */
+#define ESCHER_Sp 0xF00A /* shape type an FSP X X X 2 */
+//#define ESCHER_OPT 0xF00B /* count of properties a shape property table X X X 3 */
+#define ESCHER_Textbox 0xF00C /* RTF text C C C 0 */
+#define ESCHER_ClientTextbox 0xF00D /* host-defined the text in the textbox, in host-defined format X X X */
+#define ESCHER_Anchor 0xF00E /* a RECT, in 100000ths of an inch C C C 0 */
+#define ESCHER_ChildAnchor 0xF00F /* a RECT, in units relative to the parent group X X X 0 */
+#define ESCHER_ClientAnchor 0xF010 /* host-defined the location of the shape, in a host-defined format X X X */
+#define ESCHER_ClientData 0xF011 /* host-defined host-specific data X X X */
+#define ESCHER_OleObject 0xF11F /* a serialized IStorage for an OLE object C C C 0 */
+#define ESCHER_DeletedPspl 0xF11D /* an FPSPL; only present in top-level deleted shapes X 0 */
+#define ESCHER_SolverContainer 0xF005 /* count of rules the rules governing shapes X X X */
+#define ESCHER_ConnectorRule 0xF012 /* an FConnectorRule X X 1 */
+#define ESCHER_AlignRule 0xF013 /* an FAlignRule X X X 0 */
+#define ESCHER_ArcRule 0xF014 /* an FARCRU X X X 0 */
+#define ESCHER_ClientRule 0xF015 /* host-defined host-defined */
+#define ESCHER_CalloutRule 0xF017 /* an FCORU X X X 0 */
+#define ESCHER_Selection 0xF119 /* an FDGSL followed by the SPIDs of the shapes in the selection X 0 */
+#define ESCHER_UDefProp 0xF122
+
+#define SHAPEFLAG_GROUP 0x001 /* This shape is a group shape */
+#define SHAPEFLAG_CHILD 0x002 /* Not a top-level shape */
+#define SHAPEFLAG_PATRIARCH 0x004 /* This is the topmost group shape. Exactly one of these per drawing. */
+#define SHAPEFLAG_DELETED 0x008 /* The shape has been deleted */
+#define SHAPEFLAG_OLESHAPE 0x010 /* The shape is an OLE object */
+#define SHAPEFLAG_HAVEMASTER 0x020 /* Shape has a hspMaster property */
+#define SHAPEFLAG_FLIPH 0x040 /* Shape is flipped horizontally */
+#define SHAPEFLAG_FLIPV 0x080 /* Shape is flipped vertically */
+#define SHAPEFLAG_CONNECTOR 0x100 /* Connector type of shape */
+#define SHAPEFLAG_HAVEANCHOR 0x200 /* Shape has an anchor of some kind */
+#define SHAPEFLAG_BACKGROUND 0x400 /* Background shape */
+#define SHAPEFLAG_HAVESPT 0x800 /* Shape has a shape type property */
+
+#define ESCHER_ShpInst_Min 0
+#define ESCHER_ShpInst_NotPrimitive ESCHER_ShpInst_Min
+#define ESCHER_ShpInst_Rectangle 1
+#define ESCHER_ShpInst_RoundRectangle 2
+#define ESCHER_ShpInst_Ellipse 3
+#define ESCHER_ShpInst_Diamond 4
+#define ESCHER_ShpInst_IsocelesTriangle 5
+#define ESCHER_ShpInst_RightTriangle 6
+#define ESCHER_ShpInst_Parallelogram 7
+#define ESCHER_ShpInst_Trapezoid 8
+#define ESCHER_ShpInst_Hexagon 9
+#define ESCHER_ShpInst_Octagon 10
+#define ESCHER_ShpInst_Plus 11
+#define ESCHER_ShpInst_Star 12
+#define ESCHER_ShpInst_Arrow 13
+#define ESCHER_ShpInst_ThickArrow 14
+#define ESCHER_ShpInst_HomePlate 15
+#define ESCHER_ShpInst_Cube 16
+#define ESCHER_ShpInst_Balloon 17
+#define ESCHER_ShpInst_Seal 18
+#define ESCHER_ShpInst_Arc 19
+#define ESCHER_ShpInst_Line 20
+#define ESCHER_ShpInst_Plaque 21
+#define ESCHER_ShpInst_Can 22
+#define ESCHER_ShpInst_Donut 23
+#define ESCHER_ShpInst_TextSimple 24
+#define ESCHER_ShpInst_TextOctagon 25
+#define ESCHER_ShpInst_TextHexagon 26
+#define ESCHER_ShpInst_TextCurve 27
+#define ESCHER_ShpInst_TextWave 28
+#define ESCHER_ShpInst_TextRing 29
+#define ESCHER_ShpInst_TextOnCurve 30
+#define ESCHER_ShpInst_TextOnRing 31
+#define ESCHER_ShpInst_StraightConnector1 32
+#define ESCHER_ShpInst_BentConnector2 33
+#define ESCHER_ShpInst_BentConnector3 34
+#define ESCHER_ShpInst_BentConnector4 35
+#define ESCHER_ShpInst_BentConnector5 36
+#define ESCHER_ShpInst_CurvedConnector2 37
+#define ESCHER_ShpInst_CurvedConnector3 38
+#define ESCHER_ShpInst_CurvedConnector4 39
+#define ESCHER_ShpInst_CurvedConnector5 40
+#define ESCHER_ShpInst_Callout1 41
+#define ESCHER_ShpInst_Callout2 42
+#define ESCHER_ShpInst_Callout3 43
+#define ESCHER_ShpInst_AccentCallout1 44
+#define ESCHER_ShpInst_AccentCallout2 45
+#define ESCHER_ShpInst_AccentCallout3 46
+#define ESCHER_ShpInst_BorderCallout1 47
+#define ESCHER_ShpInst_BorderCallout2 48
+#define ESCHER_ShpInst_BorderCallout3 49
+#define ESCHER_ShpInst_AccentBorderCallout1 50
+#define ESCHER_ShpInst_AccentBorderCallout2 51
+#define ESCHER_ShpInst_AccentBorderCallout3 52
+#define ESCHER_ShpInst_Ribbon 53
+#define ESCHER_ShpInst_Ribbon2 54
+#define ESCHER_ShpInst_Chevron 55
+#define ESCHER_ShpInst_Pentagon 56
+#define ESCHER_ShpInst_NoSmoking 57
+#define ESCHER_ShpInst_Seal8 58
+#define ESCHER_ShpInst_Seal16 59
+#define ESCHER_ShpInst_Seal32 60
+#define ESCHER_ShpInst_WedgeRectCallout 61
+#define ESCHER_ShpInst_WedgeRRectCallout 62
+#define ESCHER_ShpInst_WedgeEllipseCallout 63
+#define ESCHER_ShpInst_Wave 64
+#define ESCHER_ShpInst_FoldedCorner 65
+#define ESCHER_ShpInst_LeftArrow 66
+#define ESCHER_ShpInst_DownArrow 67
+#define ESCHER_ShpInst_UpArrow 68
+#define ESCHER_ShpInst_LeftRightArrow 69
+#define ESCHER_ShpInst_UpDownArrow 70
+#define ESCHER_ShpInst_IrregularSeal1 71
+#define ESCHER_ShpInst_IrregularSeal2 72
+#define ESCHER_ShpInst_LightningBolt 73
+#define ESCHER_ShpInst_Heart 74
+#define ESCHER_ShpInst_PictureFrame 75
+#define ESCHER_ShpInst_QuadArrow 76
+#define ESCHER_ShpInst_LeftArrowCallout 77
+#define ESCHER_ShpInst_RightArrowCallout 78
+#define ESCHER_ShpInst_UpArrowCallout 79
+#define ESCHER_ShpInst_DownArrowCallout 80
+#define ESCHER_ShpInst_LeftRightArrowCallout 81
+#define ESCHER_ShpInst_UpDownArrowCallout 82
+#define ESCHER_ShpInst_QuadArrowCallout 83
+#define ESCHER_ShpInst_Bevel 84
+#define ESCHER_ShpInst_LeftBracket 85
+#define ESCHER_ShpInst_RightBracket 86
+#define ESCHER_ShpInst_LeftBrace 87
+#define ESCHER_ShpInst_RightBrace 88
+#define ESCHER_ShpInst_LeftUpArrow 89
+#define ESCHER_ShpInst_BentUpArrow 90
+#define ESCHER_ShpInst_BentArrow 91
+#define ESCHER_ShpInst_Seal24 92
+#define ESCHER_ShpInst_StripedRightArrow 93
+#define ESCHER_ShpInst_NotchedRightArrow 94
+#define ESCHER_ShpInst_BlockArc 95
+#define ESCHER_ShpInst_SmileyFace 96
+#define ESCHER_ShpInst_VerticalScroll 97
+#define ESCHER_ShpInst_HorizontalScroll 98
+#define ESCHER_ShpInst_CircularArrow 99
+#define ESCHER_ShpInst_NotchedCircularArrow 100
+#define ESCHER_ShpInst_UturnArrow 101
+#define ESCHER_ShpInst_CurvedRightArrow 102
+#define ESCHER_ShpInst_CurvedLeftArrow 103
+#define ESCHER_ShpInst_CurvedUpArrow 104
+#define ESCHER_ShpInst_CurvedDownArrow 105
+#define ESCHER_ShpInst_CloudCallout 106
+#define ESCHER_ShpInst_EllipseRibbon 107
+#define ESCHER_ShpInst_EllipseRibbon2 108
+#define ESCHER_ShpInst_FlowChartProcess 109
+#define ESCHER_ShpInst_FlowChartDecision 110
+#define ESCHER_ShpInst_FlowChartInputOutput 111
+#define ESCHER_ShpInst_FlowChartPredefinedProcess 112
+#define ESCHER_ShpInst_FlowChartInternalStorage 113
+#define ESCHER_ShpInst_FlowChartDocument 114
+#define ESCHER_ShpInst_FlowChartMultidocument 115
+#define ESCHER_ShpInst_FlowChartTerminator 116
+#define ESCHER_ShpInst_FlowChartPreparation 117
+#define ESCHER_ShpInst_FlowChartManualInput 118
+#define ESCHER_ShpInst_FlowChartManualOperation 119
+#define ESCHER_ShpInst_FlowChartConnector 120
+#define ESCHER_ShpInst_FlowChartPunchedCard 121
+#define ESCHER_ShpInst_FlowChartPunchedTape 122
+#define ESCHER_ShpInst_FlowChartSummingJunction 123
+#define ESCHER_ShpInst_FlowChartOr 124
+#define ESCHER_ShpInst_FlowChartCollate 125
+#define ESCHER_ShpInst_FlowChartSort 126
+#define ESCHER_ShpInst_FlowChartExtract 127
+#define ESCHER_ShpInst_FlowChartMerge 128
+#define ESCHER_ShpInst_FlowChartOfflineStorage 129
+#define ESCHER_ShpInst_FlowChartOnlineStorage 130
+#define ESCHER_ShpInst_FlowChartMagneticTape 131
+#define ESCHER_ShpInst_FlowChartMagneticDisk 132
+#define ESCHER_ShpInst_FlowChartMagneticDrum 133
+#define ESCHER_ShpInst_FlowChartDisplay 134
+#define ESCHER_ShpInst_FlowChartDelay 135
+#define ESCHER_ShpInst_TextPlainText 136
+#define ESCHER_ShpInst_TextStop 137
+#define ESCHER_ShpInst_TextTriangle 138
+#define ESCHER_ShpInst_TextTriangleInverted 139
+#define ESCHER_ShpInst_TextChevron 140
+#define ESCHER_ShpInst_TextChevronInverted 141
+#define ESCHER_ShpInst_TextRingInside 142
+#define ESCHER_ShpInst_TextRingOutside 143
+#define ESCHER_ShpInst_TextArchUpCurve 144
+#define ESCHER_ShpInst_TextArchDownCurve 145
+#define ESCHER_ShpInst_TextCircleCurve 146
+#define ESCHER_ShpInst_TextButtonCurve 147
+#define ESCHER_ShpInst_TextArchUpPour 148
+#define ESCHER_ShpInst_TextArchDownPour 149
+#define ESCHER_ShpInst_TextCirclePour 150
+#define ESCHER_ShpInst_TextButtonPour 151
+#define ESCHER_ShpInst_TextCurveUp 152
+#define ESCHER_ShpInst_TextCurveDown 153
+#define ESCHER_ShpInst_TextCascadeUp 154
+#define ESCHER_ShpInst_TextCascadeDown 155
+#define ESCHER_ShpInst_TextWave1 156
+#define ESCHER_ShpInst_TextWave2 157
+#define ESCHER_ShpInst_TextWave3 158
+#define ESCHER_ShpInst_TextWave4 159
+#define ESCHER_ShpInst_TextInflate 160
+#define ESCHER_ShpInst_TextDeflate 161
+#define ESCHER_ShpInst_TextInflateBottom 162
+#define ESCHER_ShpInst_TextDeflateBottom 163
+#define ESCHER_ShpInst_TextInflateTop 164
+#define ESCHER_ShpInst_TextDeflateTop 165
+#define ESCHER_ShpInst_TextDeflateInflate 166
+#define ESCHER_ShpInst_TextDeflateInflateDeflate 167
+#define ESCHER_ShpInst_TextFadeRight 168
+#define ESCHER_ShpInst_TextFadeLeft 169
+#define ESCHER_ShpInst_TextFadeUp 170
+#define ESCHER_ShpInst_TextFadeDown 171
+#define ESCHER_ShpInst_TextSlantUp 172
+#define ESCHER_ShpInst_TextSlantDown 173
+#define ESCHER_ShpInst_TextCanUp 174
+#define ESCHER_ShpInst_TextCanDown 175
+#define ESCHER_ShpInst_FlowChartAlternateProcess 176
+#define ESCHER_ShpInst_FlowChartOffpageConnector 177
+#define ESCHER_ShpInst_Callout90 178
+#define ESCHER_ShpInst_AccentCallout90 179
+#define ESCHER_ShpInst_BorderCallout90 180
+#define ESCHER_ShpInst_AccentBorderCallout90 181
+#define ESCHER_ShpInst_LeftRightUpArrow 182
+#define ESCHER_ShpInst_Sun 183
+#define ESCHER_ShpInst_Moon 184
+#define ESCHER_ShpInst_BracketPair 185
+#define ESCHER_ShpInst_BracePair 186
+#define ESCHER_ShpInst_Seal4 187
+#define ESCHER_ShpInst_DoubleWave 188
+#define ESCHER_ShpInst_ActionButtonBlank 189
+#define ESCHER_ShpInst_ActionButtonHome 190
+#define ESCHER_ShpInst_ActionButtonHelp 191
+#define ESCHER_ShpInst_ActionButtonInformation 192
+#define ESCHER_ShpInst_ActionButtonForwardNext 193
+#define ESCHER_ShpInst_ActionButtonBackPrevious 194
+#define ESCHER_ShpInst_ActionButtonEnd 195
+#define ESCHER_ShpInst_ActionButtonBeginning 196
+#define ESCHER_ShpInst_ActionButtonReturn 197
+#define ESCHER_ShpInst_ActionButtonDocument 198
+#define ESCHER_ShpInst_ActionButtonSound 199
+#define ESCHER_ShpInst_ActionButtonMovie 200
+#define ESCHER_ShpInst_HostControl 201
+#define ESCHER_ShpInst_TextBox 202
+#define ESCHER_ShpInst_COUNT 203
+#define ESCHER_ShpInst_Max 0x0FFF
+#define ESCHER_ShpInst_Nil ESCHER_ShpInst_Max
+
+enum ESCHER_BlibType
+{ // GEL provided types...
+ ERROR = 0, // An error occurred during loading
+ UNKNOWN, // An unknown blip type
+ EMF, // Windows Enhanced Metafile
+ WMF, // Windows Metafile
+ PICT, // Macintosh PICT
+ PEG, // JFIF
+ PNG, // PNG
+ DIB, // Windows DIB
+ FirstClient = 32, // First client defined blip type
+ LastClient = 255 // Last client defined blip type
+};
+
+enum ESCHER_FillStyle
+{
+ ESCHER_FillSolid, // Fill with a solid color
+ ESCHER_FillPattern, // Fill with a pattern (bitmap)
+ ESCHER_FillTexture, // A texture (pattern with its own color map)
+ ESCHER_FillPicture, // Center a picture in the shape
+ ESCHER_FillShade, // Shade from start to end points
+ ESCHER_FillShadeCenter, // Shade from bounding rectangle to end point
+ ESCHER_FillShadeShape, // Shade from shape outline to end point
+ ESCHER_FillShadeScale,
+ ESCHER_FillShadeTitle,
+ ESCHER_FillBackground
+};
+
+enum ESCHER_wMode
+{
+ ESCHER_wColor, // only used for predefined shades
+ ESCHER_wAutomatic, // depends on object type
+ ESCHER_wGrayScale, // shades of gray only
+ ESCHER_wLightGrayScale, // shades of light gray only
+ ESCHER_wInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_wGrayOutline, // pure gray and white
+ ESCHER_wBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_wHighContrast, // pure black and white mode (no grays)
+ ESCHER_wBlack, // solid black msobwWhite, // solid white
+ ESCHER_wDontShow, // object not drawn
+ ESCHER_wNumModes // number of Black and white modes
+};
+
+
+//
+enum ESCHER_ShapePath
+{
+ ESCHER_ShapeLines, // A line of straight segments
+ ESCHER_ShapeLinesClosed, // A closed polygonal object
+ ESCHER_ShapeCurves, // A line of Bezier curve segments
+ ESCHER_ShapeCurvesClosed, // A closed shape with curved edges
+ ESCHER_ShapeComplex // pSegmentInfo must be non-empty
+};
+
+
+enum ESCHER_WrapMode
+{
+ ESCHER_WrapSquare,
+ ESCHER_WrapByPoints,
+ ESCHER_WrapNone,
+ ESCHER_WrapTopBottom,
+ ESCHER_WrapThrough
+};
+
+//
+enum ESCHER_bwMode
+{
+ ESCHER_bwColor, // only used for predefined shades
+ ESCHER_bwAutomatic, // depends on object type
+ ESCHER_bwGrayScale, // shades of gray only
+ ESCHER_bwLightGrayScale, // shades of light gray only
+ ESCHER_bwInverseGray, // dark gray mapped to light gray, etc.
+ ESCHER_bwGrayOutline, // pure gray and white
+ ESCHER_bwBlackTextLine, // black text and lines, all else grayscale
+ ESCHER_bwHighContrast, // pure black and white mode (no grays)
+ ESCHER_bwBlack, // solid black
+ ESCHER_bwWhite, // solid white
+ ESCHER_bwDontShow, // object not drawn
+ ESCHER_bwNumModes // number of Black and white modes
+};
+
+
+enum ESCHER_AnchorText
+{
+ ESCHER_AnchorTop,
+ ESCHER_AnchorMiddle,
+ ESCHER_AnchorBottom,
+ ESCHER_AnchorTopCentered,
+ ESCHER_AnchorMiddleCentered,
+ ESCHER_AnchorBottomCentered,
+ ESCHER_AnchorTopBaseline,
+ ESCHER_AnchorBottomBaseline,
+ ESCHER_AnchorTopCenteredBaseline,
+ ESCHER_AnchorBottomCenteredBaseline
+};
+
+enum ESCHER_cDir
+{
+ ESCHER_cDir0, // Right
+ ESCHER_cDir90, // Down
+ ESCHER_cDir180, // Left
+ ESCHER_cDir270 // Up
+};
+
+// connector style
+enum ESCHER_cxSTYLE
+{
+ ESCHER_cxstyleStraight = 0,
+ ESCHER_cxstyleBent,
+ ESCHER_cxstyleCurved,
+ ESCHER_cxstyleNone
+};
+
+// text flow
+enum ESCHER_txfl
+{
+ ESCHER_txflHorzN, // Horizontal non-@
+ ESCHER_txflTtoBA, // Top to Bottom @-font
+ ESCHER_txflBtoT, // Bottom to Top non-@
+ ESCHER_txflTtoBN, // Top to Bottom non-@
+ ESCHER_txflHorzA, // Horizontal @-font
+ ESCHER_txflVertN // Vertical, non-@
+};
+
+// text direction (needed for Bi-Di support)
+enum ESCHER_txDir
+{
+ ESCHER_txdirLTR, // left-to-right text direction
+ ESCHER_txdirRTL, // right-to-left text direction
+ ESCHER_txdirContext // context text direction
+};
+
+// Callout Type
+enum ESCHER_spcot
+{
+ ESCHER_spcotRightAngle = 1,
+ ESCHER_spcotOneSegment = 2,
+ ESCHER_spcotTwoSegment = 3,
+ ESCHER_spcotThreeSegment= 4
+};
+
+// Callout Angle
+enum ESCHER_spcoa
+{
+ ESCHER_spcoaAny,
+ ESCHER_spcoa30,
+ ESCHER_spcoa45,
+ ESCHER_spcoa60,
+ ESCHER_spcoa90,
+ ESCHER_spcoa0
+};
+
+// Callout Drop
+enum ESCHER_spcod
+{
+ ESCHER_spcodTop,
+ ESCHER_spcodCenter,
+ ESCHER_spcodBottom,
+ ESCHER_spcodSpecified
+};
+
+// FontWork alignment
+enum ESCHER_GeoTextAlign
+{
+ ESCHER_AlignTextStretch, // Stretch each line of text to fit width.
+ ESCHER_AlignTextCenter, // Center text on width.
+ ESCHER_AlignTextLeft, // Left justify.
+ ESCHER_AlignTextRight, // Right justify.
+ ESCHER_AlignTextLetterJust, // Spread letters out to fit width.
+ ESCHER_AlignTextWordJust, // Spread words out to fit width.
+ ESCHER_AlignTextInvalid // Invalid
+};
+
+// flags for pictures
+enum ESCHER_BlipFlags
+{
+ ESCHER_BlipFlagDefault = 0,
+ ESCHER_BlipFlagComment = 0, // Blip name is a comment
+ ESCHER_BlipFlagFile, // Blip name is a file name
+ ESCHER_BlipFlagURL, // Blip name is a full URL
+ ESCHER_BlipFlagType = 3, // Mask to extract type
+ /* Or the following flags with any of the above. */
+ ESCHER_BlipFlagDoNotSave = 4,
+ ESCHER_BlipFlagLinkToFile = 8
+};
+
+//
+enum ESCHER_3DRenderMode
+{
+ ESCHER_FullRender, // Generate a full rendering
+ ESCHER_Wireframe, // Generate a wireframe
+ ESCHER_BoundingCube // Generate a bounding cube
+};
+
+//
+enum ESCHER_xFormType
+{
+ ESCHER_xFormAbsolute, // Apply transform in absolute space centered on shape
+ ESCHER_xFormShape, // Apply transform to shape geometry
+ ESCHER_xFormDrawing // Apply transform in drawing space
+};
+
+//
+enum ESCHER_ShadowType
+{
+ ESCHER_ShadowOffset, // N pixel offset shadow
+ ESCHER_ShadowDouble, // Use second offset too
+ ESCHER_ShadowRich, // Rich perspective shadow (cast relative to shape)
+ ESCHER_ShadowShape, // Rich perspective shadow (cast in shape space)
+ ESCHER_ShadowDrawing, // Perspective shadow cast in drawing space
+ ESCHER_ShadowEmbossOrEngrave
+};
+
+// - the type of a (length) measurement
+enum ESCHER_dzType
+ {
+ ESCHER_dzTypeMin = 0,
+ ESCHER_dzTypeDefault = 0, // Default size, ignore the values
+ ESCHER_dzTypeA = 1, // Values are in EMUs
+ ESCHER_dzTypeV = 2, // Values are in pixels
+ ESCHER_dzTypeShape = 3, // Values are 16.16 fractions of shape size
+ ESCHER_dzTypeFixedAspect = 4, // Aspect ratio is fixed
+ ESCHER_dzTypeAFixed = 5, // EMUs, fixed aspect ratio
+ ESCHER_dzTypeVFixed = 6, // Pixels, fixed aspect ratio
+ ESCHER_dzTypeShapeFixed = 7, // Proportion of shape, fixed aspect ratio
+ ESCHER_dzTypeFixedAspectEnlarge= 8, // Aspect ratio is fixed, favor larger size
+ ESCHER_dzTypeAFixedBig = 9, // EMUs, fixed aspect ratio
+ ESCHER_dzTypeVFixedBig = 10, // Pixels, fixed aspect ratio
+ ESCHER_dzTypeShapeFixedBig= 11, // Proportion of shape, fixed aspect ratio
+ ESCHER_dzTypeMax = 11
+};
+
+// how to interpret the colors in a shaded fill.
+enum ESCHER_ShadeType
+{
+ ESCHER_ShadeNone = 0, // Interpolate without correction between RGBs
+ ESCHER_ShadeGamma = 1, // Apply gamma correction to colors
+ ESCHER_ShadeSigma = 2, // Apply a sigma transfer function to position
+ ESCHER_ShadeBand = 4, // Add a flat band at the start of the shade
+ ESCHER_ShadeOneColor = 8, // This is a one color shade
+
+ /* A parameter for the band or sigma function can be stored in the top
+ 16 bits of the value - this is a proportion of *each* band of the
+ shade to make flat (or the approximate equal value for a sigma
+ function). NOTE: the parameter is not used for the sigma function,
+ instead a built in value is used. This value should not be changed
+ from the default! */
+ ESCHER_ShadeParameterShift = 16,
+ ESCHER_ShadeParameterMask = 0xffff0000,
+
+ ESCHER_ShadeDefault = (ESCHER_ShadeGamma|ESCHER_ShadeSigma|
+ (16384<<ESCHER_ShadeParameterShift))
+};
+
+// compound line style
+enum ESCHER_LineStyle
+{
+ ESCHER_LineSimple, // Single line (of width lineWidth)
+ ESCHER_LineDouble, // Double lines of equal width
+ ESCHER_LineThickThin, // Double lines, one thick, one thin
+ ESCHER_LineThinThick, // Double lines, reverse order
+ ESCHER_LineTriple // Three lines, thin, thick, thin
+};
+
+// how to "fill" the line contour
+enum ESCHER_LineType
+{
+ ESCHER_lineSolidType, // Fill with a solid color
+ ESCHER_linePattern, // Fill with a pattern (bitmap)
+ ESCHER_lineTexture, // A texture (pattern with its own color map)
+ ESCHER_linePicture // Center a picture in the shape
+};
+
+// dashed line style
+enum ESCHER_LineDashing
+{
+ ESCHER_LineSolid, // Solid (continuous) pen
+ ESCHER_LineDashSys, // PS_DASH system dash style
+ ESCHER_LineDotSys, // PS_DOT system dash style
+ ESCHER_LineDashDotSys, // PS_DASHDOT system dash style
+ ESCHER_LineDashDotDotSys, // PS_DASHDOTDOT system dash style
+ ESCHER_LineDotGEL, // square dot style
+ ESCHER_LineDashGEL, // dash style
+ ESCHER_LineLongDashGEL, // long dash style
+ ESCHER_LineDashDotGEL, // dash short dash
+ ESCHER_LineLongDashDotGEL, // long dash short dash
+ ESCHER_LineLongDashDotDotGEL // long dash short dash short dash
+};
+
+// line end effect
+enum ESCHER_LineEnd
+{
+ ESCHER_LineNoEnd,
+ ESCHER_LineArrowEnd,
+ ESCHER_LineArrowStealthEnd,
+ ESCHER_LineArrowDiamondEnd,
+ ESCHER_LineArrowOvalEnd,
+ ESCHER_LineArrowOpenEnd
+};
+
+// size of arrowhead
+enum ESCHER_LineWidth
+{
+ ESCHER_LineNarrowArrow,
+ ESCHER_LineMediumWidthArrow,
+ ESCHER_LineWideArrow
+};
+
+// size of arrowhead
+enum ESCHER_LineEndLenght
+{
+ ESCHER_LineShortArrow,
+ ESCHER_LineMediumLenArrow,
+ ESCHER_LineLongArrow
+};
+
+// line join style.
+enum ESCHER_LineJoin
+{
+ ESCHER_LineJoinBevel, // Join edges by a straight line
+ ESCHER_LineJoinMiter, // Extend edges until they join
+ ESCHER_LineJoinRound // Draw an arc between the two edges
+};
+
+// line cap style (applies to ends of dash segments too).
+enum ESCHER_LineCap
+{
+ ESCHER_LineEndCapRound, // Rounded ends - the default
+ ESCHER_LineEndCapSquare, // Square protrudes by half line width
+ ESCHER_LineEndCapFlat // Line ends at end point
+};
+
+// Shape Properties
+// 1pt = 12700 EMU (English Metric Units)
+// 1pt = 20 Twip = 20/1440" = 1/72"
+// 1twip=635 EMU
+// 1" = 12700*72 = 914400 EMU
+// 1" = 25.4mm
+// 1mm = 36000 EMU
+// Transform
+#define ESCHER_Prop_Rotation 4 /* Fixed Point 16.16 degrees */
+// Protection
+#define ESCHER_Prop_LockRotation 119 /* sal_Bool No rotation */
+#define ESCHER_Prop_LockAspectRatio 120 /* sal_Bool Don't allow changes in aspect ratio */
+#define ESCHER_Prop_LockPosition 121 /* sal_Bool Don't allow the shape to be moved */
+#define ESCHER_Prop_LockAgainstSelect 122 /* sal_Bool Shape may not be selected */
+#define ESCHER_Prop_LockCropping 123 /* sal_Bool No cropping this shape */
+#define ESCHER_Prop_LockVertices 124 /* sal_Bool Edit Points not allowed */
+#define ESCHER_Prop_LockText 125 /* sal_Bool Do not edit text */
+#define ESCHER_Prop_LockAdjustHandles 126 /* sal_Bool Do not adjust */
+#define ESCHER_Prop_LockAgainstGrouping 127 /* sal_Bool Do not group this shape */
+// Text
+#define ESCHER_Prop_lTxid 128 /* LONG id for the text, value determined by the host */
+#define ESCHER_Prop_dxTextLeft 129 /* LONG margins relative to shape's inscribed */
+#define ESCHER_Prop_dyTextTop 130 /* LONG text rectangle (in EMUs) */
+#define ESCHER_Prop_dxTextRight 131 /* LONG */
+#define ESCHER_Prop_dyTextBottom 132 /* LONG */
+#define ESCHER_Prop_WrapText 133 /* MSOWRAPMODE Wrap text at shape margins */
+#define ESCHER_Prop_scaleText 134 /* LONG Text zoom/scale (used if fFitTextToShape) */
+#define ESCHER_Prop_AnchorText 135 /* ESCHER_AnchorText How to anchor the text */
+#define ESCHER_Prop_txflTextFlow 136 /* MSOTXFL Text flow */
+#define ESCHER_Prop_cdirFont 137 /* MSOCDIR Font rotation */
+#define ESCHER_Prop_hspNext 138 /* MSOHSP ID of the next shape (used by Word for linked textboxes) */
+#define ESCHER_Prop_txdir 139 /* MSOTXDIR Bi-Di Text direction */
+#define ESCHER_Prop_SelectText 187 /* sal_Bool sal_True if single click selects text, sal_False if two clicks */
+#define ESCHER_Prop_AutoTextMargin 188 /* sal_Bool use host's margin calculations */
+#define ESCHER_Prop_RotateText 189 /* sal_Bool Rotate text with shape */
+#define ESCHER_Prop_FitShapeToText 190 /* sal_Bool Size shape to fit text size */
+#define ESCHER_Prop_FitTextToShape 191 /* sal_Bool Size text to fit shape size */
+// GeoText
+#define ESCHER_Prop_gtextUNICODE 192 /* WCHAR* UNICODE text string */
+#define ESCHER_Prop_gtextRTF 193 /* char* RTF text string */
+#define ESCHER_Prop_gtextAlign 194 /* MSOGEOTEXTALIGN alignment on curve */
+#define ESCHER_Prop_gtextSize 195 /* LONG default point size */
+#define ESCHER_Prop_gtextSpacing 196 /* LONG fixed point 16.16 */
+#define ESCHER_Prop_gtextFont 197 /* WCHAR* font family name */
+#define ESCHER_Prop_gtextFReverseRows 240 /* sal_Bool Reverse row order */
+#define ESCHER_Prop_fGtext 241 /* sal_Bool Has text effect */
+#define ESCHER_Prop_gtextFVertical 242 /* sal_Bool Rotate characters */
+#define ESCHER_Prop_gtextFKern 243 /* sal_Bool Kern characters */
+#define ESCHER_Prop_gtextFTight 244 /* sal_Bool Tightening or tracking */
+#define ESCHER_Prop_gtextFStretch 245 /* sal_Bool Stretch to fit shape */
+#define ESCHER_Prop_gtextFShrinkFit 246 /* sal_Bool Char bounding box */
+#define ESCHER_Prop_gtextFBestFit 247 /* sal_Bool Scale text-on-path */
+#define ESCHER_Prop_gtextFNormalize 248 /* sal_Bool Stretch char height */
+#define ESCHER_Prop_gtextFDxMeasure 249 /* sal_Bool Do not measure along path */
+#define ESCHER_Prop_gtextFBold 250 /* sal_Bool Bold font */
+#define ESCHER_Prop_gtextFItalic 251 /* sal_Bool Italic font */
+#define ESCHER_Prop_gtextFUnderline 252 /* sal_Bool Underline font */
+#define ESCHER_Prop_gtextFShadow 253 /* sal_Bool Shadow font */
+#define ESCHER_Prop_gtextFSmallcaps 254 /* sal_Bool Small caps font */
+#define ESCHER_Prop_gtextFStrikethrough 255 /* sal_Bool Strike through font */
+// Blip
+#define ESCHER_Prop_cropFromTop 256 /* LONG 16.16 fraction times total */
+#define ESCHER_Prop_cropFromBottom 257 /* LONG image width or height, */
+#define ESCHER_Prop_cropFromLeft 258 /* LONG as appropriate. */
+#define ESCHER_Prop_cropFromRight 259 /* LONG */
+#define ESCHER_Prop_pib 260 /* IMsoBlip* Blip to display */
+#define ESCHER_Prop_pibName 261 /* WCHAR* Blip file name */
+#define ESCHER_Prop_pibFlags 262 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_pictureTransparent 263 /* LONG transparent color (none if ~0UL) */
+#define ESCHER_Prop_pictureContrast 264 /* LONG contrast setting */
+#define ESCHER_Prop_pictureBrightness 265 /* LONG brightness setting */
+#define ESCHER_Prop_pictureGamma 266 /* LONG 16.16 gamma */
+#define ESCHER_Prop_pictureId 267 /* LONG Host-defined ID for OLE objects (usually a pointer) */
+#define ESCHER_Prop_pictureDblCrMod 268 /* MSOCLR Modification used if shape has double shadow */
+#define ESCHER_Prop_pictureFillCrMod 269 /* MSOCLR */
+#define ESCHER_Prop_pictureLineCrMod 270 /* MSOCLR */
+#define ESCHER_Prop_pibPrint 271 /* IMsoBlip* Blip to display when printing */
+#define ESCHER_Prop_pibPrintName 272 /* WCHAR* Blip file name */
+#define ESCHER_Prop_pibPrintFlags 273 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_fNoHitTestPicture 316 /* sal_Bool Do not hit test the picture */
+#define ESCHER_Prop_pictureGray 317 /* sal_Bool grayscale display */
+#define ESCHER_Prop_pictureBiLevel 318 /* sal_Bool bi-level display */
+#define ESCHER_Prop_pictureActive 319 /* sal_Bool Server is active (OLE objects only) */
+// Geometry
+#define ESCHER_Prop_geoLeft 320 /* LONG Defines the G (geometry) coordinate space. */
+#define ESCHER_Prop_geoTop 321 /* LONG */
+#define ESCHER_Prop_geoRight 322 /* LONG */
+#define ESCHER_Prop_geoBottom 323 /* LONG */
+#define ESCHER_Prop_shapePath 324 /* MSOSHAPEPATH */
+#define ESCHER_Prop_pVertices 325 /* IMsoArray An array of points, in G units. */
+#define ESCHER_Prop_pSegmentInfo 326 /* IMsoArray */
+#define ESCHER_Prop_adjustValue 327 /* LONG Adjustment values corresponding to */
+#define ESCHER_Prop_adjust2Value 328 /* LONG the positions of the adjust handles */
+#define ESCHER_Prop_adjust3Value 329 /* LONG of the shape. The number of values */
+#define ESCHER_Prop_adjust4Value 330 /* LONG used and their allowable ranges vary */
+#define ESCHER_Prop_adjust5Value 331 /* LONG from shape type to shape type. */
+#define ESCHER_Prop_adjust6Value 332 /* LONG */
+#define ESCHER_Prop_adjust7Value 333 /* LONG */
+#define ESCHER_Prop_adjust8Value 334 /* LONG */
+#define ESCHER_Prop_adjust9Value 335 /* LONG */
+#define ESCHER_Prop_adjust10Value 336 /* LONG */
+#define ESCHER_Prop_fShadowOK 378 /* sal_Bool Shadow may be set */
+#define ESCHER_Prop_f3DOK 379 /* sal_Bool 3D may be set */
+#define ESCHER_Prop_fLineOK 380 /* sal_Bool Line style may be set */
+#define ESCHER_Prop_fGtextOK 381 /* sal_Bool Text effect (FontWork) supported */
+#define ESCHER_Prop_fFillShadeShapeOK 382 /* sal_Bool */
+#define ESCHER_Prop_fFillOK 383 /* sal_Bool OK to fill the shape through the UI or VBA? */
+// FillStyle
+#define ESCHER_Prop_fillType 384 /* ESCHER_FillStyle Type of fill */
+#define ESCHER_Prop_fillColor 385 /* MSOCLR Foreground color */
+#define ESCHER_Prop_fillOpacity 386 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_fillBackColor 387 /* MSOCLR Background color */
+#define ESCHER_Prop_fillBackOpacity 388 /* LONG Shades only */
+#define ESCHER_Prop_fillCrMod 389 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_fillBlip 390 /* IMsoBlip* Pattern/texture */
+#define ESCHER_Prop_fillBlipName 391 /* WCHAR* Blip file name */
+#define ESCHER_Prop_fillBlipFlags 392 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_fillWidth 393 /* LONG How big (A units) to make a metafile texture. */
+#define ESCHER_Prop_fillHeight 394 /* LONG */
+#define ESCHER_Prop_fillAngle 395 /* LONG Fade angle - degrees in 16.16 */
+#define ESCHER_Prop_fillFocus 396 /* LONG Linear shaded fill focus percent */
+#define ESCHER_Prop_fillToLeft 397 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToTop 398 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToRight 399 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillToBottom 400 /* LONG Fraction 16.16 */
+#define ESCHER_Prop_fillRectLeft 401 /* LONG For shaded fills, use the specified rectangle */
+#define ESCHER_Prop_fillRectTop 402 /* LONG instead of the shape's bounding rect to */
+#define ESCHER_Prop_fillRectRight 403 /* LONG define how large the fade is going to be. */
+#define ESCHER_Prop_fillRectBottom 404 /* LONG */
+#define ESCHER_Prop_fillDztype 405 /* MSODZTYPE */
+#define ESCHER_Prop_fillShadePreset 406 /* LONG Special shades */
+#define ESCHER_Prop_fillShadeColors 407 /* IMsoArray a preset array of colors */
+#define ESCHER_Prop_fillOriginX 408 /* LONG */
+#define ESCHER_Prop_fillOriginY 409 /* LONG */
+#define ESCHER_Prop_fillShapeOriginX 410 /* LONG */
+#define ESCHER_Prop_fillShapeOriginY 411 /* LONG */
+#define ESCHER_Prop_fillShadeType 412 /* MSOSHADETYPE Type of shading, if a shaded (gradient) fill. */
+#define ESCHER_Prop_fFilled 443 /* sal_Bool Is shape filled? */
+#define ESCHER_Prop_fHitTestFill 444 /* sal_Bool Should we hit test fill? */
+#define ESCHER_Prop_fillShape 445 /* sal_Bool Register pattern on shape */
+#define ESCHER_Prop_fillUseRect 446 /* sal_Bool Use the large rect? */
+#define ESCHER_Prop_fNoFillHitTest 447 /* sal_Bool Hit test a shape as though filled */
+// LineStyle
+#define ESCHER_Prop_lineColor 448 /* MSOCLR Color of line */
+#define ESCHER_Prop_lineOpacity 449 /* LONG Not implemented */
+#define ESCHER_Prop_lineBackColor 450 /* MSOCLR Background color */
+#define ESCHER_Prop_lineCrMod 451 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_lineType 452 /* MSOLINETYPE Type of line */
+#define ESCHER_Prop_lineFillBlip 453 /* IMsoBlip* Pattern/texture */
+#define ESCHER_Prop_lineFillBlipName 454 /* WCHAR* Blip file name */
+#define ESCHER_Prop_lineFillBlipFlags 455 /* MSOBLIPFLAGS Blip flags */
+#define ESCHER_Prop_lineFillWidth 456 /* LONG How big (A units) to make */
+#define ESCHER_Prop_lineFillHeight 457 /* LONG a metafile texture. */
+#define ESCHER_Prop_lineFillDztype 458 /* MSODZTYPE How to interpret fillWidth/Height numbers. */
+#define ESCHER_Prop_lineWidth 459 /* LONG A units; 1pt == 12700 EMUs */
+#define ESCHER_Prop_lineMiterLimit 460 /* LONG ratio (16.16) of width */
+#define ESCHER_Prop_lineStyle 461 /* MSOLINESTYLE Draw parallel lines? */
+#define ESCHER_Prop_lineDashing 462 /* MSOLINEDASHING Can be overridden by: */
+#define ESCHER_Prop_lineDashStyle 463 /* IMsoArray As Win32 ExtCreatePen */
+#define ESCHER_Prop_lineStartArrowhead 464 /* MSOLINEEND Arrow at start */
+#define ESCHER_Prop_lineEndArrowhead 465 /* MSOLINEEND Arrow at end */
+#define ESCHER_Prop_lineStartArrowWidth 466 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineStartArrowLength 467 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineEndArrowWidth 468 /* MSOLINEENDWIDTH Arrow at start */
+#define ESCHER_Prop_lineEndArrowLength 469 /* MSOLINEENDLENGTH Arrow at end */
+#define ESCHER_Prop_lineJoinStyle 470 /* MSOLINEJOIN How to join lines */
+#define ESCHER_Prop_lineEndCapStyle 471 /* MSOLINECAP How to end lines */
+#define ESCHER_Prop_fArrowheadsOK 507 /* sal_Bool Allow arrowheads if prop. is set */
+#define ESCHER_Prop_fLine 508 /* sal_Bool Any line? */
+#define ESCHER_Prop_fHitTestLine 509 /* sal_Bool Should we hit test lines? */
+#define ESCHER_Prop_lineFillShape 510 /* sal_Bool Register pattern on shape */
+#define ESCHER_Prop_fNoLineDrawDash 511 /* sal_Bool Draw a dashed line if no line */
+// ShadowStyle
+#define ESCHER_Prop_shadowType 512 /* MSOSHADOWTYPE Type of effect */
+#define ESCHER_Prop_shadowColor 513 /* MSOCLR Foreground color */
+#define ESCHER_Prop_shadowHighlight 514 /* MSOCLR Embossed color */
+#define ESCHER_Prop_shadowCrMod 515 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_shadowOpacity 516 /* LONG Fixed 16.16 */
+#define ESCHER_Prop_shadowOffsetX 517 /* LONG Offset shadow */
+#define ESCHER_Prop_shadowOffsetY 518 /* LONG Offset shadow */
+#define ESCHER_Prop_shadowSecondOffsetX 519 /* LONG Double offset shadow */
+#define ESCHER_Prop_shadowSecondOffsetY 520 /* LONG Double offset shadow */
+#define ESCHER_Prop_shadowScaleXToX 521 /* LONG 16.16 */
+#define ESCHER_Prop_shadowScaleYToX 522 /* LONG 16.16 */
+#define ESCHER_Prop_shadowScaleXToY 523 /* LONG 16.16 */
+#define ESCHER_Prop_shadowScaleYToY 524 /* LONG 16.16 */
+#define ESCHER_Prop_shadowPerspectiveX 525 /* LONG 16.16 / weight */
+#define ESCHER_Prop_shadowPerspectiveY 526 /* LONG 16.16 / weight */
+#define ESCHER_Prop_shadowWeight 527 /* LONG scaling factor */
+#define ESCHER_Prop_shadowOriginX 528 /* LONG */
+#define ESCHER_Prop_shadowOriginY 529 /* LONG */
+#define ESCHER_Prop_fShadow 574 /* sal_Bool Any shadow? */
+#define ESCHER_Prop_fshadowObscured 575 /* sal_Bool Excel5-style shadow */
+// PerspectiveStyle
+#define ESCHER_Prop_perspectiveType 576 /* MSOXFORMTYPE Where transform applies */
+#define ESCHER_Prop_perspectiveOffsetX 577 /* LONG The LONG values define a */
+#define ESCHER_Prop_perspectiveOffsetY 578 /* LONG transformation matrix, */
+#define ESCHER_Prop_perspectiveScaleXToX 579 /* LONG effectively, each value */
+#define ESCHER_Prop_perspectiveScaleYToX 580 /* LONG is scaled by the */
+#define ESCHER_Prop_perspectiveScaleXToY 581 /* LONG perspectiveWeight parameter. */
+#define ESCHER_Prop_perspectiveScaleYToY 582 /* LONG */
+#define ESCHER_Prop_perspectivePerspectiveX 583 /* LONG */
+#define ESCHER_Prop_perspectivePerspectiveY 584 /* LONG */
+#define ESCHER_Prop_perspectiveWeight 585 /* LONG Scaling factor */
+#define ESCHER_Prop_perspectiveOriginX 586 /* LONG */
+#define ESCHER_Prop_perspectiveOriginY 587 /* LONG */
+#define ESCHER_Prop_fPerspective 639 /* sal_Bool On/off */
+// 3D Object
+#define ESCHER_Prop_c3DSpecularAmt 640 /* LONG Fixed-point 16.16 */
+#define ESCHER_Prop_c3DDiffuseAmt 641 /* LONG Fixed-point 16.16 */
+#define ESCHER_Prop_c3DShininess 642 /* LONG Default gives OK results */
+#define ESCHER_Prop_c3DEdgeThickness 643 /* LONG Specular edge thickness */
+#define ESCHER_Prop_c3DExtrudeForward 644 /* LONG Distance of extrusion in EMUs */
+#define ESCHER_Prop_c3DExtrudeBackward 645 /* LONG */
+#define ESCHER_Prop_c3DExtrudePlane 646 /* LONG Extrusion direction */
+#define ESCHER_Prop_c3DExtrusionColor 647 /* MSOCLR Basic color of extruded part of shape; the lighting model used will determine the exact shades used when rendering. */
+#define ESCHER_Prop_c3DCrMod 648 /* MSOCLR Modification for BW views */
+#define ESCHER_Prop_f3D 700 /* sal_Bool Does this shape have a 3D effect? */
+#define ESCHER_Prop_fc3DMetallic 701 /* sal_Bool Use metallic specularity? */
+#define ESCHER_Prop_fc3DUseExtrusionColor 702 /* sal_Bool */
+#define ESCHER_Prop_fc3DLightFace 703 /* sal_Bool */
+// 3D Style
+#define ESCHER_Prop_c3DYRotationAngle 704 /* LONG degrees (16.16) about y axis */
+#define ESCHER_Prop_c3DXRotationAngle 705 /* LONG degrees (16.16) about x axis */
+#define ESCHER_Prop_c3DRotationAxisX 706 /* LONG These specify the rotation axis; */
+#define ESCHER_Prop_c3DRotationAxisY 707 /* LONG only their relative magnitudes */
+#define ESCHER_Prop_c3DRotationAxisZ 708 /* LONG matter. */
+#define ESCHER_Prop_c3DRotationAngle 709 /* LONG degrees (16.16) about axis */
+#define ESCHER_Prop_c3DRotationCenterX 710 /* LONG rotation center x (16.16 or g-units) */
+#define ESCHER_Prop_c3DRotationCenterY 711 /* LONG rotation center y (16.16 or g-units) */
+#define ESCHER_Prop_c3DRotationCenterZ 712 /* LONG rotation center z (absolute (emus)) */
+#define ESCHER_Prop_c3DRenderMode 713 /* MSO3DRENDERMODE Full,wireframe, or bcube */
+#define ESCHER_Prop_c3DTolerance 714 /* LONG pixels (16.16) */
+#define ESCHER_Prop_c3DXViewpoint 715 /* LONG X view point (emus) */
+#define ESCHER_Prop_c3DYViewpoint 716 /* LONG Y view point (emus) */
+#define ESCHER_Prop_c3DZViewpoint 717 /* LONG Z view distance (emus) */
+#define ESCHER_Prop_c3DOriginX 718 /* LONG */
+#define ESCHER_Prop_c3DOriginY 719 /* LONG */
+#define ESCHER_Prop_c3DSkewAngle 720 /* LONG degree (16.16) skew angle */
+#define ESCHER_Prop_c3DSkewAmount 721 /* LONG Percentage skew amount */
+#define ESCHER_Prop_c3DAmbientIntensity 722 /* LONG Fixed point intensity */
+#define ESCHER_Prop_c3DKeyX 723 /* LONG Key light source direc- */
+#define ESCHER_Prop_c3DKeyY 724 /* LONG tion; only their relative */
+#define ESCHER_Prop_c3DKeyZ 725 /* LONG magnitudes matter */
+#define ESCHER_Prop_c3DKeyIntensity 726 /* LONG Fixed point intensity */
+#define ESCHER_Prop_c3DFillX 727 /* LONG Fill light source direc- */
+#define ESCHER_Prop_c3DFillY 728 /* LONG tion; only their relative */
+#define ESCHER_Prop_c3DFillZ 729 /* LONG magnitudes matter */
+#define ESCHER_Prop_c3DFillIntensity 730 /* LONG Fixed point intensity */
+#define ESCHER_Prop_fc3DConstrainRotation 763 /* sal_Bool */
+#define ESCHER_Prop_fc3DRotationCenterAuto 764 /* sal_Bool */
+#define ESCHER_Prop_fc3DParallel 765 /* sal_Bool Parallel projection? */
+#define ESCHER_Prop_fc3DKeyHarsh 766 /* sal_Bool Is key lighting harsh? */
+#define ESCHER_Prop_fc3DFillHarsh 767 /* sal_Bool Is fill lighting harsh? */
+// Shape
+#define ESCHER_Prop_hspMaster 769 /* MSOHSP master shape */
+#define ESCHER_Prop_cxstyle 771 /* MSOCXSTYLE Type of connector */
+#define ESCHER_Prop_bWMode 772 /* ESCHERwMode Settings for modifications to */
+#define ESCHER_Prop_bWModePureBW 773 /* ESCHERwMode be made when in different */
+#define ESCHER_Prop_bWModeBW 774 /* ESCHERwMode forms of black-and-white mode. */
+#define ESCHER_Prop_fOleIcon 826 /* sal_Bool For OLE objects, whether the object is in icon form */
+#define ESCHER_Prop_fPreferRelativeResize 827 /* sal_Bool For UI only. Prefer relative resizing. */
+#define ESCHER_Prop_fLockShapeType 828 /* sal_Bool Lock the shape type (don't allow Change Shape) */
+#define ESCHER_Prop_fDeleteAttachedObject 830 /* sal_Bool */
+#define ESCHER_Prop_fBackground 831 /* sal_Bool If sal_True, this is the background shape. */
+// Callout
+#define ESCHER_Prop_spcot 832 /* MSOSPCOT Callout type */
+#define ESCHER_Prop_dxyCalloutGap 833 /* LONG Distance from box to first point.(EMUs) */
+#define ESCHER_Prop_spcoa 834 /* MSOSPCOA Callout angle */
+#define ESCHER_Prop_spcod 835 /* MSOSPCOD Callout drop type */
+#define ESCHER_Prop_dxyCalloutDropSpecified 836 /* LONG if msospcodSpecified, the actual drop distance */
+#define ESCHER_Prop_dxyCalloutLengthSpecified 837 /* LONG if fCalloutLengthSpecified, the actual distance */
+#define ESCHER_Prop_fCallout 889 /* sal_Bool Is the shape a callout? */
+#define ESCHER_Prop_fCalloutAccentBar 890 /* sal_Bool does callout have accent bar */
+#define ESCHER_Prop_fCalloutTextBorder 891 /* sal_Bool does callout have a text border */
+#define ESCHER_Prop_fCalloutMinusX 892 /* sal_Bool */
+#define ESCHER_Prop_fCalloutMinusY 893 /* sal_Bool */
+#define ESCHER_Prop_fCalloutDropAuto 894 /* sal_Bool If true, then we occasionally invert the drop distance */
+#define ESCHER_Prop_fCalloutLengthSpecified 895 /* sal_Bool if true, we look at dxyCalloutLengthSpecified */
+// GroupShape
+#define ESCHER_Prop_wzName 896 /* WCHAR* Shape Name (present only if explicitly set) */
+#define ESCHER_Prop_wzDescription 897 /* WCHAR* alternate text */
+#define ESCHER_Prop_pihlShape 898 /* IHlink* The hyperlink in the shape. */
+#define ESCHER_Prop_pWrapPolygonVertices 899 /* IMsoArray The polygon that text will be wrapped around (Word) */
+#define ESCHER_Prop_dxWrapDistLeft 900 /* LONG Left wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistTop 901 /* LONG Top wrapping distance from text (Word) */
+#define ESCHER_Prop_dxWrapDistRight 902 /* LONG Right wrapping distance from text (Word) */
+#define ESCHER_Prop_dyWrapDistBottom 903 /* LONG Bottom wrapping distance from text (Word) */
+#define ESCHER_Prop_lidRegroup 904 /* LONG Regroup ID */
+#define ESCHER_Prop_tableProperties 927
+#define ESCHER_Prop_tableRowProperties 928
+#define ESCHER_Prop_fEditedWrap 953 /* sal_Bool Has the wrap polygon been edited? */
+#define ESCHER_Prop_fBehindDocument 954 /* sal_Bool Word-only (shape is behind text) */
+#define ESCHER_Prop_fOnDblClickNotify 955 /* sal_Bool Notify client on a double click */
+#define ESCHER_Prop_fIsButton 956 /* sal_Bool A button shape (i.e., clicking performs an action). Set for shapes with attached hyperlinks or macros. */
+#define ESCHER_Prop_fOneD 957 /* sal_Bool 1D adjustment */
+#define ESCHER_Prop_fHidden 958 /* sal_Bool Do not display */
+#define ESCHER_Prop_fPrint 959 /* sal_Bool Print this shape */
+
+#define ESCHER_PERSISTENTRY_PREALLOCATE 64
+
+#define ESCHER_Persist_PrivateEntry 0x80000000
+#define ESCHER_Persist_Dgg 0x00010000
+#define ESCHER_Persist_Dg 0x00020000
+#define ESCHER_Persist_CurrentPosition 0x00040000
+#define ESCHER_Persist_Grouping_Snap 0x00050000
+#define ESCHER_Persist_Grouping_Logic 0x00060000
+
+const sal_uInt32 DFF_DGG_CLUSTER_SIZE = 0x00000400; /// Shape IDs per cluster in DGG atom.
+
+// ---------------------------------------------------------------------------------------------
+
+namespace com { namespace sun { namespace star {
+ namespace awt {
+ struct Gradient;
+ }
+ namespace drawing {
+ struct EnhancedCustomShapeAdjustmentValue;
+ class XShape;
+ class XShapes;
+ }
+}}}
+
+struct MSFILTER_DLLPUBLIC EscherConnectorListEntry
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnector;
+ ::com::sun::star::awt::Point maPointA;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToA;
+ ::com::sun::star::awt::Point maPointB;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mXConnectToB;
+
+ sal_uInt32 GetConnectorRule( sal_Bool bFirst );
+
+ EscherConnectorListEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rC,
+ const ::com::sun::star::awt::Point& rPA,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSA ,
+ const ::com::sun::star::awt::Point& rPB,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rSB ) :
+ mXConnector ( rC ),
+ maPointA ( rPA ),
+ mXConnectToA( rSA ),
+ maPointB ( rPB ),
+ mXConnectToB( rSB ) {}
+
+ sal_uInt32 GetClosestPoint( const Polygon& rPoly, const ::com::sun::star::awt::Point& rP );
+};
+
+struct MSFILTER_DLLPUBLIC EscherExContainer
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExContainer( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0 );
+ ~EscherExContainer();
+};
+
+struct MSFILTER_DLLPUBLIC EscherExAtom
+{
+ sal_uInt32 nContPos;
+ SvStream& rStrm;
+
+ EscherExAtom( SvStream& rSt, const sal_uInt16 nRecType, const sal_uInt16 nInstance = 0, const sal_uInt8 nVersion = 0 );
+ ~EscherExAtom();
+};
+
+struct EscherPropertyValueHelper
+{
+ static sal_Bool GetPropertyValue(
+ ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ const OUString& rPropertyName,
+ sal_Bool bTestPropertyAvailability = sal_False
+ );
+
+ static ::com::sun::star::beans::PropertyState GetPropertyState(
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > &,
+ const OUString& rPropertyName
+ );
+};
+
+// ---------------------------------------------------------------------------------------------
+
+struct EscherPersistEntry
+{
+ sal_uInt32 mnID;
+ sal_uInt32 mnOffset;
+
+ EscherPersistEntry( sal_uInt32 nId, sal_uInt32 nOffset ) { mnID = nId; mnOffset = nOffset; };
+
+};
+
+// ---------------------------------------------------------------------------------------------
+
+class EscherBlibEntry
+{
+
+ friend class EscherGraphicProvider;
+ friend class EscherEx;
+
+protected:
+
+ sal_uInt32 mnIdentifier[ 4 ];
+ sal_uInt32 mnPictureOffset; // offset to the graphic im PictureStreams
+ sal_uInt32 mnSize; // size of real graphic
+
+ sal_uInt32 mnRefCount; // !! reference count
+ sal_uInt32 mnSizeExtra; // !! size of preceding header
+
+ ESCHER_BlibType meBlibType;
+
+ Size maPrefSize;
+ MapMode maPrefMapMode;
+
+ sal_Bool mbIsEmpty;
+ sal_Bool mbIsNativeGraphicPossible;
+
+public:
+
+ EscherBlibEntry(
+ sal_uInt32 nPictureOffset,
+ const GraphicObject& rObj,
+ const OString& rId,
+ const GraphicAttr* pAttr = NULL
+ );
+
+ ~EscherBlibEntry();
+
+ void WriteBlibEntry( SvStream& rSt, sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0 );
+ sal_Bool IsEmpty() const { return mbIsEmpty; };
+
+ sal_Bool operator==( const EscherBlibEntry& ) const;
+};
+
+// ---------------------------------------------------------------------------------------------
+
+#define _E_GRAPH_PROV_USE_INSTANCES 1
+#define _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES 2
+
+class MSFILTER_DLLPUBLIC EscherGraphicProvider
+{
+ sal_uInt32 mnFlags;
+
+ EscherBlibEntry** mpBlibEntrys;
+ sal_uInt32 mnBlibBufSize;
+ sal_uInt32 mnBlibEntrys;
+
+ OUString maBaseURI;
+
+protected:
+
+ sal_uInt32 ImplInsertBlib( EscherBlibEntry* p_EscherBlibEntry );
+
+public:
+
+ sal_uInt32 GetBlibStoreContainerSize( SvStream* pMergePicStreamBSE = NULL ) const;
+ void WriteBlibStoreContainer( SvStream& rStrm, SvStream* pMergePicStreamBSE = NULL );
+ sal_Bool WriteBlibStoreEntry(SvStream& rStrm, sal_uInt32 nBlipId,
+ sal_Bool bWritePictureOffset, sal_uInt32 nResize = 0);
+ sal_uInt32 GetBlibID(
+ SvStream& rPicOutStream,
+ const OString& rGraphicId,
+ const Rectangle& rBoundRect,
+ const com::sun::star::awt::Rectangle* pVisArea = NULL,
+ const GraphicAttr* pGrafikAttr = NULL
+ );
+ sal_Bool HasGraphics() const { return mnBlibEntrys != 0; };
+
+ void SetNewBlipStreamOffset( sal_Int32 nOffset );
+
+ sal_Bool GetPrefSize( const sal_uInt32 nBlibId, Size& rSize, MapMode& rMapMode );
+
+ void SetBaseURI( const OUString& rBaseURI ) { maBaseURI = rBaseURI; };
+ const OUString& GetBaseURI() { return maBaseURI; };
+
+ EscherGraphicProvider( sal_uInt32 nFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
+ ~EscherGraphicProvider();
+
+};
+
+struct EscherShapeListEntry;
+typedef ::std::vector< EscherShapeListEntry* > EscherShapeList_impl;
+typedef ::std::vector< EscherConnectorListEntry* > EscherConnectorList_impl;
+
+class MSFILTER_DLLPUBLIC EscherSolverContainer
+{
+ EscherShapeList_impl maShapeList;
+ EscherConnectorList_impl maConnectorList;
+
+public:
+
+ sal_uInt32 GetShapeId(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rShape
+ ) const;
+
+ void AddShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
+ sal_uInt32 nId
+ );
+
+ void AddConnector(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
+ const ::com::sun::star::awt::Point& rA,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &,
+ const ::com::sun::star::awt::Point& rB,
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rConB
+ );
+
+ void WriteSolver( SvStream& );
+
+ EscherSolverContainer(){};
+ ~EscherSolverContainer();
+};
+
+// ---------------------------------------------------------------------------------------------
+
+#define ESCHER_CREATEPOLYGON_LINE 1
+#define ESCHER_CREATEPOLYGON_POLYLINE 2
+#define ESCHER_CREATEPOLYGON_POLYPOLYGON 4
+
+class GraphicAttr;
+class SdrObjCustomShape;
+
+struct EscherPropSortStruct
+{
+ sal_uInt8* pBuf;
+ sal_uInt32 nPropSize;
+ sal_uInt32 nPropValue;
+ sal_uInt16 nPropId;
+};
+
+typedef std::vector< EscherPropSortStruct > EscherProperties;
+
+class MSFILTER_DLLPUBLIC EscherPropertyContainer
+{
+ EscherGraphicProvider* pGraphicProvider;
+ SvStream* pPicOutStrm;
+ Rectangle* pShapeBoundRect;
+
+ EscherPropSortStruct* pSortStruct;
+
+ sal_uInt32 nSortCount;
+ sal_uInt32 nSortBufSize;
+ sal_uInt32 nCountCount;
+ sal_uInt32 nCountSize;
+
+ sal_Bool bHasComplexData;
+ sal_Bool bSuppressRotation;
+
+
+ sal_uInt32 ImplGetColor( const sal_uInt32 rColor, sal_Bool bSwap = sal_True );
+ void ImplCreateGraphicAttributes(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nBlibId,
+ sal_Bool bCreateCroppingAttributes
+ );
+ sal_Bool ImplCreateEmbeddedBmp( const OString& rUniqueId );
+ void ImplInit();
+
+public:
+
+ EscherPropertyContainer();
+ EscherPropertyContainer(
+ EscherGraphicProvider& rGraphicProvider, // the PropertyContainer needs to know
+ SvStream* pPicOutStrm, // the GraphicProvider to be able to write
+ Rectangle& rShapeBoundRect // FillBitmaps or GraphicObjects.
+ ); // under some circumstances the ShapeBoundRect
+ // is adjusted this will happen when rotated
+ // GraphicObjects are saved to PowerPoint
+ ~EscherPropertyContainer();
+
+ void AddOpt( sal_uInt16 nPropertyID, const OUString& rString );
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ sal_uInt32 nPropValue,
+ sal_Bool bBlib = sal_False
+ );
+
+ void AddOpt(
+ sal_uInt16 nPropertyID,
+ sal_Bool bBlib,
+ sal_uInt32 nPropValue,
+ sal_uInt8* pProp,
+ sal_uInt32 nPropSize
+ );
+
+ sal_Bool GetOpt( sal_uInt16 nPropertyID, sal_uInt32& rPropValue ) const;
+
+ sal_Bool GetOpt( sal_uInt16 nPropertyID, EscherPropSortStruct& rPropValue ) const;
+
+ EscherProperties GetOpts() const;
+
+ void Commit( SvStream& rSt, sal_uInt16 nVersion = 3, sal_uInt16 nRecType = ESCHER_OPT );
+
+ sal_Bool CreateShapeProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
+ );
+ sal_Bool CreateOLEGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXOleObject
+ );
+
+ /** Creates a complex ESCHER_Prop_fillBlip containing the BLIP directly (for Excel charts). */
+ sal_Bool CreateEmbeddedBitmapProperties(
+ const OUString& rBitmapUrl,
+ ::com::sun::star::drawing::BitmapMode eBitmapMode
+ );
+ /** Creates a complex ESCHER_Prop_fillBlip containing a hatch style (for Excel charts). */
+ sal_Bool CreateEmbeddedHatchProperties(
+ const ::com::sun::star::drawing::Hatch& rHatch,
+ const Color& rBackColor,
+ bool bFillBackground
+ );
+
+ // the GraphicProperties will only be created if a GraphicProvider and PicOutStrm is known
+ // DR: #99897# if no GraphicProvider is present, a complex ESCHER_Prop_fillBlip
+ // will be created, containing the BLIP directly (e.g. for Excel charts).
+ sal_Bool CreateGraphicProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const OUString& rSource,
+ const sal_Bool bCreateFillBitmap,
+ const sal_Bool bCreateCroppingAttributes = sal_False,
+ const sal_Bool bFillBitmapModeAllowed = sal_True
+ );
+
+ sal_Bool CreatePolygonProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ sal_uInt32 nFlags,
+ sal_Bool bBezier,
+ ::com::sun::star::awt::Rectangle& rGeoRect,
+ Polygon* pPolygon = NULL
+ );
+
+ static sal_uInt32 GetGradientColor(
+ const ::com::sun::star::awt::Gradient* pGradient,
+ sal_uInt32 nStartColor
+ );
+
+ void CreateGradientProperties( const ::com::sun::star::awt::Gradient & rGradient );
+ void CreateGradientProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
+ );
+ void CreateLineProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_Bool bEdge
+ );
+ void CreateFillProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &, sal_Bool bEdge );
+ void CreateTextProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &,
+ sal_uInt32 nText,
+ const sal_Bool bIsCustomShape = sal_False,
+ const sal_Bool bIsTextFrame = sal_True
+ );
+
+ sal_Bool CreateConnectorProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ EscherSolverContainer& rSolver,
+ ::com::sun::star::awt::Rectangle& rGeoRect,
+ sal_uInt16& rShapeType,
+ sal_uInt16& rShapeFlags
+ );
+
+ // Because shadow properties depends to the line and fillstyle, the CreateShadowProperties method should be called at last.
+ // It activ only when at least a FillStyle or LineStyle is set.
+ sal_Bool CreateShadowProperties(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > &
+ );
+
+ // creates all necessary CustomShape properties, this includes also Text-, Shadow-, Fill-, and LineProperties
+ void CreateCustomShapeProperties(
+ const MSO_SPT eShapeType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
+ );
+ sal_Bool IsFontWork() const;
+
+ // helper functions which are also used by the escher import
+ static PolyPolygon GetPolyPolygon(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape
+ );
+ static PolyPolygon GetPolyPolygon( const ::com::sun::star::uno::Any& rSource );
+ static MSO_SPT GetCustomShapeType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ sal_uInt32& nMirrorFlags
+ );
+ static MSO_SPT GetCustomShapeType(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & rXShape,
+ sal_uInt32& nMirrorFlags,
+ OUString& rShapeType
+ );
+
+ // helper functions which are also used in ooxml export
+ static sal_Bool GetLineArrow(
+ const sal_Bool bLineStart,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ ESCHER_LineEnd& reLineEnd,
+ sal_Int32& rnArrowLength,
+ sal_Int32& rnArrowWidth
+ );
+ static sal_Bool IsDefaultObject( SdrObjCustomShape* pCustoShape );
+ static void LookForPolarHandles(
+ const MSO_SPT eShapeType,
+ sal_Int32& nAdjustmentsWhichNeedsToBeConverted
+ );
+ static sal_Bool GetAdjustmentValue( const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue & rkProp, sal_Int32 nIndex, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, sal_Int32& nValue );
+};
+
+// ---------------------------------------------------------------------------------------------
+
+typedef ::std::vector< EscherPersistEntry* > EscherPersistTable_impl;
+
+class MSFILTER_DLLPUBLIC EscherPersistTable
+{
+
+public:
+ EscherPersistTable_impl maPersistTable;
+
+ sal_Bool PtIsID( sal_uInt32 nID );
+ void PtInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtDelete( sal_uInt32 nID );
+ sal_uInt32 PtGetOffsetByID( sal_uInt32 nID );
+ sal_uInt32 PtReplace( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs );
+ sal_uInt32 PtGetCount() const { return maPersistTable.size(); };
+
+ EscherPersistTable();
+ virtual ~EscherPersistTable();
+};
+
+// ---------------------------------------------------------------------------------------------
+
+class EscherEx;
+
+/// abstract base class for ESCHER_ClientTextbox, ESCHER_ClientData
+class MSFILTER_DLLPUBLIC EscherExClientRecord_Base
+{
+public:
+ EscherExClientRecord_Base() {}
+ virtual ~EscherExClientRecord_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx ) const = 0;
+};
+
+
+/// abstract base class for ESCHER_ClientAnchor
+class MSFILTER_DLLPUBLIC EscherExClientAnchor_Base
+{
+public:
+ EscherExClientAnchor_Base() {}
+ virtual ~EscherExClientAnchor_Base();
+
+ /// Application writes the record header
+ /// using rEx.AddAtom(...) followed by
+ /// record data written to rEx.GetStream()
+ virtual void WriteData( EscherEx& rEx,
+ const Rectangle& rRect ) = 0;
+};
+
+class InteractionInfo
+{
+ bool mbHasInteraction;
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ std::auto_ptr<SvMemoryStream> mpHyperlinkRecord;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ InteractionInfo();
+
+public:
+ InteractionInfo( SvMemoryStream* pStream, bool bInteraction ) : mbHasInteraction( bInteraction )
+ {
+ mpHyperlinkRecord.reset( pStream );
+ }
+ bool hasInteraction() { return mbHasInteraction; }
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ const std::auto_ptr< SvMemoryStream >& getHyperlinkRecord() { return mpHyperlinkRecord; }
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+};
+
+class EscherExHostAppData
+{
+private:
+ EscherExClientAnchor_Base* pClientAnchor;
+ EscherExClientRecord_Base* pClientData;
+ EscherExClientRecord_Base* pClientTextbox;
+ InteractionInfo* pInteractionInfo;
+ // ignore single shape if entire pages are written
+ sal_Bool bDontWriteShape;
+
+public:
+ EscherExHostAppData() : pClientAnchor(0), pClientData(0),
+ pClientTextbox(0), pInteractionInfo(0), bDontWriteShape(sal_False)
+ {}
+
+ void SetInteractionInfo( InteractionInfo* p )
+ { pInteractionInfo = p; }
+ void SetClientAnchor( EscherExClientAnchor_Base* p )
+ { pClientAnchor = p; }
+ void SetClientData( EscherExClientRecord_Base* p )
+ { pClientData = p; }
+ void SetClientTextbox( EscherExClientRecord_Base* p )
+ { pClientTextbox = p; }
+ void SetDontWriteShape( sal_Bool b )
+ { bDontWriteShape = b; }
+ InteractionInfo* GetInteractionInfo() const
+ { return pInteractionInfo; }
+ EscherExClientAnchor_Base* GetClientAnchor() const
+ { return pClientAnchor; }
+ EscherExClientRecord_Base* GetClientData() const
+ { return pClientData; }
+ EscherExClientRecord_Base* GetClientTextbox() const
+ { return pClientTextbox; }
+
+ void WriteClientAnchor( EscherEx& rEx, const Rectangle& rRect )
+ { if( pClientAnchor ) pClientAnchor->WriteData( rEx, rRect ); }
+ void WriteClientData( EscherEx& rEx )
+ { if( pClientData ) pClientData->WriteData( rEx ); }
+ void WriteClientTextbox( EscherEx& rEx )
+ { if( pClientTextbox ) pClientTextbox->WriteData( rEx ); }
+
+ sal_Bool DontWriteShape() const { return bDontWriteShape; }
+};
+
+
+// ============================================================================
+
+/** Instance for global DFF data, shared through various instances of EscherEx. */
+class MSFILTER_DLLPUBLIC EscherExGlobal : public EscherGraphicProvider
+{
+public:
+ explicit EscherExGlobal( sal_uInt32 nGraphicProvFlags = _E_GRAPH_PROV_DO_NOT_ROTATE_METAFILES );
+ virtual ~EscherExGlobal();
+
+ /** Returns a new drawing ID for a new drawing container (DGCONTAINER). */
+ sal_uInt32 GenerateDrawingId();
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table.
+ @param nDrawingId Drawing identifier has to be passed to be able to
+ generate shape identifiers for multiple drawings simultaniously. */
+ sal_uInt32 GenerateShapeId( sal_uInt32 nDrawingId, bool bIsInSpgr );
+ /** Returns the number of shapes in the current drawing, based on number of
+ calls to the GenerateShapeId() function. */
+ sal_uInt32 GetDrawingShapeCount( sal_uInt32 nDrawingId ) const;
+ /** Returns the last shape identifier generated by the GenerateShapeId()
+ function. */
+ sal_uInt32 GetLastShapeId( sal_uInt32 nDrawingId ) const;
+
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ inline void SetDggContainer() { mbHasDggCont = true; }
+ /** Sets the flag indicating that the DGGCONTAINER exists. */
+ inline bool HasDggContainer() const { return mbHasDggCont; }
+ /** Returns the total size of the DGG atom (including header). */
+ sal_uInt32 GetDggAtomSize() const;
+ /** Writes the complete DGG atom to the passed stream (overwrites existing data!). */
+ void WriteDggAtom( SvStream& rStrm ) const;
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEscherExSdr.
+
+ On first invokation, this function calls the virtual member function
+ ImplQueryPictureStream(). The return value will be cached internally
+ for subsequent calls and for the GetPictureStream() function.
+ */
+ SvStream* QueryPictureStream();
+
+ /** Returns the picture stream if existing (queried), otherwise null. */
+ inline SvStream* GetPictureStream() { return mpPicStrm; }
+
+private:
+ /** Derived classes may implement to create a new stream used to store the
+ picture data.
+
+ The implementation has to take care about lifetime of the returned
+ stream (it will not be destructed automatically). This function is
+ called exactly once. The return value will be cached internally for
+ repeated calls of the public QueryPictureStream() function.
+ */
+ virtual SvStream* ImplQueryPictureStream();
+
+private:
+ struct ClusterEntry
+ {
+ sal_uInt32 mnDrawingId; /// Identifier of drawing this cluster belongs to (one-based index into maDrawingInfos).
+ sal_uInt32 mnNextShapeId; /// Next free shape identifier in this cluster.
+ inline explicit ClusterEntry( sal_uInt32 nDrawingId ) : mnDrawingId( nDrawingId ), mnNextShapeId( 0 ) {}
+ };
+ typedef ::std::vector< ClusterEntry > ClusterTable;
+
+ struct DrawingInfo
+ {
+ sal_uInt32 mnClusterId; /// Currently used cluster (one-based index into maClusterTable).
+ sal_uInt32 mnShapeCount; /// Current number of shapes in this drawing.
+ sal_uInt32 mnLastShapeId; /// Last shape identifier generated for this drawing.
+ inline explicit DrawingInfo( sal_uInt32 nClusterId ) : mnClusterId( nClusterId ), mnShapeCount( 0 ), mnLastShapeId( 0 ) {}
+ };
+ typedef ::std::vector< DrawingInfo > DrawingInfoVector;
+
+ ClusterTable maClusterTable; /// List with cluster IDs (used object IDs in drawings).
+ DrawingInfoVector maDrawingInfos; /// Data about all used drawings.
+ SvStream* mpPicStrm; /// Cached result of ImplQueryPictureStream().
+ bool mbHasDggCont; /// True = the DGGCONTAINER has been initialized.
+ bool mbPicStrmQueried; /// True = ImplQueryPictureStream() has been called.
+};
+
+typedef ::boost::shared_ptr< EscherExGlobal > EscherExGlobalRef;
+
+// ---------------------------------------------------------------------------------------------
+
+class SdrObject;
+class SdrPage;
+class ImplEscherExSdr;
+
+class MSFILTER_DLLPUBLIC EscherEx : public EscherPersistTable
+{
+ protected:
+ typedef ::std::auto_ptr< ImplEscherExSdr > ImplEscherExSdrPtr;
+
+ EscherExGlobalRef mxGlobal;
+ ImplEscherExSdrPtr mpImplEscherExSdr;
+ SvStream* mpOutStrm;
+ bool mbOwnsStrm;
+ sal_uInt32 mnStrmStartOfs;
+ std::vector< sal_uInt32 > mOffsets;
+ std::vector< sal_uInt16 > mRecTypes;
+
+ sal_uInt32 mnCurrentDg;
+ sal_uInt32 mnCountOfs;
+
+ sal_uInt32 mnGroupLevel;
+ sal_uInt16 mnHellLayerId;
+
+ sal_Bool mbEscherSpgr;
+ sal_Bool mbEscherDg;
+ sal_Bool mbOleEmf; // OLE is EMF instead of WMF
+
+
+ virtual sal_Bool DoSeek( sal_uInt32 nKey );
+
+public:
+ explicit EscherEx( const EscherExGlobalRef& rxGlobal, SvStream* pOutStrm );
+ virtual ~EscherEx();
+
+ /** Creates and returns a new shape identifier, updates the internal shape
+ counters and registers the identifier in the DGG cluster table. */
+ inline sal_uInt32 GenerateShapeId() { return mxGlobal->GenerateShapeId( mnCurrentDg, mbEscherSpgr ); }
+
+ /** Returns the graphic provider from the global object that has been
+ passed to the constructor.
+ */
+ inline EscherGraphicProvider& GetGraphicProvider() { return *mxGlobal; }
+
+ /** Called if a picture shall be written and no picture stream is set at
+ class ImplEscherExSdr.
+ */
+ inline SvStream* QueryPictureStream() { return mxGlobal->QueryPictureStream(); }
+
+ /// Inserts internal data into the EscherStream, this process
+ /// may and has to be executed only once
+ /// If pPicStreamMergeBSE is known, the BLIPs from this stream are being
+ /// merged into the MsofbtBSE Records of the EscherStream like it's
+ /// required for Excel (and maybe Word?)
+ virtual void Flush( SvStream* pPicStreamMergeBSE = NULL );
+
+ /** Inserts the passed number of bytes at the current position of the
+ output stream.
+
+ Inserts dummy bytes and moves all following stream data, and updates
+ all internal stream offsets stored in the PersistTable and the affected
+ container sizes, which makes this operation very expensive. (!)
+
+ @param nBytes The number of bytes to be inserted into the stream.
+
+ @param bExpandEndOfAtom If set to true, an atom that currently ends
+ exactly at the current stream position will be expanded to include
+ the inserted data. If set to false, an atom that currently ends
+ exactly at the current stream position will not be expanded to
+ include the inserted data (used to insert e.g. a new atom after an
+ existing atom). Note that containers that end exactly at the
+ current stream position are always expanded to include the inserted
+ data.
+ */
+ void InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom );
+
+ void InsertPersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset ); // It is not being checked if this key is already in the PersistantTable
+ void ReplacePersistOffset( sal_uInt32 nKey, sal_uInt32 nOffset );
+ sal_uInt32 GetPersistOffset( sal_uInt32 nKey );
+ sal_Bool SeekToPersistOffset( sal_uInt32 nKey );
+ virtual sal_Bool InsertAtPersistOffset( sal_uInt32 nKey, sal_uInt32 nValue ); // nValue is being inserted into the Stream where it's appropriate (overwrite modus), without that the
+ // current StreamPosition changes
+
+ SvStream& GetStream() const { return *mpOutStrm; }
+ sal_uLong GetStreamPos() const { return mpOutStrm->Tell(); }
+
+ // features during the creation of the following Containers:
+ //
+ // ESCHER_DggContainer: a EscherDgg Atom is automatically being created and managed
+ // ESCHER_DgContainer: a EscherDg Atom is automatically being created and managed
+ // ESCHER_SpgrContainer:
+ // ESCHER_SpContainer:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ virtual void BeginAtom();
+ virtual void EndAtom( sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ virtual void AddAtom( sal_uInt32 nAtomSitze, sal_uInt16 nRecType, int nRecVersion = 0, int nRecInstance = 0 );
+ virtual void AddChildAnchor( const Rectangle& rRectangle );
+ virtual void AddClientAnchor( const Rectangle& rRectangle );
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
+ sal_uInt32 EnterGroup( const Rectangle* pBoundRect = NULL );
+ sal_uInt32 GetGroupLevel() const { return mnGroupLevel; };
+ virtual sal_Bool SetGroupSnapRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
+ virtual sal_Bool SetGroupLogicRect( sal_uInt32 nGroupLevel, const Rectangle& rRect );
+ virtual void LeaveGroup();
+
+ // a ESCHER_Sp is being written ( a ESCHER_DgContainer has to be opened for this purpose!)
+ virtual void AddShape( sal_uInt32 nShpInstance, sal_uInt32 nFlagIds, sal_uInt32 nShapeID = 0 );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
+
+ sal_uInt32 GetColor( const sal_uInt32 nColor, sal_Bool bSwap = sal_True );
+ sal_uInt32 GetColor( const Color& rColor, sal_Bool bSwap = sal_True );
+
+ // ...Sdr... implemented in eschesdo.cxx
+
+ void AddSdrPage( const SdrPage& rPage );
+ void AddUnoShapes( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+ /// returns the ShapeID
+ sal_uInt32 AddSdrObject( const SdrObject& rObj );
+
+ /// If objects are written through AddSdrObject the
+ /// SolverContainer has to be written, and maybe some
+ /// maintenance to be done.
+ void EndSdrObjectPage();
+
+ /// Called before a shape is written, application supplies
+ /// ClientRecords. May set AppData::bDontWriteShape so the
+ /// shape is ignored.
+ virtual EscherExHostAppData* StartShape(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rShape,
+ const Rectangle* pChildAnchor );
+
+ /// Called after a shape is written to inform the application
+ /// of the resulted shape type and ID.
+ virtual void EndShape( sal_uInt16 nShapeType, sal_uInt32 nShapeID );
+
+ /// Called before an AdditionalText EnterGroup occurs.
+ /// The current shape will be written in three parts:
+ /// a group shape, the shape itself, and an extra textbox shape.
+ /// The complete flow is:
+ /// StartShape sets HostData1.
+ /// EnterAdditionalTextGroup sets HostData2, App may modify
+ /// HostData1 and keep track of the change.
+ /// The group shape is written with HostData2.
+ /// Another StartShape with the same (!) object sets HostData3.
+ /// The current shape is written with HostData3.
+ /// EndShape is called for the current shape.
+ /// Another StartShape with the same (!) object sets HostData4.
+ /// The textbox shape is written with HostData4.
+ /// EndShape is called for the textbox shape.
+ /// EndShape is called for the group shape, this provides
+ /// the same functionality as an ordinary recursive group.
+ virtual EscherExHostAppData* EnterAdditionalTextGroup();
+
+ /// Called if an ESCHER_Prop_lTxid shall be written
+ virtual sal_uInt32 QueryTextID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&, sal_uInt32 nShapeId );
+ // add an dummy rectangle shape into the escher stream
+ sal_uInt32 AddDummyShape();
+
+ static const SdrObject* GetSdrObject( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape );
+
+ void SetHellLayerId( sal_uInt16 nId ) { mnHellLayerId = nId; }
+ sal_uInt16 GetHellLayerId() const { return mnHellLayerId; }
+
+private:
+ EscherEx( const EscherEx& );
+ EscherEx& operator=( const EscherEx& );
+
+ // prevent C-style cast to former base class EscherGraphicProvider
+ operator EscherGraphicProvider&();
+ operator EscherGraphicProvider const&();
+};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mscodec.hxx b/include/filter/msfilter/mscodec.hxx
new file mode 100644
index 000000000000..f321441e2941
--- /dev/null
+++ b/include/filter/msfilter/mscodec.hxx
@@ -0,0 +1,370 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SVX_MSCODEC_HXX
+#define SVX_MSCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace msfilter {
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Xor95
+{
+public:
+ explicit MSCodec_Xor95(int nRotateDistance);
+ virtual ~MSCodec_Xor95();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void InitKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData();
+
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+ */
+ void InitCipher();
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, sal_Size nBytes )=0;
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ void Skip( sal_Size nBytes );
+
+protected:
+ sal_uInt8 mpnKey[ 16 ]; /// Encryption key.
+ sal_Size mnOffset; /// Key offset.
+
+private:
+ MSFILTER_DLLPRIVATE MSCodec_Xor95( const MSCodec_Xor95& );
+ MSFILTER_DLLPRIVATE MSCodec_Xor95& operator=( const MSCodec_Xor95& );
+
+ sal_uInt16 mnKey; /// Base key from password.
+ sal_uInt16 mnHash; /// Hash value from password.
+ int mnRotateDistance;
+};
+
+/** Encodes and decodes data from protected MSO XLS 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorXLS95 : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorXLS95() : MSCodec_Xor95(2) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, sal_Size nBytes );
+};
+
+/** Encodes and decodes data from protected MSO Word 95- documents.
+ */
+class MSFILTER_DLLPUBLIC MSCodec_XorWord95 : public MSCodec_Xor95
+{
+public:
+ explicit MSCodec_XorWord95() : MSCodec_Xor95(7) {}
+
+ /** Decodes a block of memory inplace.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pnData
+ Encrypted data block. Will contain the decrypted data afterwards.
+ @param nBytes
+ Size of the passed data block.
+ */
+ virtual void Decode( sal_uInt8* pnData, sal_Size nBytes );
+};
+
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class MSFILTER_DLLPUBLIC MSCodec_Std97
+{
+public:
+ explicit MSCodec_Std97();
+ ~MSCodec_Std97();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ sal_Bool InitCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData();
+
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pPassData
+ Wide character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pDocId
+ Unique document identifier read from or written to the file.
+ */
+ void InitKey(
+ const sal_uInt16 pPassData[ 16 ],
+ const sal_uInt8 pDocId[ 16 ] );
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSaltData
+ Salt data block read from the file.
+ @param pSaltDigest
+ Salt digest read from the file.
+
+ @return
+ true = Test was successful.
+ */
+ bool VerifyKey(
+ const sal_uInt8 pSaltData[ 16 ],
+ const sal_uInt8 pSaltDigest[ 16 ] );
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 Bytes for Word files and 1024 Bytes
+ for Excel files.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ bool InitCipher( sal_uInt32 nCounter );
+
+ /** Creates an MD5 digest of salt digest. */
+ bool CreateSaltDigest(
+ const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
+
+ /** Encodes a block of memory.
+
+ @see rtl_cipher_encode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ unencoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Unencrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the encrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Encoding was successful (no error occurred).
+ */
+ bool Encode(
+ const void* pData, sal_Size nDatLen,
+ sal_uInt8* pBuffer, sal_Size nBufLen );
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used. The destination buffer must be able to take all
+ encoded data from the source buffer (usually this means it must be
+ as long as or longer than the source buffer).
+
+ @param pData
+ Encrypted source data block.
+ @param nDatLen
+ Size of the passed source data block.
+ @param pBuffer
+ Destination buffer for the decrypted data.
+ @param nBufLen
+ Size of the destination buffer.
+
+ @return
+ true = Decoding was successful (no error occurred).
+ */
+ bool Decode(
+ const void* pData, sal_Size nDatLen,
+ sal_uInt8* pBuffer, sal_Size nBufLen );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of Decode().
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param nDatLen
+ Number of bytes to be skipped (cipher "seeks" forward).
+ */
+ bool Skip( sal_Size nDatLen );
+
+ /** Gets salt data and salt digest.
+
+ @precond
+ The codec must be initialized with InitKey() before this function
+ can be used.
+
+ @param pSalt
+ Salt, a random number.
+ @param pSaltData
+ Salt data block generated from the salt.
+ @param pSaltDigest
+ Salt digest generated from the salt.
+ */
+ void GetEncryptKey (
+ const sal_uInt8 pSalt[16],
+ sal_uInt8 pSaltData[16],
+ sal_uInt8 pSaltDigest[16]);
+
+ /* allows to get the unique document id from the codec
+ */
+ void GetDocId( sal_uInt8 pDocId[16] );
+
+ void GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] );
+
+private:
+ void InitKeyImpl(
+ const sal_uInt8 pKeyData[64],
+ const sal_uInt8 pDocId[16] );
+
+
+private:
+ MSFILTER_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& );
+ MSFILTER_DLLPRIVATE MSCodec_Std97& operator=( const MSCodec_Std97& );
+
+ rtlCipher m_hCipher;
+ rtlDigest m_hDigest;
+ sal_uInt8 m_pDigestValue[ RTL_DIGEST_LENGTH_MD5 ];
+ sal_uInt8 m_pDocId[16];
+};
+
+// ============================================================================
+
+} // namespace msfilter
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx
new file mode 100644
index 000000000000..6359277f49f4
--- /dev/null
+++ b/include/filter/msfilter/msdffimp.hxx
@@ -0,0 +1,809 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FLT_MSDFFIMP_HXX
+#define FLT_MSDFFIMP_HXX
+
+#include <string.h>
+
+#include <map>
+#include <vector>
+#include <set>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+#include <boost/ptr_container/ptr_set.hpp>
+
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/embed/XEmbeddedObject.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <tools/solar.h>
+#include <tools/color.hxx>
+#include <tools/gen.hxx>
+
+#include <sot/storage.hxx>
+
+#include <vcl/graph.hxx>
+
+#include <svx/msdffdef.hxx>
+#include <filter/msfilter/dffpropset.hxx>
+#include <filter/msfilter/dffrecordheader.hxx>
+
+#include <filter/msfilter/msfilterdllapi.h>
+
+class Graphic;
+class SvStream;
+class SdrObject;
+class SdrOle2Obj;
+class SotStorageRef;
+class Polygon;
+class PolyPolygon;
+class FmFormModel;
+class SdrModel;
+class SwFlyFrmFmt;
+
+struct SvxMSDffBLIPInfo;
+struct SvxMSDffShapeInfo;
+struct SvxMSDffShapeOrder;
+
+class SvxMSDffManager;
+class SfxItemSet;
+class SdrObject;
+class SdrTextObj;
+struct DffObjData;
+
+class MSFILTER_DLLPUBLIC DffPropertyReader : public DffPropSet
+{
+ const SvxMSDffManager& rManager;
+ DffPropSet* pDefaultPropSet;
+
+ void ApplyCustomShapeTextAttributes( SfxItemSet& rSet ) const;
+ void CheckAndCorrectExcelTextRotation( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
+ void ApplyCustomShapeAdjustmentAttributes( SfxItemSet& rSet ) const;
+ void ApplyCustomShapeGeometryAttributes( SvStream& rIn,
+ SfxItemSet& rSet,
+ const DffObjData& rObjData ) const;
+ void ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eShapeType ) const; // #i28269#
+ void ApplyFillAttributes( SvStream& rIn, SfxItemSet& rSet, const DffObjData& rObjData ) const;
+
+public:
+ sal_Int32 mnFix16Angle;
+ explicit DffPropertyReader( const SvxMSDffManager& rManager );
+ ~DffPropertyReader();
+ sal_Int32 Fix16ToAngle( sal_Int32 nAngle ) const;
+
+#ifdef DBG_CUSTOMSHAPE
+ void ReadPropSet( SvStream& rIn, void* pClientData, sal_uInt32 nShapeType = 0 ) const;
+#else
+ void ReadPropSet( SvStream& rIn, void* pClientData ) const;
+#endif
+
+ void SetDefaultPropSet( SvStream& rIn, sal_uInt32 nOffDgg ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet ) const;
+ void ApplyAttributes( SvStream& rIn, SfxItemSet& rSet, DffObjData& rObjData ) const;
+};
+
+#define COL_DEFAULT RGB_COLORDATA( 0xFA, 0xFB, 0xFC )
+
+typedef ::std::map< sal_Int32, SdrObject* > SvxMSDffShapeIdContainer;
+
+#define SVEXT_PERSIST_STREAM "\002OlePres000"
+
+// the following two will be sorted by the order of their appearance:
+typedef boost::ptr_vector<SvxMSDffBLIPInfo> SvxMSDffBLIPInfos;
+class SvxMSDffShapeOrders : public std::vector<SvxMSDffShapeOrder*>
+{
+public:
+ ~SvxMSDffShapeOrders();
+};
+
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoById
+{
+ bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+struct MSFILTER_DLLPUBLIC CompareSvxMSDffShapeInfoByTxBxComp
+{
+ bool operator()(::boost::shared_ptr<SvxMSDffShapeInfo> const& lhs,
+ ::boost::shared_ptr<SvxMSDffShapeInfo> const& rhs) const;
+};
+
+// the following will be sorted explicitly:
+typedef ::std::set< ::boost::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoById > SvxMSDffShapeInfos_ById;
+typedef ::std::multiset< ::boost::shared_ptr<SvxMSDffShapeInfo>,
+ CompareSvxMSDffShapeInfoByTxBxComp> SvxMSDffShapeInfos_ByTxBxComp;
+
+#define SVXMSDFF_SETTINGS_CROP_BITMAPS 1
+#define SVXMSDFF_SETTINGS_IMPORT_PPT 2
+#define SVXMSDFF_SETTINGS_IMPORT_EXCEL 4
+
+#define SP_FGROUP 0x001 ///< This shape is a group shape
+#define SP_FCHILD 0x002 ///< Not a top-level shape
+#define SP_FPATRIARCH 0x004 ///< This is the topmost group shape.
+ ///< Exactly one of these per drawing.
+#define SP_FDELETED 0x008 ///< The shape has been deleted
+#define SP_FOLESHAPE 0x010 ///< The shape is an OLE object
+#define SP_FHAVEMASTER 0x020 ///< Shape has a hspMaster property
+#define SP_FFLIPH 0x040 ///< Shape is flipped horizontally
+#define SP_FFLIPV 0x080 ///< Shape is flipped vertically
+#define SP_FCONNECTOR 0x100 ///< Connector type of shape
+#define SP_FHAVEANCHOR 0x200 ///< Shape has an anchor of some kind
+#define SP_FBACKGROUND 0x400 ///< Background shape
+#define SP_FHAVESPT 0x800 ///< Shape has a shape type property
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this ist stored in
+#define OLE_MATHTYPE_2_STARMATH 0x0001
+#define OLE_WINWORD_2_STARWRITER 0x0002
+#define OLE_EXCEL_2_STARCALC 0x0004
+#define OLE_POWERPOINT_2_STARIMPRESS 0x0008
+
+struct SvxMSDffConnectorRule
+{
+ sal_uInt32 nRuleId;
+ sal_uInt32 nShapeA; ///< SPID of shape A
+ sal_uInt32 nShapeB; ///< SPID of shape B
+ sal_uInt32 nShapeC; ///< SPID of connector shape
+ sal_uInt32 ncptiA; ///< Connection site Index of shape A
+ sal_uInt32 ncptiB; ///< Connection site Index of shape B
+ sal_uInt32 nSpFlagsA; ///< SpFlags of shape A (the original mirror flags
+ ///< must be known when solving the Solver Container)
+ sal_uInt32 nSpFlagsB; ///< SpFlags of shape B
+
+ SdrObject* pAObj; ///< pPtr of object (corresponding to shape A)
+ SdrObject* pBObj; ///< pPtr of object (corresponding to shape B)
+ SdrObject* pCObj; ///< pPtr of connector object
+
+ SvxMSDffConnectorRule() : nSpFlagsA( 0 ), nSpFlagsB( 0 ), pAObj( NULL ),
+ pBObj( NULL ), pCObj( NULL ) {};
+
+ friend SvStream& operator>>( SvStream& rIn, SvxMSDffConnectorRule& rAtom );
+};
+
+typedef ::std::vector< SvxMSDffConnectorRule* > SvxMSDffConnectorRuleList;
+
+struct MSFILTER_DLLPUBLIC SvxMSDffSolverContainer
+{
+ SvxMSDffConnectorRuleList aCList;
+
+ SvxMSDffSolverContainer();
+ ~SvxMSDffSolverContainer();
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, SvxMSDffSolverContainer& rAtom );
+};
+
+struct FIDCL
+{
+ sal_uInt32 dgid; ///< DG owning the SPIDs in this cluster
+ sal_uInt32 cspidCur; ///< number of SPIDs used so far
+};
+
+/// provided by SvxMSDffManager for each shape in a group
+struct MSDffTxId
+{
+ sal_uInt16 nTxBxS;
+ sal_uInt16 nSequence;
+ MSDffTxId( sal_uInt16 nTxBxS_, sal_uInt16 nSequence_ )
+ : nTxBxS( nTxBxS_ ), nSequence( nSequence_ ){}
+ MSDffTxId( const MSDffTxId& rCopy )
+ : nTxBxS( rCopy.nTxBxS ), nSequence( rCopy.nSequence ){}
+};
+
+struct MSFILTER_DLLPUBLIC SvxMSDffImportRec
+{
+ static const int RELTO_DEFAULT = 2;
+
+ SdrObject* pObj;
+ Polygon* pWrapPolygon;
+ char* pClientAnchorBuffer;
+ sal_uInt32 nClientAnchorLen;
+ char* pClientDataBuffer;
+ sal_uInt32 nClientDataLen;
+ sal_uInt32 nXAlign;
+ sal_uInt32 *pXRelTo;
+ sal_uInt32 nYAlign;
+ sal_uInt32 *pYRelTo;
+ sal_uInt32 nLayoutInTableCell;
+ sal_uInt32 nFlags;
+ long nTextRotationAngle;
+ long nDxTextLeft; ///< distance of text box from surrounding shape
+ long nDyTextTop;
+ long nDxTextRight;
+ long nDyTextBottom;
+ long nDxWrapDistLeft;
+ long nDyWrapDistTop;
+ long nDxWrapDistRight;
+ long nDyWrapDistBottom;
+ long nCropFromTop;
+ long nCropFromBottom;
+ long nCropFromLeft;
+ long nCropFromRight;
+ MSDffTxId aTextId; ///< identifier for text boxes
+ sal_uLong nNextShapeId; ///< for linked text boxes
+ sal_uLong nShapeId;
+ MSO_SPT eShapeType;
+ MSO_LineStyle eLineStyle; ///< border types
+ MSO_LineDashing eLineDashing;
+ sal_Bool bDrawHell :1;
+ sal_Bool bHidden :1;
+ sal_Bool bReplaceByFly :1;
+ sal_Bool bLastBoxInChain :1;
+ sal_Bool bHasUDefProp :1;
+ sal_Bool bVFlip :1;
+ sal_Bool bHFlip :1;
+ sal_Bool bAutoWidth :1;
+ int relativeHorizontalWidth; ///< in 0.1% or -1 for none
+ bool isHorizontalRule;
+
+ SvxMSDffImportRec();
+ SvxMSDffImportRec(const SvxMSDffImportRec& rCopy);
+ ~SvxMSDffImportRec();
+
+ bool operator==( const SvxMSDffImportRec& rEntry ) const
+ { return nShapeId == rEntry.nShapeId; }
+ bool operator<( const SvxMSDffImportRec& rEntry ) const
+ { return nShapeId < rEntry.nShapeId; }
+
+private:
+ SvxMSDffImportRec &operator=(const SvxMSDffImportRec&);
+};
+
+/** list of all SvxMSDffImportRec instances of/for a group */
+class MSDffImportRecords
+ : public ::boost::ptr_set<SvxMSDffImportRec>
+{};
+
+/** block of parameters for import/export for a single call of
+ ImportObjAtCurrentStreamPos() */
+struct SvxMSDffImportData
+{
+ MSDffImportRecords aRecords; ///< Shape pointer, Shape ids and private data
+ Rectangle aParentRect;///< Rectangle of the surrounding groups,
+ ///< which might have been provided externally
+ Rectangle aNewRect; ///< Rectangle that is defined by this shape
+
+ SvxMSDffImportData()
+ {}
+ explicit SvxMSDffImportData( const Rectangle& rParentRect ) : aParentRect( rParentRect ) {}
+ void SetNewRect(sal_Int32 left, sal_Int32 top, sal_Int32 right, sal_Int32 bottom )
+ { aNewRect = Rectangle(left, top, right, bottom); }
+ sal_Bool HasParRect() const { return aParentRect.IsEmpty(); }
+ sal_Bool HasNewRect() const { return aNewRect.IsEmpty() ; }
+ bool empty() const { return aRecords.empty(); }
+ size_t size() const { return aRecords.size(); }
+ MSDffImportRecords::const_iterator begin() const { return aRecords.begin(); }
+ MSDffImportRecords::const_iterator end() const { return aRecords.end(); }
+};
+
+struct DffObjData
+{
+ const DffRecordHeader& rSpHd;
+
+ Rectangle aBoundRect;
+ Rectangle aChildAnchor;
+
+ sal_uInt32 nShapeId;
+ sal_uInt32 nSpFlags;
+ MSO_SPT eShapeType;
+
+ sal_Bool bShapeType : 1;
+ sal_Bool bClientAnchor : 1;
+ sal_Bool bClientData : 1;
+ sal_Bool bChildAnchor : 1;
+ sal_Bool bOpt : 1;
+ sal_Bool bOpt2 : 1;
+ sal_Bool bIsAutoText : 1;
+ sal_Bool bRotateTextWithShape : 1;
+ bool bPageAnchor;
+ int nCalledByGroup;
+
+ DffObjData( const DffRecordHeader& rObjHd,
+ const Rectangle& rBoundRect,
+ int nClByGroup ) :
+ rSpHd( rObjHd ),
+ aBoundRect( rBoundRect ),
+ nShapeId( 0 ),
+ nSpFlags( 0 ),
+ eShapeType( mso_sptNil ),
+ bShapeType( sal_False ),
+ bClientAnchor( sal_False ),
+ bClientData( sal_False ),
+ bChildAnchor( sal_False ),
+ bOpt( sal_False ),
+ bOpt2( sal_False ),
+ bIsAutoText( sal_False ),
+ bRotateTextWithShape( sal_True ),
+ bPageAnchor( true ),
+ nCalledByGroup( nClByGroup ){}
+};
+
+#define DFF_RECORD_MANAGER_BUF_SIZE 64
+
+struct DffRecordList
+{
+ sal_uInt32 nCount;
+ sal_uInt32 nCurrent;
+ DffRecordList* pPrev;
+ DffRecordList* pNext;
+
+ DffRecordHeader mHd[ DFF_RECORD_MANAGER_BUF_SIZE ];
+
+ explicit DffRecordList( DffRecordList* pList );
+ ~DffRecordList();
+};
+
+enum DffSeekToContentMode
+{
+ SEEK_FROM_BEGINNING,
+ SEEK_FROM_CURRENT,
+ SEEK_FROM_CURRENT_AND_RESTART
+};
+
+class MSFILTER_DLLPUBLIC DffRecordManager : public DffRecordList
+{
+public :
+ DffRecordList* pCList;
+
+ void Clear();
+ void Consume( SvStream& rIn,
+ sal_Bool bAppend = sal_False,
+ sal_uInt32 nStOfs = 0 );
+
+ sal_Bool SeekToContent( SvStream& rIn,
+ sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+ DffRecordHeader* GetRecordHeader( sal_uInt16 nRecType,
+ DffSeekToContentMode eMode = SEEK_FROM_BEGINNING );
+
+ DffRecordManager();
+ explicit DffRecordManager( SvStream& rIn );
+ ~DffRecordManager();
+
+ DffRecordHeader* Current();
+ DffRecordHeader* First();
+ DffRecordHeader* Next();
+ DffRecordHeader* Prev();
+ DffRecordHeader* Last();
+};
+
+/** abstract base class for Escher imports
+
+ Purpose: access to objects in Drawing File Format
+
+ Note: The method ProcessUserDefinedRecord() _has_ to be implemented in the
+ inheriting class(es) that is/are eventually used for PowerPoint, Word,
+ or Excel importing.
+
+ Status: Currently only access to BLIPs (will be extended later)
+*/
+class MSFILTER_DLLPUBLIC SvxMSDffManager : public DffPropertyReader
+{
+ FmFormModel* pFormModel;
+ SvxMSDffBLIPInfos* pBLIPInfos;
+ ::boost::scoped_ptr<SvxMSDffShapeInfos_ByTxBxComp> m_pShapeInfosByTxBxComp;
+ ::boost::scoped_ptr<SvxMSDffShapeInfos_ById> m_pShapeInfosById;
+ SvxMSDffShapeOrders* pShapeOrders;
+ sal_uLong nDefaultFontHeight;
+ sal_uInt32 nOffsDgg;
+ sal_uInt16 nBLIPCount;
+ sal_uInt16 nShapeCount;
+ sal_uInt32 nGroupShapeFlags;
+
+ void CheckTxBxStoryChain();
+ void GetFidclData(sal_uInt32 nOffsDgg);
+
+protected :
+ typedef std::map<sal_uInt32, sal_uInt32> OffsetMap;
+
+ OUString maBaseURL;
+ sal_uInt32 mnCurMaxShapeId; // we need this information to
+ sal_uInt32 mnDrawingsSaved; // access the right drawing
+ sal_uInt32 mnIdClusters; // while only knowing the shapeid
+ std::vector<FIDCL> maFidcls;
+ OffsetMap maDgOffsetTable; ///< array of fileoffsets
+
+ friend class DffPropertyReader;
+
+ SvStream& rStCtrl;
+ SvStream* pStData;
+ SvStream* pStData2;
+ SdrModel* pSdrModel;
+
+ long nMapMul;
+ long nMapDiv;
+ long nMapXOfs;
+ long nMapYOfs;
+ long nEmuMul;
+ long nEmuDiv;
+ long nPntMul;
+ long nPntDiv;
+ bool bNeedMap;
+ sal_uInt32 nSvxMSDffSettings;
+ sal_uInt32 nSvxMSDffOLEConvFlags;
+
+ /** stores a reference to an imported SdrObject
+ with its shape id if it has one */
+ SvxMSDffShapeIdContainer maShapeIdContainer;
+
+ void GetCtrlData(sal_uInt32 nOffsDgg);
+ void GetDrawingGroupContainerData( SvStream& rSt,
+ sal_uLong nLenDgg );
+ // #156763#
+ // Add internal drawing container id as parameter to the sub methods of
+ // reading the control information about the drawing objects.
+ // The drawing container id is used to distinguish the text ids of drawing
+ // objects in different drawing containers.
+ void GetDrawingContainerData( SvStream& rSt,
+ sal_uLong nLenDg,
+ const unsigned long nDrawingContainerId );
+ sal_Bool GetShapeGroupContainerData( SvStream& rSt,
+ sal_uLong nLenShapeGroupCont,
+ sal_Bool bPatriarch,
+ const unsigned long nDrawingContainerId );
+ sal_Bool GetShapeContainerData( SvStream& rSt,
+ sal_uLong nLenShapeCont,
+ sal_uLong nPosGroup,
+ const unsigned long nDrawingContainerId );
+
+ bool ReadGraphic( SvStream& rSt, sal_uLong nIndex, Graphic& rGraphic ) const;
+ SdrObject* ImportGraphic( SvStream&, SfxItemSet&, const DffObjData& );
+ // #i32596# - pass <nCalledByGroup> to method
+ // Needed in Writer's Microsoft Word import to avoid import of OLE objects
+ // inside groups. Instead a graphic object is created.
+ virtual SdrObject* ImportOLE( long nOLEId,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ const int _nCalledByGroup,
+ sal_Int64 nAspect ) const;
+ static com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > CheckForConvertToSOObj(
+ sal_uInt32 nConvertFlags, SotStorage& rSrcStg,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg,
+ const Graphic& rGrf,
+ const Rectangle& rVisArea );
+
+// the following methods need to be overriden for Excel imports
+ virtual sal_Bool ProcessClientAnchor( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ char*& rpBuff,
+ sal_uInt32& rBuffLen ) const;
+ virtual void ProcessClientAnchor2( SvStream& rStData,
+ DffRecordHeader& rHd,
+ void* pData, DffObjData& );
+ virtual sal_Bool ProcessClientData( SvStream& rStData,
+ sal_uInt32 nDatLen,
+ char*& rpBuff,
+ sal_uInt32& rBuffLen ) const;
+ virtual SdrObject* ProcessObj( SvStream& rSt,
+ DffObjData& rData,
+ void* pData,
+ Rectangle& rTextRect,
+ SdrObject* pObj = NULL);
+ virtual sal_uLong Calc_nBLIPPos( sal_uLong nOrgVal,
+ sal_uLong nStreamPos ) const;
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
+
+ // Fontwork objects use a new implementation of ReadObjText because the old
+ // one does not properly import multiple paragraphs.
+ static void ReadObjText( const OUString& rText, SdrObject* pObj );
+
+// the following method needs to be overridden for the import of OLE objects
+ virtual sal_Bool GetOLEStorageName( long nOLEId,
+ OUString& rStorageName,
+ SotStorageRef& rSrcStorage,
+ com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg
+ ) const;
+
+ /** Prevent that (rounded) rectangles with wrapped text will always be
+ converted into SdrRectObj( OBJ_TEXT ).
+
+ @return sal_True means "conversion".
+ */
+ virtual sal_Bool ShapeHasText(sal_uLong nShapeId, sal_uLong nFilePos) const;
+
+public:
+ DffPropertyReader* pSecPropSet;
+ std::map<sal_uInt32,OString> aEscherBlipCache;
+
+ DffRecordManager maShapeRecords;
+ ColorData mnDefaultColor;
+
+ sal_Bool mbTracing;
+
+ Color MSO_TEXT_CLR_ToColor( sal_uInt32 nColorCode ) const;
+ Color MSO_CLR_ToColor( sal_uInt32 nColorCode,
+ sal_uInt16 nContextProperty = DFF_Prop_lineColor ) const;
+ virtual sal_Bool SeekToShape( SvStream& rSt,
+ void* pClientData,
+ sal_uInt32 nId ) const;
+ bool SeekToRec( SvStream& rSt,
+ sal_uInt16 nRecId,
+ sal_uLong nMaxFilePos,
+ DffRecordHeader* pRecHd = NULL,
+ sal_uLong nSkipCount = 0 ) const;
+ bool SeekToRec2( sal_uInt16 nRecId1,
+ sal_uInt16 nRecId2,
+ sal_uLong nMaxFilePos,
+ DffRecordHeader* pRecHd = NULL,
+ sal_uLong nSkipCount = 0 ) const;
+
+ static OUString MSDFFReadZString( SvStream& rIn,
+ sal_uInt32 nMaxLen,
+ bool bUniCode = sal_False);
+
+ static bool ReadCommonRecordHeader( SvStream& rSt,
+ sal_uInt8& rVer,
+ sal_uInt16& rInst,
+ sal_uInt16& rFbt,
+ sal_uInt32& rLength) SAL_WARN_UNUSED_RESULT;
+
+// TODO: provide proper documentation here
+ /** constructor
+
+ sets nBLIPCount
+
+ @param rStCtrl Management stream with containers, FBSE
+ objects and shapes (mandatory; stream needs
+ to be open already)
+ @param rBaseURL ???
+ @param nOffsDgg offset in rStrCtrl; beginning of the drawing
+ group container
+ @param pStData data stream in that the BLIPs are stored (if
+ NULL it is assumed that all BLIPs are also in
+ the rStCtrl; stream needs to be open already)
+ @param pSdrModel_ ??? (can be empty during Ctor call but needs
+ to be set via SetModel() later in that case!)
+ @param nApplicationScale ???
+ @param mnDefaultColor_ ???
+ @param nDefaultFontHeight_ ???
+ @param pStData2_ ???
+ */
+ SvxMSDffManager( SvStream& rStCtrl,
+ const OUString& rBaseURL,
+ sal_uInt32 nOffsDgg,
+ SvStream* pStData,
+ SdrModel* pSdrModel_ = 0,
+ long nApplicationScale = 0,
+ ColorData mnDefaultColor_ = COL_DEFAULT,
+ sal_uLong nDefaultFontHeight_ = 24,
+ SvStream* pStData2_ = 0 );
+
+ // in PPT the parameters DGGContainerOffset and PicStream are provided by an
+ // init method
+ SvxMSDffManager( SvStream& rStCtrl, const OUString& rBaseURL );
+ void InitSvxMSDffManager( sal_uInt32 nOffsDgg_,
+ SvStream* pStData_,
+ sal_uInt32 nSvxMSDffOLEConvFlags);
+ void SetDgContainer( SvStream& rSt );
+
+ virtual ~SvxMSDffManager();
+
+ sal_uInt32 GetSvxMSDffSettings() const { return nSvxMSDffSettings; };
+ void SetSvxMSDffSettings( sal_uInt32 nSettings ) { nSvxMSDffSettings = nSettings; };
+
+ static sal_Bool MakeContentStream( SotStorage * pStor, const GDIMetaFile & );
+ static void ReadObjText( SvStream& rStream, SdrObject* pObj );
+ static sal_Bool ConvertToOle2( SvStream& rStm,
+ sal_uInt32 nLen,
+ const GDIMetaFile*,
+ const SotStorageRef & rDest );
+
+ void SetModel(SdrModel* pModel, long nApplicationScale);
+ SdrModel* GetModel() const { return pSdrModel; }
+ void Scale(sal_Int32& rVal) const;
+ void Scale(Point& rPos) const;
+ void Scale(Size& rSiz) const;
+ void ScaleEmu(sal_Int32& rVal) const;
+ sal_uInt32 ScalePt( sal_uInt32 nPt ) const;
+ sal_Int32 ScalePoint( sal_Int32 nVal ) const;
+
+// TODO: provide proper documentation here
+ /** Request for a specific BLIP.
+
+ @param[in] nIdx number of the requested BLIP (mandatory)
+ @param[out] rData already converted data (insert directly as graphics
+ into our documents)
+ @param pVisArea ???
+
+ @return sal_True if successful, sal_False otherwise
+ */
+ sal_Bool GetBLIP( sal_uLong nIdx, Graphic& rData, Rectangle* pVisArea = NULL );
+
+// TODO: provide proper documentation here
+ /** read a BLIP out of a already positioned stream
+
+ @param[in] rBLIPStream alread positioned stream (mandatory)
+ @param[out] rData already converted data (insert directly as
+ graphics into our documents)
+ @param pVisArea ???
+
+ @return sal_True if successful, sal_False otherwise
+ */
+ sal_Bool GetBLIPDirect(SvStream& rBLIPStream, Graphic& rData, Rectangle* pVisArea = NULL ) const;
+
+ sal_Bool GetShape(sal_uLong nId, SdrObject*& rpData, SvxMSDffImportData& rData);
+
+ /** Get count of managed BLIPs
+
+ @return Number of BLIPs in pStData (or rStCtrl), thus number of FBSEs in
+ the drawing group container. If 0 is returned this means that
+ the structure is ok but there are no BLIPs; if USHRT_MAX is
+ returned than there was an error: no correct Drawing File Format
+ */
+ sal_uInt16 GetBLIPCount() const{ return nBLIPCount; }
+
+ SdrObject* ImportObj( SvStream& rSt,
+ void* pData,
+ Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect,
+ int nCalledByGroup = 0,
+ sal_Int32* pShapeId = NULL);
+ SdrObject* ImportGroup( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ void* pData,
+ Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect,
+ int nCalledByGroup = 0,
+ sal_Int32* pShapeId = NULL );
+ SdrObject* ImportShape( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ void* pData,
+ Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect,
+ int nCalledByGroup = 0,
+ sal_Int32* pShapeId = NULL);
+
+ Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ Rectangle& aClientRect );
+ void GetGroupAnchors( const DffRecordHeader& rHd,
+ SvStream& rSt,
+ Rectangle& rGroupClientAnchor,
+ Rectangle& rGroupChildAnchor,
+ const Rectangle& rClientRect,
+ const Rectangle& rGlobalChildRect );
+
+ inline const SvxMSDffShapeInfos_ById* GetShapeInfos( void ) const
+ { return m_pShapeInfosById.get(); }
+
+ inline const SvxMSDffShapeOrders* GetShapeOrders( void ) const
+ { return pShapeOrders; }
+
+ void StoreShapeOrder(sal_uLong nId,
+ sal_uLong nTxBx,
+ SdrObject* pObject,
+ SwFlyFrmFmt* pFly = 0,
+ short nHdFtSection = 0) const;
+
+ void ExchangeInShapeOrder(SdrObject* pOldObject,
+ sal_uLong nTxBx,
+ SwFlyFrmFmt* pFly,
+ SdrObject* pObject) const;
+
+ void RemoveFromShapeOrder( SdrObject* pObject ) const;
+
+ sal_uInt32 GetConvertFlags() const { return nSvxMSDffOLEConvFlags; }
+
+ static SdrOle2Obj* CreateSdrOLEFromStorage( const OUString& rStorageName,
+ SotStorageRef& rSrcStorage,
+ const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xDestStg,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ SvStream* pDataStrrm,
+ ErrCode& rError,
+ sal_uInt32 nConvertFlags,
+ sal_Int64 nAspect );
+
+ /** Create connections between shapes.
+ This method should be called after a page is imported.
+
+ @param rSolver contains necessary data that is collected during the
+ import of each shape
+ */
+ void SolveSolver( const SvxMSDffSolverContainer& rSolver );
+
+ static sal_Bool SetPropValue(
+ const ::com::sun::star::uno::Any& rAny,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
+ const OUString& rPropertyName,
+ sal_Bool bTestPropertyAvailability = sal_False
+ );
+
+ void insertShapeId( sal_Int32 nShapeId, SdrObject* pShape );
+ void removeShapeId( SdrObject* pShape );
+ SdrObject* getShapeForId( sal_Int32 nShapeId );
+};
+
+struct SvxMSDffBLIPInfo
+{
+ sal_uInt16 nBLIPType; ///< type of BLIP: e.g. 6 for PNG
+ sal_uLong nFilePos; ///< offset of the BLIP in data strem
+ sal_uLong nBLIPSize; ///< number of bytes that the BLIP needs in stream
+ SvxMSDffBLIPInfo(sal_uInt16 nBType, sal_uLong nFPos, sal_uLong nBSize):
+ nBLIPType( nBType ), nFilePos( nFPos ), nBLIPSize( nBSize ){}
+};
+
+struct SvxMSDffShapeInfo
+{
+ sal_uInt32 nShapeId; ///< shape id, used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uLong nFilePos; ///< offset of the shape in control stream for
+ ///< potential later access to it
+ sal_uInt32 nTxBxComp;
+
+ sal_Bool bReplaceByFly :1; ///< shape can be replaced by a frame in Writer
+ sal_Bool bLastBoxInChain:1;
+
+ explicit SvxMSDffShapeInfo(sal_uLong nFPos, sal_uInt32 nId=0, // sal_uLong nBIdx=0,
+ sal_uInt16 nSeqId=0, sal_uInt16 nBoxId=0):
+ nShapeId( nId ),
+ nFilePos( nFPos ),
+ nTxBxComp( (nSeqId << 16) + nBoxId )
+ {
+ bReplaceByFly = sal_False;
+ bLastBoxInChain = sal_True;
+ }
+ SvxMSDffShapeInfo(SvxMSDffShapeInfo& rInfo):
+ nShapeId( rInfo.nShapeId ),
+ nFilePos( rInfo.nFilePos ),
+ nTxBxComp( rInfo.nTxBxComp )
+ {
+ bReplaceByFly = rInfo.bReplaceByFly;
+ bLastBoxInChain = rInfo.bLastBoxInChain;
+ }
+};
+
+
+struct SvxMSDffShapeOrder
+{
+ sal_uLong nShapeId; ///< shape id used in PLCF SPA and in mso_fbtSp (FSP)
+ sal_uLong nTxBxComp; ///< chain or box number in the Text-Box-Story (or NULL)
+ SwFlyFrmFmt* pFly; ///< format of frame that was inserted as a replacement
+ ///< for a Sdr-Text object in Writer - needed for
+ ///< chaining!
+ short nHdFtSection; ///< used by Writer to find out if linked frames are in
+ ///< the same header or footer of the same section
+ SdrObject* pObj; ///< pointer to the draw object (or NULL if not used)
+
+ // Approach: In the Ctor of SvxMSDffManager only the shape ids are stored in
+ // the shape order array. The Text-Box number and the object
+ // pointer are only stored if the shape is really imported.
+ explicit SvxMSDffShapeOrder( sal_uLong nId ):
+ nShapeId( nId ), nTxBxComp( 0 ), pFly( 0 ), nHdFtSection( 0 ), pObj( 0 ){}
+
+ bool operator==( const SvxMSDffShapeOrder& rEntry ) const
+ { return (nTxBxComp == rEntry.nTxBxComp); }
+ bool operator<( const SvxMSDffShapeOrder& rEntry ) const
+ { return (nTxBxComp < rEntry.nTxBxComp); }
+};
+
+// the following will be sorted explicitly:
+struct CompareSvxMSDffShapeTxBxSort
+{
+ bool operator()( SvxMSDffShapeOrder* const& lhs, SvxMSDffShapeOrder* const& rhs ) const { return (*lhs)<(*rhs); }
+};
+class MSFILTER_DLLPUBLIC SvxMSDffShapeTxBxSort : public std::set<SvxMSDffShapeOrder*,CompareSvxMSDffShapeTxBxSort> {};
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msfilterdllapi.h b/include/filter/msfilter/msfilterdllapi.h
new file mode 100644
index 000000000000..03816baa92fc
--- /dev/null
+++ b/include/filter/msfilter/msfilterdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_MSFILTER_DLLAPI_H
+#define INCLUDED_MSFILTER_DLLAPI_H
+
+#include "sal/types.h"
+
+#if defined MSFILTER_DLLIMPLEMENTATION
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define MSFILTER_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#define MSFILTER_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msocximex.hxx b/include/filter/msfilter/msocximex.hxx
new file mode 100644
index 000000000000..79815e49126e
--- /dev/null
+++ b/include/filter/msfilter/msocximex.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MSOCXIMEX_HXX
+#define _MSOCXIMEX_HXX
+
+#include <sot/storage.hxx>
+
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace com{namespace sun{namespace star{
+ namespace drawing{
+ class XDrawPage;
+ class XShape;
+ class XShapes;
+ }
+ namespace form{
+ class XFormComponent;
+ }
+ namespace lang{
+ class XMultiServiceFactory;
+ }
+ namespace container{
+ class XIndexContainer;
+ class XNameContainer;
+ }
+ namespace beans{
+ class XPropertySet;
+ }
+ namespace text{
+ class XText;
+ }
+ namespace awt{
+ struct Size;
+ class XControlModel;
+ }
+ namespace uno{
+ class XComponentContext;
+ }
+ namespace frame{
+ class XModel;
+ }
+
+}}}
+
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC SvxMSConvertOCXControls
+{
+public:
+ SvxMSConvertOCXControls( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
+ virtual ~SvxMSConvertOCXControls();
+
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference<
+ com::sun::star::form::XFormComponent >& /*rFComp*/,
+ const com::sun::star::awt::Size& /*rSize*/,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape >* /*pShape*/,
+ sal_Bool /*bFloatingCtrl*/ ) {return sal_False;}
+
+ /*begin: Backwards compatability with office 95 import, modify later*/
+ const com::sun::star::uno::Reference<
+ com::sun::star::lang::XMultiServiceFactory > & GetServiceFactory();
+protected:
+ const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > &
+ GetShapes();
+
+ const com::sun::star::uno::Reference<
+ com::sun::star::container::XIndexContainer > & GetFormComps();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+
+ // gecachte Interfaces
+ com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >
+ xDrawPage;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >
+ xShapes;
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceFactory;
+
+ // das einzige Formular
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >
+ xFormComps;
+
+ virtual const com::sun::star::uno::Reference<
+ com::sun::star::drawing::XDrawPage > & GetDrawPage();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msoleexp.hxx b/include/filter/msfilter/msoleexp.hxx
new file mode 100644
index 000000000000..468fa6284513
--- /dev/null
+++ b/include/filter/msfilter/msoleexp.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MSOLEEXP_HXX
+#define _MSOLEEXP_HXX
+
+#include <com/sun/star/uno/Reference.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+// for the CreateSdrOLEFromStorage we need the information, how we handle
+// convert able OLE-Objects - this ist stored in
+#define OLE_STARMATH_2_MATHTYPE 0x0001
+#define OLE_STARWRITER_2_WINWORD 0x0002
+#define OLE_STARCALC_2_EXCEL 0x0004
+#define OLE_STARIMPRESS_2_POWERPOINT 0x0008
+
+class SotStorage;
+
+#include <svtools/embedhlp.hxx>
+
+class MSFILTER_DLLPUBLIC SvxMSExportOLEObjects
+{
+ sal_uInt32 nConvertFlags;
+public:
+ SvxMSExportOLEObjects( sal_uInt32 nCnvrtFlgs ) : nConvertFlags(nCnvrtFlgs) {}
+
+ void SetFlags( sal_uInt32 n ) { nConvertFlags = n; }
+ sal_uInt32 GetFlags() const { return nConvertFlags; }
+
+ void ExportOLEObject( svt::EmbeddedObjectRef& rObj, SotStorage& rDestStg );
+ void ExportOLEObject( const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject>& rObj, SotStorage& rDestStg );
+};
+
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/mstoolbar.hxx b/include/filter/msfilter/mstoolbar.hxx
new file mode 100644
index 000000000000..fc80f3115177
--- /dev/null
+++ b/include/filter/msfilter/mstoolbar.hxx
@@ -0,0 +1,359 @@
+/* -*- 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
+ * Noel Power <noel.power@novell.com>
+ * Portions created by the Initial Developer are Copyright (C) 2010 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Noel Power <noel.power@novell.com>
+ *
+ * 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 _MSTOOLBAR_HXX
+#define _MSTOOLBAR_HXX
+#include "filter/msfilter/msfilterdllapi.h"
+#include <sot/storage.hxx>
+#include <ostream>
+#include <memory>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/ui/ImageType.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <vcl/bitmap.hxx>
+#include <cppuhelper/implbase1.hxx>
+
+class TBCHeader;
+
+
+class MSOCommandConvertor
+{
+public:
+ virtual ~MSOCommandConvertor() {}
+ virtual OUString MSOCommandToOOCommand( sal_Int16 msoCmd ) = 0;
+ virtual OUString MSOTCIDToOOCommand( sal_Int16 msoTCID ) = 0;
+};
+
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC CustomToolBarImportHelper
+{
+ struct iconcontrolitem
+ {
+ OUString sCommand;
+ css::uno::Reference< css::graphic::XGraphic > image;
+ };
+ std::vector< iconcontrolitem > iconcommands;
+ std::auto_ptr< MSOCommandConvertor > pMSOCmdConvertor;
+ css::uno::Reference< css::ui::XUIConfigurationManagerSupplier > m_xCfgSupp;
+ css::uno::Reference< css::ui::XUIConfigurationManager > m_xAppCfgMgr;
+ SfxObjectShell& mrDocSh;
+ void ScaleImage( css::uno::Reference< css::graphic::XGraphic >& xGraphic, long nNewSize );
+public:
+ CustomToolBarImportHelper( SfxObjectShell& rDocSh, const css::uno::Reference< css::ui::XUIConfigurationManager >& rxAppCfgMgr );
+
+ void setMSOCommandMap( MSOCommandConvertor* pCnvtr ) { pMSOCmdConvertor.reset( pCnvtr ); }
+ css::uno::Reference< css::ui::XUIConfigurationManager > getCfgManager();
+ css::uno::Reference< css::ui::XUIConfigurationManager > getAppCfgManager();
+
+
+ css::uno::Any createCommandFromMacro( const OUString& sCmd );
+
+ void addIcon( const css::uno::Reference< css::graphic::XGraphic >& xImage, const OUString& sString );
+ void applyIcons();
+ OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
+ OUString MSOTCIDToOOCommand( sal_Int16 msoTCID );
+ SfxObjectShell& GetDocShell() { return mrDocSh; }
+ bool createMenu( const OUString& rName, const css::uno::Reference< css::container::XIndexAccess >& xMenuDesc, bool bPersist );
+};
+
+class MSFILTER_DLLPUBLIC TBBase
+{
+friend class Indent;
+ static int nIndent; // num spaces to indent before printing
+protected:
+ void indent_printf(FILE* fp, const char* format, ... );
+ sal_uInt32 nOffSet; // usually for debug we can store the offset in the stream to this record
+public:
+ TBBase() : nOffSet( 0 ) {}
+ virtual ~TBBase(){}
+
+ virtual bool Read(SvStream &rS) = 0;
+ virtual void Print( FILE* ) {} // #FIXME remove this an implement the debug routines in all the classes below to enable some sort of readable output
+ sal_uInt32 GetOffset() { return nOffSet; }
+};
+
+class Indent
+{
+public:
+ Indent( bool binit = false )
+ {
+ if ( binit )
+ init();
+ else
+ TBBase::nIndent = TBBase::nIndent + 2;
+ }
+ ~Indent() { TBBase::nIndent = TBBase::nIndent - 2; }
+ void init() { TBBase::nIndent = 0; }
+};
+
+
+class MSFILTER_DLLPUBLIC WString : public TBBase
+{
+ OUString sString;
+
+public:
+ WString(){};
+ ~WString(){};
+ bool Read(SvStream &rS);
+ OUString getString(){ return sString; }
+};
+
+class MSFILTER_DLLPUBLIC TBCExtraInfo : public TBBase
+{
+ WString wstrHelpFile;
+ sal_Int32 idHelpContext;
+ WString wstrTag;
+ WString wstrOnAction;
+ WString wstrParam;
+ sal_Int8 tbcu;
+ sal_Int8 tbmg;
+
+ TBCExtraInfo(const TBCExtraInfo&);
+ TBCExtraInfo& operator = ( const TBCExtraInfo&);
+public:
+ TBCExtraInfo();
+ ~TBCExtraInfo(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ OUString getOnAction();
+};
+
+class MSFILTER_DLLPUBLIC TBCGeneralInfo : public TBBase
+{
+ sal_uInt8 bFlags;
+ WString customText;
+ WString descriptionText;
+ WString tooltip;
+ TBCExtraInfo extraInfo;
+
+public:
+ TBCGeneralInfo();
+ ~TBCGeneralInfo() {}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ bool ImportToolBarControlData( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >& );
+ OUString CustomText() { return customText.getString(); }
+ OUString DescriptionText() { return descriptionText.getString(); }
+ OUString Tooltip() { return tooltip.getString(); }
+};
+
+class MSFILTER_DLLPUBLIC TBCBitMap : public TBBase
+{
+friend class TBCBSpecific; // #FIXME hacky access, need to fix
+ sal_Int32 cbDIB;
+ Bitmap mBitMap;
+public:
+ TBCBitMap();
+ ~TBCBitMap();
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ Bitmap& getBitMap();
+};
+
+class MSFILTER_DLLPUBLIC TBCMenuSpecific : public TBBase
+{
+ sal_Int32 tbid;
+ boost::shared_ptr< WString > name; //exist only if tbid equals 0x00000001
+public:
+ TBCMenuSpecific();
+ ~TBCMenuSpecific(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ OUString Name();
+};
+
+class MSFILTER_DLLPUBLIC TBCCDData : public TBBase
+{
+ sal_Int16 cwstrItems; //Signed integer that specifies the number of items in wstrList. MUST be positive.
+ std::vector< WString > wstrList; // Zero-based index array of WString structures. Number of elements MUST be equal to cwstrItems.
+ sal_Int16 cwstrMRU; // Signed integer that specifies the number of most recently used string
+ sal_Int16 iSel ; // Signed integer that specifies the zero-based index of the selected item in the wstrList field. MUST be equal to 0xFFFF (-1) or greater than or equal to 0x0000.
+ sal_Int16 cLines; // Signed integer that specifies the suggested number of lines that the toolbar control will display at any time when displaying the elements of wstrList of available items.
+ sal_Int16 dxWidth; // Signed integer that specifies the width in pixels that the interior of the dropdown has. This excludes the width of the toolbar control border and scroll bar.
+ WString wstrEdit; //Structure of type WString. Editable text for editable area of the ComboBox toolbar control.
+
+public:
+ TBCCDData();
+ ~TBCCDData();
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+};
+
+class TBCComboDropdownSpecific : public TBBase
+{
+ boost::shared_ptr< TBCCDData > data;
+public:
+ TBCComboDropdownSpecific( const TBCHeader& header );
+ TBCComboDropdownSpecific(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+};
+
+class TBCBSpecific : public TBBase
+{
+ sal_uInt8 bFlags;
+ boost::shared_ptr< TBCBitMap > icon; // optional
+ boost::shared_ptr< TBCBitMap > iconMask; // optional
+ boost::shared_ptr< sal_uInt16 > iBtnFace; // optional
+ boost::shared_ptr< WString > wstrAcc; // optional
+
+public:
+ TBCBSpecific();
+ ~TBCBSpecific(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ // #TODO just add a getGraphic member here
+ TBCBitMap* getIcon();
+ TBCBitMap* getIconMask();
+ sal_uInt16* getBtnFace() { return iBtnFace.get(); }
+};
+
+/* TBCHeader.tct controlSpecificInfo type
+
+0x01 (Button control) TBCBSpecific
+0x10 (ExpandingGrid control) TBCBSpecific
+0x0A (Popup control) TBCMenuSpecific
+0x0C (ButtonPopup control) TBCMenuSpecific
+0x0D (SplitButtonPopup control) TBCMenuSpecific
+0x0E (SplitButtonMRUPopup control) TBCMenuSpecific
+0x02 (Edit control) TBCComboDropdow nSpecific
+0x04 (ComboBox control) TBCComboDropdow nSpecific
+0x14 (GraphicCombo control) TBCComboDropdow nSpecific
+0x03 (DropDown control) TBCComboDropdow nSpecific
+0x06 (SplitDropDown control) TBCComboDropdow nSpecific
+0x09 (GraphicDropDown control) TBCComboDropdow nSpecific
+0x07 (OCXDropDown control) controlSpecificInfo MUST NOT exist
+0x0F (Label control) controlSpecificInfo MUST NOT exist
+0x12 (Grid control) controlSpecificInfo MUST NOT exist
+0x13 (Gauge control) controlSpecificInfo MUST NOT exist
+0x16 (ActiveX control) controlSpecificInfo MUST NOT exist
+
+*/
+class MSFILTER_DLLPUBLIC TBCHeader : public TBBase
+{
+ sal_Int8 bSignature;
+ sal_Int8 bVersion;
+ sal_uInt8 bFlagsTCR;
+ sal_uInt8 tct;
+ sal_uInt16 tcid;
+ sal_uInt32 tbct;
+ sal_uInt8 bPriority;
+ boost::shared_ptr< sal_uInt16 > width; //optional
+ boost::shared_ptr< sal_uInt16 > height; //optional
+
+public:
+ TBCHeader();
+ ~TBCHeader();
+ sal_uInt8 getTct() const { return tct; }
+ sal_uInt16 getTcID() const { return tcid; }
+ bool isVisible() { return !( bFlagsTCR & 0x1 ); }
+ bool isBeginGroup() { return ( bFlagsTCR & 0x2 ); }
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ sal_uInt32 getTbct() { return tbct; };
+};
+
+class MSFILTER_DLLPUBLIC TBCData : public TBBase
+{
+ TBCHeader rHeader;
+ TBCGeneralInfo controlGeneralInfo;
+ boost::shared_ptr< TBBase > controlSpecificInfo; // can be one of TBCBSpecific, TBCMenuSpecific or TBCComboDropdow nSpecific depending on the control type specified by TBCHeader.tct
+ TBCData(const TBCData&);
+ TBCData& operator = ( const TBCData&);
+public:
+ TBCData( const TBCHeader& Header );
+ ~TBCData(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ bool ImportToolBarControl( CustomToolBarImportHelper&, std::vector< css::beans::PropertyValue >&, bool& bBeginGroup, bool bIsMenuBar );
+ TBCGeneralInfo& getGeneralInfo() { return controlGeneralInfo; }
+ TBCMenuSpecific* getMenuSpecific();
+};
+
+class MSFILTER_DLLPUBLIC TB : public TBBase
+{
+ sal_uInt8 bSignature;// Signed integer that specifies the toolbar signature number. MUST be 0x02.
+ sal_uInt8 bVersion; // Signed integer that specifies the toolbar version number. MUST be 0x01.
+ sal_Int16 cCL; // Signed integer that SHOULD specify the number of toolbar controls contained in this toolbar.
+ sal_Int32 ltbid;// Signed integer that specifies the toolbar ID. MUST be 0x0001 (custom toolbar ID).
+ sal_uInt32 ltbtr;// Unsigned integer of type TBTRFlags that specifies the toolbar type and toolbar restrictions.
+ sal_uInt16 cRowsDefault;// Unsigned integer that specifies the number of preferred rows for the toolbar when the toolbar is not docked. MUST be less than or equal to 255.
+ sal_uInt16 bFlags; //Unsigned integer of type TBFlags.
+ WString name; //Structure of type WString that specifies the toolbar name
+public:
+ TB();
+ ~TB(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+ sal_Int16 getcCL(){ return cCL; }
+ WString& getName(){ return name; }
+ bool IsEnabled();
+ bool IsMenuToolbar(){ return ( ( ltbtr & 0x2000000 ) == 0x2000000 ); }
+};
+
+class MSFILTER_DLLPUBLIC SRECT : public TBBase
+{
+public:
+ SRECT() : left(0), top(0), right(0), bottom(0) {}
+ sal_Int16 left;
+ sal_Int16 top;
+ sal_Int16 right;
+ sal_Int16 bottom;
+ bool Read( SvStream &rS ) { rS >> left >> top >> right >> bottom; return true; }
+ void Print( FILE* fo );
+};
+
+typedef cppu::WeakImplHelper1< css::container::XIndexContainer > PropertyValueIndexContainer_BASE;
+
+class MSFILTER_DLLPUBLIC TBVisualData : public TBBase
+{
+ sal_Int8 tbds;
+ sal_Int8 tbv;
+ sal_Int8 tbdsDock;
+ sal_Int8 iRow;
+
+ SRECT rcDock;
+ SRECT rcFloat;
+
+public:
+ TBVisualData();
+ ~TBVisualData(){}
+ bool Read(SvStream &rS);
+ void Print( FILE* );
+};
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/msvbahelper.hxx b/include/filter/msfilter/msvbahelper.hxx
new file mode 100644
index 000000000000..bafcc461a598
--- /dev/null
+++ b/include/filter/msfilter/msvbahelper.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _MSVBAHELPER_HXX
+#define _MSVBAHELPER_HXX
+
+#include <sfx2/objsh.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/script/vba/XVBAMacroResolver.hpp>
+#include <com/sun/star/awt/KeyEvent.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "filter/msfilter/msfilterdllapi.h"
+namespace ooo {
+namespace vba {
+
+// ============================================================================
+
+struct MSFILTER_DLLPUBLIC MacroResolvedInfo
+{
+ SfxObjectShell* mpDocContext;
+ OUString msResolvedMacro;
+ bool mbFound;
+
+ inline explicit MacroResolvedInfo( SfxObjectShell* pDocContext = 0 ) : mpDocContext( pDocContext ), mbFound( false ) {}
+};
+
+MSFILTER_DLLPUBLIC OUString makeMacroURL( const OUString& sMacroName );
+MSFILTER_DLLPUBLIC OUString extractMacroName( const OUString& rMacroUrl );
+MSFILTER_DLLPUBLIC OUString getDefaultProjectName( SfxObjectShell* pShell );
+MSFILTER_DLLPUBLIC OUString resolveVBAMacro( SfxObjectShell* pShell, const OUString& rLibName, const OUString& rModuleName, const OUString& rMacroName );
+MSFILTER_DLLPUBLIC MacroResolvedInfo resolveVBAMacro( SfxObjectShell* pShell, const OUString& rMacroName, bool bSearchGlobalTemplates = false );
+MSFILTER_DLLPUBLIC sal_Bool executeMacro( SfxObjectShell* pShell, const OUString& sMacroName, com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArgs, com::sun::star::uno::Any& aRet, const com::sun::star::uno::Any& aCaller );
+MSFILTER_DLLPUBLIC ::com::sun::star::awt::KeyEvent parseKeyEvent( const OUString& sKey ) throw (::com::sun::star::uno::RuntimeException);
+MSFILTER_DLLPUBLIC void applyShortCutKeyBinding ( const ::com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxDoc, const ::com::sun::star::awt::KeyEvent& rKeyEvent, const OUString& sMacro ) throw (::com::sun::star::uno::RuntimeException);
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper3<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::script::vba::XVBAMacroResolver > VBAMacroResolverBase;
+
+class VBAMacroResolver : public VBAMacroResolverBase
+{
+public:
+ explicit VBAMacroResolver();
+ virtual ~VBAMacroResolver();
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rService )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.script.vba.XVBAMacroResolver interface --------------------
+
+ virtual OUString SAL_CALL
+ resolveVBAMacroToScriptURL( const OUString& rVBAMacroName )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+ virtual OUString SAL_CALL
+ resolveScriptURLtoVBAMacro( const OUString& rScriptURL )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
+ SfxObjectShell* mpObjShell;
+ OUString maProjectName;
+};
+
+// ============================================================================
+
+} // namespace vba
+} // namespace ooo
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/rtfutil.hxx b/include/filter/msfilter/rtfutil.hxx
new file mode 100644
index 000000000000..b8d3c2c6d8ca
--- /dev/null
+++ b/include/filter/msfilter/rtfutil.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_MSFILTER_RTFUTIL_HXX
+#define INCLUDED_MSFILTER_RTFUTIL_HXX
+
+#include "filter/msfilter/msfilterdllapi.h"
+#include <rtl/string.hxx>
+#include <rtl/textenc.h>
+#include <tools/string.hxx>
+
+namespace msfilter {
+namespace rtfutil {
+
+/// Outputs a single character in hex form.
+MSFILTER_DLLPUBLIC OString OutHex(sal_uLong nHex, sal_uInt8 nLen);
+
+/// Handles correct unicode and legacy export of a single character.
+MSFILTER_DLLPUBLIC OString OutChar(sal_Unicode c, int *pUCMode, rtl_TextEncoding eDestEnc, bool* pSuccess = 0, bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string.
+ *
+ * @param rStr the string to export
+ * @param eDestEnc the legacy encoding to use
+ * @param bUnicode if unicode output is wanted as well, or just legacy
+ */
+MSFILTER_DLLPUBLIC OString OutString(const String &rStr, rtl_TextEncoding eDestEnc, bool bUnicode = true);
+
+/**
+ * Handles correct unicode and legacy export of a string, when a
+ * '{' \upr '{' keyword ansi_text '}{\*' \ud '{' keyword Unicode_text '}}}'
+ * construct should be used.
+ *
+ * @param pToken the keyword
+ * @param rStr the text to export
+ * @param eDestEnc the legacy encoding to use
+ */
+MSFILTER_DLLPUBLIC OString OutStringUpr(const sal_Char *pToken, const String &rStr, rtl_TextEncoding eDestEnc);
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
new file mode 100644
index 000000000000..2fbf096aec58
--- /dev/null
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -0,0 +1,1564 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVDFPPT_HXX
+#define _SVDFPPT_HXX
+
+#include <tools/solar.h>
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include <tools/color.hxx>
+#include <svx/svdobj.hxx>
+#include <editeng/numitem.hxx>
+#include <editeng/editdata.hxx>
+#include <filter/msfilter/msdffimp.hxx>
+#include <filter/msfilter/msocximex.hxx>
+#include <editeng/eeitem.hxx>
+#define ITEMID_FIELD EE_FEATURE_FIELD
+#include <editeng/flditem.hxx>
+#undef ITEMID_FIELD
+#include "filter/msfilter/msfilterdllapi.h"
+#include <vcl/font.hxx>
+#include <vector>
+#include <boost/optional.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
+
+class SdrModel;
+class SdPage;
+class SdrPage;
+class SdrObject;
+class SvStream;
+class Polygon;
+class PolyPolygon;
+class SfxItemSet;
+class Outliner;
+class Graphic;
+class SvxMSDffManager;
+class PPTTextObj;
+class DffRecordHeader;
+class SvxBulletItem;
+
+#define PPT_IMPORTFLAGS_NO_TEXT_ASSERT 1
+
+struct MSFILTER_DLLPUBLIC PptCurrentUserAtom
+{
+ sal_uInt32 nMagic;
+ sal_uInt32 nCurrentUserEdit;
+ sal_uInt16 nDocFileVersion;
+ sal_uInt8 nMajorVersion;
+ sal_uInt8 nMinorVersion;
+ OUString aCurrentUser;
+
+public:
+
+ PptCurrentUserAtom() : nMagic ( 0 ),
+ nCurrentUserEdit ( 0 ),
+ nDocFileVersion ( 0 ),
+ nMajorVersion ( 0 ),
+ nMinorVersion ( 0 ) {}
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, PptCurrentUserAtom& rAtom );
+};
+
+struct MSFILTER_DLLPUBLIC PowerPointImportParam
+{
+ SvStream& rDocStream;
+ sal_uInt32 nImportFlags;
+ PptCurrentUserAtom aCurrentUserAtom;
+
+ PowerPointImportParam( SvStream& rDocStream, sal_uInt32 nImportFlags );
+};
+
+struct SdHyperlinkEntry
+{
+ sal_uInt32 nIndex;
+ sal_Int32 nPrivate1;
+ sal_Int32 nPrivate2;
+ sal_Int32 nPrivate3;
+ sal_Int32 nInfo;
+ OUString aTarget;
+ OUString aSubAdress;
+
+ sal_Int32 nStartPos;
+ sal_Int32 nEndPos;
+
+ OUString aConvSubString;
+ ESelection aESelection;
+ sal_Bool bSelection;
+};
+
+// Hilfsklasse zum Einlesen der PPT InteractiveInfoAtom
+struct MSFILTER_DLLPUBLIC PptInteractiveInfoAtom
+{
+ sal_uInt32 nSoundRef;
+ sal_uInt32 nExHyperlinkId;
+ sal_uInt8 nAction;
+ sal_uInt8 nOleVerb;
+ sal_uInt8 nJump;
+ sal_uInt8 nFlags;
+ sal_uInt8 nHyperlinkType;
+
+ // unknown, da Gesamtgroesse 16 ist
+ sal_uInt8 nUnknown1;
+ sal_uInt8 nUnknown2;
+ sal_uInt8 nUnknown3;
+
+public:
+
+ MSFILTER_DLLPUBLIC friend SvStream& operator>>( SvStream& rIn, PptInteractiveInfoAtom& rAtom );
+};
+
+enum PptPageKind { PPT_MASTERPAGE, PPT_SLIDEPAGE, PPT_NOTEPAGE };
+
+enum PptPageFormat
+{ PPTPF_SCREEN, //
+ PPTPF_USLETTER, // 8.5x11"
+ PPTPF_A4, // 210x297mm
+ PPTPF_35MMDIA, // DIA
+ PPTPF_OVERHEAD, //
+ PPTPF_CUSTOM
+};
+
+// Werte fuer den sal_uLong im PPT_PST_TextHeaderAtom
+enum PPT_TextHeader
+{
+ PPTTH_TITLE,
+ PPTTH_BODY,
+ PPTTH_NOTES,
+ PPTTH_NOTUSED,
+ PPTTH_OTHER, // Text in a Shape
+ PPTTH_CENTERBODY, // Subtitle in Title-Slide
+ PPTTH_CENTERTITLE, // Title in Title-Slide
+ PPTTH_HALFBODY, // Body in two-column slide
+ PPTTH_QUARTERBODY // Body in four-body slide
+};
+
+#define TSS_TYPE_PAGETITLE (0)
+#define TSS_TYPE_BODY (1)
+#define TSS_TYPE_NOTES (2)
+#define TSS_TYPE_UNUSED (3)
+#define TSS_TYPE_TEXT_IN_SHAPE (4)
+#define TSS_TYPE_SUBTITLE (5)
+#define TSS_TYPE_TITLE (6)
+#define TSS_TYPE_HALFBODY (7)
+#define TSS_TYPE_QUARTERBODY (8)
+
+// Inventor-Id fuer PPT UserData
+const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001
+ + sal_uInt32('P') * 0x00000100
+ + sal_uInt32('T') * 0x00010000
+ + sal_uInt32('0') * 0x01000000;
+
+// Object-Ids fuer StarDraw UserData
+#define PPT_OBJECTINFO_ID (1)
+
+struct MSFILTER_DLLPUBLIC PptDocumentAtom
+{
+ Size aSlidesPageSize; // page size of the slides in 576DPI
+ Size aNotesPageSize; // page size of the notes in 576DPI
+ // RatioAtom erstmal weggelassen
+ sal_uInt32 nNotesMasterPersist; // 0=non-existent
+ sal_uInt32 nHandoutMasterPersist; // 0=non-existent
+ sal_uInt16 n1stPageNumber; // page number of the first slide
+ PptPageFormat eSlidesPageFormat; // page format of the slides
+ sal_Bool bEmbeddedTrueType : 1; // TrueType direcly within the File?
+ sal_Bool bTitlePlaceholdersOmitted : 1;
+ sal_Bool bRightToLeft : 1;
+ sal_Bool bShowComments : 1;
+
+public:
+
+ Size GetPageSize( const Size& rSiz ) const;
+ Size GetSlidesPageSize() const { return GetPageSize( aSlidesPageSize ); }
+ Size GetNotesPageSize() const { return GetPageSize( aNotesPageSize ); }
+
+ friend SvStream& operator>>( SvStream& rIn, PptDocumentAtom& rAtom );
+};
+
+struct PptSlideLayoutAtom
+{
+ sal_Int32 eLayout; // 0..18
+ sal_uInt8 aPlaceholderId[ 8 ];
+ sal_uLong aPlacementId[ 8 ];
+
+public:
+ PptSlideLayoutAtom() { Clear(); }
+ void Clear();
+
+ // Das SlideLayoutAtom wird ohne Header eingelesen!
+ friend SvStream& operator>>( SvStream& rIn, PptSlideLayoutAtom& rAtom );
+};
+
+struct PptSlideAtom
+{
+ PptSlideLayoutAtom aLayout;
+ sal_uInt32 nMasterId;
+ sal_uInt32 nNotesId;
+ sal_uInt16 nFlags;
+
+public:
+ PptSlideAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>(SvStream& rIn, PptSlideAtom& rAtom);
+};
+
+struct PptSlidePersistAtom
+{
+ sal_uInt32 nPsrReference;
+ sal_uInt32 nFlags;
+ sal_uInt32 nNumberTexts;
+ sal_uInt32 nSlideId;
+ sal_uInt32 nReserved; // we will use nReserved temporarly to set the offset to SSSlideInfoAtom ( if possible )
+
+public:
+ PptSlidePersistAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>(SvStream& rIn, PptSlidePersistAtom& rAtom);
+};
+
+struct PptNotesAtom
+{
+ sal_uInt32 nSlideId;
+ sal_uInt16 nFlags;
+
+public:
+ PptNotesAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>(SvStream& rIn, PptNotesAtom& rAtom);
+};
+
+struct PptColorSchemeAtom
+{
+ sal_uInt8 aData[32];
+
+public:
+ PptColorSchemeAtom () { Clear(); }
+ void Clear();
+ Color GetColor( sal_uInt16 nNum ) const;
+
+ friend SvStream& operator>>(SvStream& rIn, PptColorSchemeAtom& rAtom);
+};
+
+struct PptFontEntityAtom
+{
+ OUString aName;
+ double fScaling;
+ sal_uInt8 lfClipPrecision;
+ sal_uInt8 lfQuality;
+
+ sal_uInt32 nUniqueFontId; // not used anymore
+ CharSet eCharSet;
+ FontFamily eFamily;
+ FontPitch ePitch;
+ sal_Bool bAvailable;
+
+ friend SvStream& operator>>(SvStream& rIn, PptFontEntityAtom& rAtom);
+};
+
+class PptFontCollection;
+struct PptUserEditAtom
+{
+ DffRecordHeader aHd;
+ sal_Int32 nLastSlideID; // ID of last visible slide
+ sal_uInt32 nVersion; // This is major/minor/build which did the edit
+ sal_uInt32 nOffsetLastEdit; // File offset of prev PptUserEditAtom
+ sal_uInt32 nOffsetPersistDirectory; // Offset to PersistPtrs for this file version.
+ sal_uInt32 nDocumentRef;
+ sal_uInt32 nMaxPersistWritten; // total number of Persist entries up to this point
+ sal_Int16 eLastViewType; // enum view type
+
+public:
+ PptUserEditAtom() : nOffsetPersistDirectory( 0 ) {}
+
+ friend SvStream& operator>>( SvStream& rIn, PptUserEditAtom& rAtom );
+};
+
+struct PptOEPlaceholderAtom
+{
+ sal_uInt32 nPlacementId;
+ sal_uInt8 nPlaceholderId;
+ sal_uInt8 nPlaceholderSize; // 0=Full size, 1=Half size, 2=Quarter of Slide
+
+public:
+ PptOEPlaceholderAtom() { Clear(); }
+ void Clear();
+
+ friend SvStream& operator>>( SvStream& rIn, PptOEPlaceholderAtom& rAtom );
+};
+
+struct ProcessData;
+struct PPTStyleSheet;
+struct HeaderFooterEntry;
+struct PptSlidePersistEntry
+{
+ PptSlidePersistAtom aPersistAtom;
+ PptSlideAtom aSlideAtom;
+ PptNotesAtom aNotesAtom;
+ PptColorSchemeAtom aColorScheme; // each slide includes this colorscheme atom
+ PPTStyleSheet* pStyleSheet; // stylesheet of this page ( only in masterpages ), since XP supports more than one masterpage
+
+ sal_uInt32 HeaderFooterOfs[ 4 ]; // containing the ofs to the placeholder (only masterpage)
+ HeaderFooterEntry* pHeaderFooterEntry;
+ SvxMSDffSolverContainer* pSolverContainer;
+ sal_uInt32 nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
+ sal_uInt32 nSlidePersistEndOffset;
+ sal_uInt32 nBackgroundOffset; // fileoffset
+ sal_uInt32 nDrawingDgId; // valid, if not -1
+ sal_uInt32* pPresentationObjects; // if valid, this is a pointer to an array that includes the offsets to the presentation objects
+ // on this masterpage for each instance ( 0 - 8 );
+ SdrObject* pBObj;
+ sal_Bool bBObjIsTemporary;
+
+ PptPageKind ePageKind; //
+
+ sal_Bool bNotesMaster : 1; // for NotesMaster
+ sal_Bool bHandoutMaster : 1; // for HandoutMaster
+ sal_Bool bStarDrawFiller : 1; // special for StarDraw
+public:
+ PptSlidePersistEntry();
+ ~PptSlidePersistEntry();
+ sal_uInt32 GetSlideId() const { return aPersistAtom.nSlideId; }
+};
+
+class _PptSlidePersistList : public std::vector<PptSlidePersistEntry*>
+{
+public:
+ ~_PptSlidePersistList()
+ {
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+ }
+};
+
+#define PPTSLIDEPERSIST_ENTRY_NOTFOUND 0xFFFF
+
+class MSFILTER_DLLPUBLIC PptSlidePersistList: public _PptSlidePersistList
+{
+public:
+ sal_uInt16 FindPage( sal_uInt32 nId ) const;
+};
+
+class SfxObjectShell;
+struct PPTOleEntry
+{
+ sal_uInt32 nId; // OleId
+ sal_uInt32 nPersistPtr; // PersistPtr
+ sal_uInt32 nRecHdOfs; // points to the record header: ExObjListHd
+ SfxObjectShell* pShell;
+ sal_uInt16 nType; // maybe PPT_PST_ExEmbed or PPT_PST_ExControl
+ sal_uInt32 nAspect; // the aspect of the OLE object
+
+ PPTOleEntry( sal_uInt32 nid, sal_uInt32 nOfs, SfxObjectShell* pSh, sal_uInt16 nT, sal_uInt32 nAsp ) :
+ nId ( nid ),
+ nRecHdOfs ( nOfs ),
+ pShell ( pSh ),
+ nType ( nT ),
+ nAspect ( nAsp ) {}
+};
+
+struct PptExOleObjAtom
+{
+ sal_uInt32 nAspect;
+ sal_uInt32 nId;
+ sal_uInt32 nPersistPtr;
+
+public:
+
+ friend SvStream& operator>>( SvStream& rIn, PptExOleObjAtom& rAtom );
+};
+
+typedef ::std::vector< PPTOleEntry* > PPTOleEntryList;
+class PPTExtParaProv;
+class MSFILTER_DLLPUBLIC SdrEscherImport : public SvxMSDffManager
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTPortionObj;
+ friend struct PPTStyleTextPropReader;
+ friend class ImplSdPPTImport;
+
+ PptDocumentAtom aDocAtom;
+ DffRecordManager aDocRecManager; // contains all first level container and atoms of the document container
+
+ PPTOleEntryList aOleObjectList; // contains PPTOleEntrys
+
+ PptFontCollection* pFonts;
+
+ sal_uInt32 nStreamLen;
+ sal_uInt16 nTextStylesIndex;
+
+ CharSet eCharSetSystem;
+
+ sal_Bool bWingdingsChecked : 1;
+ sal_Bool bWingdingsAvailable : 1;
+ sal_Bool bMonotypeSortsChecked : 1;
+ sal_Bool bMonotypeSortsAvailable : 1;
+ sal_Bool bTimesNewRomanChecked : 1;
+ sal_Bool bTimesNewRomanAvailable : 1;
+
+ sal_Bool ReadString( OUString& rStr ) const;
+ // nur fuer PowerPoint-Filter:
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
+
+public:
+ using SvxMSDffManager::ReadObjText;
+
+ PowerPointImportParam& rImportParam;
+
+ SdrEscherImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrEscherImport();
+ virtual bool GetColorFromPalette( sal_uInt16 nNum, Color& rColor ) const;
+ virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const;
+ PptFontEntityAtom* GetFontEnityAtom( sal_uInt32 nNum ) const;
+ void RecolorGraphic( SvStream& rSt, sal_uInt32 nRecLen, Graphic& rGraph );
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const;
+ virtual SdrObject* ProcessObj( SvStream& rSt, DffObjData& rData, void* pData, Rectangle& rTextRect, SdrObject* pObj );
+ virtual void ProcessClientAnchor2( SvStream& rSt, DffRecordHeader& rHd, void* pData, DffObjData& rObj );
+ void ImportHeaderFooterContainer( DffRecordHeader& rHeader, HeaderFooterEntry& rEntry );
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#define SD_HEADERFOOTER_DATE 1
+#define SD_HEADERFOOTER_TODAYDATE 2
+#define SD_HEADERFOOTER_USERDATE 4
+#define SD_HEADERFOOTER_SLIDENUMBER 8
+#define SD_HEADERFOOTER_HEADER 16
+#define SD_HEADERFOOTER_FOOTER 32
+
+class SvxFieldItem;
+struct MSFILTER_DLLPUBLIC PPTFieldEntry
+{
+ sal_uInt16 nPos;
+ sal_uInt16 nTextRangeEnd;
+ SvxFieldItem* pField1;
+ SvxFieldItem* pField2;
+ OUString* pString;
+
+ PPTFieldEntry() : nPos( 0 ), nTextRangeEnd( 0 ), pField1( NULL ), pField2( NULL ), pString( NULL ) {};
+ ~PPTFieldEntry();
+
+ void SetDateTime( sal_uInt32 nType );
+
+ // converting PPT date time format:
+ static void GetDateTime(
+ const sal_uInt32 nVal,
+ SvxDateFormat& eDateFormat,
+ SvxTimeFormat& eTimeFormat
+ );
+};
+
+struct MSFILTER_DLLPUBLIC HeaderFooterEntry
+{
+ const PptSlidePersistEntry* pMasterPersist;
+ OUString pPlaceholder[ 4 ];
+ sal_uInt32 nAtom;
+
+ sal_uInt32 GetMaskForInstance( sal_uInt32 nInstance );
+ sal_uInt32 IsToDisplay( sal_uInt32 nInstance );
+ sal_uInt32 NeedToImportInstance(
+ const sal_uInt32 nInstance,
+ const PptSlidePersistEntry& rSlidePersist
+ );
+
+ explicit HeaderFooterEntry( const PptSlidePersistEntry* pMaster = NULL );
+ ~HeaderFooterEntry();
+};
+
+struct ProcessData
+{
+ PptSlidePersistEntry& rPersistEntry;
+ SdPage* pPage;
+ ::std::vector< SdrObject* > aBackgroundColoredObjects;
+ sal_uInt32* pTableRowProperties;
+
+ ProcessData( PptSlidePersistEntry& rP, SdPage* pP ) :
+ rPersistEntry ( rP ),
+ pPage ( pP ),
+ pTableRowProperties ( NULL ) {};
+ ~ProcessData() { delete[] pTableRowProperties; };
+};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+
+typedef ::std::vector< SdHyperlinkEntry* > SdHyperlinkEntryList;
+class SdrTextObj;
+class SfxObjectShell;
+
+class MSFILTER_DLLPUBLIC SdrPowerPointImport : public SdrEscherImport
+{
+protected:
+
+ friend class PPTTextObj;
+ friend class PPTExtParaProv;
+ friend struct PPTStyleSheet;
+ friend class PPTNumberFormatCreator;
+
+ sal_Bool bOk;
+ PptUserEditAtom aUserEditAtom;
+ PptColorSchemeAtom aPageColors;
+ SdHyperlinkEntryList aHyperList;
+ sal_uInt32* pPersistPtr;
+ sal_uLong nPersistPtrAnz;
+
+ const PPTStyleSheet* pPPTStyleSheet; // this is the current stylesheet;
+ const PPTStyleSheet* pDefaultSheet; // this is a sheet we are using if no masterpage can be found, but that should
+ // never happen just preventing a crash
+ PptSlidePersistList* pMasterPages;
+ PptSlidePersistList* pSlidePages;
+ PptSlidePersistList* pNotePages;
+ sal_uInt16 nAktPageNum;
+ sal_uLong nDocStreamPos;
+ sal_uInt16 nPageColorsNum;
+ PptPageKind ePageColorsKind;
+ PptPageKind eAktPageKind;
+
+protected:
+ using SdrEscherImport::ReadObjText;
+
+ sal_Bool SeekToAktPage(DffRecordHeader* pRecHd=NULL) const;
+ sal_Bool SeekToDocument(DffRecordHeader* pRecHd=NULL) const;
+ sal_Bool SeekToContentOfProgTag(
+ sal_Int32 nVersion,
+ SvStream& rSt,
+ const DffRecordHeader& rProgTagBinaryDataHd,
+ DffRecordHeader& rContentHd
+ );
+ virtual SdrObject* ApplyTextObj(
+ PPTTextObj* pTextObj,
+ SdrTextObj* pText,
+ SdPage* pPage,
+ SfxStyleSheet*,
+ SfxStyleSheet** )
+ const;
+ virtual SdrObject* ReadObjText( PPTTextObj* pTextObj, SdrObject* pObj, SdPage* pPage ) const;
+ // #i32596# - new parameter <_nCalledByGroup>, which
+ // indicates, if the OLE object is imported inside a group object.
+ virtual SdrObject* ImportOLE(
+ long nOLEId,
+ const Graphic& rGraf,
+ const Rectangle& rBoundRect,
+ const Rectangle& rVisArea,
+ const int _nCalledByGroup,
+ sal_Int64 nAspect
+ ) const;
+ SvMemoryStream* ImportExOleObjStg( sal_uInt32 nPersistPtr, sal_uInt32& nOleId ) const;
+ SdrPage* MakeBlancPage(sal_Bool bMaster) const;
+ sal_Bool ReadFontCollection();
+ sal_Bool ForceFontCollection() const
+ { return pFonts!=NULL?sal_True:((SdrPowerPointImport*)this)->ReadFontCollection(); }
+ PptSlidePersistList* GetPageList(PptPageKind ePageKind) const;
+ sal_uInt32 GetAktPageId();
+ sal_uInt32 GetMasterPageId(sal_uInt16 nPageNum, PptPageKind ePageKind) const;
+ sal_uInt32 GetNotesPageId(sal_uInt16 nPageNum ) const;
+ SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const;
+ void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
+
+public:
+ SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
+ virtual ~SdrPowerPointImport();
+ sal_uInt16 GetPageCount( PptPageKind eKind = PPT_SLIDEPAGE ) const;
+ void SetPageNum( sal_uInt16 nPageNum, PptPageKind = PPT_SLIDEPAGE );
+ sal_uInt16 GetPageNum() const { return nAktPageNum; }
+ PptPageKind GetPageKind() const { return eAktPageKind; }
+ Size GetPageSize() const;
+ SdrObject* ImportPageBackgroundObject(
+ const SdrPage& rPage,
+ sal_uInt32& nBgFileOffset,
+ sal_Bool bForce
+ );
+ sal_Bool IsNoteOrHandout( sal_uInt16 nPageNum, PptPageKind ePageKind ) const;
+ sal_Bool HasMasterPage(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+ sal_uInt16 GetMasterPageIndex(
+ sal_uInt16 nPageNum,
+ PptPageKind ePageKind = PPT_SLIDEPAGE
+ ) const;
+
+ void ImportPage( SdrPage* pPage, const PptSlidePersistEntry* pMasterPersist = NULL );
+ virtual bool GetColorFromPalette(sal_uInt16 nNum, Color& rColor) const;
+ virtual sal_Bool SeekToShape( SvStream& rSt, void* pClientData, sal_uInt32 nId ) const;
+ sal_Unicode PPTSubstitute(
+ sal_uInt16 nFont,
+ sal_Unicode nChar,
+ sal_uInt32& nMappedFontId,
+ Font& rFont,
+ char nDefault
+ ) const;
+ const PptDocumentAtom& GetDocumentAtom() const { return aDocAtom; }
+ virtual const PptSlideLayoutAtom* GetSlideLayoutAtom() const;
+ SdrObject* CreateTable(
+ SdrObject* pGroupObject,
+ sal_uInt32* pTableArry,
+ SvxMSDffSolverContainer*
+ );
+ virtual bool ReadFormControl( SotStorageRef& rSrc1, com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rFormComp ) const = 0;
+};
+
+struct PPTTextCharacterStyleAtomInterpreter
+{
+ sal_uInt16 nFlags1;
+ sal_uInt16 nFlags2;
+ sal_uInt16 nFlags3;
+ sal_Int32 n1;
+ sal_uInt16 nFontHeight;
+ sal_Int32 nFontColor;
+
+ PPTTextCharacterStyleAtomInterpreter();
+ ~PPTTextCharacterStyleAtomInterpreter();
+
+ sal_Bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
+
+ sal_uInt32 GetColor( sal_uInt32 nDefault );
+};
+
+struct PPTTextParagraphStyleAtomInterpreter
+{
+ sal_Bool bValid;
+ sal_Bool bForbiddenRules;
+ sal_Bool bHangingPunctuation;
+ sal_Bool bLatinTextWrap;
+
+ PPTTextParagraphStyleAtomInterpreter();
+ ~PPTTextParagraphStyleAtomInterpreter();
+
+ sal_Bool Read( SvStream& rIn, const DffRecordHeader& rRecHd );
+};
+
+struct PPTTextSpecInfo
+{
+ sal_uInt32 nCharIdx;
+ sal_uInt16 nLanguage[ 3 ];
+ sal_uInt16 nDontKnow;
+
+ explicit PPTTextSpecInfo( sal_uInt32 nCharIdx );
+ ~PPTTextSpecInfo();
+};
+
+typedef ::std::vector< PPTTextSpecInfo* > PPTTextSpecInfoList;
+struct PPTTextSpecInfoAtomInterpreter
+{
+ sal_Bool bValid;
+ PPTTextSpecInfoList aList;
+
+ PPTTextSpecInfoAtomInterpreter();
+ ~PPTTextSpecInfoAtomInterpreter();
+
+ sal_Bool Read(
+ SvStream& rIn,
+ const DffRecordHeader& rRecHd,
+ sal_uInt16 nRecordType,
+ const PPTTextSpecInfo* pTextSpecDefault = NULL
+ );
+
+};
+
+#define PPT_STYLESHEETENTRYS 9
+
+struct PPTExtParaLevel
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mcfPP10Ext;
+ sal_Bool mbSet;
+
+ PPTExtParaLevel();
+ friend SvStream& operator>>( SvStream& rIn, PPTExtParaLevel& rL );
+};
+
+struct PPTExtParaSheet
+{
+ PPTExtParaLevel aExtParaLevel[ 5 ];
+};
+
+struct PPTBuGraEntry
+{
+ sal_uInt32 nInstance;
+ Graphic aBuGra;
+
+ PPTBuGraEntry( Graphic& rGraphic, sal_uInt32 nInstance );
+};
+
+typedef ::std::vector< PPTBuGraEntry* > PPTBuGraEntryList;
+
+class PPTExtParaProv
+{
+ PPTBuGraEntryList aBuGraList;
+
+public :
+ sal_Bool bStyles;
+ sal_Bool bGraphics;
+ DffRecordManager aExtendedPresRules;
+
+ PPTExtParaSheet aExtParaSheet[ PPT_STYLESHEETENTRYS ];
+
+ sal_Bool GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const;
+
+ PPTExtParaProv(
+ SdrPowerPointImport& rManager,
+ SvStream& rSt,
+ const DffRecordHeader* pMainMasterHd
+ );
+ ~PPTExtParaProv();
+};
+
+struct PPTCharLevel
+{
+ Color mnFontColorInStyleSheet;
+ sal_uInt32 mnFontColor;
+ sal_uInt16 mnFlags;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+};
+
+struct PPTCharSheet
+{
+ PPTCharLevel maCharLevel[ 5 ];
+
+ explicit PPTCharSheet( sal_uInt32 nInstance );
+ PPTCharSheet( const PPTCharSheet& rCharSheet );
+
+ void Read( SvStream& rIn, sal_Bool bMasterStyle, sal_uInt32 nLevel, sal_Bool bFirst );
+};
+
+struct PPTParaLevel
+{
+ sal_uInt16 mnBuFlags;
+ sal_uInt16 mnBulletChar;
+ sal_uInt16 mnBulletFont;
+ sal_uInt16 mnBulletHeight;
+ sal_uInt32 mnBulletColor;
+
+ sal_uInt16 mnAdjust;
+ sal_uInt16 mnLineFeed;
+ sal_uInt16 mnUpperDist;
+ sal_uInt16 mnLowerDist;
+ sal_uInt16 mnTextOfs;
+ sal_uInt16 mnBulletOfs;
+ sal_uInt16 mnDefaultTab;
+ sal_uInt16 mnAsianLineBreak; // bit0: use asian rules for first and last character
+ // 1: do not wrap latin text in the middle of the word
+ // 2: allow hanging punctuation
+ sal_uInt16 mnBiDi;
+};
+
+struct PPTParaSheet
+{
+public:
+
+ PPTParaLevel maParaLevel[ 5 ];
+
+ explicit PPTParaSheet( sal_uInt32 nInstance );
+ PPTParaSheet( const PPTParaSheet& rParaSheet );
+
+ void Read(
+ SdrPowerPointImport& rMan,
+ SvStream& rIn,
+ sal_Bool bMasterStyle,
+ sal_uInt32 nLevel,
+ sal_Bool bFirst
+ );
+ void UpdateBulletRelSize( sal_uInt32 nLevel, sal_uInt16 nFontHeight );
+};
+
+class PPTParagraphObj;
+class PPTNumberFormatCreator
+{
+ sal_uInt32 nIsBullet;
+ sal_uInt32 nBulletChar;
+ sal_uInt32 nBulletFont;
+ sal_uInt32 nBulletHeight;
+ sal_uInt32 nBulletColor;
+ sal_uInt32 nTextOfs;
+ sal_uInt32 nBulletOfs;
+
+ void ImplGetNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel
+ );
+ sal_Bool ImplGetExtNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ sal_uInt32 nInstance,
+ sal_uInt32 nInstanceInSheet,
+ boost::optional< sal_Int16 >& rStartNumbering,
+ sal_uInt32 nFontHeight,
+ PPTParagraphObj* pPara
+ );
+
+protected:
+
+ PPTNumberFormatCreator( PPTExtParaProv* );
+ ~PPTNumberFormatCreator();
+
+public:
+
+ PPTExtParaProv* pExtParaProv;
+
+ void GetNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ sal_uInt32 nLevel,
+ const PPTParaLevel& rParaLevel,
+ const PPTCharLevel& rCharLevel,
+ sal_uInt32 nInstance
+ );
+
+ sal_Bool GetNumberFormat(
+ SdrPowerPointImport& rMan,
+ SvxNumberFormat& rNumberFormat,
+ PPTParagraphObj* pPara,
+ sal_uInt32 nInstanceInSheet,
+ boost::optional< sal_Int16 >& rStartNumbering
+ );
+};
+
+class SvxNumBulletItem;
+struct PPTStyleSheet : public PPTNumberFormatCreator
+{
+ PPTTextSpecInfo maTxSI;
+ PPTCharSheet* mpCharSheet[ PPT_STYLESHEETENTRYS ];
+ PPTParaSheet* mpParaSheet[ PPT_STYLESHEETENTRYS ];
+ SvxNumBulletItem* mpNumBulletItem[ PPT_STYLESHEETENTRYS ];
+
+ PPTStyleSheet(
+ const DffRecordHeader& rSlideHd,
+ SvStream& rSt, SdrPowerPointImport&,
+ const PPTTextCharacterStyleAtomInterpreter&,
+ const PPTTextParagraphStyleAtomInterpreter&,
+ const PPTTextSpecInfo&
+ );
+ ~PPTStyleSheet();
+};
+
+struct ImplPPTParaPropSet
+{
+ sal_uInt32 mnRefCount;
+
+ sal_uInt16 mnDepth;
+ sal_uInt32 mnAttrSet;
+ sal_uInt32 mnBulletColor;
+ sal_uInt16 mpArry[ 22 ];
+
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt16 mnHasAnm;
+ sal_uInt16 mnBuBlip;
+
+ sal_uInt32 nDontKnow1;
+ sal_uInt32 nDontKnow2;
+ sal_uInt16 nDontKnow2bit06;
+
+ ImplPPTParaPropSet()
+ { mnRefCount = 1; mnAttrSet = 0; mnExtParagraphMask = 0; mnDepth = 0; };
+};
+
+struct PPTParaPropSet
+{
+ sal_uInt32 mnOriginalTextPos;
+ ImplPPTParaPropSet* pParaSet;
+
+ PPTParaPropSet();
+ PPTParaPropSet( PPTParaPropSet& rParaPropSet );
+ ~PPTParaPropSet();
+
+ PPTParaPropSet& operator=( PPTParaPropSet& rParaPropSet );
+};
+
+struct ImplPPTCharPropSet
+{
+ sal_uInt32 mnRefCount;
+
+ sal_uInt32 mnAttrSet;
+ sal_uInt16 mnFlags;
+ sal_uInt32 mnColor;
+ sal_uInt16 mnFont;
+ sal_uInt16 mnAsianOrComplexFont;
+ sal_uInt16 mnANSITypeface;
+ sal_uInt16 mnFontHeight;
+ sal_uInt16 mnEscapement;
+ sal_uInt16 mnSymbolFont;
+
+ ImplPPTCharPropSet(){ mnRefCount = 1; mnAttrSet = 0; };
+};
+
+struct PPTCharPropSet
+{
+ //when the bullet text has more than two color,next the text following with bullet has been set hyperlink.
+ //now,the bullet color should be set original hyperlink text's color
+ //so "mbHardHylinkOrigColor" hold the original hyperlink text's color.
+ sal_uInt32 mnHylinkOrigColor;
+ //the bullet text weather has a hyperlink.
+ sal_Bool mbIsHyperlink;
+ //the hyperlink text weather has a custom color.
+ sal_Bool mbHardHylinkOrigColor;
+
+ sal_uInt32 mnOriginalTextPos;
+ sal_uInt32 mnParagraph;
+ OUString maString;
+ SvxFieldItem* mpFieldItem;
+ sal_uInt16 mnLanguage[ 3 ];
+
+ ImplPPTCharPropSet* pCharSet;
+
+ void SetFont( sal_uInt16 nFont );
+ void SetColor( sal_uInt32 nColor );
+
+ explicit PPTCharPropSet( sal_uInt32 nParagraph );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet );
+ PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 nParagraph );
+ ~PPTCharPropSet();
+
+ PPTCharPropSet& operator=( const PPTCharPropSet& rCharPropSet );
+
+private:
+ void ImplMakeUnique();
+};
+
+struct PPTTabEntry
+{
+ sal_uInt16 nOffset;
+ sal_uInt16 nStyle;
+};
+
+struct PPTRuler
+{
+ sal_uInt32 nRefCount;
+
+ sal_Int32 nFlags;
+ sal_uInt16 nDefaultTab;
+ sal_uInt16 nTextOfs[ 5 ];
+ sal_uInt16 nBulletOfs[ 5 ];
+ PPTTabEntry* pTab;
+ sal_uInt16 nTabCount;
+
+ PPTRuler();
+ ~PPTRuler();
+};
+
+struct PPTTextRulerInterpreter
+{
+ PPTRuler *mpImplRuler;
+
+ PPTTextRulerInterpreter();
+ PPTTextRulerInterpreter( PPTTextRulerInterpreter& rRuler );
+ PPTTextRulerInterpreter(
+ sal_uInt32 nFileOfs,
+ SdrPowerPointImport&,
+ DffRecordHeader& rHd,
+ SvStream& rIn
+ );
+ ~PPTTextRulerInterpreter();
+
+ sal_uInt16 GetTabOffsetByIndex( sal_uInt16 nIndex ) const
+ { return mpImplRuler->pTab[ nIndex ].nOffset; };
+
+ sal_uInt16 GetTabStyleByIndex( sal_uInt16 nIndex ) const
+ { return mpImplRuler->pTab[ nIndex ].nStyle; };
+
+ sal_uInt16 GetTabCount() const { return mpImplRuler->nTabCount; };
+ sal_Bool GetDefaultTab( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+ sal_Bool GetTextOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+ sal_Bool GetBulletOfs( sal_uInt32 nLevel, sal_uInt16& nValue ) const;
+
+ PPTTextRulerInterpreter& operator=( PPTTextRulerInterpreter& rRuler );
+};
+
+#define PPT_SPEC_NEWLINE 0x10000
+#define PPT_SPEC_SYMBOL 0x20000
+#define PPT_SPEC_USE_STARBATS 0x40000
+
+struct StyleTextProp9
+{
+ sal_uInt32 mnExtParagraphMask;
+ sal_uInt16 mnBuBlip;
+ sal_uInt16 mnHasAnm;
+ sal_uInt32 mnAnmScheme;
+ sal_uInt32 mpfPP10Ext;
+ sal_uInt32 mnExtCharacterMask;
+ sal_uInt32 mncfPP10Ext;
+ sal_uInt32 mnSpecialInfoMask;
+ sal_uInt32 mnPP10Ext;
+ sal_uInt16 mfBidi;
+
+ StyleTextProp9()
+ : mnExtParagraphMask( 0 )
+ , mnBuBlip( 0 )
+ , mnHasAnm( 0 )
+ , mnAnmScheme( 0 )
+ , mpfPP10Ext( 0 )
+ , mnExtCharacterMask( 0 )
+ , mncfPP10Ext( 0 )
+ , mnSpecialInfoMask( 0 )
+ , mnPP10Ext( 0 )
+ , mfBidi( 0 )
+ {
+ }
+ void Read( SvStream& rSt );
+};
+
+typedef std::vector<PPTParaPropSet*> PPTParaPropSetList;
+typedef std::vector<PPTCharPropSet*> PPTCharPropSetList;
+
+struct PPTStyleTextPropReader
+{
+ std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
+ PPTParaPropSetList aParaPropList;
+ PPTCharPropSetList aCharPropList;
+
+ PPTStyleTextPropReader(
+ SvStream& rIn,
+ SdrPowerPointImport&,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter& rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ sal_uInt32 nTextInstance
+ );
+ ~PPTStyleTextPropReader();
+
+ void Init(
+ SvStream& rIn,
+ SdrPowerPointImport&,
+ const DffRecordHeader& rClientTextBoxHd,
+ PPTTextRulerInterpreter& rInterpreter,
+ const DffRecordHeader& rExtParaHd,
+ sal_uInt32 nTextInstance
+ );
+ void ReadParaProps(
+ SvStream& rIn,
+ SdrPowerPointImport& rMan,
+ const DffRecordHeader& rTextHeader,
+ const OUString& aString,
+ PPTTextRulerInterpreter& rRuler,
+ sal_uInt32& nCharCount,
+ sal_Bool& bTextPropAtom
+ );
+ void ReadCharProps(
+ SvStream& rIn,
+ PPTCharPropSet& aCharPropSet,
+ const OUString& aString,
+ sal_uInt32& nCharCount,
+ sal_uInt32 nCharAnzRead,
+ sal_Bool& bTextPropAtom,
+ sal_uInt32 nExtParaPos,
+ const std::vector< StyleTextProp9 >& aStyleTextProp9,
+ sal_uInt32& nExtParaFlags,
+ sal_uInt16& nBuBlip,
+ sal_uInt16& nHasAnm,
+ sal_uInt32& nAnmScheme
+ );
+};
+
+class SvxFieldItem;
+class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
+{
+
+ friend class PPTParagraphObj;
+
+ const PPTStyleSheet& mrStyleSheet;
+ sal_uInt32 mnInstance;
+ sal_uInt32 mnDepth;
+
+public:
+
+ sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ) const;
+ SvxFieldItem* GetTextField();
+
+ PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth );
+ PPTPortionObj(
+ const PPTCharPropSet&,
+ const PPTStyleSheet&,
+ sal_uInt32 nInstance,
+ sal_uInt32 nDepth
+ );
+ PPTPortionObj( const PPTPortionObj& );
+ ~PPTPortionObj();
+
+ // the following function should be removed during next full update
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ sal_uInt32 nInstanceInSheet
+ );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ SdrPowerPointImport& rManager,
+ sal_uInt32 nInstanceInSheet,
+ const PPTTextObj* pTextObj
+ );
+ sal_uInt32 Count() const { return ( mpFieldItem ) ? 1 : maString.getLength(); };
+ sal_Bool HasTabulator();
+};
+
+class MSFILTER_DLLPUBLIC PPTParagraphObj
+ : public PPTParaPropSet,
+ public PPTNumberFormatCreator,
+ public PPTTextRulerInterpreter
+{
+ friend class PPTTextObj;
+ friend class PPTNumberFormatCreator;
+
+ const PPTStyleSheet& mrStyleSheet;
+ sal_uInt32 mnInstance;
+
+protected:
+
+ void ImplClear();
+
+public:
+
+ sal_Bool mbTab; // if true, this paragraph has tabulators in text
+
+ sal_uInt32 mnCurrentObject;
+ ::boost::ptr_vector<PPTPortionObj> m_PortionList;
+
+ void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
+ sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
+
+ PPTParagraphObj(
+ const PPTStyleSheet&,
+ sal_uInt32 nInstance,
+ sal_uInt16 nDepth
+ );
+ PPTParagraphObj(
+ PPTStyleTextPropReader&,
+ size_t nCurParaPos,
+ size_t& rnCurCharPos,
+ const PPTStyleSheet&,
+ sal_uInt32 nInstance,
+ PPTTextRulerInterpreter& rRuler
+ );
+ ~PPTParagraphObj();
+
+ sal_uInt32 GetTextSize();
+ PPTPortionObj* First();
+ PPTPortionObj* Next();
+
+ void AppendPortion( PPTPortionObj& rPortion );
+ void ApplyTo(
+ SfxItemSet& rSet,
+ boost::optional< sal_Int16 >& rStartNumbering,
+ SdrPowerPointImport& rManager,
+ sal_uInt32 nInstanceInSheet,
+ const PPTParagraphObj* pPrev
+ );
+};
+
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT 1
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER 2
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT 4
+#define PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK 8
+#define PPT_TEXTOBJ_FLAGS_VERTICAL 16
+
+struct ImplPPTTextObj
+{
+ sal_uInt32 mnRefCount;
+ sal_uInt32 mnShapeId;
+ sal_uInt32 mnShapeMaster;
+ PptOEPlaceholderAtom* mpPlaceHolderAtom;
+ sal_uInt16 mnInstance;
+ sal_uInt16 mnDestinationInstance;
+ MSO_SPT meShapeType;
+
+ sal_uInt32 mnCurrentObject;
+ sal_uInt32 mnParagraphCount;
+ PPTParagraphObj** mpParagraphList;
+ PptSlidePersistEntry& mrPersistEntry;
+
+ sal_uInt32 mnTextFlags;
+
+ explicit ImplPPTTextObj( PptSlidePersistEntry& rPersistEntry ) : mrPersistEntry ( rPersistEntry ) {};
+};
+
+class PPTTextObj
+{
+ ImplPPTTextObj* mpImplTextObj;
+ void ImplClear();
+
+ PPTTextObj(){};
+public:
+ PPTTextObj(
+ SvStream& rSt,
+ SdrPowerPointImport&,
+ PptSlidePersistEntry&,
+ DffObjData*
+ );
+ PPTTextObj( PPTTextObj& rTextObj );
+ ~PPTTextObj();
+
+ sal_uInt32 GetCurrentIndex() const { return mpImplTextObj->mnCurrentObject; };
+ sal_uInt32 Count() const { return mpImplTextObj->mnParagraphCount; };
+ PPTParagraphObj* First();
+ PPTParagraphObj* Next();
+ MSO_SPT GetShapeType() const { return mpImplTextObj->meShapeType; };
+ sal_uInt32 GetInstance() const { return mpImplTextObj->mnInstance; };
+ void SetInstance( sal_uInt16 nInstance )
+ { mpImplTextObj->mnInstance = nInstance; }
+
+ sal_uInt32 GetDestinationInstance() const
+ { return mpImplTextObj->mnDestinationInstance; }
+
+ void SetDestinationInstance( sal_uInt16 nInstance )
+ { mpImplTextObj->mnDestinationInstance = nInstance; }
+
+ PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mpImplTextObj->mpPlaceHolderAtom; }
+ sal_uInt32 GetTextFlags() const { return mpImplTextObj->mnTextFlags; }
+ void SetVertical( sal_Bool bVertical )
+ {
+ if ( bVertical )
+ mpImplTextObj->mnTextFlags |= PPT_TEXTOBJ_FLAGS_VERTICAL;
+ else
+ mpImplTextObj->mnTextFlags &= ~PPT_TEXTOBJ_FLAGS_VERTICAL;
+ }
+ sal_Bool GetVertical() const
+ { return ( mpImplTextObj->mnTextFlags & PPT_TEXTOBJ_FLAGS_VERTICAL ) != 0; }
+
+ const SfxItemSet* GetBackground() const;
+
+ PPTTextObj& operator=( PPTTextObj& rTextObj );
+};
+
+class PPTConvertOCXControls : public SvxMSConvertOCXControls
+{
+ virtual const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > & GetDrawPage();
+ PptPageKind ePageKind;
+ const SdrPowerPointImport* mpPPTImporter;
+ com::sun::star::uno::Reference< com::sun::star::io::XInputStream > mxInStrm;
+public :
+
+ PPTConvertOCXControls( const SdrPowerPointImport* pPPTImporter, com::sun::star::uno::Reference< com::sun::star::io::XInputStream >& rxInStrm, const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rxModel, PptPageKind ePKind ) :
+ SvxMSConvertOCXControls ( rxModel ),
+ ePageKind ( ePKind ),
+ mpPPTImporter ( pPPTImporter ),
+ mxInStrm ( rxInStrm )
+ {};
+ virtual sal_Bool ReadOCXStream( SotStorageRef& rSrc1,
+ com::sun::star::uno::Reference<
+ com::sun::star::drawing::XShape > *pShapeRef=0,
+ sal_Bool bFloatingCtrl=sal_False );
+ virtual sal_Bool InsertControl(
+ const com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > &rFComp,
+ const com::sun::star::awt::Size& rSize,
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > *pShape,
+ sal_Bool bFloatingCtrl
+ );
+};
+
+// Powerpoint Recordtypen
+#define PPT_PST_Unknown 0
+#define PPT_PST_SubContainerCompleted 1
+#define PPT_PST_IRRAtom 2
+#define PPT_PST_PSS 3
+#define PPT_PST_SubContainerException 4
+#define PPT_PST_ClientSignal1 6
+#define PPT_PST_ClientSignal2 7
+#define PPT_PST_PowerPointStateInfoAtom 10
+#define PPT_PST_Document 1000
+#define PPT_PST_DocumentAtom 1001
+#define PPT_PST_EndDocument 1002
+#define PPT_PST_SlidePersist 1003
+#define PPT_PST_SlideBase 1004
+#define PPT_PST_SlideBaseAtom 1005
+#define PPT_PST_Slide 1006
+#define PPT_PST_SlideAtom 1007
+#define PPT_PST_Notes 1008
+#define PPT_PST_NotesAtom 1009
+#define PPT_PST_Environment 1010
+#define PPT_PST_SlidePersistAtom 1011
+#define PPT_PST_Scheme 1012
+#define PPT_PST_SchemeAtom 1013
+#define PPT_PST_DocViewInfo 1014
+#define PPT_PST_SslideLayoutAtom 1015
+#define PPT_PST_MainMaster 1016
+#define PPT_PST_SSSlideInfoAtom 1017
+#define PPT_PST_SlideViewInfo 1018
+#define PPT_PST_GuideAtom 1019
+#define PPT_PST_ViewInfo 1020
+#define PPT_PST_ViewInfoAtom 1021
+#define PPT_PST_SlideViewInfoAtom 1022
+#define PPT_PST_VBAInfo 1023
+#define PPT_PST_VBAInfoAtom 1024
+#define PPT_PST_SSDocInfoAtom 1025
+#define PPT_PST_Summary 1026
+#define PPT_PST_Texture 1027
+#define PPT_PST_VBASlideInfo 1028
+#define PPT_PST_VBASlideInfoAtom 1029
+#define PPT_PST_DocRoutingSlip 1030
+#define PPT_PST_OutlineViewInfo 1031
+#define PPT_PST_SorterViewInfo 1032
+#define PPT_PST_ExObjList 1033
+#define PPT_PST_ExObjListAtom 1034
+#define PPT_PST_PPDrawingGroup 1035
+#define PPT_PST_PPDrawing 1036
+#define PPT_PST_NewlyAddedAtomByXP1037 1037
+#define PPT_PST_NamedShows 1040
+#define PPT_PST_NamedShow 1041
+#define PPT_PST_NamedShowSlides 1042
+#define PPT_PST_List 2000
+#define PPT_PST_FontCollection 2005
+#define PPT_PST_ListPlaceholder 2017
+#define PPT_PST_BookmarkCollection 2019
+#define PPT_PST_SoundCollection 2020
+#define PPT_PST_SoundCollAtom 2021
+#define PPT_PST_Sound 2022
+#define PPT_PST_SoundData 2023
+#define PPT_PST_BookmarkSeedAtom 2025
+#define PPT_PST_GuideList 2026
+#define PPT_PST_RunArray 2028
+#define PPT_PST_RunArrayAtom 2029
+#define PPT_PST_ArrayElementAtom 2030
+#define PPT_PST_Int4ArrayAtom 2031
+#define PPT_PST_ColorSchemeAtom 2032
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedBuGraContainer 2040 // consist of 4041
+#define PPT_PST_ExtendedBuGraAtom 2041 // the instance of this atom indices the current graphic
+
+#define PPT_PST_OEShape 3008
+#define PPT_PST_ExObjRefAtom 3009
+#define PPT_PST_OEPlaceholderAtom 3011
+#define PPT_PST_GrColor 3020
+#define PPT_PST_GrectAtom 3025
+#define PPT_PST_GratioAtom 3031
+#define PPT_PST_Gscaling 3032
+#define PPT_PST_GpointAtom 3034
+#define PPT_PST_OEShapeAtom 3035
+#define PPT_PST_OutlineTextRefAtom 3998
+#define PPT_PST_TextHeaderAtom 3999
+#define PPT_PST_TextCharsAtom 4000
+#define PPT_PST_StyleTextPropAtom 4001
+#define PPT_PST_BaseTextPropAtom 4002
+#define PPT_PST_TxMasterStyleAtom 4003
+#define PPT_PST_TxCFStyleAtom 4004
+#define PPT_PST_TxPFStyleAtom 4005
+#define PPT_PST_TextRulerAtom 4006
+#define PPT_PST_TextBookmarkAtom 4007
+#define PPT_PST_TextBytesAtom 4008
+#define PPT_PST_TxSIStyleAtom 4009
+#define PPT_PST_TextSpecInfoAtom 4010
+#define PPT_PST_DefaultRulerAtom 4011
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_ExtendedParagraphAtom 4012
+#define PPT_PST_ExtendedParagraphMasterAtom 4013
+#define PPT_PST_ExtendedPresRuleContainer 4014 // consist of 4012, 4015,
+#define PPT_PST_ExtendedParagraphHeaderAtom 4015 // the instance of this atom indices the current presobj
+ // the first sal_uInt32 in this atom indices the current slideId
+#define PPT_PST_NewlyAddedAtom4016 4016
+
+#define PPT_PST_FontEntityAtom 4023
+#define PPT_PST_FontEmbedData 4024
+#define PPT_PST_TypeFace 4025
+#define PPT_PST_CString 4026
+#define PPT_PST_ExternalObject 4027
+#define PPT_PST_MetaFile 4033
+#define PPT_PST_ExOleObj 4034
+#define PPT_PST_ExOleObjAtom 4035
+#define PPT_PST_ExPlainLinkAtom 4036
+#define PPT_PST_CorePict 4037
+#define PPT_PST_CorePictAtom 4038
+#define PPT_PST_ExPlainAtom 4039
+#define PPT_PST_SrKinsoku 4040
+#define PPT_PST_Handout 4041
+#define PPT_PST_ExEmbed 4044
+#define PPT_PST_ExEmbedAtom 4045
+#define PPT_PST_ExLink 4046
+#define PPT_PST_ExLinkAtom_old 4047
+#define PPT_PST_BookmarkEntityAtom 4048
+#define PPT_PST_ExLinkAtom 4049
+#define PPT_PST_SrKinsokuAtom 4050
+#define PPT_PST_ExHyperlinkAtom 4051
+#define PPT_PST_ExPlain 4053
+#define PPT_PST_ExPlainLink 4054
+#define PPT_PST_ExHyperlink 4055
+#define PPT_PST_SlideNumberMCAtom 4056
+#define PPT_PST_HeadersFooters 4057
+#define PPT_PST_HeadersFootersAtom 4058
+#define PPT_PST_RecolorEntryAtom 4062
+#define PPT_PST_TxInteractiveInfoAtom 4063
+#define PPT_PST_EmFormatAtom 4065
+#define PPT_PST_CharFormatAtom 4066
+#define PPT_PST_ParaFormatAtom 4067
+#define PPT_PST_MasterText 4068
+#define PPT_PST_RecolorInfoAtom 4071
+#define PPT_PST_ExQuickTime 4073
+#define PPT_PST_ExQuickTimeMovie 4074
+#define PPT_PST_ExQuickTimeMovieData 4075
+#define PPT_PST_ExSubscription 4076
+#define PPT_PST_ExSubscriptionSection 4077
+#define PPT_PST_ExControl 4078
+#define PPT_PST_ExControlAtom 4091
+#define PPT_PST_SlideListWithText 4080
+#define PPT_PST_AnimationInfoAtom 4081
+#define PPT_PST_InteractiveInfo 4082
+#define PPT_PST_InteractiveInfoAtom 4083
+#define PPT_PST_SlideList 4084
+#define PPT_PST_UserEditAtom 4085
+#define PPT_PST_CurrentUserAtom 4086
+#define PPT_PST_DateTimeMCAtom 4087
+#define PPT_PST_GenericDateMCAtom 4088
+#define PPT_PST_HeaderMCAtom 4089
+#define PPT_PST_FooterMCAtom 4090
+#define PPT_PST_ExMediaAtom 4100
+#define PPT_PST_ExVideo 4101
+#define PPT_PST_ExAviMovie 4102
+#define PPT_PST_ExMCIMovie 4103
+#define PPT_PST_ExMIDIAudio 4109
+#define PPT_PST_ExCDAudio 4110
+#define PPT_PST_ExWAVAudioEmbedded 4111
+#define PPT_PST_ExWAVAudioLink 4112
+#define PPT_PST_ExOleObjStg 4113
+#define PPT_PST_ExCDAudioAtom 4114
+#define PPT_PST_ExWAVAudioEmbeddedAtom 4115
+#define PPT_PST_AnimationInfo 4116
+#define PPT_PST_RTFDateTimeMCAtom 4117
+#define PPT_PST_ProgTags 5000
+#define PPT_PST_ProgStringTag 5001
+#define PPT_PST_ProgBinaryTag 5002
+#define PPT_PST_BinaryTagData 5003
+#define PPT_PST_PrintOptions 6000
+#define PPT_PST_PersistPtrFullBlock 6001
+#define PPT_PST_PersistPtrIncrementalBlock 6002
+
+// these atoms first was seen in ppt2000 in a private Tag atom
+#define PPT_PST_NewlyAddedAtomByPPT2000_6010 6010
+#define PPT_PST_NewlyAddedAtomByPPT2000_6011 6011
+
+#define PPT_PST_RulerIndentAtom 10000
+#define PPT_PST_GscalingAtom 10001
+#define PPT_PST_GrColorAtom 10002
+#define PPT_PST_GLPointAtom 10003
+#define PPT_PST_GlineAtom 10004
+
+#define PPT_PST_NewlyAddedAtomByXP11008 11008
+#define PPT_PST_NewlyAddedAtomByXP11010 11010
+#define PPT_PST_Comment10 12000
+#define PPT_PST_CommentAtom10 12001
+#define PPT_PST_NewlyAddedAtomByXP12004 12004
+#define PPT_PST_NewlyAddedAtomByXP12010 12010
+#define PPT_PST_NewlyAddedAtomByXP12011 12011
+#define PPT_PST_NewlyAddedAtomByXP14001 14001
+
+// Attribute fuer PptTextStyleSheet
+#define PPT_ParaAttr_BulletOn 0 //00000001
+#define PPT_ParaAttr_BuHardFont 1 //00000002
+#define PPT_ParaAttr_BuHardColor 2 //00000004
+#define PPT_ParaAttr_BuHardHeight 3 //00000008
+#define PPT_ParaAttr_BulletFont 4 //00000010
+#define PPT_ParaAttr_BulletColor 5 //00000020
+#define PPT_ParaAttr_BulletHeight 6 //00000040
+#define PPT_ParaAttr_BulletChar 7 //00000080
+#define PPT_ParaAttr_DontKnow1 8 //00000100
+#define PPT_ParaAttr_DontKnow2 9 //00000200
+#define PPT_ParaAttr_DontKnow3 10 //00000400
+#define PPT_ParaAttr_Adjust 11 //00000800 0000=Left, 0001=Center, 0002=Right, 0003=Block
+#define PPT_ParaAttr_LineFeed 12 //00001000
+#define PPT_ParaAttr_UpperDist 13 //00002000 ist bei Textframes default immer auf 0032 gesetzt
+#define PPT_ParaAttr_LowerDist 14 //00004000
+#define PPT_ParaAttr_TextOfs 15 //00008000
+#define PPT_ParaAttr_BulletOfs 16 //00010000
+#define PPT_ParaAttr_DefaultTab 17 //00020000
+#define PPT_ParaAttr_AsianLB_1 18
+#define PPT_ParaAttr_AsianLB_2 19
+#define PPT_ParaAttr_AsianLB_3 20
+#define PPT_ParaAttr_BiDi 21 //00200000
+
+#define PPT_CharAttr_Bold 0 //00000001
+#define PPT_CharAttr_Italic 1 //00000002
+#define PPT_CharAttr_Underline 2 //00000004
+#define PPT_CharAttr_Shadow 4 //00000010
+#define PPT_CharAttr_Strikeout 8 //00000100
+#define PPT_CharAttr_Embossed 9 //00000200
+#define PPT_CharAttr_ResetNumbering 10 //00000400
+#define PPT_CharAttr_EnableNumbering1 11 //00000800
+#define PPT_CharAttr_EnableNumbering2 12 //00001000
+#define PPT_CharAttr_Font 16 //00010000
+#define PPT_CharAttr_AsianOrComplexFont 21 //00200000
+#define PPT_CharAttr_ANSITypeface 22 //00400000
+#define PPT_CharAttr_Symbol 23 //00800000
+#define PPT_CharAttr_FontHeight 17 //00020000
+#define PPT_CharAttr_FontColor 18 //00040000
+#define PPT_CharAttr_Escapement 19 //00080000
+
+// Werte fuer PptSlideLayoutAtom.eLayout
+#define PPT_LAYOUT_TITLESLIDE 0 // The slide is a title slide
+#define PPT_LAYOUT_TITLEANDBODYSLIDE 1 // Title and body slide
+#define PPT_LAYOUT_TITLEMASTERSLIDE 2 // Title master slide
+#define PPT_LAYOUT_MASTERSLIDE 3 // Master slide layout
+#define PPT_LAYOUT_MASTERNOTES 4 // Master notes layout
+#define PPT_LAYOUT_NOTESTITLEBODY 5 // Notes title/body layout
+#define PPT_LAYOUT_HANDOUTLAYOUT 6 // Handout layout, therefore it doesn't have placeholders except header, footer, and date
+#define PPT_LAYOUT_ONLYTITLE 7 // Only title placeholder
+#define PPT_LAYOUT_2COLUMNSANDTITLE 8 // Body of the slide has 2 columns and a title
+#define PPT_LAYOUT_2ROWSANDTITLE 9 // Slide's body has 2 rows and a title
+#define PPT_LAYOUT_RIGHTCOLUMN2ROWS 10 // Body contains 2 columns, right column has 2 rows
+#define PPT_LAYOUT_LEFTCOLUMN2ROWS 11 // Body contains 2 columns, left column has 2 rows
+#define PPT_LAYOUT_BOTTOMROW2COLUMNS 12 // Body contains 2 rows, bottom row has 2 columns
+#define PPT_LAYOUT_TOPROW2COLUMN 13 // Body contains 2 rows, top row has 2 columns
+#define PPT_LAYOUT_4OBJECTS 14 // 4 objects
+#define PPT_LAYOUT_BIGOBJECT 15 // Big object
+#define PPT_LAYOUT_BLANCSLIDE 16 // Blank slide
+#define PPT_LAYOUT_TITLERIGHTBODYLEFT 17 // Vertical title on the right, body on the left
+#define PPT_LAYOUT_TITLERIGHT2BODIESLEFT 18 // Vertical title on the right, body on the left split into 2 rows
+
+// the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
+#define PPT_PLACEHOLDER_NONE 0 // 0 None
+#define PPT_PLACEHOLDER_MASTERTITLE 1 // 1 Master title
+#define PPT_PLACEHOLDER_MASTERBODY 2 // 2 Master body
+#define PPT_PLACEHOLDER_MASTERCENTEREDTITLE 3 // 3 Master centered title
+#define PPT_PLACEHOLDER_MASTERSUBTITLE 4 // 10 Master subtitle
+#define PPT_PLACEHOLDER_MASTERNOTESSLIDEIMAGE 5 // 4 Master notes slide image
+#define PPT_PLACEHOLDER_MASTERNOTESBODYIMAGE 6 // 5 Master notes body image
+#define PPT_PLACEHOLDER_MASTERDATE 7 // 6 Master date
+#define PPT_PLACEHOLDER_MASTERSLIDENUMBER 8 // 7 Master slide number
+#define PPT_PLACEHOLDER_MASTERFOOTER 9 // 8 Master footer
+#define PPT_PLACEHOLDER_MASTERHEADER 10 // 9 Master header
+#define PPT_PLACEHOLDER_GENERICTEXTOBJECT // 11 Generic text object
+#define PPT_PLACEHOLDER_TITLE 13 // 12 Title
+#define PPT_PLACEHOLDER_BODY 14 // 13 Body
+#define PPT_PLACEHOLDER_NOTESBODY 12 // 14 Notes body
+#define PPT_PLACEHOLDER_CENTEREDTITLE 15 // 15 Centered title
+#define PPT_PLACEHOLDER_SUBTITLE 16 // 16 Subtitle
+#define PPT_PLACEHOLDER_VERTICALTEXTTITLE 17 // 17 Vertical text title
+#define PPT_PLACEHOLDER_VERTICALTEXTBODY 18 // 18 Vertical text body
+#define PPT_PLACEHOLDER_NOTESSLIDEIMAGE 11 // 19 Notes slide image
+#define PPT_PLACEHOLDER_OBJECT 19 // 20 Object (no matter the size)
+#define PPT_PLACEHOLDER_GRAPH 20 // 21 Graph
+#define PPT_PLACEHOLDER_TABLE 21 // 22 Table
+#define PPT_PLACEHOLDER_CLIPART 22 // 23 Clip Art
+#define PPT_PLACEHOLDER_ORGANISZATIONCHART 23 // 24 Organization Chart
+#define PPT_PLACEHOLDER_MEDIACLIP 24 // 25 Media Clip
+
+#endif //_SVDFPPT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx
new file mode 100644
index 000000000000..8f87401edee5
--- /dev/null
+++ b/include/filter/msfilter/svxmsbas.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _SVXMSBAS_HXX
+#define _SVXMSBAS_HXX
+
+#include <tools/solar.h>
+#include "filter/msfilter/msfilterdllapi.h"
+
+#include <sot/storage.hxx>
+#include <map>
+#include <boost/unordered_map.hpp>
+
+class SfxObjectShell;
+
+/* Construct with the root storage of the MS document, with bImportCode
+ * set the visual basic code will be imported into the stardocument when Import
+ * is called, with bCopyStorage set, the visual basic storage tree will be
+ * copied completely into staroffice, so that any future export to a msoffice
+ * format will retain the vba code, allowing a lossless roundtrip from
+ * msoffice to staroffice and back.
+ *
+ * Setting bAsComment to true in Import will import the visual basic as a
+ * starbasic comment. Which is currently necessary, as vb is not valid sb.
+ *
+ * Setting bStripped will remove the "Attribute" lines from the vb, msoffice
+ * does this itself when it shows the vb code in the vbeditor, so this is
+ * probably what the user expects to see when viewing the code
+ */
+
+typedef boost::unordered_map< sal_Int32, OUString > ObjIdToName;
+
+typedef std::map< OUString, ObjIdToName > ControlAttributeInfo;
+
+class MSFILTER_DLLPUBLIC SvxImportMSVBasic
+{
+public:
+ SvxImportMSVBasic( SfxObjectShell &rDocS, SotStorage &rRoot )
+ : xRoot(&rRoot), rDocSh(rDocS)
+ {}
+ // only for the export - copy or delete the saved VBA-macro-storage
+ // form the ObjectShell
+ // - returns a warning code if a modified basic exist, in all other
+ // cases return ERRCODE_NONE.
+ sal_uLong SaveOrDelMSVBAStorage( sal_Bool bSaveInto, const OUString& rStorageName );
+
+ // check if the MS-VBA-Storage exist in the RootStorage of the DocShell.
+ // If it exist, then return the WarningId for loosing the information.
+ static sal_uLong GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocS );
+
+ static OUString GetMSBasicStorageName();
+private:
+ SotStorageRef xRoot;
+ SfxObjectShell &rDocSh;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/filter/msfilter/util.hxx b/include/filter/msfilter/util.hxx
new file mode 100644
index 000000000000..f50e4d10ea83
--- /dev/null
+++ b/include/filter/msfilter/util.hxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_MSFILTER_UTIL_HXX
+#define INCLUDED_MSFILTER_UTIL_HXX
+
+#include <rtl/textenc.h>
+#include <tools/datetime.hxx>
+#include <tools/color.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include "filter/msfilter/msfilterdllapi.h"
+
+namespace msfilter {
+namespace util {
+
+/// Returns the best-fit default 8bit encoding for a given locale
+/// i.e. useful when dealing with legacy formats which use legacy text encodings without recording
+/// what the encoding is, but you know or can guess the language
+MSFILTER_DLLPUBLIC rtl_TextEncoding getBestTextEncodingFromLocale(const ::com::sun::star::lang::Locale &rLocale);
+
+/// Convert a color in BGR format to RGB.
+MSFILTER_DLLPUBLIC sal_uInt32 BGRToRGB(sal_uInt32 nColour);
+
+/** Convert from DTTM to Writer's DateTime
+
+ @author
+ <a href="mailto:mmaher@openoffice.org">Martin Maher</a
+ */
+MSFILTER_DLLPUBLIC DateTime DTTM2DateTime( long lDTTM );
+
+/** Convert DateTime to xsd::dateTime string.
+
+I guess there must be an implementation of this somewhere in LO, but I failed
+to find it, unfortunately :-(
+*/
+MSFILTER_DLLPUBLIC OString DateTimeToOString( const DateTime& rDateTime );
+
+/// Given a cBullet in encoding r_ioChrSet and fontname r_ioFontName return a
+/// suitable new Bullet and change r_ioChrSet and r_ioFontName to form the
+/// best-fit replacement in terms of default available MSOffice symbol
+/// fonts.
+///
+/// Set bDisableUnicodeSupport when exporting to 8bit encodings
+///
+/// Used to map from [Open|Star]Symbol to some Windows font or other.
+MSFILTER_DLLPUBLIC sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cBullet,
+ rtl_TextEncoding& r_ioChrSet, OUString& r_ioFontName, bool bDisableUnicodeSupport = false);
+
+
+enum TextCategory
+{
+ latin, //Latin
+ cs, //Complex Script
+ ea, //East Asian
+ sym //Symbol
+};
+
+/** Categorize codepoints according to how MS seems to do it.
+
+ It's been bugging me for ages as to what codepoint MS considers in
+ what category. Tom Jebo has a post suggesting the criteria used here
+ and indicating its been submitting to the standards working group
+ as a proposed resolution.
+*/
+MSFILTER_DLLPUBLIC TextCategory categorizeCodePoint(sal_uInt32 codePoint, const OUString &rBcp47LanguageTag);
+
+/// Converts tools Color to HTML color (without leading hashmark).
+MSFILTER_DLLPUBLIC OString ConvertColor( const Color &rColor );
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/ExternalReferenceHelper.hxx b/include/formula/ExternalReferenceHelper.hxx
new file mode 100644
index 000000000000..cd9b3b5b69c6
--- /dev/null
+++ b/include/formula/ExternalReferenceHelper.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_EXTERNALREFERENCEHELPER_HXX
+#define FORMULA_EXTERNALREFERENCEHELPER_HXX
+
+#include <rtl/ustring.hxx>
+#include "formula/formuladllapi.h"
+
+namespace formula
+{
+ class FORMULA_DLLPUBLIC SAL_NO_VTABLE ExternalReferenceHelper
+ {
+ public:
+ virtual OUString getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const = 0;
+
+ protected:
+ ~ExternalReferenceHelper() {}
+ };
+// =============================================================================
+} // formula
+// =============================================================================
+#endif //FORMULA_EXTERNALREFERENCEHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/FormulaCompiler.hxx b/include/formula/FormulaCompiler.hxx
new file mode 100644
index 000000000000..b53bb2df4316
--- /dev/null
+++ b/include/formula/FormulaCompiler.hxx
@@ -0,0 +1,388 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_COMPILER_HXX_INCLUDED
+#define FORMULA_COMPILER_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+#include <tools/string.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include "formula/opcode.hxx"
+#include "formula/grammar.hxx"
+#include "formula/token.hxx"
+#include "formula/ExternalReferenceHelper.hxx"
+
+
+#define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */
+#define MAXCODE 512 /* maximum number of tokens in formula */
+
+
+namespace com { namespace sun { namespace star {
+ namespace sheet {
+ struct FormulaOpCodeMapEntry;
+ struct FormulaToken;
+ }
+}}}
+
+
+namespace formula
+{
+ class FormulaTokenArray;
+
+struct FormulaArrayStack
+{
+ FormulaArrayStack* pNext;
+ FormulaTokenArray* pArr;
+ bool bTemp;
+};
+
+
+struct FORMULA_DLLPUBLIC StringHashCode
+{
+ size_t operator()( const String& rStr ) const
+ {
+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
+ }
+};
+
+typedef ::boost::unordered_map< String, OpCode, StringHashCode, ::std::equal_to< String > > OpCodeHashMap;
+typedef ::boost::unordered_map< String, String, StringHashCode, ::std::equal_to< String > > ExternalHashMap;
+
+class FORMULA_DLLPUBLIC FormulaCompiler
+{
+public:
+ FormulaCompiler();
+ FormulaCompiler(FormulaTokenArray& _rArr);
+ virtual ~FormulaCompiler();
+
+ // SUNWS8 needs a forward declared friend, otherwise members of the outer
+ // class are not accessible.
+ class OpCodeMap;
+ friend class FormulaCompiler::OpCodeMap;
+
+ /** Mappings from strings to OpCodes and vice versa. */
+ class FORMULA_DLLPUBLIC OpCodeMap
+ {
+ OpCodeHashMap * mpHashMap; /// Hash map of symbols, String -> OpCode
+ String * mpTable; /// Array of symbols, OpCode -> String, offset==OpCode
+ ExternalHashMap * mpExternalHashMap; /// Hash map of ocExternal, Filter String -> AddIn String
+ ExternalHashMap * mpReverseExternalHashMap; /// Hash map of ocExternal, AddIn String -> Filter String
+ FormulaGrammar::Grammar meGrammar; /// Grammar, language and reference convention
+ sal_uInt16 mnSymbols; /// Count of OpCode symbols
+ bool mbCore : 1; /// If mapping was setup by core, not filters
+ bool mbEnglish : 1; /// If English symbols and external names
+
+ OpCodeMap(); // prevent usage
+ OpCodeMap( const OpCodeMap& ); // prevent usage
+ OpCodeMap& operator=( const OpCodeMap& ); // prevent usage
+
+ public:
+
+ OpCodeMap(sal_uInt16 nSymbols, bool bCore, FormulaGrammar::Grammar eGrammar ) :
+ mpHashMap( new OpCodeHashMap( nSymbols)),
+ mpTable( new String[ nSymbols ]),
+ mpExternalHashMap( new ExternalHashMap),
+ mpReverseExternalHashMap( new ExternalHashMap),
+ meGrammar( eGrammar),
+ mnSymbols( nSymbols),
+ mbCore( bCore)
+ {
+ mbEnglish = FormulaGrammar::isEnglish( meGrammar);
+ }
+ virtual ~OpCodeMap();
+
+ void copyFrom( const OpCodeMap& r );
+
+ /// Get the symbol String -> OpCode hash map for finds.
+ inline const OpCodeHashMap* getHashMap() const { return mpHashMap; }
+
+ /// Get the symbol String -> AddIn String hash map for finds.
+ inline const ExternalHashMap* getExternalHashMap() const { return mpExternalHashMap; }
+
+ /// Get the AddIn String -> symbol String hash map for finds.
+ inline const ExternalHashMap* getReverseExternalHashMap() const { return mpReverseExternalHashMap; }
+
+ /// Get the symbol string matching an OpCode.
+ inline const String& getSymbol( const OpCode eOp ) const
+ {
+ DBG_ASSERT( sal_uInt16(eOp) < mnSymbols, "OpCodeMap::getSymbol: OpCode out of range");
+ if (sal_uInt16(eOp) < mnSymbols)
+ return mpTable[ eOp ];
+ static String s_sEmpty;
+ return s_sEmpty;
+ }
+
+ /// Get the grammar.
+ inline FormulaGrammar::Grammar getGrammar() const { return meGrammar; }
+
+ /// Get the symbol count.
+ inline sal_uInt16 getSymbolCount() const { return mnSymbols; }
+
+ /** Are these English symbols, as opposed to native language (which may
+ be English as well)? */
+ inline bool isEnglish() const { return mbEnglish; }
+
+ /// Is it an internal core mapping, or setup by filters?
+ inline bool isCore() const { return mbCore; }
+
+ /// Is it an ODF 1.1 compatibility mapping?
+ inline bool isPODF() const { return FormulaGrammar::isPODF( meGrammar); }
+
+ /// Is it an ODFF / ODF 1.2 mapping?
+ inline bool isODFF() const { return FormulaGrammar::isODFF( meGrammar); }
+
+ /// Does it have external symbol/name mappings?
+ inline bool hasExternals() const { return !mpExternalHashMap->empty(); }
+
+ /// Put entry of symbol String and OpCode pair.
+ void putOpCode( const String & rStr, const OpCode eOp );
+
+ /// Put entry of symbol String and AddIn international String pair.
+ void putExternal( const String & rSymbol, const String & rAddIn );
+
+ /** Put entry of symbol String and AddIn international String pair,
+ failing silently if rAddIn name already exists. */
+ void putExternalSoftly( const String & rSymbol, const String & rAddIn );
+
+ /// Core implementation of XFormulaOpCodeMapper::getMappings()
+ ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >
+ createSequenceOfFormulaTokens(const FormulaCompiler& _rCompiler,
+ const ::com::sun::star::uno::Sequence< OUString >& rNames ) const;
+
+ /// Core implementation of XFormulaOpCodeMapper::getAvailableMappings()
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::sheet::FormulaOpCodeMapEntry >
+ createSequenceOfAvailableMappings( const FormulaCompiler& _rCompiler,const sal_Int32 nGroup ) const;
+
+ /** The value used in createSequenceOfAvailableMappings() and thus in
+ XFormulaOpCodeMapper::getMappings() for an unknown symbol. */
+ static sal_Int32 getOpCodeUnknown();
+ };
+
+public:
+ typedef ::boost::shared_ptr< const OpCodeMap > OpCodeMapPtr;
+ typedef ::boost::shared_ptr< OpCodeMap > NonConstOpCodeMapPtr;
+
+ /** Get OpCodeMap for formula language.
+ @param nLanguage
+ One of ::com::sun::star::sheet::FormulaLanguage constants.
+ @return Map for nLanguage. If nLanguage is unknown, a NULL map is returned.
+ */
+ OpCodeMapPtr GetOpCodeMap( const sal_Int32 nLanguage ) const;
+
+ /** Create an internal symbol map from API mapping.
+ @param bEnglish
+ Use English number parser / formatter instead of native.
+ */
+ OpCodeMapPtr CreateOpCodeMap(
+ const ::com::sun::star::uno::Sequence<
+ const ::com::sun::star::sheet::FormulaOpCodeMapEntry > & rMapping,
+ bool bEnglish );
+
+ /** Get current OpCodeMap in effect. */
+ inline OpCodeMapPtr GetCurrentOpCodeMap() const { return mxSymbols; }
+
+ /** Get OpCode for English symbol.
+ Used in XFunctionAccess to create token array.
+ @param rName
+ Symbol to lookup. MUST be upper case.
+ */
+ OpCode GetEnglishOpCode( const String& rName ) const;
+
+ sal_uInt16 GetErrorConstant( const String& rName ) const;
+
+ void SetCompileForFAP( bool bVal )
+ { bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+
+ static bool IsOpCodeVolatile( OpCode eOp );
+
+ static bool DeQuote( String& rStr );
+
+
+ static const String& GetNativeSymbol( OpCode eOp );
+ static bool IsMatrixFunction(OpCode _eOpCode); // if a function _always_ returns a Matrix
+
+ short GetNumFormatType() const { return nNumFmt; }
+ bool CompileTokenArray();
+
+ void CreateStringFromTokenArray( String& rFormula );
+ void CreateStringFromTokenArray( OUStringBuffer& rBuffer );
+ FormulaToken* CreateStringFromToken( String& rFormula, FormulaToken* pToken,
+ bool bAllowArrAdvance = false );
+ FormulaToken* CreateStringFromToken( OUStringBuffer& rBuffer, FormulaToken* pToken,
+ bool bAllowArrAdvance = false );
+
+ void AppendBoolean( OUStringBuffer& rBuffer, bool bVal );
+ void AppendDouble( OUStringBuffer& rBuffer, double fVal );
+ void AppendString( OUStringBuffer& rBuffer, const String & rStr );
+
+ /** Set symbol map corresponding to one of predefined formula::FormulaGrammar::Grammar,
+ including an address reference convention. */
+ inline FormulaGrammar::Grammar GetGrammar() const { return meGrammar; }
+
+ static void UpdateSeparatorsNative( const OUString& rSep, const OUString& rArrayColSep, const OUString& rArrayRowSep );
+ static void ResetNativeSymbols();
+ static void SetNativeSymbols( const OpCodeMapPtr& xMap );
+protected:
+ virtual String FindAddInFunction( const String& rUpperName, bool bLocalFirst ) const;
+ virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const;
+ virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, FormulaGrammar::Grammar _eGrammar ) const;
+ virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const;
+ virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const;
+
+ virtual void SetError(sal_uInt16 nError);
+ virtual FormulaTokenRef ExtendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2, bool bReuseDoubleRef );
+ virtual bool HandleExternalReference(const FormulaToken& _aToken);
+ virtual bool HandleRange();
+ virtual bool HandleSingleRef();
+ virtual bool HandleDbData();
+
+ virtual void CreateStringFromExternal(OUStringBuffer& rBuffer, FormulaToken* pTokenP);
+ virtual void CreateStringFromSingleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void CreateStringFromDoubleRef(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void CreateStringFromMatrix(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void CreateStringFromIndex(OUStringBuffer& rBuffer,FormulaToken* pTokenP);
+ virtual void LocalizeString( String& rName ); // modify rName - input: exact name
+
+ void AppendErrorConstant( OUStringBuffer& rBuffer, sal_uInt16 nError );
+
+ bool GetToken();
+ OpCode NextToken();
+ void PutCode( FormulaTokenRef& );
+ void Factor();
+ void RangeLine();
+ void UnionLine();
+ void IntersectionLine();
+ void UnaryLine();
+ void PostOpLine();
+ void PowLine();
+ void MulDivLine();
+ void AddSubLine();
+ void ConcatLine();
+ void CompareLine();
+ void NotLine();
+ OpCode Expression();
+ void PopTokenArray();
+ void PushTokenArray( FormulaTokenArray*, bool = false );
+
+ bool MergeRangeReference( FormulaToken * * const pCode1, FormulaToken * const * const pCode2 );
+
+ String aCorrectedFormula; // autocorrected Formula
+ String aCorrectedSymbol; // autocorrected Symbol
+
+ OpCodeMapPtr mxSymbols; // which symbols are used
+
+ FormulaTokenRef mpToken; // current token
+ FormulaTokenRef pCurrentFactorToken; // current factor token (of Factor() method)
+ FormulaTokenArray* pArr;
+ ExternalReferenceHelper* pExternalRef;
+
+ FormulaToken** pCode;
+ FormulaArrayStack* pStack;
+
+ OpCode eLastOp;
+ short nRecursion; // GetToken() recursions
+ short nNumFmt; // set during CompileTokenArray()
+ sal_uInt16 pc; // program counter
+
+ FormulaGrammar::Grammar meGrammar; // The grammar used, language plus convention.
+
+ bool bAutoCorrect; // whether to apply AutoCorrection
+ bool bCorrected; // AutoCorrection was applied
+ bool bCompileForFAP; //! not real RPN but names, for FunctionAutoPilot
+ // will not be resolved
+ bool bIgnoreErrors; // on AutoCorrect and CompileForFAP
+ // ignore errors and create RPN nevertheless
+ bool glSubTotal; // if code contains one or more subtotal functions
+private:
+ void InitSymbolsNative() const; /// only SymbolsNative, on first document creation
+ void InitSymbolsEnglish() const; /// only SymbolsEnglish, maybe later
+ void InitSymbolsPODF() const; /// only SymbolsPODF, on demand
+ void InitSymbolsODFF() const; /// only SymbolsODFF, on demand
+ void InitSymbolsEnglishXL() const; /// only SymbolsEnglishXL, on demand
+
+ void loadSymbols(sal_uInt16 _nSymbols,FormulaGrammar::Grammar _eGrammar,NonConstOpCodeMapPtr& _xMap) const;
+
+ static inline void ForceArrayOperator( FormulaTokenRef& rCurr, const FormulaTokenRef& rPrev )
+ {
+ if ( rPrev && rPrev->HasForceArray() &&
+ rCurr->GetType() == svByte && rCurr->GetOpCode() != ocPush
+ && !rCurr->HasForceArray() )
+ rCurr->SetForceArray( true);
+ }
+
+ // SUNWS7 needs a forward declared friend, otherwise members of the outer
+ // class are not accessible.
+ class CurrentFactor;
+ friend class FormulaCompiler::CurrentFactor;
+ class CurrentFactor
+ {
+ FormulaTokenRef pPrevFac;
+ FormulaCompiler* pCompiler;
+ // not implemented
+ CurrentFactor( const CurrentFactor& );
+ CurrentFactor& operator=( const CurrentFactor& );
+ public:
+ explicit CurrentFactor( FormulaCompiler* pComp )
+ : pPrevFac( pComp->pCurrentFactorToken )
+ , pCompiler( pComp )
+ {}
+ ~CurrentFactor()
+ { pCompiler->pCurrentFactorToken = pPrevFac; }
+ // yes, this operator= may modify the RValue
+ void operator=( FormulaTokenRef& r )
+ {
+ ForceArrayOperator( r, pPrevFac);
+ pCompiler->pCurrentFactorToken = r;
+ }
+ void operator=( FormulaToken* p )
+ {
+ FormulaTokenRef xTemp( p );
+ *this = xTemp;
+ }
+ operator FormulaTokenRef&()
+ { return pCompiler->pCurrentFactorToken; }
+ FormulaToken* operator->()
+ { return pCompiler->pCurrentFactorToken.operator->(); }
+ operator FormulaToken*()
+ { return operator->(); }
+ };
+
+
+ mutable NonConstOpCodeMapPtr mxSymbolsODFF; // ODFF symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsPODF; // ODF 1.1 symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsNative; // native symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsEnglish; // English symbols
+ mutable NonConstOpCodeMapPtr mxSymbolsEnglishXL; // English Excel symbols (for VBA formula parsing)
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_COMPILER_HXX_INCLUDED
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/FormulaOpCodeMapperObj.hxx b/include/formula/FormulaOpCodeMapperObj.hxx
new file mode 100644
index 000000000000..07945ca27101
--- /dev/null
+++ b/include/formula/FormulaOpCodeMapperObj.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED
+#define FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <memory>
+#include "formula/FormulaCompiler.hxx"
+
+
+namespace formula
+{
+
+class FORMULA_DLLPUBLIC FormulaOpCodeMapperObj : public ::cppu::WeakImplHelper2<
+ ::com::sun::star::sheet::XFormulaOpCodeMapper,
+ ::com::sun::star::lang::XServiceInfo >
+{
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr<FormulaCompiler> m_pCompiler;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+public:
+ static OUString getImplementationName_Static();
+ static ::com::sun::star::uno::Sequence< OUString> getSupportedServiceNames_Static();
+ static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext);
+
+protected:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ FormulaOpCodeMapperObj(::std::auto_ptr<FormulaCompiler> _pCompiler);
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+ virtual ~FormulaOpCodeMapperObj();
+
+private:
+ // XFormulaOpCodeMapper
+ // Attributes
+ virtual ::sal_Int32 SAL_CALL getOpCodeExternal() throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getOpCodeUnknown() throw (::com::sun::star::uno::RuntimeException);
+ // Methods
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getMappings(
+ const ::com::sun::star::uno::Sequence< OUString >& rNames,
+ sal_Int32 nLanguage )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaOpCodeMapEntry > SAL_CALL getAvailableMappings(
+ sal_Int32 nLanguage, sal_Int32 nGroups )
+ throw ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
+ throw(::com::sun::star::uno::RuntimeException);
+
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_FORMULAOPCODEMAPPER_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/IControlReferenceHandler.hxx b/include/formula/IControlReferenceHandler.hxx
new file mode 100644
index 000000000000..bee4bac3953e
--- /dev/null
+++ b/include/formula/IControlReferenceHandler.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED
+#define FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED
+
+#include "formula/formuladllapi.h"
+
+namespace formula
+{
+ class RefEdit;
+ class RefButton;
+ class FORMULA_DLLPUBLIC SAL_NO_VTABLE IControlReferenceHandler
+ {
+ public:
+ virtual void ShowReference(const String& _sRef) = 0;
+ virtual void HideReference( sal_Bool bDoneRefMode = sal_True ) = 0;
+ virtual void ReleaseFocus( RefEdit* pEdit, RefButton* pButton = NULL ) = 0;
+ virtual void ToggleCollapsed( RefEdit* pEdit, RefButton* pButton = NULL ) = 0;
+
+ protected:
+ ~IControlReferenceHandler() {}
+ };
+} // formula
+#endif // FORMULA_ICONTROL_REFERENCE_HANDLER_HXX_INCLUDED
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/IFunctionDescription.hxx b/include/formula/IFunctionDescription.hxx
new file mode 100644
index 000000000000..1747c2f2ddce
--- /dev/null
+++ b/include/formula/IFunctionDescription.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDE_FUNCTION_DESCRIPTION
+#define INCLUDE_FUNCTION_DESCRIPTION
+
+#include <vector>
+#include <memory>
+#include "formula/formuladllapi.h"
+#include <rtl/ustring.hxx>
+#include <tools/string.hxx>
+#include <com/sun/star/sheet/XFormulaParser.hpp>
+#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
+
+class SvTreeListEntry;
+
+namespace formula
+{
+ class IFunctionCategory;
+ class IFunctionDescription;
+ class FormEditData;
+ class FormulaTokenArray;
+
+ class SAL_NO_VTABLE IFunctionManager
+ {
+ public:
+ IFunctionManager(){}
+ enum EToken
+ {
+ eOk,
+ eClose,
+ eSep,
+ eArrayOpen,
+ eArrayClose
+ };
+ virtual sal_uInt32 getCount() const = 0;
+ virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0;
+ virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0;
+ virtual const IFunctionDescription* getFunctionByName(const OUString& _sFunctionName) const = 0;
+
+ virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
+
+ protected:
+ ~IFunctionManager() {}
+ };
+
+ class SAL_NO_VTABLE IFunctionCategory
+ {
+ public:
+ IFunctionCategory(){}
+ virtual const IFunctionManager* getFunctionManager() const = 0;
+ virtual sal_uInt32 getCount() const = 0;
+ virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0;
+ virtual sal_uInt32 getNumber() const = 0;
+ virtual OUString getName() const = 0;
+
+ protected:
+ ~IFunctionCategory() {}
+ };
+
+ class SAL_NO_VTABLE IFunctionDescription
+ {
+ public:
+ IFunctionDescription(){}
+ virtual OUString getFunctionName() const = 0;
+ virtual const IFunctionCategory* getCategory() const = 0;
+ virtual OUString getDescription() const = 0;
+ // GetSuppressedArgCount
+ virtual xub_StrLen getSuppressedArgumentCount() const = 0;
+ // GetFormulaString
+ virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
+ // GetVisibleArgMapping
+ virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
+ virtual void initArgumentInfo() const = 0;
+ virtual OUString getSignature() const = 0;
+ virtual OString getHelpId() const = 0;
+
+ // parameter
+ virtual sal_uInt32 getParameterCount() const = 0;
+ virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
+ virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
+ virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
+
+ protected:
+ ~IFunctionDescription() {}
+ };
+
+ class SAL_NO_VTABLE IFormulaToken
+ {
+ public:
+ virtual bool isFunction() const = 0;
+ virtual sal_uInt32 getArgumentCount() const = 0;
+
+ protected:
+ ~IFormulaToken() {}
+ };
+
+ class SAL_NO_VTABLE IStructHelper
+ {
+ public:
+ IStructHelper(){}
+ virtual SvTreeListEntry* InsertEntry(const XubString& rText, SvTreeListEntry* pParent,
+ sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL) = 0;
+
+ virtual String GetEntryText(SvTreeListEntry* pEntry) const = 0;
+ virtual SvTreeListEntry* GetParent(SvTreeListEntry* pEntry) const = 0;
+
+ protected:
+ ~IStructHelper() {}
+ };
+
+ class SAL_NO_VTABLE IFormulaEditorHelper
+ {
+ public:
+ IFormulaEditorHelper(){}
+ virtual void notifyChange() = 0;
+ virtual void fill() = 0;
+
+ virtual String getCurrentFormula() const = 0;
+ virtual void setCurrentFormula(const String& _sReplacement) = 0;
+
+ virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const = 0;
+ virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd) = 0;
+
+ virtual FormEditData* getFormEditData() const = 0;
+ virtual bool calculateValue(const String& _sExpression,String& _rResult) = 0;
+
+ virtual void switchBack() = 0;
+
+ virtual void clear() = 0;
+ virtual void deleteFormData() = 0;
+ virtual void setReferenceInput(const FormEditData* _pData) = 0;
+
+ virtual IFunctionManager* getFunctionManager() = 0;
+ virtual ::std::auto_ptr<FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList) = 0;
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
+ virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
+
+ virtual void setDispatcherLock( sal_Bool bLock ) = 0;
+ virtual void dispatch(sal_Bool _bOK,sal_Bool _bMartixChecked) = 0;
+ virtual void doClose(sal_Bool _bOk) = 0;
+ virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
+ virtual void showReference(const String& _sFormula) = 0;
+
+ protected:
+ ~IFormulaEditorHelper() {}
+ };
+
+}
+#endif //INCLUDE_FUNCTION_DESCRIPTION
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
new file mode 100644
index 000000000000..053947c2a796
--- /dev/null
+++ b/include/formula/compiler.hrc
@@ -0,0 +1,423 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_COMPILER_HRC
+#define FORMULA_COMPILER_HRC
+
+/* Central definition of OpCodes for spreadsheet functions */
+
+/*** Special commands ***/
+#define SC_OPCODE_PUSH 0 /* internal commands */
+#define SC_OPCODE_CALL 1
+#define SC_OPCODE_STOP 2
+#define SC_OPCODE_EXTERNAL 3
+#define SC_OPCODE_NAME 4
+#define SC_OPCODE_EXTERNAL_REF 5
+#define SC_OPCODE_IF 6 /* jump commands */
+#define SC_OPCODE_IF_ERROR 7
+#define SC_OPCODE_IF_NA 8
+#define SC_OPCODE_CHOSE 9
+#define SC_OPCODE_OPEN 10 /* parentheses and separators */
+#define SC_OPCODE_CLOSE 11
+#define SC_OPCODE_SEP 12
+#define SC_OPCODE_MISSING 13 /* special OpCodes */
+#define SC_OPCODE_BAD 14
+#define SC_OPCODE_STRINGXML 15
+#define SC_OPCODE_SPACES 16
+#define SC_OPCODE_MAT_REF 17
+#define SC_OPCODE_DB_AREA 18 /* additional access operators */
+#define SC_OPCODE_MACRO 19
+#define SC_OPCODE_COL_ROW_NAME 20
+#define SC_OPCODE_COL_ROW_NAME_AUTO 21
+#define SC_OPCODE_PERCENT_SIGN 22 /* operator _follows_ value */
+#define SC_OPCODE_ARRAY_OPEN 23
+#define SC_OPCODE_ARRAY_CLOSE 24
+#define SC_OPCODE_ARRAY_ROW_SEP 25
+#define SC_OPCODE_ARRAY_COL_SEP 26 /* some convs use sep != col_sep */
+#define SC_OPCODE_STOP_DIV 27
+#define SC_OPCODE_SKIP 28 /* used to skip raw tokens during string compilation */
+
+/*** error constants #... ***/
+#define SC_OPCODE_START_ERRORS 30
+#define SC_OPCODE_ERROR_NULL 30
+#define SC_OPCODE_ERROR_DIVZERO 31
+#define SC_OPCODE_ERROR_VALUE 32
+#define SC_OPCODE_ERROR_REF 33
+#define SC_OPCODE_ERROR_NAME 34
+#define SC_OPCODE_ERROR_NUM 35
+#define SC_OPCODE_ERROR_NA 36
+#define SC_OPCODE_STOP_ERRORS 37
+
+/*** Binary operators ***/
+#define SC_OPCODE_START_BIN_OP 40
+#define SC_OPCODE_ADD 40
+#define SC_OPCODE_SUB 41
+#define SC_OPCODE_MUL 42
+#define SC_OPCODE_DIV 43
+#define SC_OPCODE_AMPERSAND 44
+#define SC_OPCODE_POW 45
+#define SC_OPCODE_EQUAL 46
+#define SC_OPCODE_NOT_EQUAL 47
+#define SC_OPCODE_LESS 48
+#define SC_OPCODE_GREATER 49
+#define SC_OPCODE_LESS_EQUAL 50
+#define SC_OPCODE_GREATER_EQUAL 51
+#define SC_OPCODE_AND 52
+#define SC_OPCODE_OR 53
+#define SC_OPCODE_INTERSECT 54
+#define SC_OPCODE_UNION 55
+#define SC_OPCODE_RANGE 56
+#define SC_OPCODE_STOP_BIN_OP 57
+
+/* NOTE: binary and unary operators must be in sequence for compiler! */
+
+/*** Unary operators ***/
+#define SC_OPCODE_START_UN_OP 60
+#define SC_OPCODE_NOT 60
+#define SC_OPCODE_NEG 61
+#define SC_OPCODE_NEG_SUB 62
+#define SC_OPCODE_STOP_UN_OP 63
+
+#define SC_OPCODE_START_FUNCTION 65
+
+/*** Functions without parameters ***/
+#define SC_OPCODE_START_NO_PAR 65
+#define SC_OPCODE_PI 65
+#define SC_OPCODE_RANDOM 66
+#define SC_OPCODE_TRUE 67
+#define SC_OPCODE_FALSE 68
+#define SC_OPCODE_GET_ACT_DATE 69
+#define SC_OPCODE_GET_ACT_TIME 70
+#define SC_OPCODE_NO_VALUE 71
+#define SC_OPCODE_CURRENT 72
+#define SC_OPCODE_STOP_NO_PAR 73
+
+/*** Functions with one parameter ***/
+#define SC_OPCODE_START_1_PAR 80
+#define SC_OPCODE_DEG 80 /* trigonometric */
+#define SC_OPCODE_RAD 81
+#define SC_OPCODE_SIN 82
+#define SC_OPCODE_COS 83
+#define SC_OPCODE_TAN 84
+#define SC_OPCODE_COT 85
+#define SC_OPCODE_ARC_SIN 86
+#define SC_OPCODE_ARC_COS 87
+#define SC_OPCODE_ARC_TAN 88
+#define SC_OPCODE_ARC_COT 89
+#define SC_OPCODE_SIN_HYP 90
+#define SC_OPCODE_COS_HYP 91
+#define SC_OPCODE_TAN_HYP 92
+#define SC_OPCODE_COT_HYP 93
+#define SC_OPCODE_ARC_SIN_HYP 94 /* transcendent */
+#define SC_OPCODE_ARC_COS_HYP 95
+#define SC_OPCODE_ARC_TAN_HYP 96
+#define SC_OPCODE_ARC_COT_HYP 97
+#define SC_OPCODE_COSECANT 98
+#define SC_OPCODE_SECANT 99
+#define SC_OPCODE_COSECANT_HYP 100
+#define SC_OPCODE_SECANT_HYP 101
+#define SC_OPCODE_EXP 102
+#define SC_OPCODE_LN 103
+#define SC_OPCODE_SQRT 104
+#define SC_OPCODE_FACT 105
+#define SC_OPCODE_GET_YEAR 106 /* date and time */
+#define SC_OPCODE_GET_MONTH 107
+#define SC_OPCODE_GET_DAY 108
+#define SC_OPCODE_GET_HOUR 109
+#define SC_OPCODE_GET_MIN 110
+#define SC_OPCODE_GET_SEC 111
+#define SC_OPCODE_PLUS_MINUS 112 /* miscellaneous */
+#define SC_OPCODE_ABS 113
+#define SC_OPCODE_INT 114
+#define SC_OPCODE_PHI 115
+#define SC_OPCODE_GAUSS 116
+#define SC_OPCODE_IS_EMPTY 117 /* obtain type */
+#define SC_OPCODE_IS_STRING 118
+#define SC_OPCODE_IS_NON_STRING 119
+#define SC_OPCODE_IS_LOGICAL 120
+#define SC_OPCODE_TYPE 121
+#define SC_OPCODE_IS_REF 122
+#define SC_OPCODE_IS_VALUE 123
+#define SC_OPCODE_IS_FORMULA 124
+#define SC_OPCODE_IS_NV 125
+#define SC_OPCODE_IS_ERR 126
+#define SC_OPCODE_IS_ERROR 127
+#define SC_OPCODE_IS_EVEN 128
+#define SC_OPCODE_IS_ODD 129
+#define SC_OPCODE_N 130
+#define SC_OPCODE_GET_DATE_VALUE 131 /* string functions */
+#define SC_OPCODE_GET_TIME_VALUE 132
+#define SC_OPCODE_CODE 133
+#define SC_OPCODE_TRIM 134
+#define SC_OPCODE_UPPER 135
+#define SC_OPCODE_PROPPER 136
+#define SC_OPCODE_LOWER 137
+#define SC_OPCODE_LEN 138
+#define SC_OPCODE_T 139 /* miscellaneous, part 21 */
+#define SC_OPCODE_VALUE 140
+#define SC_OPCODE_CLEAN 141
+#define SC_OPCODE_CHAR 142
+#define SC_OPCODE_LOG10 143
+#define SC_OPCODE_EVEN 144
+#define SC_OPCODE_ODD 145
+#define SC_OPCODE_STD_NORM_DIST 146
+#define SC_OPCODE_FISHER 147
+#define SC_OPCODE_FISHER_INV 148
+#define SC_OPCODE_S_NORM_INV 149
+#define SC_OPCODE_GAMMA_LN 150
+#define SC_OPCODE_ERROR_TYPE 151
+#define SC_OPCODE_ERR_CELL 152
+#define SC_OPCODE_FORMULA 153
+#define SC_OPCODE_ARABIC 154
+#define SC_OPCODE_INFO 155
+#define SC_OPCODE_BAHTTEXT 156
+#define SC_OPCODE_JIS 157
+#define SC_OPCODE_ASC 158
+#define SC_OPCODE_UNICODE 159
+#define SC_OPCODE_UNICHAR 160
+#define SC_OPCODE_GAMMA 161
+#define SC_OPCODE_STOP_1_PAR 162
+
+/*** Functions with more than one parameters ***/
+#define SC_OPCODE_START_2_PAR 201
+#define SC_OPCODE_ARC_TAN_2 201
+#define SC_OPCODE_CEIL 202
+#define SC_OPCODE_FLOOR 203
+#define SC_OPCODE_ROUND 204
+#define SC_OPCODE_ROUND_UP 205
+#define SC_OPCODE_ROUND_DOWN 206
+#define SC_OPCODE_TRUNC 207
+#define SC_OPCODE_LOG 208
+#define SC_OPCODE_POWER 209
+#define SC_OPCODE_GGT 210
+#define SC_OPCODE_KGV 211
+#define SC_OPCODE_MOD 212
+#define SC_OPCODE_SUM_PRODUCT 213
+#define SC_OPCODE_SUM_SQ 214
+#define SC_OPCODE_SUM_X2MY2 215
+#define SC_OPCODE_SUM_X2DY2 216
+#define SC_OPCODE_SUM_XMY2 217
+#define SC_OPCODE_GET_DATE 218
+#define SC_OPCODE_GET_TIME 219
+#define SC_OPCODE_GET_DIFF_DATE 220
+#define SC_OPCODE_GET_DIFF_DATE_360 221
+#define SC_OPCODE_MIN 222
+#define SC_OPCODE_MAX 223
+#define SC_OPCODE_SUM 224
+#define SC_OPCODE_PRODUCT 225
+#define SC_OPCODE_AVERAGE 226
+#define SC_OPCODE_COUNT 227
+#define SC_OPCODE_COUNT_2 228
+#define SC_OPCODE_NBW 229
+#define SC_OPCODE_IKV 230
+#define SC_OPCODE_VAR 231
+#define SC_OPCODE_VAR_P 232
+#define SC_OPCODE_ST_DEV 233
+#define SC_OPCODE_ST_DEV_P 234
+#define SC_OPCODE_B 235
+#define SC_OPCODE_NORM_DIST 236
+#define SC_OPCODE_EXP_DIST 237
+#define SC_OPCODE_BINOM_DIST 238
+#define SC_OPCODE_POISSON_DIST 239
+#define SC_OPCODE_KOMBIN 240
+#define SC_OPCODE_KOMBIN_2 241
+#define SC_OPCODE_VARIATIONEN 242
+#define SC_OPCODE_VARIATIONEN_2 243
+#define SC_OPCODE_BW 244
+#define SC_OPCODE_DIA 245
+#define SC_OPCODE_GDA 246
+#define SC_OPCODE_GDA_2 247
+#define SC_OPCODE_VBD 248
+#define SC_OPCODE_LAUFZ 249
+#define SC_OPCODE_LIA 250
+#define SC_OPCODE_RMZ 251
+#define SC_OPCODE_COLUMNS 252
+#define SC_OPCODE_ROWS 253
+#define SC_OPCODE_COLUMN 254
+#define SC_OPCODE_ROW 255
+#define SC_OPCODE_ZGZ 256
+#define SC_OPCODE_ZW 257
+#define SC_OPCODE_ZZR 258
+#define SC_OPCODE_ZINS 259
+#define SC_OPCODE_ZINS_Z 260
+#define SC_OPCODE_KAPZ 261
+#define SC_OPCODE_KUM_ZINS_Z 262
+#define SC_OPCODE_KUM_KAP_Z 263
+#define SC_OPCODE_EFFEKTIV 264
+#define SC_OPCODE_NOMINAL 265
+#define SC_OPCODE_SUB_TOTAL 266
+#define SC_OPCODE_DB_SUM 267 /* database functions */
+#define SC_OPCODE_DB_COUNT 268
+#define SC_OPCODE_DB_COUNT_2 269
+#define SC_OPCODE_DB_AVERAGE 270
+#define SC_OPCODE_DB_GET 271
+#define SC_OPCODE_DB_MAX 272
+#define SC_OPCODE_DB_MIN 273
+#define SC_OPCODE_DB_PRODUCT 274
+#define SC_OPCODE_DB_STD_DEV 275
+#define SC_OPCODE_DB_STD_DEV_P 276
+#define SC_OPCODE_DB_VAR 277
+#define SC_OPCODE_DB_VAR_P 278
+#define SC_OPCODE_INDIRECT 279 /* management functions */
+#define SC_OPCODE_ADDRESS 280
+#define SC_OPCODE_MATCH 281
+#define SC_OPCODE_COUNT_EMPTY_CELLS 282
+#define SC_OPCODE_COUNT_IF 283
+#define SC_OPCODE_SUM_IF 284
+#define SC_OPCODE_LOOKUP 285
+#define SC_OPCODE_V_LOOKUP 286
+#define SC_OPCODE_H_LOOKUP 287
+#define SC_OPCODE_MULTI_AREA 288
+#define SC_OPCODE_OFFSET 289
+#define SC_OPCODE_INDEX 290
+#define SC_OPCODE_AREAS 291
+#define SC_OPCODE_CURRENCY 292 /* string functions */
+#define SC_OPCODE_REPLACE 293
+#define SC_OPCODE_FIXED 294
+#define SC_OPCODE_FIND 295
+#define SC_OPCODE_EXACT 296
+#define SC_OPCODE_LEFT 297
+#define SC_OPCODE_RIGHT 298
+#define SC_OPCODE_SEARCH 299
+#define SC_OPCODE_MID 300
+#define SC_OPCODE_TEXT 301
+#define SC_OPCODE_SUBSTITUTE 302
+#define SC_OPCODE_REPT 303
+#define SC_OPCODE_CONCAT 304
+#define SC_OPCODE_MAT_VALUE 305 /* matrix functions */
+#define SC_OPCODE_MAT_DET 306
+#define SC_OPCODE_MAT_INV 307
+#define SC_OPCODE_MAT_MULT 308
+#define SC_OPCODE_MAT_TRANS 309
+#define SC_OPCODE_MATRIX_UNIT 310
+#define SC_OPCODE_BACK_SOLVER 311 /* BackSolver */
+#define SC_OPCODE_HYP_GEOM_DIST 312 /* statistical functions */
+#define SC_OPCODE_LOG_NORM_DIST 313
+#define SC_OPCODE_T_DIST 314
+#define SC_OPCODE_F_DIST 315
+#define SC_OPCODE_CHI_DIST 316
+#define SC_OPCODE_WEIBULL 317
+#define SC_OPCODE_NEG_BINOM_VERT 318
+#define SC_OPCODE_KRIT_BINOM 319
+#define SC_OPCODE_KURT 320
+#define SC_OPCODE_HAR_MEAN 321
+#define SC_OPCODE_GEO_MEAN 322
+#define SC_OPCODE_STANDARD 323
+#define SC_OPCODE_AVE_DEV 324
+#define SC_OPCODE_SCHIEFE 325
+#define SC_OPCODE_DEV_SQ 326
+#define SC_OPCODE_MEDIAN 327
+#define SC_OPCODE_MODAL_VALUE 328
+#define SC_OPCODE_Z_TEST 329
+#define SC_OPCODE_T_TEST 330
+#define SC_OPCODE_RANK 331
+#define SC_OPCODE_PERCENTILE 332
+#define SC_OPCODE_PERCENT_RANK 333
+#define SC_OPCODE_LARGE 334
+#define SC_OPCODE_SMALL 335
+#define SC_OPCODE_FREQUENCY 336
+#define SC_OPCODE_QUARTILE 337
+#define SC_OPCODE_NORM_INV 338
+#define SC_OPCODE_CONFIDENCE 339
+#define SC_OPCODE_F_TEST 340
+#define SC_OPCODE_TRIM_MEAN 341
+#define SC_OPCODE_PROB 342
+#define SC_OPCODE_CORREL 343
+#define SC_OPCODE_COVAR 344
+#define SC_OPCODE_PEARSON 345
+#define SC_OPCODE_RSQ 346
+#define SC_OPCODE_STEYX 347
+#define SC_OPCODE_SLOPE 348
+#define SC_OPCODE_INTERCEPT 349
+#define SC_OPCODE_TREND 350
+#define SC_OPCODE_GROWTH 351
+#define SC_OPCODE_RGP 352
+#define SC_OPCODE_RKP 353
+#define SC_OPCODE_FORECAST 354
+#define SC_OPCODE_CHI_INV 355
+#define SC_OPCODE_GAMMA_DIST 356
+#define SC_OPCODE_GAMMA_INV 357
+#define SC_OPCODE_T_INV 358
+#define SC_OPCODE_F_INV 359
+#define SC_OPCODE_CHI_TEST 360
+#define SC_OPCODE_LOG_INV 361
+#define SC_OPCODE_TABLE_OP 362
+#define SC_OPCODE_BETA_DIST 363
+#define SC_OPCODE_BETA_INV 364
+#define SC_OPCODE_WEEK 365 /* miscellaneous */
+#define SC_OPCODE_GET_DAY_OF_WEEK 366
+#define SC_OPCODE_NO_NAME 367
+#define SC_OPCODE_STYLE 368
+#define SC_OPCODE_DDE 369
+#define SC_OPCODE_BASE 370
+#define SC_OPCODE_TABLE 371
+#define SC_OPCODE_TABLES 372
+#define SC_OPCODE_MIN_A 373
+#define SC_OPCODE_MAX_A 374
+#define SC_OPCODE_AVERAGE_A 375
+#define SC_OPCODE_ST_DEV_A 376
+#define SC_OPCODE_ST_DEV_P_A 377
+#define SC_OPCODE_VAR_A 378
+#define SC_OPCODE_VAR_P_A 379
+#define SC_OPCODE_EASTERSUNDAY 380
+#define SC_OPCODE_DECIMAL 381
+#define SC_OPCODE_CONVERT 382
+#define SC_OPCODE_ROMAN 383
+#define SC_OPCODE_MIRR 384
+#define SC_OPCODE_CELL 385
+#define SC_OPCODE_ISPMT 386
+#define SC_OPCODE_HYPERLINK 387
+#define SC_OPCODE_INDIRECT_XL 388 /* See also INDIRECT for OOO variant */
+#define SC_OPCODE_ADDRESS_XL 389 /* See also ADRESS for OOO variant */
+#define SC_OPCODE_GET_PIVOT_DATA 390
+#define SC_OPCODE_EUROCONVERT 391
+#define SC_OPCODE_NUMBERVALUE 392
+#define SC_OPCODE_CHISQ_DIST 393
+#define SC_OPCODE_CHISQ_INV 394
+#define SC_OPCODE_BITAND 395
+#define SC_OPCODE_BITOR 396
+#define SC_OPCODE_BITXOR 397
+#define SC_OPCODE_BITRSHIFT 398
+#define SC_OPCODE_BITLSHIFT 399
+#define SC_OPCODE_GET_DATEDIF 400
+#define SC_OPCODE_XOR 401
+#define SC_OPCODE_AVERAGE_IF 402
+#define SC_OPCODE_SUM_IFS 403
+#define SC_OPCODE_AVERAGE_IFS 404
+#define SC_OPCODE_COUNT_IFS 405
+#define SC_OPCODE_SKEWP 406
+#define SC_OPCODE_STOP_2_PAR 407
+#define SC_OPCODE_LAST_OPCODE_ID 406 /* last OpCode */
+
+#define SC_OPCODE_STOP_FUNCTION 407
+
+/*** Internal ***/
+#define SC_OPCODE_INTERNAL_BEGIN 9999
+#define SC_OPCODE_TTT 9999
+#define SC_OPCODE_INTERNAL_END 9999
+
+/*** from here on ExtraData contained ***/
+#define SC_OPCODE_DATA_TOKEN_1 10000
+
+#define SC_OPCODE_NONE 0xFFFF
+
+
+#endif /* FORMULA_COMPILER_HRC */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/errorcodes.hxx b/include/formula/errorcodes.hxx
new file mode 100644
index 000000000000..1e145e04132b
--- /dev/null
+++ b/include/formula/errorcodes.hxx
@@ -0,0 +1,119 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef SC_ERRORCODES_HXX
+#define SC_ERRORCODES_HXX
+
+#include <rtl/math.hxx>
+#include <tools/solar.h>
+
+namespace ScErrorCodes
+{
+
+const sal_uInt16 errIllegalChar = 501;
+const sal_uInt16 errIllegalArgument = 502;
+const sal_uInt16 errIllegalFPOperation = 503; // #NUM!
+const sal_uInt16 errIllegalParameter = 504;
+const sal_uInt16 errIllegalJump = 505;
+const sal_uInt16 errSeparator = 506;
+const sal_uInt16 errPair = 507;
+const sal_uInt16 errPairExpected = 508;
+const sal_uInt16 errOperatorExpected = 509;
+const sal_uInt16 errVariableExpected = 510;
+const sal_uInt16 errParameterExpected = 511;
+const sal_uInt16 errCodeOverflow = 512;
+const sal_uInt16 errStringOverflow = 513;
+const sal_uInt16 errStackOverflow = 514;
+const sal_uInt16 errUnknownState = 515;
+const sal_uInt16 errUnknownVariable = 516;
+const sal_uInt16 errUnknownOpCode = 517;
+const sal_uInt16 errUnknownStackVariable = 518;
+const sal_uInt16 errNoValue = 519; // #VALUE!
+const sal_uInt16 errUnknownToken = 520;
+const sal_uInt16 errNoCode = 521; // #NULL!
+const sal_uInt16 errCircularReference = 522;
+const sal_uInt16 errNoConvergence = 523;
+const sal_uInt16 errNoRef = 524; // #REF!
+const sal_uInt16 errNoName = 525; // #NAME?
+const sal_uInt16 errDoubleRef = 526;
+const sal_uInt16 errInterpOverflow = 527;
+// Not displayed, temporary for TrackFormulas,
+// Cell depends on another cell that has errCircularReference
+const sal_uInt16 errTrackFromCircRef = 528;
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// set as mnStringNoValueError no error is generated but 0 returned.
+const sal_uInt16 errCellNoValue = 529;
+// Interpreter: needed AddIn not found
+const sal_uInt16 errNoAddin = 530;
+// Interpreter: needed Macro not found
+const sal_uInt16 errNoMacro = 531;
+// Interpreter: Division by zero
+const sal_uInt16 errDivisionByZero = 532; // #DIV/0!
+// Compiler: a non-simple (str,err,val) value was put in an array
+const sal_uInt16 errNestedArray = 533;
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// temporarily (!) set as mnStringNoValueError, the error is generated and can
+// be used to distinguish that condition from all other (inherited) errors. Do
+// not use for anything else! Never push or inherit the error otherwise!
+const sal_uInt16 errNotNumericString = 534;
+// ScInterpreter internal: jump matrix already has a result at this position,
+// do not overwrite in case of empty code path.
+const sal_uInt16 errJumpMatHasResult = 535;
+
+// Interpreter: NA() not available condition, not a real error
+const sal_uInt16 NOTAVAILABLE = 0x7fff;
+
+
+/** Unconditionally construct a double value of NAN where the lower bits
+ represent an interpreter error code. */
+inline double CreateDoubleError( sal_uInt16 nErr )
+{
+ union
+ {
+ double fVal;
+ sal_math_Double smVal;
+ };
+ ::rtl::math::setNan( &fVal );
+ smVal.nan_parts.fraction_lo = nErr;
+ return fVal;
+}
+
+
+/** Recreate the error code of a coded double error, if any. */
+inline sal_uInt16 GetDoubleErrorValue( double fVal )
+{
+ if ( ::rtl::math::isFinite( fVal ) )
+ return 0;
+ if ( ::rtl::math::isInf( fVal ) )
+ return errIllegalFPOperation; // normal INF
+ sal_uInt32 nErr = reinterpret_cast< sal_math_Double * >(
+ &fVal)->nan_parts.fraction_lo;
+ if ( nErr & 0xffff0000 )
+ return errNoValue; // just a normal NAN
+ return (sal_uInt16)(nErr & 0x0000ffff); // any other error
+}
+
+} // namespace ScErrorCodes
+
+// yes, exceptionally we put a "using namespace" in a header file..
+using namespace ScErrorCodes;
+
+#endif // SC_ERRORCODES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formdata.hxx b/include/formula/formdata.hxx
new file mode 100644
index 000000000000..595ddb63fc5a
--- /dev/null
+++ b/include/formula/formdata.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMDATA_HXX
+#define FORMULA_FORMDATA_HXX
+
+#include <tools/string.hxx>
+#include <tools/gen.hxx>
+#include "formula/formuladllapi.h"
+
+//============================================================================
+namespace formula
+{
+class FORMULA_DLLPUBLIC FormEditData
+{
+public:
+ FormEditData();
+ virtual ~FormEditData();
+
+ virtual void SaveValues();
+ sal_Bool HasParent() const { return pParent != NULL; }
+
+ inline sal_uInt16 GetMode() const { return nMode; }
+ inline xub_StrLen GetFStart() const { return nFStart; }
+ inline sal_uInt16 GetCatSel() const { return nCatSel; }
+ inline sal_uInt16 GetFuncSel() const { return nFuncSel; }
+ inline sal_uInt16 GetOffset() const { return nOffset; }
+ inline sal_uInt16 GetEdFocus() const { return nEdFocus; }
+ inline const String& GetUndoStr() const { return aUndoStr; }
+ inline sal_Bool GetMatrixFlag()const{ return bMatrix;}
+ inline OString GetUniqueId()const { return aUniqueId;}
+ inline const Selection& GetSelection()const { return aSelection;}
+
+ inline void SetMode( sal_uInt16 nNew ) { nMode = nNew; }
+ inline void SetFStart( xub_StrLen nNew ) { nFStart = nNew; }
+ inline void SetCatSel( sal_uInt16 nNew ) { nCatSel = nNew; }
+ inline void SetFuncSel( sal_uInt16 nNew ) { nFuncSel = nNew; }
+ inline void SetOffset( sal_uInt16 nNew ) { nOffset = nNew; }
+ inline void SetEdFocus( sal_uInt16 nNew ) { nEdFocus = nNew; }
+ inline void SetUndoStr( const String& rNew ) { aUndoStr = rNew; }
+ inline void SetMatrixFlag(sal_Bool bNew) { bMatrix=bNew;}
+ inline void SetUniqueId(const OString nNew) { aUniqueId=nNew;}
+ inline void SetSelection(const Selection& aSel) { aSelection=aSel;}
+protected:
+ void Reset();
+ FormEditData( const FormEditData& );
+ const FormEditData& operator=( const FormEditData& r );
+
+ FormEditData* pParent; // fuer Verschachtelung
+private:
+ sal_uInt16 nMode; // enum ScFormulaDlgMode
+ xub_StrLen nFStart;
+ sal_uInt16 nCatSel;
+ sal_uInt16 nFuncSel;
+ sal_uInt16 nOffset;
+ sal_uInt16 nEdFocus;
+ String aUndoStr;
+ sal_Bool bMatrix;
+ OString aUniqueId;
+ Selection aSelection;
+};
+
+
+} // formula
+#endif // FORMULA_FORMDATA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formula.hxx b/include/formula/formula.hxx
new file mode 100644
index 000000000000..5a55f5ca81d1
--- /dev/null
+++ b/include/formula/formula.hxx
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMULA_HXX
+#define FORMULA_FORMULA_HXX
+
+#include <sfx2/basedlgs.hxx>
+#include <memory>
+#include "formula/formuladllapi.h"
+#include "formula/omoduleclient.hxx"
+#include <formula/IFunctionDescription.hxx>
+
+namespace formula
+{
+//============================================================================
+#define STRUCT_END 1
+#define STRUCT_FOLDER 2
+#define STRUCT_ERROR 3
+
+enum FormulaDlgMode { FORMULA_FORMDLG_FORMULA, FORMULA_FORMDLG_ARGS, FORMULA_FORMDLG_EDIT };
+
+//============================================================================
+
+class FormulaDlg_Impl;
+class IControlReferenceHandler;
+class IFunctionDescription;
+class IFunctionManager;
+class FormulaHelper;
+class RefEdit;
+class RefButton;
+class FormEditData;
+//============================================================================
+class FORMULA_DLLPUBLIC FormulaModalDialog : public ModalDialog, public formula::IFormulaEditorHelper
+{
+ friend class FormulaDlg_Impl;
+public:
+ FormulaModalDialog( Window* pParent
+ , bool _bSupportFunctionResult
+ , bool _bSupportResult
+ , bool _bSupportMatrix
+ ,IFunctionManager* _pFunctionMgr
+ ,IControlReferenceHandler* _pDlg = NULL );
+ virtual ~FormulaModalDialog();
+private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr<FormulaDlg_Impl> m_pImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+protected:
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputDoneAfter( sal_Bool bForced = sal_False );
+ void SetFocusWin(Window *pWin,const OString& nUniqueId);
+
+ void SetMeText(const String& _sText);
+ void Update();
+ sal_Bool CheckMatrix(String& aFormula /*IN/OUT*/);
+ void Update(const String& _sExp);
+
+ void StoreFormEditData(FormEditData* pData);
+};
+
+class FORMULA_DLLPUBLIC FormulaDlg:
+ private OModuleClient, public SfxModelessDialog, public IFormulaEditorHelper
+ // order of base classes is important, as OModuleClient controls the
+ // lifecycle of the ResMgr passed into SfxModelessDialog (via
+ // formula::ModuleRes), and at least with DBG_UTIL calling TestRes in
+ // ~Resource, the ResMgr must outlive the Resource (from which
+ // SfxModelessDialog ultimately derives)
+{
+ friend class FormulaDlg_Impl;
+public:
+ FormulaDlg( SfxBindings* pB
+ , SfxChildWindow* pCW
+ , Window* pParent
+ , bool _bSupportFunctionResult
+ , bool _bSupportResult
+ , bool _bSupportMatrix
+ , IFunctionManager* _pFunctionMgr
+ , IControlReferenceHandler* _pDlg = NULL );
+ virtual ~FormulaDlg();
+private:
+ SAL_WNODEPRECATED_DECLARATIONS_PUSH
+ ::std::auto_ptr<FormulaDlg_Impl> m_pImpl;
+ SAL_WNODEPRECATED_DECLARATIONS_POP
+
+ DECL_LINK( UpdateFocusHdl, void*);
+protected:
+ void disableOk();
+
+protected:
+
+ virtual long PreNotify( NotifyEvent& rNEvt );
+ ::std::pair<RefButton*,RefEdit*> RefInputStartBefore( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputStartAfter( RefEdit* pEdit, RefButton* pButton = NULL );
+ void RefInputDoneAfter( sal_Bool bForced = sal_False );
+ void SetFocusWin(Window *pWin,const OString& nUniqueId);
+ void HighlightFunctionParas(const String& aFormula);
+
+ void SetMeText(const String& _sText);
+ FormulaDlgMode SetMeText(const String& _sText,xub_StrLen PrivStart, xub_StrLen PrivEnd,sal_Bool bMatrix,sal_Bool _bSelect,sal_Bool _bUpdate);
+ void Update();
+ sal_Bool CheckMatrix(String& aFormula /*IN/OUT*/);
+ String GetMeText() const;
+ void Update(const String& _sExp);
+ void CheckMatrix();
+ void DoEnter(sal_Bool _bOk);
+ sal_Bool isUserMatrix() const;
+ const IFunctionDescription* getCurrentFunctionDescription() const;
+ sal_Bool UpdateParaWin(Selection& _rSelection);
+ void UpdateParaWin(const Selection& _rSelection,const String& _sRefStr);
+ RefEdit* GetActiveEdit();
+ void SetEdSelection();
+
+ void StoreFormEditData(FormEditData* pData);
+
+ const FormulaHelper& GetFormulaHelper() const;
+};
+
+} // formula
+
+#endif // FORMULA_FORMULA_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formuladllapi.h b/include/formula/formuladllapi.h
new file mode 100644
index 000000000000..b2f4b06bd1a8
--- /dev/null
+++ b/include/formula/formuladllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULADLLAPI_H
+#define INCLUDED_FORMULADLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(FORMULA_DLLIMPLEMENTATION)
+#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FORMULA_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define FORMULA_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_FORMULADLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/formulahelper.hxx b/include/formula/formulahelper.hxx
new file mode 100644
index 000000000000..27c9b6683964
--- /dev/null
+++ b/include/formula/formulahelper.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FORMULA_HELPER_HXX
+#define FORMULA_FORMULA_HELPER_HXX
+
+#include "formula/IFunctionDescription.hxx"
+#include <vector>
+#include <tools/string.hxx>
+#include <memory>
+#include "formula/formuladllapi.h"
+
+class SvtSysLocale;
+class CharClass;
+
+namespace formula
+{
+ class FORMULA_DLLPUBLIC FormulaHelper
+ {
+ ::std::auto_ptr<SvtSysLocale> m_pSysLocale;
+ const CharClass* m_pCharClass;
+ const IFunctionManager* m_pFunctionManager;
+ const sal_Unicode open;
+ const sal_Unicode close;
+ const sal_Unicode sep;
+ const sal_Unicode arrayOpen;
+ const sal_Unicode arrayClose;
+ public:
+ FormulaHelper(const IFunctionManager* _pFunctionManager);
+
+ inline const CharClass* GetCharClass() const { return m_pCharClass; }
+
+ sal_Bool GetNextFunc( const String& rFormula,
+ sal_Bool bBack,
+ xub_StrLen& rFStart, // Ein- und Ausgabe
+ xub_StrLen* pFEnd = NULL,
+ const IFunctionDescription** ppFDesc = NULL,
+ ::std::vector< OUString>* pArgs = NULL ) const;
+
+ xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart,
+ sal_Bool bBack, String* pFuncName = NULL ) const;
+
+ xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart ) const;
+
+ xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart,
+ sal_uInt16 nArg ) const;
+
+ void GetArgStrings ( ::std::vector< OUString >& _rArgs,
+ const String& rFormula,
+ xub_StrLen nFuncPos,
+ sal_uInt16 nArgs ) const;
+
+ void FillArgStrings ( const String& rFormula,
+ xub_StrLen nFuncPos,
+ sal_uInt16 nArgs,
+ ::std::vector< OUString >& _rArgs ) const;
+ };
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif //FORMULA_FORMULA_HELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
new file mode 100644
index 000000000000..6676117cdf20
--- /dev/null
+++ b/include/formula/funcutl.hxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_FUNCUTL_HXX
+#define FORMULA_FUNCUTL_HXX
+
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/edit.hxx>
+#include "formula/formuladllapi.h"
+
+namespace formula {
+
+class IControlReferenceHandler;
+
+class FORMULA_DLLPUBLIC RefEdit : public Edit
+{
+private:
+ Timer aTimer;
+ IControlReferenceHandler* pAnyRefDlg; // parent dialog
+ Window* pLabelWidget;
+
+ DECL_LINK( UpdateHdl, void* );
+
+protected:
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+public:
+ RefEdit( Window* _pParent,IControlReferenceHandler* pParent,
+ Window* pShrinkModeLabel, const ResId& rResId );
+ RefEdit( Window* _pParent, Window* pShrinkModeLabel,
+ WinBits nStyle = WB_BORDER );
+ virtual ~RefEdit();
+
+ void SetRefString( const XubString& rStr );
+
+ /**
+ * Flag reference valid or invalid, which in turn changes the visual
+ * appearance of the control accordingly.
+ */
+ void SetRefValid(bool bValid);
+
+ using Edit::SetText;
+ virtual void SetText( const XubString& rStr );
+ virtual void Modify();
+
+ void StartUpdateData();
+
+ void SetReferences( IControlReferenceHandler* pDlg, Window *pLabelWidget );
+ IControlReferenceHandler* GetRefDialog() { return pAnyRefDlg; }
+ Window* GetLabelWidgetForShrinkMode() { return pLabelWidget; }
+};
+
+
+//============================================================================
+
+class FORMULA_DLLPUBLIC RefButton : public ImageButton
+{
+private:
+ Image aImgRefStart; /// Start reference input
+ Image aImgRefDone; /// Stop reference input
+ OUString aShrinkQuickHelp;
+ OUString aExpandQuickHelp;
+ IControlReferenceHandler* pAnyRefDlg; // parent dialog
+ RefEdit* pRefEdit; // zugeordnetes Edit-Control
+
+protected:
+ virtual void Click();
+ virtual void KeyInput( const KeyEvent& rKEvt );
+ virtual void GetFocus();
+ virtual void LoseFocus();
+
+public:
+ RefButton(Window* _pParent, const ResId& rResId);
+ RefButton(Window* _pParent, WinBits nStyle = 0);
+ RefButton(Window* _pParent, const ResId& rResId,
+ RefEdit* pEdit, IControlReferenceHandler* pDlg);
+
+ void SetReferences( IControlReferenceHandler* pDlg,
+ RefEdit* pEdit );
+
+ void SetStartImage();
+ void SetEndImage();
+ void DoRef() { Click(); }
+};
+
+} // formula
+
+#endif // FORMULA_FUNCUTL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/grammar.hxx b/include/formula/grammar.hxx
new file mode 100644
index 000000000000..584aff1ae57f
--- /dev/null
+++ b/include/formula/grammar.hxx
@@ -0,0 +1,242 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_GRAMMAR_HXX
+#define FORMULA_GRAMMAR_HXX
+
+#include "com/sun/star/sheet/FormulaLanguage.hpp"
+#include "formula/formuladllapi.h"
+#include <tools/debug.hxx>
+
+namespace formula
+{
+
+/** Grammars digested by ScCompiler.
+ */
+class FORMULA_DLLPUBLIC FormulaGrammar
+{
+public:
+ enum AddressConvention{
+ CONV_UNSPECIFIED = -1, /* useful when we want method to chose, must be first */
+
+ /* elements must be sequential and changes should be reflected in ScCompiler::pCharTables */
+ CONV_OOO = 0, /* 'doc'#sheet.A1:sheet2.B2 */
+ CONV_ODF, /* ['doc'#sheet.A1:sheet2.B2] */
+ CONV_XL_A1, /* [doc]sheet:sheet2!A1:B2 */
+ CONV_XL_R1C1, /* [doc]sheet:sheet2!R1C1:R2C2 */
+ CONV_XL_OOX, /* [#]sheet:sheet2!A1:B2 */
+
+ CONV_LOTUS_A1, /* external? 3d? A1.B2 <placeholder/> */
+
+ CONV_LAST /* for loops, must always be last */
+ };
+
+ //! CONV_UNSPECIFIED is a negative value!
+ static const int kConventionOffset = - CONV_UNSPECIFIED + 1;
+ // Room for 32k hypothetical languages plus EXTERNAL.
+ static const int kConventionShift = 16;
+ // Room for 256 reference conventions.
+ static const int kEnglishBit = (1 << (kConventionShift + 8));
+ // Mask off all non-language bits.
+ static const int kFlagMask = ~((~int(0)) << kConventionShift);
+
+ /** Values encoding the formula language plus address reference convention
+ plus English parsing/formatting
+ */
+ //! When adding new values adapt isSupported() below as well.
+ enum Grammar
+ {
+ /// Used only in ScCompiler ctor and in some XML import API context.
+ GRAM_UNSPECIFIED = -1,
+ /// ODFF with default ODF A1 bracketed references.
+ GRAM_ODFF = ::com::sun::star::sheet::FormulaLanguage::ODFF |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with default ODF A1 bracketed references.
+ GRAM_PODF = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with default A1 reference style.
+ GRAM_ENGLISH = ::com::sun::star::sheet::FormulaLanguage::ENGLISH |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Native with default A1 reference style.
+ GRAM_NATIVE = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift),
+ /// ODFF with reference style as set in UI, may be A1 or R1C1.
+ GRAM_ODFF_UI = ::com::sun::star::sheet::FormulaLanguage::ODFF |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODFF with A1 reference style, unbracketed.
+ GRAM_ODFF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODFF |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with reference style as set in UI, may be A1 or R1C1.
+ GRAM_PODF_UI = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// ODF 1.1 with A1 reference style, unbracketed.
+ GRAM_PODF_A1 = ::com::sun::star::sheet::FormulaLanguage::ODF_11 |
+ ((CONV_OOO +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Native with reference style as set in UI, may be A1 or R1C1.
+ GRAM_NATIVE_UI = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_UNSPECIFIED +
+ kConventionOffset) << kConventionShift),
+ /// Native with ODF A1 bracketed references. Not very useful but supported.
+ GRAM_NATIVE_ODF = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_ODF +
+ kConventionOffset) << kConventionShift),
+ /// Native with Excel A1 reference style.
+ GRAM_NATIVE_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_XL_A1 +
+ kConventionOffset) << kConventionShift),
+ /// Native with Excel R1C1 reference style.
+ GRAM_NATIVE_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::NATIVE |
+ ((CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift),
+ /// English with Excel A1 reference style.
+ GRAM_ENGLISH_XL_A1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_A1 +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// English with Excel R1C1 reference style.
+ GRAM_ENGLISH_XL_R1C1 = ::com::sun::star::sheet::FormulaLanguage::XL_ENGLISH |
+ ((CONV_XL_R1C1 +
+ kConventionOffset) << kConventionShift) |
+ kEnglishBit,
+ /// Central definition of the default grammar to be used.
+ GRAM_DEFAULT = GRAM_NATIVE_UI,
+
+ /// Central definition of the default storage grammar to be used.
+ GRAM_STORAGE_DEFAULT = GRAM_ODFF,
+
+ /** OpCodeMap set by external filter and merged with reference
+ convention plus English bit on top. Plain value acts as
+ FormulaLanguage. */
+ GRAM_EXTERNAL = (1 << (kConventionShift - 1))
+ };
+
+ /// If English parsing/formatting is associated with a grammar.
+ static inline bool isEnglish( const Grammar eGrammar )
+ {
+ return (eGrammar & kEnglishBit) != 0;
+ }
+
+ /** Compatibility helper for old "bCompileEnglish, bCompileXML" API calls
+ to obtain the new grammar. */
+ static Grammar mapAPItoGrammar( const bool bEnglish, const bool bXML )
+ {
+ Grammar eGrammar;
+ if (bEnglish && bXML)
+ eGrammar = GRAM_PODF;
+ else if (bEnglish && !bXML)
+ eGrammar = GRAM_PODF_A1;
+ else if (!bEnglish && bXML)
+ eGrammar = GRAM_NATIVE_ODF;
+ else // (!bEnglish && !bXML)
+ eGrammar = GRAM_NATIVE;
+ return eGrammar;
+ }
+
+ static bool isSupported( const Grammar eGrammar )
+ {
+ switch (eGrammar)
+ {
+ case GRAM_ODFF :
+ case GRAM_PODF :
+ case GRAM_ENGLISH :
+ case GRAM_NATIVE :
+ case GRAM_ODFF_UI :
+ case GRAM_ODFF_A1 :
+ case GRAM_PODF_UI :
+ case GRAM_PODF_A1 :
+ case GRAM_NATIVE_UI :
+ case GRAM_NATIVE_ODF :
+ case GRAM_NATIVE_XL_A1 :
+ case GRAM_NATIVE_XL_R1C1 :
+ case GRAM_ENGLISH_XL_A1 :
+ case GRAM_ENGLISH_XL_R1C1:
+ return true;
+ default:
+ return extractFormulaLanguage( eGrammar) == GRAM_EXTERNAL;
+ }
+ }
+
+ static inline sal_Int32 extractFormulaLanguage( const Grammar eGrammar )
+ {
+ return eGrammar & kFlagMask;
+ }
+
+ static inline AddressConvention extractRefConvention( const Grammar eGrammar )
+ {
+ return static_cast<AddressConvention>(
+ ((eGrammar & ~kEnglishBit) >> kConventionShift) -
+ kConventionOffset);
+ }
+
+ static inline Grammar setEnglishBit( const Grammar eGrammar, const bool bEnglish )
+ {
+ if (bEnglish)
+ return static_cast<Grammar>( eGrammar | kEnglishBit);
+ else
+ return static_cast<Grammar>( eGrammar & ~kEnglishBit);
+ }
+
+ static inline Grammar mergeToGrammar( const Grammar eGrammar, const AddressConvention eConv )
+ {
+ bool bEnglish = isEnglish( eGrammar);
+ Grammar eGram = static_cast<Grammar>(
+ extractFormulaLanguage( eGrammar) |
+ ((eConv + kConventionOffset) << kConventionShift));
+ eGram = setEnglishBit( eGram, bEnglish);
+ DBG_ASSERT( isSupported( eGram), "CompilerGrammarMap::mergeToGrammar: unsupported grammar");
+ return eGram;
+ }
+
+ /// If grammar is of ODF 1.1
+ static inline bool isPODF( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ ::com::sun::star::sheet::FormulaLanguage::ODF_11;
+ }
+
+ /// If grammar is of ODFF
+ static inline bool isODFF( const Grammar eGrammar )
+ {
+ return extractFormulaLanguage( eGrammar) ==
+ ::com::sun::star::sheet::FormulaLanguage::ODFF;
+ }
+
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif // FORMULA_GRAMMAR_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/omoduleclient.hxx b/include/formula/omoduleclient.hxx
new file mode 100644
index 000000000000..76fcee97fb57
--- /dev/null
+++ b/include/formula/omoduleclient.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FORMULA_MODULECLIENT_HXX
+#define INCLUDED_FORMULA_MODULECLIENT_HXX
+
+#include "sal/config.h"
+
+#include "boost/noncopyable.hpp"
+#include "formula/formuladllapi.h"
+
+namespace formula {
+
+/** Base class for objects which use any global module-specific resources.
+*/
+class FORMULA_DLLPUBLIC OModuleClient: private boost::noncopyable
+{
+public:
+ OModuleClient();
+ ~OModuleClient();
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
new file mode 100644
index 000000000000..b94c066a624b
--- /dev/null
+++ b/include/formula/opcode.hxx
@@ -0,0 +1,420 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_OPCODE_HXX
+#define FORMULA_OPCODE_HXX
+
+#include "formula/compiler.hrc" // OpCodes
+#include <tools/solar.h>
+
+enum OpCodeEnum
+{
+ // Special commands
+ ocPush = SC_OPCODE_PUSH,
+ ocCall = SC_OPCODE_CALL,
+ ocStop = SC_OPCODE_STOP,
+ ocExternal = SC_OPCODE_EXTERNAL,
+ ocName = SC_OPCODE_NAME,
+ ocExternalRef = SC_OPCODE_EXTERNAL_REF,
+ // Jump commands
+ ocIf = SC_OPCODE_IF,
+ ocIfError = SC_OPCODE_IF_ERROR,
+ ocIfNA = SC_OPCODE_IF_NA,
+ ocChose = SC_OPCODE_CHOSE,
+ // Parentheses and separators
+ ocOpen = SC_OPCODE_OPEN,
+ ocClose = SC_OPCODE_CLOSE,
+ ocSep = SC_OPCODE_SEP,
+ ocArrayOpen = SC_OPCODE_ARRAY_OPEN,
+ ocArrayClose = SC_OPCODE_ARRAY_CLOSE,
+ ocArrayRowSep = SC_OPCODE_ARRAY_ROW_SEP,
+ ocArrayColSep = SC_OPCODE_ARRAY_COL_SEP,
+ // Special OpCodes
+ ocMissing = SC_OPCODE_MISSING,
+ ocBad = SC_OPCODE_BAD,
+ ocStringXML = SC_OPCODE_STRINGXML,
+ ocSpaces = SC_OPCODE_SPACES,
+ ocMatRef = SC_OPCODE_MAT_REF,
+ ocSkip = SC_OPCODE_SKIP,
+ // Access commands
+ ocDBArea = SC_OPCODE_DB_AREA,
+ ocMacro = SC_OPCODE_MACRO,
+ ocColRowName = SC_OPCODE_COL_ROW_NAME,
+ ocColRowNameAuto = SC_OPCODE_COL_ROW_NAME_AUTO,
+ // Percent operator _follows_ value
+ ocPercentSign = SC_OPCODE_PERCENT_SIGN,
+ // Error constants
+ ocErrNull = SC_OPCODE_ERROR_NULL,
+ ocErrDivZero = SC_OPCODE_ERROR_DIVZERO,
+ ocErrValue = SC_OPCODE_ERROR_VALUE,
+ ocErrRef = SC_OPCODE_ERROR_REF,
+ ocErrName = SC_OPCODE_ERROR_NAME,
+ ocErrNum = SC_OPCODE_ERROR_NUM,
+ ocErrNA = SC_OPCODE_ERROR_NA,
+ // Binary operators
+ ocAdd = SC_OPCODE_ADD,
+ ocSub = SC_OPCODE_SUB,
+ ocMul = SC_OPCODE_MUL,
+ ocDiv = SC_OPCODE_DIV,
+ ocAmpersand = SC_OPCODE_AMPERSAND,
+ ocPow = SC_OPCODE_POW,
+ ocEqual = SC_OPCODE_EQUAL,
+ ocNotEqual = SC_OPCODE_NOT_EQUAL,
+ ocLess = SC_OPCODE_LESS,
+ ocGreater = SC_OPCODE_GREATER,
+ ocLessEqual = SC_OPCODE_LESS_EQUAL,
+ ocGreaterEqual = SC_OPCODE_GREATER_EQUAL,
+ ocAnd = SC_OPCODE_AND,
+ ocOr = SC_OPCODE_OR,
+ ocXor = SC_OPCODE_XOR,
+ ocIntersect = SC_OPCODE_INTERSECT,
+ ocUnion = SC_OPCODE_UNION,
+ ocRange = SC_OPCODE_RANGE,
+ // Unary operators
+ ocNot = SC_OPCODE_NOT,
+ ocNeg = SC_OPCODE_NEG,
+ ocNegSub = SC_OPCODE_NEG_SUB,
+ // Functions with no parameters
+ ocPi = SC_OPCODE_PI,
+ ocRandom = SC_OPCODE_RANDOM,
+ ocTrue = SC_OPCODE_TRUE,
+ ocFalse = SC_OPCODE_FALSE,
+ ocGetActDate = SC_OPCODE_GET_ACT_DATE,
+ ocGetActTime = SC_OPCODE_GET_ACT_TIME,
+ ocNotAvail = SC_OPCODE_NO_VALUE,
+ ocCurrent = SC_OPCODE_CURRENT,
+ // Functions with one parameter
+ ocDeg = SC_OPCODE_DEG,
+ ocRad = SC_OPCODE_RAD,
+ ocSin = SC_OPCODE_SIN,
+ ocCos = SC_OPCODE_COS,
+ ocTan = SC_OPCODE_TAN,
+ ocCot = SC_OPCODE_COT,
+ ocArcSin = SC_OPCODE_ARC_SIN,
+ ocArcCos = SC_OPCODE_ARC_COS,
+ ocArcTan = SC_OPCODE_ARC_TAN,
+ ocArcCot = SC_OPCODE_ARC_COT,
+ ocSinHyp = SC_OPCODE_SIN_HYP,
+ ocCosHyp = SC_OPCODE_COS_HYP,
+ ocTanHyp = SC_OPCODE_TAN_HYP,
+ ocCotHyp = SC_OPCODE_COT_HYP,
+ ocArcSinHyp = SC_OPCODE_ARC_SIN_HYP,
+ ocArcCosHyp = SC_OPCODE_ARC_COS_HYP,
+ ocArcTanHyp = SC_OPCODE_ARC_TAN_HYP,
+ ocArcCotHyp = SC_OPCODE_ARC_COT_HYP,
+ ocCosecant = SC_OPCODE_COSECANT,
+ ocSecant = SC_OPCODE_SECANT,
+ ocCosecantHyp = SC_OPCODE_COSECANT_HYP,
+ ocSecantHyp = SC_OPCODE_SECANT_HYP,
+ ocExp = SC_OPCODE_EXP,
+ ocLn = SC_OPCODE_LN,
+ ocSqrt = SC_OPCODE_SQRT,
+ ocFact = SC_OPCODE_FACT,
+ ocGetYear = SC_OPCODE_GET_YEAR,
+ ocGetMonth = SC_OPCODE_GET_MONTH,
+ ocGetDay = SC_OPCODE_GET_DAY,
+ ocGetHour = SC_OPCODE_GET_HOUR,
+ ocGetMin = SC_OPCODE_GET_MIN,
+ ocGetSec = SC_OPCODE_GET_SEC,
+ ocPlusMinus = SC_OPCODE_PLUS_MINUS,
+ ocAbs = SC_OPCODE_ABS,
+ ocInt = SC_OPCODE_INT,
+ ocPhi = SC_OPCODE_PHI,
+ ocGauss = SC_OPCODE_GAUSS,
+ ocIsEmpty = SC_OPCODE_IS_EMPTY,
+ ocIsString = SC_OPCODE_IS_STRING,
+ ocIsNonString = SC_OPCODE_IS_NON_STRING,
+ ocIsLogical = SC_OPCODE_IS_LOGICAL,
+ ocType = SC_OPCODE_TYPE,
+ ocCell = SC_OPCODE_CELL,
+ ocIsRef = SC_OPCODE_IS_REF,
+ ocIsValue = SC_OPCODE_IS_VALUE,
+ ocIsFormula = SC_OPCODE_IS_FORMULA,
+ ocIsNA = SC_OPCODE_IS_NV,
+ ocIsErr = SC_OPCODE_IS_ERR,
+ ocIsError = SC_OPCODE_IS_ERROR,
+ ocIsEven = SC_OPCODE_IS_EVEN,
+ ocIsOdd = SC_OPCODE_IS_ODD,
+ ocN = SC_OPCODE_N,
+ // String functions
+ ocGetDateValue = SC_OPCODE_GET_DATE_VALUE,
+ ocGetTimeValue = SC_OPCODE_GET_TIME_VALUE,
+ ocCode = SC_OPCODE_CODE,
+ ocTrim = SC_OPCODE_TRIM,
+ ocUpper = SC_OPCODE_UPPER,
+ ocPropper = SC_OPCODE_PROPPER,
+ ocLower = SC_OPCODE_LOWER,
+ ocLen = SC_OPCODE_LEN,
+ ocT = SC_OPCODE_T,
+ ocValue = SC_OPCODE_VALUE,
+ ocClean = SC_OPCODE_CLEAN,
+ ocChar = SC_OPCODE_CHAR,
+ ocLog10 = SC_OPCODE_LOG10,
+ ocEven = SC_OPCODE_EVEN,
+ ocOdd = SC_OPCODE_ODD,
+ ocStdNormDist = SC_OPCODE_STD_NORM_DIST,
+ ocFisher = SC_OPCODE_FISHER,
+ ocFisherInv = SC_OPCODE_FISHER_INV,
+ ocSNormInv = SC_OPCODE_S_NORM_INV,
+ ocGammaLn = SC_OPCODE_GAMMA_LN,
+ ocGamma = SC_OPCODE_GAMMA,
+ ocErrorType = SC_OPCODE_ERROR_TYPE,
+ ocErrCell = SC_OPCODE_ERR_CELL,
+ ocFormula = SC_OPCODE_FORMULA,
+ ocArabic = SC_OPCODE_ARABIC,
+ ocInfo = SC_OPCODE_INFO,
+ ocBahtText = SC_OPCODE_BAHTTEXT,
+ ocJis = SC_OPCODE_JIS,
+ ocAsc = SC_OPCODE_ASC,
+ ocUnicode = SC_OPCODE_UNICODE,
+ ocUnichar = SC_OPCODE_UNICHAR,
+ // Functions with more than one parameters
+ ocArcTan2 = SC_OPCODE_ARC_TAN_2,
+ ocCeil = SC_OPCODE_CEIL,
+ ocFloor = SC_OPCODE_FLOOR,
+ ocRound = SC_OPCODE_ROUND,
+ ocRoundUp = SC_OPCODE_ROUND_UP,
+ ocRoundDown = SC_OPCODE_ROUND_DOWN,
+ ocTrunc = SC_OPCODE_TRUNC,
+ ocLog = SC_OPCODE_LOG,
+ ocPower = SC_OPCODE_POWER,
+ ocGCD = SC_OPCODE_GGT,
+ ocLCM = SC_OPCODE_KGV,
+ ocMod = SC_OPCODE_MOD,
+ ocSumProduct = SC_OPCODE_SUM_PRODUCT,
+ ocSumSQ = SC_OPCODE_SUM_SQ,
+ ocSumX2MY2 = SC_OPCODE_SUM_X2MY2,
+ ocSumX2DY2 = SC_OPCODE_SUM_X2DY2,
+ ocSumXMY2 = SC_OPCODE_SUM_XMY2,
+ ocGetDate = SC_OPCODE_GET_DATE,
+ ocGetTime = SC_OPCODE_GET_TIME,
+ ocGetDiffDate = SC_OPCODE_GET_DIFF_DATE,
+ ocGetDiffDate360 = SC_OPCODE_GET_DIFF_DATE_360,
+ ocGetDateDif = SC_OPCODE_GET_DATEDIF,
+ ocMin = SC_OPCODE_MIN,
+ ocMax = SC_OPCODE_MAX,
+ ocSum = SC_OPCODE_SUM,
+ ocProduct = SC_OPCODE_PRODUCT,
+ ocAverage = SC_OPCODE_AVERAGE,
+ ocCount = SC_OPCODE_COUNT,
+ ocCount2 = SC_OPCODE_COUNT_2,
+ ocNPV = SC_OPCODE_NBW,
+ ocIRR = SC_OPCODE_IKV,
+ ocMIRR = SC_OPCODE_MIRR,
+ ocISPMT = SC_OPCODE_ISPMT,
+ ocVar = SC_OPCODE_VAR,
+ ocVarP = SC_OPCODE_VAR_P,
+ ocStDev = SC_OPCODE_ST_DEV,
+ ocStDevP = SC_OPCODE_ST_DEV_P,
+ ocB = SC_OPCODE_B,
+ ocNormDist = SC_OPCODE_NORM_DIST,
+ ocExpDist = SC_OPCODE_EXP_DIST,
+ ocBinomDist = SC_OPCODE_BINOM_DIST,
+ ocPoissonDist = SC_OPCODE_POISSON_DIST,
+ ocKombin = SC_OPCODE_KOMBIN,
+ ocKombin2 = SC_OPCODE_KOMBIN_2,
+ ocVariationen = SC_OPCODE_VARIATIONEN,
+ ocVariationen2 = SC_OPCODE_VARIATIONEN_2,
+ ocBW = SC_OPCODE_BW,
+ ocDIA = SC_OPCODE_DIA,
+ ocGDA = SC_OPCODE_GDA,
+ ocGDA2 = SC_OPCODE_GDA_2,
+ ocVBD = SC_OPCODE_VBD,
+ ocLaufz = SC_OPCODE_LAUFZ,
+ ocLIA = SC_OPCODE_LIA,
+ ocRMZ = SC_OPCODE_RMZ,
+ ocColumns = SC_OPCODE_COLUMNS,
+ ocRows = SC_OPCODE_ROWS,
+ ocColumn = SC_OPCODE_COLUMN,
+ ocRow = SC_OPCODE_ROW,
+ ocZGZ = SC_OPCODE_ZGZ,
+ ocZW = SC_OPCODE_ZW,
+ ocZZR = SC_OPCODE_ZZR,
+ ocZins = SC_OPCODE_ZINS,
+ ocZinsZ = SC_OPCODE_ZINS_Z,
+ ocKapz = SC_OPCODE_KAPZ,
+ ocKumZinsZ = SC_OPCODE_KUM_ZINS_Z,
+ ocKumKapZ = SC_OPCODE_KUM_KAP_Z,
+ ocEffektiv = SC_OPCODE_EFFEKTIV,
+ ocNominal = SC_OPCODE_NOMINAL,
+ ocSubTotal = SC_OPCODE_SUB_TOTAL,
+ // Database functions
+ ocDBSum = SC_OPCODE_DB_SUM,
+ ocDBCount = SC_OPCODE_DB_COUNT,
+ ocDBCount2 = SC_OPCODE_DB_COUNT_2,
+ ocDBAverage = SC_OPCODE_DB_AVERAGE,
+ ocDBGet = SC_OPCODE_DB_GET,
+ ocDBMax = SC_OPCODE_DB_MAX,
+ ocDBMin = SC_OPCODE_DB_MIN,
+ ocDBProduct = SC_OPCODE_DB_PRODUCT,
+ ocDBStdDev = SC_OPCODE_DB_STD_DEV,
+ ocDBStdDevP = SC_OPCODE_DB_STD_DEV_P,
+ ocDBVar = SC_OPCODE_DB_VAR,
+ ocDBVarP = SC_OPCODE_DB_VAR_P,
+ // Management functions
+ ocIndirect = SC_OPCODE_INDIRECT,
+ ocIndirectXL = SC_OPCODE_INDIRECT_XL,
+ ocAddress = SC_OPCODE_ADDRESS,
+ ocAddressXL = SC_OPCODE_ADDRESS_XL,
+ ocMatch = SC_OPCODE_MATCH,
+ ocCountEmptyCells = SC_OPCODE_COUNT_EMPTY_CELLS,
+ ocCountIf = SC_OPCODE_COUNT_IF,
+ ocSumIf = SC_OPCODE_SUM_IF,
+ ocAverageIf = SC_OPCODE_AVERAGE_IF,
+ ocSumIfs = SC_OPCODE_SUM_IFS,
+ ocAverageIfs = SC_OPCODE_AVERAGE_IFS,
+ ocCountIfs = SC_OPCODE_COUNT_IFS,
+ ocLookup = SC_OPCODE_LOOKUP,
+ ocVLookup = SC_OPCODE_V_LOOKUP,
+ ocHLookup = SC_OPCODE_H_LOOKUP,
+ ocMultiArea = SC_OPCODE_MULTI_AREA,
+ ocOffset = SC_OPCODE_OFFSET,
+ ocIndex = SC_OPCODE_INDEX,
+ ocAreas = SC_OPCODE_AREAS,
+ // String functions
+ ocCurrency = SC_OPCODE_CURRENCY,
+ ocReplace = SC_OPCODE_REPLACE,
+ ocFixed = SC_OPCODE_FIXED,
+ ocFind = SC_OPCODE_FIND,
+ ocExact = SC_OPCODE_EXACT,
+ ocLeft = SC_OPCODE_LEFT,
+ ocRight = SC_OPCODE_RIGHT,
+ ocSearch = SC_OPCODE_SEARCH,
+ ocMid = SC_OPCODE_MID,
+ ocText = SC_OPCODE_TEXT,
+ ocSubstitute = SC_OPCODE_SUBSTITUTE,
+ ocRept = SC_OPCODE_REPT,
+ ocConcat = SC_OPCODE_CONCAT,
+ ocNumberValue = SC_OPCODE_NUMBERVALUE,
+ // Matrix functions
+ ocMatValue = SC_OPCODE_MAT_VALUE,
+ ocMatDet = SC_OPCODE_MAT_DET,
+ ocMatInv = SC_OPCODE_MAT_INV,
+ ocMatMult = SC_OPCODE_MAT_MULT,
+ ocMatTrans = SC_OPCODE_MAT_TRANS,
+ ocMatrixUnit = SC_OPCODE_MATRIX_UNIT,
+ // BackSolver
+ ocBackSolver = SC_OPCODE_BACK_SOLVER,
+ // Statistical functions
+ ocHypGeomDist = SC_OPCODE_HYP_GEOM_DIST,
+ ocLogNormDist = SC_OPCODE_LOG_NORM_DIST,
+ ocTDist = SC_OPCODE_T_DIST,
+ ocFDist = SC_OPCODE_F_DIST,
+ ocChiDist = SC_OPCODE_CHI_DIST,
+ ocChiSqDist = SC_OPCODE_CHISQ_DIST,
+ ocChiSqInv = SC_OPCODE_CHISQ_INV,
+ ocWeibull = SC_OPCODE_WEIBULL,
+ ocNegBinomVert = SC_OPCODE_NEG_BINOM_VERT,
+ ocKritBinom = SC_OPCODE_KRIT_BINOM,
+ ocKurt = SC_OPCODE_KURT,
+ ocHarMean = SC_OPCODE_HAR_MEAN,
+ ocGeoMean = SC_OPCODE_GEO_MEAN,
+ ocStandard = SC_OPCODE_STANDARD,
+ ocAveDev = SC_OPCODE_AVE_DEV,
+ ocSchiefe = SC_OPCODE_SCHIEFE,
+ ocSkewp = SC_OPCODE_SKEWP,
+ ocDevSq = SC_OPCODE_DEV_SQ,
+ ocMedian = SC_OPCODE_MEDIAN,
+ ocModalValue = SC_OPCODE_MODAL_VALUE,
+ ocZTest = SC_OPCODE_Z_TEST,
+ ocTTest = SC_OPCODE_T_TEST,
+ ocRank = SC_OPCODE_RANK,
+ ocPercentile = SC_OPCODE_PERCENTILE,
+ ocPercentrank = SC_OPCODE_PERCENT_RANK,
+ ocLarge = SC_OPCODE_LARGE,
+ ocSmall = SC_OPCODE_SMALL,
+ ocFrequency = SC_OPCODE_FREQUENCY,
+ ocQuartile = SC_OPCODE_QUARTILE,
+ ocNormInv = SC_OPCODE_NORM_INV,
+ ocConfidence = SC_OPCODE_CONFIDENCE,
+ ocFTest = SC_OPCODE_F_TEST,
+ ocTrimMean = SC_OPCODE_TRIM_MEAN,
+ ocProb = SC_OPCODE_PROB,
+ ocCorrel = SC_OPCODE_CORREL,
+ ocCovar = SC_OPCODE_COVAR,
+ ocPearson = SC_OPCODE_PEARSON,
+ ocRSQ = SC_OPCODE_RSQ,
+ ocSTEYX = SC_OPCODE_STEYX,
+ ocSlope = SC_OPCODE_SLOPE,
+ ocIntercept = SC_OPCODE_INTERCEPT,
+ ocTrend = SC_OPCODE_TREND,
+ ocGrowth = SC_OPCODE_GROWTH,
+ ocRGP = SC_OPCODE_RGP,
+ ocRKP = SC_OPCODE_RKP,
+ ocForecast = SC_OPCODE_FORECAST,
+ ocChiInv = SC_OPCODE_CHI_INV,
+ ocGammaDist = SC_OPCODE_GAMMA_DIST,
+ ocGammaInv = SC_OPCODE_GAMMA_INV,
+ ocTInv = SC_OPCODE_T_INV,
+ ocFInv = SC_OPCODE_F_INV,
+ ocChiTest = SC_OPCODE_CHI_TEST,
+ ocLogInv = SC_OPCODE_LOG_INV,
+ ocTableOp = SC_OPCODE_TABLE_OP,
+ ocBetaDist = SC_OPCODE_BETA_DIST,
+ ocBetaInv = SC_OPCODE_BETA_INV,
+ // Bit functions
+ ocBitAnd = SC_OPCODE_BITAND,
+ ocBitOr = SC_OPCODE_BITOR,
+ ocBitXor = SC_OPCODE_BITXOR,
+ ocBitRshift = SC_OPCODE_BITRSHIFT,
+ ocBitLshift = SC_OPCODE_BITLSHIFT,
+ // miscellaneous
+ ocWeek = SC_OPCODE_WEEK,
+ ocGetDayOfWeek = SC_OPCODE_GET_DAY_OF_WEEK,
+ ocNoName = SC_OPCODE_NO_NAME,
+ ocStyle = SC_OPCODE_STYLE,
+ ocDde = SC_OPCODE_DDE,
+ ocBase = SC_OPCODE_BASE,
+ ocTable = SC_OPCODE_TABLE,
+ ocTables = SC_OPCODE_TABLES,
+ ocMinA = SC_OPCODE_MIN_A,
+ ocMaxA = SC_OPCODE_MAX_A,
+ ocAverageA = SC_OPCODE_AVERAGE_A,
+ ocStDevA = SC_OPCODE_ST_DEV_A,
+ ocStDevPA = SC_OPCODE_ST_DEV_P_A,
+ ocVarA = SC_OPCODE_VAR_A,
+ ocVarPA = SC_OPCODE_VAR_P_A,
+ ocEasterSunday = SC_OPCODE_EASTERSUNDAY,
+ ocDecimal = SC_OPCODE_DECIMAL,
+ ocConvert = SC_OPCODE_CONVERT,
+ ocRoman = SC_OPCODE_ROMAN,
+ ocHyperLink = SC_OPCODE_HYPERLINK,
+ ocGetPivotData = SC_OPCODE_GET_PIVOT_DATA,
+ ocEuroConvert = SC_OPCODE_EUROCONVERT,
+ // internal stuff
+ ocInternalBegin = SC_OPCODE_INTERNAL_BEGIN,
+ ocTTT = SC_OPCODE_TTT,
+ ocInternalEnd = SC_OPCODE_INTERNAL_END,
+ // from here on ExtraData
+ ocDataToken1 = SC_OPCODE_DATA_TOKEN_1,
+ // no OpCode
+ ocNone = SC_OPCODE_NONE
+};
+
+#ifndef DBG_UTIL
+// save memory since compilers tend to int an enum
+typedef sal_uInt16 OpCode;
+#else
+// have enum names in debugger
+typedef OpCodeEnum OpCode;
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/token.hxx b/include/formula/token.hxx
new file mode 100644
index 000000000000..3a174d7b9d4f
--- /dev/null
+++ b/include/formula/token.hxx
@@ -0,0 +1,428 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_TOKEN_HXX
+#define FORMULA_TOKEN_HXX
+
+#include <memory>
+#include <string.h>
+#include <vector>
+#include "formula/opcode.hxx"
+#include <tools/mempool.hxx>
+#include "formula/IFunctionDescription.hxx"
+#include "formula/formuladllapi.h"
+
+#include <boost/intrusive_ptr.hpp>
+
+namespace formula
+{
+
+enum StackVarEnum
+{
+ svByte,
+ svDouble,
+ svString,
+ svSingleRef,
+ svDoubleRef,
+ svMatrix,
+ svIndex,
+ svJump,
+ svExternal, // Byte + String
+ svFAP, // FormulaAutoPilot only, ever exported
+ svJumpMatrix, // 2003-07-02
+ svRefList, // ocUnion result
+ svEmptyCell, // Result is an empty cell, e.g. in LOOKUP()
+
+ svMatrixCell, // Result is a matrix with bells and
+ // whistles as needed for _the_ matrix
+ // formula result.
+
+ svHybridCell, // A temporary condition of a formula
+ // cell during import, having a double
+ // and/or string result and a formula
+ // string to be compiled.
+
+ svHybridValueCell, // A temporary formula cell with an value
+ // and possibily a string representation
+
+ svExternalSingleRef,
+ svExternalDoubleRef,
+ svExternalName,
+ svSubroutine, // A token with a subroutine token array.
+ svError, // error token
+ svMissing = 0x70, // 0 or ""
+ svSep, // separator, ocSep, ocOpen, ocClose
+ svUnknown // unknown StackType
+};
+
+#ifndef DBG_UTIL
+// save memory since compilers tend to int an enum
+typedef sal_uInt8 StackVar;
+#else
+// have enum names in debugger
+typedef StackVarEnum StackVar;
+#endif
+
+
+class FormulaToken;
+typedef ::boost::intrusive_ptr<FormulaToken> FormulaTokenRef;
+typedef ::boost::intrusive_ptr<const FormulaToken> FormulaConstTokenRef;
+
+class FormulaTokenArray;
+
+class FORMULA_DLLPUBLIC FormulaToken : public IFormulaToken
+{
+ OpCode eOp;
+ // not implemented, prevent usage
+ FormulaToken();
+ FormulaToken& operator=( const FormulaToken& );
+protected:
+
+ const StackVar eType; // type of data
+ mutable sal_uInt16 nRefCnt; // reference count
+
+public:
+ FormulaToken( StackVar eTypeP,OpCode e = ocPush ) :
+ eOp(e), eType( eTypeP ), nRefCnt(0) {}
+ FormulaToken( const FormulaToken& r ) : IFormulaToken(),
+ eOp(r.eOp), eType( r.eType ), nRefCnt(0) {}
+
+ virtual ~FormulaToken();
+
+ inline void Delete() { delete this; }
+ inline StackVar GetType() const { return eType; }
+ bool IsFunction() const; // pure functions, no operators
+ bool IsExternalRef() const;
+ sal_uInt8 GetParamCount() const;
+ inline void IncRef() const { nRefCnt++; }
+ inline void DecRef() const
+ {
+ if (!--nRefCnt)
+ const_cast<FormulaToken*>(this)->Delete();
+ }
+ inline sal_uInt16 GetRef() const { return nRefCnt; }
+ inline OpCode GetOpCode() const { return eOp; }
+
+ /**
+ Dummy methods to avoid switches and casts where possible,
+ the real token classes have to overload the appropriate method[s].
+ The only methods valid anytime if not overloaded are:
+
+ - GetByte() since this represents the count of parameters to a function
+ which of course is 0 on non-functions. FormulaByteToken and ScExternal do
+ overload it.
+
+ - HasForceArray() since also this is only used for operators and
+ functions and is 0 for other tokens.
+
+ Any other non-overloaded method pops up an assertion.
+ */
+
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual bool HasForceArray() const;
+ virtual void SetForceArray( bool b );
+ virtual double GetDouble() const;
+ virtual double& GetDoubleAsReference();
+ virtual const String& GetString() const;
+ virtual sal_uInt16 GetIndex() const;
+ virtual void SetIndex( sal_uInt16 n );
+ virtual bool IsGlobal() const;
+ virtual void SetGlobal( bool b );
+ virtual short* GetJump() const;
+ virtual const String& GetExternal() const;
+ virtual FormulaToken* GetFAPOrigToken() const;
+ virtual sal_uInt16 GetError() const;
+ virtual void SetError( sal_uInt16 );
+
+ virtual FormulaToken* Clone() const { return new FormulaToken(*this); }
+
+ virtual bool Is3DRef() const; // reference with 3D flag set
+ virtual bool TextEqual( const formula::FormulaToken& rToken ) const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ virtual bool isFunction() const
+ {
+ return IsFunction();
+ }
+
+ virtual sal_uInt32 getArgumentCount() const
+ {
+ return GetParamCount();
+ }
+
+ /** This is dirty and only the compiler should use it! */
+ struct PrivateAccess { friend class FormulaCompiler; private: PrivateAccess() { } };
+ inline void NewOpCode( OpCode e, const PrivateAccess& ) { eOp = e; }
+
+ static size_t GetStrLenBytes( xub_StrLen nLen )
+ { return nLen * sizeof(sal_Unicode); }
+ static size_t GetStrLenBytes( const String& rStr )
+ { return GetStrLenBytes( rStr.Len() ); }
+};
+
+inline void intrusive_ptr_add_ref(const FormulaToken* p)
+{
+ p->IncRef();
+}
+
+inline void intrusive_ptr_release(const FormulaToken* p)
+{
+ p->DecRef();
+}
+
+class FORMULA_DLLPUBLIC FormulaByteToken : public FormulaToken
+{
+private:
+ sal_uInt8 nByte;
+ bool bHasForceArray;
+protected:
+ FormulaByteToken( OpCode e, sal_uInt8 n, StackVar v, bool b ) :
+ FormulaToken( v,e ), nByte( n ),
+ bHasForceArray( b ) {}
+public:
+ FormulaByteToken( OpCode e, sal_uInt8 n, bool b ) :
+ FormulaToken( svByte,e ), nByte( n ),
+ bHasForceArray( b ) {}
+ FormulaByteToken( OpCode e, sal_uInt8 n ) :
+ FormulaToken( svByte,e ), nByte( n ),
+ bHasForceArray( false ) {}
+ FormulaByteToken( OpCode e ) :
+ FormulaToken( svByte,e ), nByte( 0 ),
+ bHasForceArray( false ) {}
+ FormulaByteToken( const FormulaByteToken& r ) :
+ FormulaToken( r ), nByte( r.nByte ),
+ bHasForceArray( r.bHasForceArray ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaByteToken(*this); }
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual bool HasForceArray() const;
+ virtual void SetForceArray( bool b );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaByteToken )
+};
+
+
+// A special token for the FormulaAutoPilot only. Keeps a reference pointer of
+// the token of which it was created for comparison.
+class FORMULA_DLLPUBLIC FormulaFAPToken : public FormulaByteToken
+{
+private:
+ FormulaTokenRef pOrigToken;
+public:
+ FormulaFAPToken( OpCode e, sal_uInt8 n, FormulaToken* p ) :
+ FormulaByteToken( e, n, svFAP, false ),
+ pOrigToken( p ) {}
+ FormulaFAPToken( const FormulaFAPToken& r ) :
+ FormulaByteToken( r ), pOrigToken( r.pOrigToken ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaFAPToken(*this); }
+ virtual FormulaToken* GetFAPOrigToken() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+class FORMULA_DLLPUBLIC FormulaDoubleToken : public FormulaToken
+{
+private:
+ double fDouble;
+public:
+ FormulaDoubleToken( double f ) :
+ FormulaToken( svDouble ), fDouble( f ) {}
+ FormulaDoubleToken( const FormulaDoubleToken& r ) :
+ FormulaToken( r ), fDouble( r.fDouble ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaDoubleToken(*this); }
+ virtual double GetDouble() const;
+ virtual double& GetDoubleAsReference();
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaDoubleToken )
+};
+
+
+class FORMULA_DLLPUBLIC FormulaStringToken : public FormulaToken
+{
+private:
+ String aString;
+public:
+ FormulaStringToken( const String& r ) :
+ FormulaToken( svString ), aString( r ) {}
+ FormulaStringToken( const FormulaStringToken& r ) :
+ FormulaToken( r ), aString( r.aString ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaStringToken(*this); }
+ virtual const String& GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+ DECL_FIXEDMEMPOOL_NEWDEL_DLL( FormulaStringToken )
+};
+
+
+/** Identical to FormulaStringToken, but with explicit OpCode instead of implicit
+ ocPush, and an optional sal_uInt8 for ocBad tokens. */
+class FORMULA_DLLPUBLIC FormulaStringOpToken : public FormulaByteToken
+{
+private:
+ String aString;
+public:
+ FormulaStringOpToken( OpCode e, const String& r ) :
+ FormulaByteToken( e, 0, svString, false ), aString( r ) {}
+ FormulaStringOpToken( const FormulaStringOpToken& r ) :
+ FormulaByteToken( r ), aString( r.aString ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaStringOpToken(*this); }
+ virtual const String& GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+class FORMULA_DLLPUBLIC FormulaIndexToken : public FormulaToken
+{
+private:
+ sal_uInt16 nIndex;
+ bool mbGlobal;
+public:
+ FormulaIndexToken( OpCode e, sal_uInt16 n, bool bGlobal = true ) :
+ FormulaToken( svIndex, e ), nIndex( n ), mbGlobal( bGlobal ) {}
+ FormulaIndexToken( const FormulaIndexToken& r ) :
+ FormulaToken( r ), nIndex( r.nIndex ), mbGlobal( r.mbGlobal ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaIndexToken(*this); }
+ virtual sal_uInt16 GetIndex() const;
+ virtual void SetIndex( sal_uInt16 n );
+ virtual bool IsGlobal() const;
+ virtual void SetGlobal( bool b );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaExternalToken : public FormulaToken
+{
+private:
+ String aExternal;
+ sal_uInt8 nByte;
+public:
+ FormulaExternalToken( OpCode e, sal_uInt8 n, const String& r ) :
+ FormulaToken( svExternal, e ), aExternal( r ),
+ nByte( n ) {}
+ FormulaExternalToken( OpCode e, const String& r ) :
+ FormulaToken(svExternal, e ), aExternal( r ),
+ nByte( 0 ) {}
+ FormulaExternalToken( const FormulaExternalToken& r ) :
+ FormulaToken( r ), aExternal( r.aExternal ),
+ nByte( r.nByte ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaExternalToken(*this); }
+ virtual const String& GetExternal() const;
+ virtual sal_uInt8 GetByte() const;
+ virtual void SetByte( sal_uInt8 n );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaMissingToken : public FormulaToken
+{
+public:
+ FormulaMissingToken() :
+ FormulaToken( svMissing,ocMissing ) {}
+ FormulaMissingToken( const FormulaMissingToken& r ) :
+ FormulaToken( r ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaMissingToken(*this); }
+ virtual double GetDouble() const;
+ virtual const String& GetString() const;
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+class FORMULA_DLLPUBLIC FormulaJumpToken : public FormulaToken
+{
+private:
+ short* pJump;
+public:
+ FormulaJumpToken( OpCode e, short* p ) :
+ FormulaToken( formula::svJump , e)
+ {
+ pJump = new short[ p[0] + 1 ];
+ memcpy( pJump, p, (p[0] + 1) * sizeof(short) );
+ }
+ FormulaJumpToken( const FormulaJumpToken& r ) :
+ FormulaToken( r )
+ {
+ pJump = new short[ r.pJump[0] + 1 ];
+ memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) );
+ }
+ virtual ~FormulaJumpToken();
+ virtual short* GetJump() const;
+ virtual bool operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new FormulaJumpToken(*this); }
+};
+
+
+class FORMULA_DLLPUBLIC FormulaSubroutineToken : public FormulaToken
+{
+public:
+ /** Takes ownership of pArray and deletes it upon destruction! */
+ FormulaSubroutineToken( const FormulaTokenArray* pArray ) :
+ FormulaToken( svSubroutine, ocCall ), mpArray( pArray) {}
+ FormulaSubroutineToken( const FormulaSubroutineToken& r );
+ virtual ~FormulaSubroutineToken();
+ virtual FormulaToken* Clone() const { return new FormulaSubroutineToken(*this); }
+ virtual bool operator==( const FormulaToken& rToken ) const;
+
+private:
+ const FormulaTokenArray* mpArray;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaUnknownToken : public FormulaToken
+{
+public:
+ FormulaUnknownToken( OpCode e ) :
+ FormulaToken( svUnknown, e ) {}
+ FormulaUnknownToken( const FormulaUnknownToken& r ) :
+ FormulaToken( r ) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaUnknownToken(*this); }
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+
+class FORMULA_DLLPUBLIC FormulaErrorToken : public FormulaToken
+{
+ sal_uInt16 nError;
+public:
+ FormulaErrorToken( sal_uInt16 nErr ) :
+ FormulaToken( svError ), nError( nErr) {}
+ FormulaErrorToken( const FormulaErrorToken& r ) :
+ FormulaToken( r ), nError( r.nError) {}
+
+ virtual FormulaToken* Clone() const { return new FormulaErrorToken(*this); }
+ virtual sal_uInt16 GetError() const;
+ virtual void SetError( sal_uInt16 nErr );
+ virtual bool operator==( const FormulaToken& rToken ) const;
+};
+
+// =============================================================================
+} // formula
+// =============================================================================
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/tokenarray.hxx b/include/formula/tokenarray.hxx
new file mode 100644
index 000000000000..875b055a621a
--- /dev/null
+++ b/include/formula/tokenarray.hxx
@@ -0,0 +1,287 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FORMULA_TOKENARRAY_HXX
+#define FORMULA_TOKENARRAY_HXX
+
+#include <limits.h>
+#include "formula/token.hxx"
+#include "formula/ExternalReferenceHelper.hxx"
+#include <tools/solar.h>
+#include <com/sun/star/sheet/FormulaToken.hpp>
+
+namespace formula
+{
+
+// RecalcMode access only via TokenArray SetRecalcMode / IsRecalcMode...
+
+typedef sal_uInt8 ScRecalcMode;
+// Only one of the exclusive bits can be set,
+// handled by TokenArray SetRecalcMode... methods
+#define RECALCMODE_NORMAL 0x01 // exclusive
+#define RECALCMODE_ALWAYS 0x02 // exclusive, always
+#define RECALCMODE_ONLOAD 0x04 // exclusive, always after load
+#define RECALCMODE_ONLOAD_ONCE 0x08 // exclusive, once after load
+#define RECALCMODE_FORCED 0x10 // combined, also if cell isn't visible
+#define RECALCMODE_ONREFMOVE 0x20 // combined, if reference was moved
+#define RECALCMODE_EMASK 0x0F // mask of exclusive bits
+// If new bits are to be defined, AddRecalcMode has to be adjusted!
+
+class FormulaMissingContext;
+
+class FORMULA_DLLPUBLIC MissingConvention
+{
+ bool mbODFF; /// TRUE: ODFF, FALSE: PODF
+public:
+ explicit MissingConvention( bool bODFF ) : mbODFF(bODFF) {}
+ // Implementation and usage only in token.cxx
+ inline bool isRewriteNeeded( OpCode eOp ) const;
+ inline bool isODFF() const { return mbODFF; }
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenArray
+{
+ friend class FormulaCompiler;
+ friend class FormulaTokenIterator;
+ friend class FormulaMissingContext;
+
+protected:
+ FormulaToken** pCode; // Token code array
+ FormulaToken** pRPN; // RPN array
+ sal_uInt16 nLen; // Length of token array
+ sal_uInt16 nRPN; // Length of RPN array
+ sal_uInt16 nIndex; // Current step index
+ sal_uInt16 nError; // Error code
+ short nRefs; // Count of cell references
+ ScRecalcMode nMode; // Flags to indicate when to recalc this code
+ bool bHyperLink; // If HYPERLINK() occurs in the formula.
+
+protected:
+ void Assign( const FormulaTokenArray& );
+
+ /// Also used by the compiler. The token MUST had been allocated with new!
+ FormulaToken* Add( FormulaToken* );
+ inline void SetCombinedBitsRecalcMode( ScRecalcMode nBits )
+ { nMode |= (nBits & ~RECALCMODE_EMASK); }
+ inline ScRecalcMode GetCombinedBitsRecalcMode() const
+ { return nMode & ~RECALCMODE_EMASK; }
+ /** Exclusive bits already set in nMode are
+ zero'ed, nBits may contain combined bits, but
+ only one exclusive bit may be set! */
+ inline void SetMaskedRecalcMode( ScRecalcMode nBits )
+ { nMode = GetCombinedBitsRecalcMode() | nBits; }
+
+public:
+ FormulaTokenArray();
+ /// Assignment with references to FormulaToken entries (not copied!)
+ FormulaTokenArray( const FormulaTokenArray& );
+ virtual ~FormulaTokenArray();
+ FormulaTokenArray* Clone() const; /// True copy!
+
+ void Clear();
+ void DelRPN();
+ FormulaToken* First() { nIndex = 0; return Next(); }
+ FormulaToken* Next();
+ FormulaToken* FirstNoSpaces() { nIndex = 0; return NextNoSpaces(); }
+ FormulaToken* NextNoSpaces();
+ FormulaToken* GetNextName();
+ FormulaToken* GetNextReference();
+ FormulaToken* GetNextReferenceRPN();
+ FormulaToken* GetNextReferenceOrName();
+ FormulaToken* GetNextColRowName();
+ FormulaToken* GetNextOpCodeRPN( OpCode );
+ /// Peek at nIdx-1 if not out of bounds, decrements nIdx if successful. Returns NULL if not.
+ FormulaToken* PeekPrev( sal_uInt16 & nIdx );
+ FormulaToken* PeekNext();
+ FormulaToken* PeekPrevNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
+ FormulaToken* PeekNextNoSpaces(); /// Only after Reset/First/Next/Last/Prev!
+ FormulaToken* FirstRPN() { nIndex = 0; return NextRPN(); }
+ FormulaToken* NextRPN();
+ FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
+ FormulaToken* PrevRPN();
+
+ bool HasExternalRef() const;
+ bool HasOpCode( OpCode ) const;
+ bool HasOpCodeRPN( OpCode ) const;
+ /// Token of type svIndex or opcode ocColRowName
+ bool HasNameOrColRowName() const;
+
+ FormulaToken** GetArray() const { return pCode; }
+ FormulaToken** GetCode() const { return pRPN; }
+ sal_uInt16 GetLen() const { return nLen; }
+ sal_uInt16 GetCodeLen() const { return nRPN; }
+ void Reset() { nIndex = 0; }
+ sal_uInt16 GetCodeError() const { return nError; }
+ void SetCodeError( sal_uInt16 n ) { nError = n; }
+ short GetRefs() const { return nRefs; }
+ void IncrementRefs() { ++nRefs; }
+ void SetHyperLink( bool bVal ) { bHyperLink = bVal; }
+ bool IsHyperLink() const { return bHyperLink; }
+
+ inline ScRecalcMode GetRecalcMode() const { return nMode; }
+ /** Bits aren't set directly but validated and
+ maybe handled according to priority if more
+ than one exclusive bit was set. */
+ void AddRecalcMode( ScRecalcMode nBits );
+
+ inline void ClearRecalcMode() { nMode = RECALCMODE_NORMAL; }
+ inline void SetExclusiveRecalcModeNormal()
+ { SetMaskedRecalcMode( RECALCMODE_NORMAL ); }
+ inline void SetExclusiveRecalcModeAlways()
+ { SetMaskedRecalcMode( RECALCMODE_ALWAYS ); }
+ inline void SetExclusiveRecalcModeOnLoad()
+ { SetMaskedRecalcMode( RECALCMODE_ONLOAD ); }
+ inline void SetExclusiveRecalcModeOnLoadOnce()
+ { SetMaskedRecalcMode( RECALCMODE_ONLOAD_ONCE ); }
+ inline void SetRecalcModeForced()
+ { nMode |= RECALCMODE_FORCED; }
+ inline void ClearRecalcModeForced()
+ { nMode &= ~RECALCMODE_FORCED; }
+ inline void SetRecalcModeOnRefMove()
+ { nMode |= RECALCMODE_ONREFMOVE; }
+ inline void ClearRecalcModeOnRefMove()
+ { nMode &= ~RECALCMODE_ONREFMOVE; }
+ inline bool IsRecalcModeNormal() const
+ { return (nMode & RECALCMODE_NORMAL) != 0; }
+ inline bool IsRecalcModeAlways() const
+ { return (nMode & RECALCMODE_ALWAYS) != 0; }
+ inline bool IsRecalcModeOnLoad() const
+ { return (nMode & RECALCMODE_ONLOAD) != 0; }
+ inline bool IsRecalcModeOnLoadOnce() const
+ { return (nMode & RECALCMODE_ONLOAD_ONCE) != 0; }
+ inline bool IsRecalcModeForced() const
+ { return (nMode & RECALCMODE_FORCED) != 0; }
+ inline bool IsRecalcModeOnRefMove() const
+ { return (nMode & RECALCMODE_ONREFMOVE) != 0; }
+
+ /** Get OpCode of the most outer function */
+ inline OpCode GetOuterFuncOpCode();
+
+ /** Operators +,-,*,/,^,&,=,<>,<,>,<=,>=
+ with DoubleRef in Formula? */
+ bool HasMatrixDoubleRefOps();
+
+ virtual FormulaToken* AddOpCode(OpCode e);
+
+ /** Adds the single token to array.
+ Derived classes must overload it when they want to support derived classes from FormulaToken.
+ @return true when an error occurs
+ */
+ virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken, ExternalReferenceHelper* _pRef = NULL);
+
+ /** fill the array with the tokens from the sequence.
+ It calls AddFormulaToken for each token in the list.
+ @param _aSequence the token to add
+ @return true when an error occurs
+ */
+ bool Fill(const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& _aSequence, ExternalReferenceHelper* _pRef = NULL);
+
+ /**
+ * Do some checking based on the individual tokens. For now, we use this
+ * only to check whether we can vectorize the token array.
+ */
+ virtual void CheckToken( const FormulaToken& t );
+
+ FormulaToken* AddToken( const FormulaToken& );
+ FormulaToken* AddString( const sal_Unicode* pStr );
+ FormulaToken* AddString( const String& rStr );
+ FormulaToken* AddDouble( double fVal );
+ FormulaToken* AddExternal( const sal_Unicode* pStr );
+ /** Xcl import may play dirty tricks with OpCode!=ocExternal.
+ Others don't use! */
+ FormulaToken* AddExternal( const String& rStr, OpCode eOp = ocExternal );
+ FormulaToken* AddBad( const String& rStr ); /// ocBad with String
+ FormulaToken* AddStringXML( const String& rStr ); /// ocStringXML with String, temporary during import
+
+ virtual FormulaToken* MergeArray( );
+
+ /// Assignment with references to FormulaToken entries (not copied!)
+ FormulaTokenArray& operator=( const FormulaTokenArray& );
+
+ /** Determines if this formula needs any changes to convert it to something
+ previous versions of OOo could consume (Plain Old Formula). */
+ bool NeedsPofRewrite(const MissingConvention & rConv);
+
+ /** Rewrites to Plain Old Formula, substituting missing parameters. The
+ FormulaTokenArray* returned is new'ed. */
+ FormulaTokenArray* RewriteMissingToPof(const MissingConvention & rConv);
+
+ /** Determines if this formula may be followed by a reference. */
+ bool MayReferenceFollow();
+};
+
+inline OpCode FormulaTokenArray::GetOuterFuncOpCode()
+{
+ if ( pRPN && nRPN )
+ return pRPN[nRPN-1]->GetOpCode();
+ return ocNone;
+}
+
+struct ImpTokenIterator
+{
+ ImpTokenIterator* pNext;
+ const FormulaTokenArray* pArr;
+ short nPC;
+ short nStop;
+
+ DECL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator );
+};
+
+class FORMULA_DLLPUBLIC FormulaTokenIterator
+{
+ ImpTokenIterator* pCur;
+
+public:
+ FormulaTokenIterator( const FormulaTokenArray& );
+ ~FormulaTokenIterator();
+ void Reset();
+ const FormulaToken* Next();
+ const FormulaToken* PeekNextOperator();
+ bool IsEndOfPath() const; /// if a jump or subroutine path is done
+ bool HasStacked() const { return pCur->pNext != 0; }
+ short GetPC() const { return pCur->nPC; }
+
+ /** Jump or subroutine call.
+ Program counter values will be incremented before code is executed =>
+ positions are to be passed with -1 offset.
+ @param nStart
+ Start on code at position nStart+1 (yes, pass with offset -1)
+ @param nNext
+ After subroutine continue with instruction at position nNext+1
+ @param nStop
+ Stop before reaching code at position nStop. If not specified the
+ default is to either run the entire code, or to stop if an ocSep or
+ ocClose is encountered, which are only present in ocIf or ocChose
+ jumps.
+ */
+ void Jump( short nStart, short nNext, short nStop = SHRT_MAX );
+ void Push( const FormulaTokenArray* );
+ void Pop();
+
+private:
+ const FormulaToken* GetNonEndOfPathToken( short nIdx ) const;
+};
+// =============================================================================
+} // formula
+// =============================================================================
+
+
+#endif // FORMULA_TOKENARRAY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/actiontriggerhelper.hxx b/include/framework/actiontriggerhelper.hxx
new file mode 100644
index 000000000000..e942de94924f
--- /dev/null
+++ b/include/framework/actiontriggerhelper.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
+#define __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <vcl/menu.hxx>
+#include <framework/fwedllapi.h>
+
+
+namespace framework
+{
+ class FWE_DLLPUBLIC ActionTriggerHelper
+ {
+ public:
+ // Fills the submitted menu with the structure contained in the second
+ // parameter rActionTriggerContainer
+ // @param pNewMenu = must be a valid and empty menu
+ // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContaienr"
+ static void
+ CreateMenuFromActionTriggerContainer(
+ Menu* pNewMenu,
+ const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer );
+
+ // Creates a "com::sun::star::ui::ActionTriggerContainer" with the structure of the menu
+ // provided as a parameter. The implementation class stores the menu pointer
+ // to optimize the time of creation of a menu from a actiontrigger structure.
+ // IMPORTANT: The caller must ensure that the menu pointer is valid through the
+ // life time of the XIndexContainer object!!!
+ // @param pNewMenu = Must be a valid menu. Please be aware that this implementation is based on
+ // the above mentioned restriction!!!
+
+ static com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > CreateActionTriggerContainerFromMenu(
+ const Menu* pMenu, const OUString* pMenuIdentifier );
+
+ // Fills the submitted rActionTriggerContainer with the structure of the menu
+ // provided as the second parameter
+ // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer"
+ // @param pNewMenu = must be a valid menu
+ static void
+ FillActionTriggerContainerFromMenu(
+ com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer,
+ const Menu* pMenu );
+
+ };
+}
+
+#endif // __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/addonmenu.hxx b/include/framework/addonmenu.hxx
new file mode 100644
index 000000000000..6390459be0f1
--- /dev/null
+++ b/include/framework/addonmenu.hxx
@@ -0,0 +1,127 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_ADDONMENU_HXX_
+#define __FRAMEWORK_CLASSES_ADDONMENU_HXX_
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <vcl/menu.hxx>
+#include <framework/fwedllapi.h>
+
+#define ADDONMENU_ITEMID_START 2000
+#define ADDONMENU_ITEMID_END 3000
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC AddonMenu : public PopupMenu
+{
+ public:
+ AddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+ ~AddonMenu();
+
+ protected:
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
+};
+
+class AddonMenuManager;
+
+class FWE_DLLPUBLIC AddonPopupMenu : public AddonMenu
+{
+ public:
+ ~AddonPopupMenu();
+
+ // Check if command URL string has the unique prefix to identify addon popup menus
+ static sal_Bool IsCommandURLPrefix( const OUString& aCmdURL );
+
+ void SetCommandURL( const OUString& aCmdURL ) { m_aCommandURL = aCmdURL; }
+ const OUString& GetCommandURL() const { return m_aCommandURL; }
+
+ protected:
+ void Initialize( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonPopupMenuDefinition );
+
+ private:
+ AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
+
+ OUString m_aCommandURL;
+
+ friend class AddonMenuManager;
+};
+
+class FWE_DLLPUBLIC AddonMenuManager
+{
+ public:
+ enum MenuType
+ {
+ ADDON_MENU,
+ ADDON_POPUPMENU
+ };
+
+ static sal_Bool HasAddonMenuElements();
+
+ static sal_Bool IsAddonMenuId( sal_uInt16 nId ) { return (( nId >= ADDONMENU_ITEMID_START ) && ( nId < ADDONMENU_ITEMID_END )); }
+
+ // Check if the context string matches the provided xModel context
+ static sal_Bool IsCorrectContext( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rModel, const OUString& aContext );
+
+ // Factory method to create different Add-On menu types
+ static PopupMenu* CreatePopupMenuType( MenuType eMenuType, const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame );
+
+ // Create the Add-Ons menu
+ static AddonMenu* CreateAddonMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+
+ // Merge the Add-Ons help menu items into the given menu bar at a defined pos
+ static void MergeAddonHelpMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ MenuBar* pMergeMenuBar );
+
+ // Merge the addon popup menus into the given menu bar at the provided pos.
+ static void MergeAddonPopupMenus( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel,
+ sal_uInt16 nMergeAtPos,
+ MenuBar* pMergeMenuBar );
+
+ // Returns the next position to insert a menu item/sub menu
+ static sal_uInt16 GetNextPos( sal_uInt16 nPos );
+
+ // Build up the menu item and sub menu into the provided pCurrentMenu. The sub menus should be of type nSubMenuType.
+ static void BuildMenu( PopupMenu* pCurrentMenu,
+ MenuType nSubMenuType,
+ sal_uInt16 nInsPos,
+ sal_uInt16& nUniqueMenuId,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > > aAddonMenuDefinition,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame,
+ const com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel );
+
+ // Retrieve the menu entry property values from a sequence
+ static void GetMenuEntry( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rAddonMenuEntry,
+ OUString& rTitle,
+ OUString& rURL,
+ OUString& rTarget,
+ OUString& rImageId,
+ OUString& rContext,
+ com::sun::star::uno::Sequence< com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > >& rAddonSubMenu );
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_ADDONMENU_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/addonsoptions.hxx b/include/framework/addonsoptions.hxx
new file mode 100644
index 000000000000..def743378216
--- /dev/null
+++ b/include/framework/addonsoptions.hxx
@@ -0,0 +1,350 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
+#define __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
+
+#include <sal/types.h>
+#include <osl/mutex.hxx>
+#include <vcl/image.hxx>
+#include <vcl/bitmap.hxx>
+#include <vcl/svapp.hxx>
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <framework/fwedllapi.h>
+//_________________________________________________________________________________________________________________
+// types, enums, ...
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @descr The method GetAddonsMenu() returns a list of property values.
+ Use follow defines to seperate values by names.
+*//*-*************************************************************************************************************/
+#define ADDONSMENUITEM_STRING_URL "URL"
+#define ADDONSMENUITEM_STRING_TITLE "Title"
+#define ADDONSMENUITEM_STRING_TARGET "Target"
+#define ADDONSMENUITEM_STRING_IMAGEIDENTIFIER "ImageIdentifier"
+#define ADDONSMENUITEM_STRING_CONTEXT "Context"
+#define ADDONSMENUITEM_STRING_SUBMENU "Submenu"
+#define ADDONSMENUITEM_STRING_CONTROLTYPE "ControlType"
+#define ADDONSMENUITEM_STRING_WIDTH "Width"
+
+#define ADDONSMENUITEM_URL_LEN 3
+#define ADDONSMENUITEM_TITLE_LEN 5
+#define ADDONSMENUITEM_TARGET_LEN 6
+#define ADDONSMENUITEM_SUBMENU_LEN 7
+#define ADDONSMENUITEM_CONTEXT_LEN 7
+#define ADDONSMENUITEM_IMAGEIDENTIFIER_LEN 15
+
+#define ADDONSMENUITEM_PROPERTYNAME_URL OUString(ADDONSMENUITEM_STRING_URL )
+#define ADDONSMENUITEM_PROPERTYNAME_TITLE OUString(ADDONSMENUITEM_STRING_TITLE )
+#define ADDONSMENUITEM_PROPERTYNAME_TARGET OUString(ADDONSMENUITEM_STRING_TARGET )
+#define ADDONSMENUITEM_PROPERTYNAME_IMAGEIDENTIFIER OUString(ADDONSMENUITEM_STRING_IMAGEIDENTIFIER )
+#define ADDONSMENUITEM_PROPERTYNAME_CONTEXT OUString(ADDONSMENUITEM_STRING_CONTEXT )
+#define ADDONSMENUITEM_PROPERTYNAME_SUBMENU OUString(ADDONSMENUITEM_STRING_SUBMENU )
+#define ADDONSMENUITEM_PROPERTYNAME_CONTROLTYPE OUString(ADDONSMENUITEM_STRING_CONTROLTYPE )
+#define ADDONSMENUITEM_PROPERTYNAME_WIDTH OUString(ADDONSMENUITEM_STRING_WIDTH )
+
+#define ADDONSPOPUPMENU_URL_PREFIX_STR "private:menu/Addon"
+
+#define ADDONSPOPUPMENU_URL_PREFIX OUString( ADDONSPOPUPMENU_URL_PREFIX_STR )
+
+namespace framework
+{
+
+typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > MergeMenuDefinition;
+
+struct FWE_DLLPUBLIC MergeMenuInstruction
+{
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeMenu;
+};
+typedef ::std::vector< MergeMenuInstruction > MergeMenuInstructionContainer;
+
+struct FWE_DLLPUBLIC MergeToolbarInstruction
+{
+ OUString aMergeToolbar;
+ OUString aMergePoint;
+ OUString aMergeCommand;
+ OUString aMergeCommandParameter;
+ OUString aMergeFallback;
+ OUString aMergeContext;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > aMergeToolbarItems;
+};
+
+typedef ::std::vector< MergeToolbarInstruction > MergeToolbarInstructionContainer;
+
+//_________________________________________________________________________________________________________________
+// forward declarations
+//_________________________________________________________________________________________________________________
+
+/*-************************************************************************************************************//**
+ @short forward declaration to our private date container implementation
+ @descr We use these class as internal member to support small memory requirements.
+ You can create the container if it is neccessary. The class which use these mechanism
+ is faster and smaller then a complete implementation!
+*//*-*************************************************************************************************************/
+
+class AddonsOptions_Impl;
+
+/*-************************************************************************************************************//**
+ @short collect information about menu features
+ @descr -
+
+ @implements -
+ @base -
+
+ @devstatus ready to use
+*//*-*************************************************************************************************************/
+
+class FWE_DLLPUBLIC AddonsOptions
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ public:
+ //---------------------------------------------------------------------------------------------------------
+ // constructor / destructor
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short standard constructor and destructor
+ @descr This will initialize an instance with default values.
+ We implement these class with a refcount mechanism! Every instance of this class increase it
+ at create and decrease it at delete time - but all instances use the same data container!
+ He is implemented as a static member ...
+
+ @seealso member m_nRefCount
+ @seealso member m_pDataContainer
+
+ @param -
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ AddonsOptions();
+ ~AddonsOptions();
+
+ //---------------------------------------------------------------------------------------------------------
+ // interface
+ //---------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short clears completely the addons menu
+ @descr Call this methods to clear the addons menu
+ To fill it again use AppendItem().
+
+ @seealso -
+
+ @param "eMenu" select right menu to clear.
+ @return -
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ void Clear();
+
+ /*-****************************************************************************************************//**
+ @short returns if an addons menu is available
+ @descr Call to retrieve if a addons menu is available
+
+
+ @return sal_True if there is a menu otherwise sal_False
+ *//*-*****************************************************************************************************/
+
+ sal_Bool HasAddonsMenu() const;
+
+ /*-****************************************************************************************************//**
+ @short returns number of addons toolbars
+ @descr Call to retrieve the number of addons toolbars
+
+
+ @return number of addons toolbars
+ *//*-*****************************************************************************************************/
+ sal_Int32 GetAddonsToolBarCount() const ;
+
+ /*-****************************************************************************************************//**
+ @short returns the complete addons menu
+ @descr Call it to get all entries of the addon menu.
+ We return a list of all nodes with his names and properties.
+
+ @seealso -
+
+ @return A list of menu items is returned.
+
+ @onerror We return an empty list.
+ *//*-*****************************************************************************************************/
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenu() const;
+
+ /*-****************************************************************************************************//**
+ @short Gets the menu bar part of all addon components registered
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsMenuBarPart() const;
+
+ /*-****************************************************************************************************//**
+ @short Gets a toolbar part of an single addon
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsToolBarPart( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************//**
+ @short Gets a unique toolbar resource name of an single addon
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const OUString GetAddonsToolbarResourceName( sal_uInt32 nIndex ) const;
+
+ /*-****************************************************************************************************//**
+ @short Retrieves all available merge instructions for the Office menu bar
+ @descr -
+
+ @seealso -
+
+ @return The filled MergeMenuDefinitionContaier
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+
+ const MergeMenuInstructionContainer& GetMergeMenuInstructions() const;
+
+ /*-****************************************************************************************************//**
+ @short Retrieves all available merge instructions for a single toolbar
+ @descr -
+
+ @seealso -
+
+ @return The filled
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ bool GetMergeToolbarInstructions( const OUString& rToolbarName, MergeToolbarInstructionContainer& rToolbar ) const;
+
+ /*-****************************************************************************************************//**
+ @short Gets the Add-On help menu part of all addon components registered
+ @descr -
+
+ @seealso -
+
+ @return A complete
+
+ @onerror We return sal_False
+ *//*-*****************************************************************************************************/
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& GetAddonsHelpMenu() const;
+
+ /*-****************************************************************************************************//**
+ @short Retrieve an image for a command URL which is defined inside the addon menu configuration
+ @descr Call it to retrieve an image for a command URL which is defined inside the addon menu configuration
+
+ @seealso -
+
+ @return An image which was defined in the configuration for the menu item. The image can be empty
+ no bitmap was defined for the request image properties.
+
+ @onerror An empty image
+ *//*-*****************************************************************************************************/
+
+ Image GetImageFromURL( const OUString& aURL, sal_Bool bBig, sal_Bool bNoScale ) const;
+ Image GetImageFromURL( const OUString& aURL, sal_Bool bBig ) const;
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private methods
+ //-------------------------------------------------------------------------------------------------------------
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+
+ static ::osl::Mutex& GetOwnStaticMutex();
+
+ /*-****************************************************************************************************//**
+ @short return a reference to a static mutex
+ @descr These class is partially threadsafe (for de-/initialization only).
+ All access methods are'nt safe!
+ We create a static mutex only for one ime and use at different times.
+
+ @seealso -
+
+ @param -
+ @return A reference to a static mutex member.
+
+ @onerror -
+ *//*-*****************************************************************************************************/
+ DECL_STATIC_LINK( AddonsOptions, Notify, void* );
+
+ //-------------------------------------------------------------------------------------------------------------
+ // private member
+ //-------------------------------------------------------------------------------------------------------------
+
+ private:
+
+ /*Attention
+
+ Don't initialize these static member in these header!
+ a) Double dfined symbols will be detected ...
+ b) and unresolved externals exist at linking time.
+ Do it in your source only.
+ */
+
+ static AddonsOptions_Impl* m_pDataContainer ; /// impl. data container as dynamic pointer for smaller memory requirements!
+ static sal_Int32 m_nRefCount ; /// internal ref count mechanism
+
+}; // class SvtMenuOptions
+
+}
+
+#endif // #ifndef __FRAMEWORK_CLASSES_ADDONSOPTIONS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/bmkmenu.hxx b/include/framework/bmkmenu.hxx
new file mode 100644
index 000000000000..d78eefeced24
--- /dev/null
+++ b/include/framework/bmkmenu.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX
+#define __FRAMEWORK_CLASSES_BMKMENU_HXX
+
+#include "framework/addonmenu.hxx"
+
+#include <com/sun/star/frame/XFrame.hpp>
+#include <framework/fwedllapi.h>
+
+#include <vcl/menu.hxx>
+#include <vcl/image.hxx>
+
+class String;
+class ImageList;
+
+#define BMKMENU_ITEMID_START 20000
+
+namespace framework
+{
+
+class BmkMenu_Impl;
+class FWE_DLLPUBLIC BmkMenu : public AddonMenu
+{
+ public:
+ enum BmkMenuType
+ {
+ BMK_NEWMENU,
+ BMK_WIZARDMENU
+ };
+
+ BmkMenu( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ BmkMenuType nType
+ );
+
+ ~BmkMenu();
+
+ void Initialize(); // Synchrones Laden der Eintraege
+
+ protected:
+ BmkMenu::BmkMenuType m_nType;
+ sal_uInt16 CreateMenuId();
+
+ private:
+
+ BmkMenu_Impl* _pImp;
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_BMKMENU_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/configimporter.hxx b/include/framework/configimporter.hxx
new file mode 100644
index 000000000000..06b6467f6c2a
--- /dev/null
+++ b/include/framework/configimporter.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_
+#define __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_
+
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/ui/XUIConfigurationManager2.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <rtl/ustring.hxx>
+#include <framework/fwedllapi.h>
+
+namespace framework
+{
+ class FWE_DLLPUBLIC UIConfigurationImporterOOo1x
+ {
+ public:
+ static sal_Bool ImportCustomToolbars(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager2 >& rContainerFactory,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > >& rSeqContainer,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rToolbarStorage );
+ };
+
+} // namespace framework
+
+#endif // __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/documentundoguard.hxx b/include/framework/documentundoguard.hxx
new file mode 100644
index 000000000000..1954a72b5c67
--- /dev/null
+++ b/include/framework/documentundoguard.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+#define FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+
+#include "framework/fwedllapi.h"
+
+#include <com/sun/star/uno/XInterface.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+//......................................................................................................................
+namespace framework
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= DocumentUndoGuard
+ //==================================================================================================================
+ struct DocumentUndoGuard_Data;
+ /** a helper class guarding the Undo manager of a document
+
+ This class guards, within a given scope, the Undo Manager of a document (or another component supporting
+ the XUndoManagerSupplier interface). When entering the scope (i.e. when the <code>DocumentUndoGuard</code>
+ instances is constructed), the current state of the undo contexts of the undo manager is examined.
+ Upon leaving the scope (i.e. when the <code>DocumentUndoGuard</code> is destructed), the guard will execute
+ as many calls to <member scope="com::sun::star::document">XUndoManager::leaveUndoContext</member> as are
+ necessary to restore the manager's initial state.
+ */
+ class FWE_DLLPUBLIC DocumentUndoGuard
+ {
+ public:
+ DocumentUndoGuard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& i_undoSupplierComponent );
+ ~DocumentUndoGuard();
+
+ private:
+ ::boost::scoped_ptr< DocumentUndoGuard_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace framework
+//......................................................................................................................
+
+#endif // FRAMEWORK_DOCUMENTUNDOGUARD_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/eventsconfiguration.hxx b/include/framework/eventsconfiguration.hxx
new file mode 100644
index 000000000000..29694b7fb539
--- /dev/null
+++ b/include/framework/eventsconfiguration.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_
+#define __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_
+
+#include <framework/fwedllapi.h>
+#include <tools/stream.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+namespace framework
+{
+
+struct FWE_DLLPUBLIC EventsConfig
+{
+ ::com::sun::star::uno::Sequence< OUString > aEventNames;
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aEventsProperties;
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_XML_EVENTSCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/framelistanalyzer.hxx b/include/framework/framelistanalyzer.hxx
new file mode 100644
index 000000000000..951474c3934d
--- /dev/null
+++ b/include/framework/framelistanalyzer.hxx
@@ -0,0 +1,195 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
+#define __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
+
+#include <com/sun/star/frame/XFrame.hpp>
+
+#include <framework/fwedllapi.h>
+
+namespace framework{
+
+/** analyze and split the current available frame list of a given frames supplier
+ into different parts.
+
+ These analyzed information can be used e.g. to decide if it's neccessary
+ to switch into the backing mode, close the current active frame only or
+ exit the whole application explicitly or implicitly.
+ */
+class FWE_DLLPUBLIC FrameListAnalyzer
+{
+ //_______________________________________
+ // types
+
+ public:
+
+ /** These enums can be combined as flags to enable/disable
+ special search algorithm during analyze phase.
+ see impl_analyze() for further information.
+ But note: To be useable as flags, these enums
+ must be values of range [2^n]! */
+ enum EDetect
+ {
+ E_MODEL = 1,
+ E_HELP = 2,
+ E_BACKINGCOMPONENT = 4,
+ E_HIDDEN = 8,
+ E_ALL = 15,
+ E_ZOMBIE = 32768 // use it for special test scenarios only!!!
+ };
+
+ //_______________________________________
+ // member
+
+ public:
+
+ /** provides access to the frame container, which should be analyzed. */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& m_xSupplier;
+
+ /** hold the reference frame, which is used e.g. to detect other frames with the same model. */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& m_xReferenceFrame;
+
+ /** enable/disable some special analyzing steps.
+ see impl_analyze() for further information. */
+ sal_uInt32 m_eDetectMode;
+
+ /** contains all frames, which uses the same model like the reference frame.
+ Will be filled only if m_eDetectMode has set the flag E_MODEL.
+ The reference frame is never part of this list! */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lModelFrames;
+
+ /** contains all frames, which does not contain the same model like the reference frame.
+ Filling of it can't be supressed by m_eDetectMode.
+ The reference frame is never part of this list!
+ All frames inside this list are visible ones. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherVisibleFrames;
+
+ /** contains all frames, which does not contain the same model like the reference frame.
+ Filling of it can't be supressed by m_eDetectMode.
+ The reference frame is never part of this list!
+ All frames inside this list are hidden ones. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > > m_lOtherHiddenFrames;
+
+ /** points to the help frame.
+ Will be set only, if any other frame (means different from the reference frame)
+ contains the help component. If the reference frame itself includes the help module
+ it's not set ... but another member m_bIsHelp is used to safe this information.
+ See following example code:
+
+ <listing>
+ if (m_xReferenceFrame == help)
+ {
+ m_xHelp = NULL;
+ m_bIsHelp = sal_True;
+ }
+ else
+ if (xOtherFrame == help)
+ {
+ m_xHelp = xOtherFrame;
+ m_bIsHelp = sal_False;
+ }
+ </listing>
+
+ Analyzing of the help frame ignores the visible state of any frame.
+ But note: a hidden help frame indicates a wrong state!
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xHelp;
+
+ /** points to the frame, which contains the backing component.
+ Will be set only, if any other frame (means different from the reference frame)
+ contains the backing component. If the reference frame itself includes the
+ backing component it's not set ... but another member m_bIsBackingComponent
+ will used to safe this information.
+ See following example code:
+
+ <listing>
+ if (m_xReferenceFrame == backing)
+ {
+ m_xBackingComponent = NULL;
+ m_bIsBackingComponent = sal_True;
+ }
+ else
+ if (xOtherFrame == backing)
+ {
+ m_xBackingComponent = xOtherFrame;
+ m_bIsBackingComponent = sal_False ;
+ }
+ </listing>
+
+ Analyzing of the help frame ignores the visible state of any frame.
+ But note: a hidden backing mode frame indicates a wrong state!
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xBackingComponent;
+
+ /** is set to true only, if the reference frame is a hidden one.
+ This value is undefined if m_eDetectMode doesn't have set the flag E_HIDDEN! */
+ sal_Bool m_bReferenceIsHidden;
+
+ /** is set to true only, if the reference frame contains the help component.
+ In this case the member m_xHelp is set to NULL everytimes.
+ This value is undefined if m_eDetectMode doesn't have set the flag E_HELP! */
+ sal_Bool m_bReferenceIsHelp;
+
+ /** is set to true only, if the reference frame contains the backing component.
+ In this case the member m_xBackingComponent is set to NULL everytimes.
+ This value is undefined if m_eDetectMode doesn't have set the flag E_BACKINGCOMPONENT! */
+ sal_Bool m_bReferenceIsBacking;
+
+ //_______________________________________
+ // interface
+
+ public:
+
+ /** starts analyze phase and fille all members with valid information.
+
+ @param xSupplier
+ Must be a valid reference to a frames supplier, which provies
+ access to the frame list for analyzing.
+
+ @param xReferenceFrame
+ This frame must(!) exist inside the analyzed frame list and
+ is used for some comparing functions. Further some member states
+ depends from the current state of this frame.
+
+ @param eDetectMode
+ It represent a flag field, which can enable/disable special
+ analyze steps. Note: Some member values will be undefined, if
+ an analyze step will be disabled.
+ */
+ FrameListAnalyzer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFramesSupplier >& xSupplier ,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xReferenceFrame ,
+ sal_uInt32 eDetectMode );
+ virtual ~FrameListAnalyzer();
+
+ //_______________________________________
+ // helper
+
+ private:
+
+ void impl_analyze();
+
+
+}; // class FrameListAnalyzer
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_CLASSES_FRAMELISTANALYZER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/fwedllapi.h b/include/framework/fwedllapi.h
new file mode 100644
index 000000000000..14201508768a
--- /dev/null
+++ b/include/framework/fwedllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_FWEDLLAPI_H
+#define INCLUDED_FWEDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(FWE_DLLIMPLEMENTATION)
+#define FWE_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define FWE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define FWE_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_FWEDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/iguard.hxx b/include/framework/iguard.hxx
new file mode 100644
index 000000000000..a522d6225e43
--- /dev/null
+++ b/include/framework/iguard.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_THREADHELP_IGUARD_H_
+#define __FRAMEWORK_THREADHELP_IGUARD_H_
+
+#include <sal/types.h>
+
+namespace framework{
+
+/*-************************************************************************************************************//**
+ @descr interface for guarding a lock
+*//*-*************************************************************************************************************/
+class SAL_NO_VTABLE IGuard
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ /** clears the lock. If the guard does not currently hold the lock, nothing happens.
+ */
+ virtual void clear() = 0;
+
+ /** attempts to re-establishes the lock, blocking until the attempt is successful.
+ */
+ virtual void reset() = 0;
+
+ protected:
+ ~IGuard() {}
+
+}; // class IGuard
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_THREADHELP_IGUARD_H_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/imageproducer.hxx b/include/framework/imageproducer.hxx
new file mode 100644
index 000000000000..0d9398f7b2a3
--- /dev/null
+++ b/include/framework/imageproducer.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_
+#define __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_
+
+#include <sal/types.h>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <vcl/image.hxx>
+#include <rtl/ustring.hxx>
+#include <framework/fwedllapi.h>
+
+namespace framework
+{
+
+typedef Image ( *pfunc_getImage)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL,
+ bool bBig
+);
+
+pfunc_getImage FWE_DLLPUBLIC SAL_CALL SetImageProducer( pfunc_getImage pGetImageFunc );
+
+Image FWE_DLLPUBLIC SAL_CALL GetImageFromURL(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL,
+ bool bBig
+);
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/imutex.hxx b/include/framework/imutex.hxx
new file mode 100644
index 000000000000..f576297e0d14
--- /dev/null
+++ b/include/framework/imutex.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_THREADHELP_IMUTEX_H_
+#define __FRAMEWORK_THREADHELP_IMUTEX_H_
+
+#include <sal/types.h>
+
+namespace framework{
+
+/*-************************************************************************************************************//**
+ @descr We need this interface to support using of different mutex implementations in a generic way.
+*//*-*************************************************************************************************************/
+class SAL_NO_VTABLE IMutex
+{
+ //-------------------------------------------------------------------------------------------------------------
+ // public methods
+ //-------------------------------------------------------------------------------------------------------------
+ public:
+
+ /*-****************************************************************************************************//**
+ @descr These functions must be supported by a derived class!
+ acquire() -try to register thread
+ release() -unregister thread
+ *//*-*****************************************************************************************************/
+ virtual void acquire() = 0;
+ virtual void release() = 0;
+
+ protected:
+ ~IMutex() {}
+}; // class IMutex
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_THREADHELP_IMUTEX_H_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/interaction.hxx b/include/framework/interaction.hxx
new file mode 100644
index 000000000000..1cd56bbd36d9
--- /dev/null
+++ b/include/framework/interaction.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_DISPATCH_INTERACTION_HXX_
+#define __FRAMEWORK_DISPATCH_INTERACTION_HXX_
+
+#include <com/sun/star/task/XInteractionRequest.hpp>
+#include <com/sun/star/task/XInteractionContinuation.hpp>
+#include <com/sun/star/task/XInteractionAbort.hpp>
+#include <com/sun/star/task/XInteractionApprove.hpp>
+#include <com/sun/star/task/XInteractionDisapprove.hpp>
+#include <com/sun/star/task/XInteractionRetry.hpp>
+#include <com/sun/star/document/XInteractionFilterSelect.hpp>
+#include <com/sun/star/document/NoSuchFilterRequest.hpp>
+#include <com/sun/star/document/AmbigousFilterRequest.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+
+#include <rtl/ustring.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <framework/fwedllapi.h>
+
+namespace framework{
+
+/*-************************************************************************************************************//**
+ @short special request for interaction to ask user for right filter
+ @descr These helper can be used to ask user for right filter, if filter detection failed.
+ It capsulate communication with any interaction handler and supports an easy
+ access on interaction results for user of these class.
+ Use it and forget complex mechanism of interaction ...
+
+ @example RequestFilterSelect* pRequest = new RequestFilterSelect;
+ Reference< XInteractionRequest > xRequest ( pRequest );
+ xInteractionHandler->handle( xRequest );
+ if( ! pRequest.isAbort() )
+ {
+ OUString sFilter = pRequest->getFilter();
+ }
+
+ @implements XInteractionRequest
+
+ @base WeakImplHelper1
+
+ @devstatus ready to use
+ @threadsafe no (used on once position only!)
+*//*-*************************************************************************************************************/
+class RequestFilterSelect_Impl;
+class FWE_DLLPUBLIC RequestFilterSelect
+{
+ RequestFilterSelect_Impl* pImp;
+
+ public:
+ RequestFilterSelect( const OUString& sURL );
+ ~RequestFilterSelect();
+ sal_Bool isAbort () const;
+ OUString getFilter() const;
+ com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > GetRequest();
+};
+
+/*-************************************************************************************************************//**
+ @short special request for interaction
+ @descr User must decide between a preselected and another detected filter.
+ It capsulate communication with any interaction handler and supports an easy
+ access on interaction results for user of these class.
+
+ @implements XInteractionRequest
+
+ @base WeakImplHelper1
+
+ @devstatus ready to use
+ @threadsafe no (used on once position only!)
+*//*-*************************************************************************************************************/
+class FWE_DLLPUBLIC InteractionRequest
+{
+public:
+ static com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >
+ CreateRequest( const ::com::sun::star::uno::Any& aRequest,
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > lContinuations );
+};
+
+
+} // namespace framework
+
+#endif // #define __FRAMEWORK_DISPATCH_INTERACTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/menuconfiguration.hxx b/include/framework/menuconfiguration.hxx
new file mode 100644
index 000000000000..1ccd6ba0d167
--- /dev/null
+++ b/include/framework/menuconfiguration.hxx
@@ -0,0 +1,107 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
+#define __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <framework/fwedllapi.h>
+
+#include <cppuhelper/weak.hxx>
+#include <vcl/menu.hxx>
+#include <vcl/toolbox.hxx>
+
+#define BOOKMARK_NEWMENU OUString( "private:menu_bookmark_new" )
+#define BOOKMARK_WIZARDMENU OUString( "private:menu_bookmark_wizard" )
+
+// Prepare for inclusion by framework and sfx
+// Please consider that there is a corresponding define also in sfxsids.hrc!! (SID_SFX_START)/(SID_ADDONS)
+#define FWK_SID_SFX_START 5000
+#define FWK_SID_ADDONS (FWK_SID_SFX_START+1678)
+#define FWK_SID_ADDONHELP (FWK_SID_SFX_START+1684)
+
+const sal_uInt16 START_ITEMID_PICKLIST = 4500;
+const sal_uInt16 END_ITEMID_PICKLIST = 4599;
+const sal_uInt16 MAX_ITEMCOUNT_PICKLIST = 99; // difference between START_... & END_... for picklist / must be changed too, if these values are changed!
+const sal_uInt16 START_ITEMID_WINDOWLIST = 4600;
+const sal_uInt16 END_ITEMID_WINDOWLIST = 4699;
+const sal_uInt16 ITEMID_ADDONLIST = FWK_SID_ADDONS;
+const sal_uInt16 ITEMID_ADDONHELP = FWK_SID_ADDONHELP;
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC MenuConfiguration
+{
+ public:
+ struct Attributes
+ {
+ Attributes() {}
+ Attributes( const OUString& aFrame, const OUString& aImageIdStr ) :
+ aTargetFrame( aFrame ), aImageId( aImageIdStr ) {}
+
+ OUString aTargetFrame;
+ OUString aImageId;
+ ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XDispatchProvider > xDispatchProvider;
+ sal_Int16 nStyle;
+ };
+
+ MenuConfiguration(
+ // use const when giving a uno reference by reference
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
+
+ virtual ~MenuConfiguration();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > CreateMenuBarConfigurationFromXML(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ PopupMenu* CreateBookmarkMenu(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& aURL )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ ToolBox* CreateToolBoxFromConfiguration(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ void StoreMenuBarConfigurationToXML( ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rMenuBarConfiguration,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ void StoreToolBox( ToolBox* pToolBox,
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream )
+ throw ( ::com::sun::star::lang::WrappedTargetException );
+
+ private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
+};
+
+}
+
+#endif // __FRAMEWORK_XML_MENUCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/menuextensionsupplier.hxx b/include/framework/menuextensionsupplier.hxx
new file mode 100644
index 000000000000..6d3a6761e38e
--- /dev/null
+++ b/include/framework/menuextensionsupplier.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_
+#define __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_
+
+#include <rtl/ustring.hxx>
+#include <framework/fwedllapi.h>
+
+struct FWE_DLLPUBLIC MenuExtensionItem
+{
+ OUString aLabel;
+ OUString aURL;
+};
+
+typedef MenuExtensionItem ( *pfunc_setMenuExtensionSupplier)();
+
+namespace framework
+{
+
+FWE_DLLPUBLIC MenuExtensionItem SAL_CALL GetMenuExtension();
+
+}
+
+#endif // __FRAMEWORK_CLASSES_MENUEXTENSIONSUPPLIER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/preventduplicateinteraction.hxx b/include/framework/preventduplicateinteraction.hxx
new file mode 100644
index 000000000000..5be9d52f62cf
--- /dev/null
+++ b/include/framework/preventduplicateinteraction.hxx
@@ -0,0 +1,236 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_
+#define __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_
+
+#include <framework/fwedllapi.h>
+
+#include <vector>
+
+#include <com/sun/star/task/XInteractionHandler2.hpp>
+#include <com/sun/star/task/XInteractionRequest.hpp>
+
+#include <cppuhelper/implbase1.hxx>
+
+namespace framework{
+
+/**
+ @short Prevent us from showing the same interaction more then once during
+ the same transaction.
+
+ @descr Every interaction provided to this helper will be safed ... handled by the internal
+ used UUIInteractionHandler (!) and never be handled a second time!
+
+ On the other side there exists some interactions, which allow a retry.
+ So this helper allow to set a list of interactions combined with a retry value.
+ */
+struct ThreadHelpBase2
+{
+ public:
+ mutable ::osl::Mutex m_aLock;
+};
+
+class FWE_DLLPUBLIC PreventDuplicateInteraction : private ThreadHelpBase2
+ ,public ::cppu::WeakImplHelper1< css::task::XInteractionHandler2 >
+{
+ //_____________________________________
+ // structs, types etcp.
+ public:
+
+ struct InteractionInfo
+ {
+ public:
+ /// describe the interaction.
+ css::uno::Type m_aInteraction;
+ /// after max count was reached this interaction will be blocked.
+ sal_Int32 m_nMaxCount;
+ /// count how often this interaction was called.
+ sal_Int32 m_nCallCount;
+ /** hold the last intercepted request (matching the set interaction type) alive
+ so it can be used for further checks */
+ css::uno::Reference< css::task::XInteractionRequest > m_xRequest;
+
+ public:
+
+ InteractionInfo(const css::uno::Type& aInteraction,
+ sal_Int32 nMaxCount )
+ : m_aInteraction(aInteraction)
+ , m_nMaxCount (nMaxCount )
+ , m_nCallCount (0 )
+ {}
+
+ InteractionInfo(const InteractionInfo& aCopy)
+ : m_aInteraction(aCopy.m_aInteraction)
+ , m_nMaxCount (aCopy.m_nMaxCount )
+ , m_nCallCount (aCopy.m_nCallCount )
+ , m_xRequest (aCopy.m_xRequest )
+ {}
+ };
+
+ typedef ::std::vector< InteractionInfo > InteractionList;
+
+ //_____________________________________
+ // member
+ private:
+
+ /// Used to create needed uno services at runtime.
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+
+ /** The outside interaction handler, which is used to handle every incoming interaction,
+ if it's not blocked. */
+ css::uno::Reference< css::task::XInteractionHandler > m_xHandler;
+
+ /** This list describe which and how incoming interactions must be handled.
+ Further it contains all collected information after this interaction
+ object was used.*/
+ InteractionList m_lInteractionRules;
+
+ //_____________________________________
+ // uno interface
+ public:
+
+ //_________________________________
+ /**
+ @interface XInteractionHandler
+ @short called from outside to handle a problem
+ @descr We filter the incoming interactions. some of them
+ will be forwarded to the generic UI interaction handler.
+ So we must not implement it twice. Some other ones
+ will be aborted only.
+
+ @threadsafe yes
+ */
+ virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest >& xRequest)
+ throw(css::uno::RuntimeException);
+
+ //_________________________________
+ /**
+ @interface XInteractionHandler2
+ @short called from outside to handle a problem
+ @descr We filter the incoming interactions. some of them
+ will be forwarded to the generic UI interaction handler.
+ So we must not implement it twice. Some other ones
+ will be aborted only.
+
+ @threadsafe yes
+ */
+ virtual ::sal_Bool SAL_CALL handleInteractionRequest( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest >& xRequest )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //_________________________________
+ /**
+ @interface XInterface
+ @short called to query another interface of the component
+ @descr Will allow to query for XInteractionHandler2 if and only if m_xHandler supports this interface, too.
+
+ @threadsafe yes
+ */
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
+ throw (::com::sun::star::uno::RuntimeException);
+ //_____________________________________
+ // c++ interface
+ public:
+
+ //_________________________________
+ /**
+ @short ctor to guarantee right initialized instances of this class
+ @descr It uses the given uno service manager to create the global
+ generic UI interaction handler for later internal using.
+
+ @param xSMGR
+ uno service manager for creating services internaly
+
+ @threadsafe not neccessary
+ */
+ PreventDuplicateInteraction(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+
+ //_________________________________
+ /**
+ @short dtor to free used memory.
+ */
+ virtual ~PreventDuplicateInteraction();
+
+ //_________________________________
+ /**
+ @short set the outside interaction handler, which must be used internaly
+ if the interaction will not be blocked by the set list of rules.
+
+ @note This overwrites the settings of e.g. useDefaultUUIHandler()!
+
+ @param xHandler
+ the new interaction handler
+ */
+ virtual void setHandler(const css::uno::Reference< css::task::XInteractionHandler >& xHandler);
+
+ //_________________________________
+ /**
+ @short instead of setting an outside interaction handler, this method
+ make sure the default UUI interaction handler of the office is used.
+
+ @note This overwrites the settings of e.g. setHandler()!
+ */
+ virtual void useDefaultUUIHandler();
+
+ //_________________________________
+ /**
+ @short add a new interaction to the list of interactions, which
+ must be handled by this helper.
+
+ @descr This method must be called immediately after a new instance of this helper was
+ created. Without such list of InteractionRules, this instances does nothing!
+ On the other side there is no possibility to remove rules.
+ So the same instance cant be used within different transactions.
+ It's a OneWay-object .-)
+
+ @param aInteractionInfo
+ describe the type of interaction, hos often it can be called etcpp.
+
+ @threadsafe yes
+ */
+ virtual void addInteractionRule(const PreventDuplicateInteraction::InteractionInfo& aInteractionInfo);
+
+ //_________________________________
+ /**
+ @short return the info struct for the specified interaction.
+
+ @param aInteraction
+ specify the interaction.
+
+ @param pReturn
+ provides information about:
+ - the count how often this interaction was handled during the
+ lifetime of this helper.
+ - the interaction itself, so it can be analyzed further
+
+ @return [boolean]
+ sal_True if the queried interaction could be found.
+ sal_False otherwise.
+
+ @threadsafe yes
+ */
+ virtual sal_Bool getInteractionInfo(const css::uno::Type& aInteraction,
+ PreventDuplicateInteraction::InteractionInfo* pReturn ) const;
+};
+
+} // namespace framework
+
+#endif // #ifndef __FRAMEWORK_INTERACTION_PREVENTDUPLICATEINTERACTION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/sfxhelperfunctions.hxx b/include/framework/sfxhelperfunctions.hxx
new file mode 100644
index 000000000000..ce2b604f5e5e
--- /dev/null
+++ b/include/framework/sfxhelperfunctions.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_
+#define __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_
+
+#include <framework/fwedllapi.h>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <rtl/ustring.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/status.hxx>
+#include <svtools/toolboxcontroller.hxx>
+#include <svtools/statusbarcontroller.hxx>
+
+typedef svt::ToolboxController* ( *pfunc_setToolBoxControllerCreator)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ ToolBox* pToolbox,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+typedef svt::StatusbarController* ( *pfunc_setStatusBarControllerCreator)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+typedef void ( *pfunc_getRefreshToolbars)(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+
+typedef void ( *pfunc_createDockingWindow)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+typedef bool ( *pfunc_isDockingWindowVisible)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+typedef void ( *pfunc_activateToolPanel)(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const OUString& i_rPanelURL );
+
+
+namespace framework
+{
+FWE_DLLPUBLIC pfunc_setToolBoxControllerCreator SAL_CALL SetToolBoxControllerCreator( pfunc_setToolBoxControllerCreator pSetToolBoxControllerCreator );
+FWE_DLLPUBLIC svt::ToolboxController* SAL_CALL CreateToolBoxController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ ToolBox* pToolbox,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+FWE_DLLPUBLIC pfunc_setStatusBarControllerCreator SAL_CALL SetStatusBarControllerCreator( pfunc_setStatusBarControllerCreator pSetStatusBarControllerCreator );
+FWE_DLLPUBLIC svt::StatusbarController* SAL_CALL CreateStatusBarController(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ StatusBar* pStatusBar,
+ unsigned short nID,
+ const OUString& aCommandURL );
+
+FWE_DLLPUBLIC pfunc_getRefreshToolbars SAL_CALL SetRefreshToolbars( pfunc_getRefreshToolbars pRefreshToolbarsFunc );
+FWE_DLLPUBLIC void SAL_CALL RefreshToolbars(
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
+
+FWE_DLLPUBLIC pfunc_createDockingWindow SAL_CALL SetDockingWindowCreator( pfunc_createDockingWindow pCreateDockingWindow );
+FWE_DLLPUBLIC void SAL_CALL CreateDockingWindow(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+FWE_DLLPUBLIC pfunc_isDockingWindowVisible SAL_CALL SetIsDockingWindowVisible( pfunc_isDockingWindowVisible pIsDockingWindowVisible );
+FWE_DLLPUBLIC bool SAL_CALL IsDockingWindowVisible(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame,
+ const OUString& rResourceURL );
+
+FWE_DLLPUBLIC pfunc_activateToolPanel SAL_CALL SetActivateToolPanel( pfunc_activateToolPanel i_pActivator );
+FWE_DLLPUBLIC void SAL_CALL ActivateToolPanel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& i_rFrame,
+ const OUString& i_rPanelURL );
+}
+
+#endif // __FRAMEWORK_CLASSES_SFXHELPERFUNCTIONS_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/statusbarconfiguration.hxx b/include/framework/statusbarconfiguration.hxx
new file mode 100644
index 000000000000..e71a89fe0ca4
--- /dev/null
+++ b/include/framework/statusbarconfiguration.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
+#define __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
+
+#include <framework/fwedllapi.h>
+#include <tools/stream.hxx>
+#include <vcl/status.hxx>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC StatusBarConfiguration
+{
+ public:
+ static sal_Bool LoadStatusBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rStatusbarConfiguration );
+
+ static sal_Bool StoreStatusBar(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rStatusbarConfiguration );
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_CLASSES_STATUSBARCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/titlehelper.hxx b/include/framework/titlehelper.hxx
new file mode 100644
index 000000000000..c4cdc31a6329
--- /dev/null
+++ b/include/framework/titlehelper.hxx
@@ -0,0 +1,206 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _FRAMEWORK_TITLEHELPER_HXX_
+#define _FRAMEWORK_TITLEHELPER_HXX_
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
+#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/frame/XController.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XFrameActionListener.hpp>
+#include <com/sun/star/document/XEventListener.hpp>
+
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/weakref.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+
+#include <rtl/ustrbuf.hxx>
+
+#include <boost/unordered_map.hpp>
+#include <framework/fwedllapi.h>
+
+
+namespace framework{
+
+
+/** @short can be used as implementation helper of interface css.frame.XTitle
+
+ @threadsafe
+ */
+class FWE_DLLPUBLIC TitleHelper : private ::cppu::BaseMutex
+ , public ::cppu::WeakImplHelper5< css::frame::XTitle ,
+ css::frame::XTitleChangeBroadcaster,
+ css::frame::XTitleChangeListener ,
+ css::frame::XFrameActionListener ,
+ css::document::XEventListener >
+{
+ //-------------------------------------------
+ // interface
+ public:
+
+ //---------------------------------------
+ /** @short lightweight constructor.
+ */
+ TitleHelper(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+
+ //---------------------------------------
+ /** @short free all internaly used resources.
+ */
+ virtual ~TitleHelper();
+
+ //---------------------------------------
+ /** set an outside component which uses this container and must be set
+ as source of all broadcasted messages, exceptions.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be alloed. It will reset the internal
+ member reference only.
+
+ @param xOwner
+ the new owner of this collection.
+ */
+ void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner);
+
+ //---------------------------------------
+ /** set an outside component which provides the righht string and number for
+ an untitled component.
+
+ It's holded weak only so we do not need any complex dispose sessions.
+
+ Note: Passing NULL as parameter will be alloed. It will reset the internal
+ member reference only.
+
+ @param xNumbers
+ the right numbered collection for this helper.
+ */
+ void connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers);
+
+ //---------------------------------------
+ /** @see XTitle */
+ virtual OUString SAL_CALL getTitle()
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitle */
+ virtual void SAL_CALL setTitle(const OUString& sTitle)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitleChangeBroadcaster */
+ virtual void SAL_CALL addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitleChangeBroadcaster */
+ virtual void SAL_CALL removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see XTitleChangeListener */
+ virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see css.document.XEventListener */
+ virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see css.lang.XEventListener */
+ virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent)
+ throw (css::uno::RuntimeException);
+
+ //---------------------------------------
+ /** @see css.frame.XFrameActionListener */
+ virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent)
+ throw(css::uno::RuntimeException);
+
+ //-------------------------------------------
+ // internal
+ private:
+
+ void impl_sendTitleChangedEvent ();
+
+ void impl_updateTitle (bool init = false);
+ void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel, bool init);
+ void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController, bool init);
+ void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame, bool init);
+
+ void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel);
+ void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController);
+ void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+ void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame);
+
+ void impl_appendComponentTitle ( OUStringBuffer& sTitle ,
+ const css::uno::Reference< css::uno::XInterface >& xComponent);
+ void impl_appendProductName (OUStringBuffer& sTitle);
+ void impl_appendProductExtension (OUStringBuffer& sTitle);
+ void impl_appendModuleName (OUStringBuffer& sTitle);
+ void impl_appendDebugVersion (OUStringBuffer& sTitle);
+
+ void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle);
+
+ OUString impl_convertURL2Title(const OUString& sURL);
+
+ //-------------------------------------------
+ // member
+ private:
+
+ /** points to the global uno service manager. */
+ css::uno::Reference< css::uno::XComponentContext> m_xContext;
+
+ /** reference to the outside UNO class using this helper. */
+ css::uno::WeakReference< css::uno::XInterface > m_xOwner;
+
+ /** used to know how an "Untitled X" string can be created right :-) */
+ css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers;
+
+ /** provides parts of our own title and we listen there for changes too. */
+ css::uno::WeakReference< css::frame::XTitle > m_xSubTitle;
+
+ /** if it's set to sal_True the member m_sTitle has not to be changed internaly.
+ It was set from outside and so outside code has to make sure it will be
+ updated.
+ */
+ ::sal_Bool m_bExternalTitle;
+
+ /** the actual title value */
+ OUString m_sTitle;
+
+ /** knows the leased number which must be used for untitled components. */
+ ::sal_Int32 m_nLeasedNumber;
+
+ /** contains all title change listener */
+ ::cppu::OMultiTypeInterfaceContainerHelper m_aListener;
+};
+
+} // namespace framework
+
+#endif // _FRAMEWORK_TITLEHELPER_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/toolboxconfiguration.hxx b/include/framework/toolboxconfiguration.hxx
new file mode 100644
index 000000000000..a296231a07ea
--- /dev/null
+++ b/include/framework/toolboxconfiguration.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
+#define __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
+
+#include <framework/fwedllapi.h>
+#include <vcl/bitmap.hxx>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+namespace framework
+{
+
+class FWE_DLLPUBLIC ToolBoxConfiguration
+{
+ public:
+ static sal_Bool LoadToolBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rToolbarConfiguration );
+
+ static sal_Bool StoreToolBox(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& rToolbarConfiguration );
+};
+
+} // namespace framework
+
+#endif // __FRAMEWORK_XML_TOOLBOXCONFIGURATION_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/framework/undomanagerhelper.hxx b/include/framework/undomanagerhelper.hxx
new file mode 100644
index 000000000000..ae91db981553
--- /dev/null
+++ b/include/framework/undomanagerhelper.hxx
@@ -0,0 +1,159 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef FRAMEWORK_UNDOMANAGERHELPER_HXX
+#define FRAMEWORK_UNDOMANAGERHELPER_HXX
+
+#include "framework/fwedllapi.h"
+#include "framework/iguard.hxx"
+#include "framework/imutex.hxx"
+
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/util/XModifyListener.hpp>
+
+#include <boost/scoped_ptr.hpp>
+
+namespace svl
+{
+ class IUndoManager;
+}
+
+//......................................................................................................................
+namespace framework
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= IMutexGuard
+ //==================================================================================================================
+ class SAL_NO_VTABLE IMutexGuard : public IGuard
+ {
+ public:
+ /** returns the mutex guarded by the instance.
+
+ Even if the guard currently has not a lock on the mutex, this method must succeed.
+ */
+ virtual IMutex& getGuardedMutex() = 0;
+
+ protected:
+ ~IMutexGuard() {}
+ };
+
+ //==================================================================================================================
+ //= IUndoManagerImplementation
+ //==================================================================================================================
+ class SAL_NO_VTABLE IUndoManagerImplementation
+ {
+ public:
+ /** returns the IUndoManager interface to the actual Undo stack
+
+ @throws com::sun::star::lang::DisposedException
+ when the instance is already disposed, and no IUndoManager can be provided
+
+ @throws com::sun::star::lang::NotInitializedException
+ when the instance is not initialized, yet, and no IUndoManager can be provided
+ */
+ virtual ::svl::IUndoManager& getImplUndoManager() = 0;
+
+ /** provides access to an UNO interface for the XUndoManager implementation. Used when throwing exceptions.
+ */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager >
+ getThis() = 0;
+
+ protected:
+ ~IUndoManagerImplementation() {}
+ };
+
+ //==================================================================================================================
+ //= UndoManagerHelper
+ //==================================================================================================================
+ class UndoManagerHelper_Impl;
+ /** helper class for implementing an XUndoManager
+
+ Several of the methods of the class take an IMutexGuard instance. It is assumed that this guard has a lock on
+ its mutext at the moment the method is entered. The lock will be released before any notifications to the
+ registered XUndoManagerListeners happen.
+
+ The following locking strategy is used for this mutex:
+ <ul><li>Any notifications to the registered XUndoManagerListeners are after the guard has been cleared. i.e.
+ without the mutex being locked.</p>
+ <li>Any calls into the <code>IUndoManager</code> implementation is made without the mutex being locked.
+ Note that this implies that the <code>IUndoManager</code> implementation must be thread-safe in itself
+ (which is true for the default implementation, SfxUndoManager).</li>
+ <li>An exception to the previous item are the <member>IUndoManager::Undo</member> and
+ <member>IUndoManager::Redo</member> methods: They're called with the given external mutex being
+ locked.</li>
+ </ul>
+
+ The reason for the exception for IUndoManager::Undo and IUndoManager::Redo is that those are expected to
+ modify the actual document which the UndoManager works for. And as long as our documents are not thread-safe,
+ and as long as we do not re-fit <strong>all</strong> existing SfxUndoImplementations to <em>not</em> expect
+ the dreaded SolarMutex being locked when they're called, the above behavior is a compromise between "how it should
+ be" and "how it can realistically be".
+ */
+ class FWE_DLLPUBLIC UndoManagerHelper
+ {
+ public:
+ UndoManagerHelper( IUndoManagerImplementation& i_undoManagerImpl );
+ ~UndoManagerHelper();
+
+ // life time control
+ void disposing();
+
+ // XUndoManager equivalents
+ void enterUndoContext( const OUString& i_title, IMutexGuard& i_instanceLock );
+ void enterHiddenUndoContext( IMutexGuard& i_instanceLock );
+ void leaveUndoContext( IMutexGuard& i_instanceLock );
+ void addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action, IMutexGuard& i_instanceLock );
+ void undo( IMutexGuard& i_instanceLock );
+ void redo( IMutexGuard& i_instanceLock );
+ ::sal_Bool isUndoPossible() const;
+ ::sal_Bool isRedoPossible() const;
+ OUString getCurrentUndoActionTitle() const;
+ OUString getCurrentRedoActionTitle() const;
+ ::com::sun::star::uno::Sequence< OUString >
+ getAllUndoActionTitles() const;
+ ::com::sun::star::uno::Sequence< OUString >
+ getAllRedoActionTitles() const;
+ void clear( IMutexGuard& i_instanceLock );
+ void clearRedo( IMutexGuard& i_instanceLock );
+ void reset( IMutexGuard& i_instanceLock );
+ void addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener );
+ void removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener );
+
+ // XLockable, base of XUndoManager, equivalents
+ void lock();
+ void unlock();
+ ::sal_Bool isLocked();
+
+ // XModifyBroadcaster equivalents
+ void addModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& i_listener );
+ void removeModifyListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& i_listener );
+
+ private:
+ ::boost::scoped_ptr< UndoManagerHelper_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace framework
+//......................................................................................................................
+
+#endif // FRAMEWORK_UNDOMANAGERHELPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/i18nlangtagdllapi.h b/include/i18nlangtag/i18nlangtagdllapi.h
new file mode 100644
index 000000000000..ba9af35c08fe
--- /dev/null
+++ b/include/i18nlangtag/i18nlangtagdllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H
+#define INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(I18NLANGTAG_DLLIMPLEMENTATION)
+#define I18NLANGTAG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NLANGTAG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NLANGTAG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_I18NLANGTAG_I18NLANGTAGDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h
new file mode 100644
index 000000000000..d4f5ca7a61b3
--- /dev/null
+++ b/include/i18nlangtag/lang.h
@@ -0,0 +1,568 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANG_H
+#define INCLUDED_I18NLANGTAG_LANG_H
+
+/**
+ These are MS LANGIDs, the lower 10 bits (mask 0x03ff, values below 0x0400
+ aren't real locale IDs) represent the primary language ID, the upper 6 bits
+ represent the sublanguage ID, which in most cases together with the primary
+ language simply designates a country. A LANGID is constructed by
+ UINT16 nLangID = ((((UINT16)(SubLangId)) << 10) | (UINT16)(PriLangId));
+
+ A user-defined primary language ID is a value in the range 0x0200 to 0x03ff.
+ All other values are reserved for Windows system use.
+
+ A user-defined sublanguage identifier is a value in the range 0x20 to 0x3f.
+ All other values are reserved for Windows system use.
+ If there is no sublanguage ID for a primary language ID, use SUBLANG_DEFAULT
+ (0x01, which shifted to the left by 10 bits results in the frequently seen
+ 0x0400). OR'ed with a 0x0200 primary results in 0x0600.
+
+ Values added as of 2006-04-18, a helper script: ../../source/isolang/lcid.awk
+ Utility to compare MS-LANGID definitions with those defined in this file.
+
+ For further information about MS-LANGIDs please see include/winnt.h of a
+ recent MSDEV version and the following web pages.
+
+
+ The once complete list, not necessarily supported by Windows:
+ List of Locale ID (LCID) Values as Assigned by Microsoft
+ http://www.microsoft.com/globaldev/reference/lcid-all.mspx
+
+ As a complete list is never complete, some more that came with WinXP SP2:
+ Windows XP/Server 2003 - List of Locale IDs, Input Locale, and Language Collection
+ http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx
+
+ And of course 2 lists aren't enough, so Windows Vista needs an extra one.
+ Which at least seems to include values of other versions of Windows.
+ Language Identifier Constants and Strings
+ http://msdn2.microsoft.com/en-us/library/ms776294.aspx
+
+ Hey, yet another list, maybe this one will not move around? It seems to be
+ quite complete..
+ Language Identifier Constants and Strings (Windows)
+ http://msdn.microsoft.com/en-us/library/dd318693(VS.85).aspx
+
+ List of supported locale identifiers in Word
+ http://support.microsoft.com/default.aspx?scid=KB;en-us;q221435
+ */
+
+
+/* It must be safe to include this file in plain C code, so only C style
+ * comments are used. Do NOT use // C++ style comments. */
+
+/* disable typedef for usage in svtools/source/misc/langtab.src */
+#ifndef RSC_RESOURCE_USAGE
+typedef unsigned short LanguageType;
+#endif
+
+#define LANGUAGE_MASK_PRIMARY 0x03ff
+
+#ifdef __cplusplus
+/* Please use the methods provided in mslangid.hxx for type-safety! */
+#else
+#define MSLANGID_MAKELANGID( nSubLangId, nPriLangId ) \
+ (((nSubLangId) << 10) | (nPriLangId))
+#define MSLANGID_GETPRIMARYLANGUAGE( nLangID ) \
+ ((nLangID) & LANGUAGE_MASK_PRIMARY)
+#define MSLANGID_GETSUBLANGUAGE( nLangID ) \
+ (((nLangID) & ~LANGUAGE_MASK_PRIMARY) >> 10)
+#endif
+
+
+#define LANGUAGE_DONTKNOW 0x03FF /* yes, the mask */
+#define LANGUAGE_NONE 0x00FF
+#define LANGUAGE_HID_HUMAN_INTERFACE_DEVICE 0x04FF
+#define LANGUAGE_SYSTEM 0x0000 /* OOo/SO definition */
+
+/* The Invariant Locale (Locale ID = 0x007f) is a locale that can be used by
+ * applications when a consistent and locale-independent result is required.
+ * The invariant locale can be used, for example, when comparing character
+ * strings using the CompareString() API and a consistent result regardless of
+ * the User Locale is expected.
+ * The settings of the Invariant Locale are similar to US-English international
+ * standards, but should not be used to display formatted data. */
+/* NOTE: this is taken from the MS documentation! Not supported by OOo/SO! */
+#define LANGUAGE_INVARIANT 0x007F
+
+#define LANGUAGE_AFRIKAANS 0x0436
+#define LANGUAGE_ALBANIAN 0x041C
+#define LANGUAGE_ALSATIAN_FRANCE 0x0484
+#define LANGUAGE_AMHARIC_ETHIOPIA 0x045E
+#define LANGUAGE_ARABIC_ALGERIA 0x1401
+#define LANGUAGE_ARABIC_BAHRAIN 0x3C01
+#define LANGUAGE_ARABIC_EGYPT 0x0C01
+#define LANGUAGE_ARABIC_IRAQ 0x0801
+#define LANGUAGE_ARABIC_JORDAN 0x2C01
+#define LANGUAGE_ARABIC_KUWAIT 0x3401
+#define LANGUAGE_ARABIC_LEBANON 0x3001
+#define LANGUAGE_ARABIC_LIBYA 0x1001
+#define LANGUAGE_ARABIC_MOROCCO 0x1801
+#define LANGUAGE_ARABIC_OMAN 0x2001
+#define LANGUAGE_ARABIC_QATAR 0x4001
+#define LANGUAGE_ARABIC_SAUDI_ARABIA 0x0401
+#define LANGUAGE_ARABIC_SYRIA 0x2801
+#define LANGUAGE_ARABIC_TUNISIA 0x1C01
+#define LANGUAGE_ARABIC_UAE 0x3801
+#define LANGUAGE_ARABIC_YEMEN 0x2401
+#define LANGUAGE_ARABIC_PRIMARY_ONLY 0x0001 /* primary only, not a locale! */
+#define LANGUAGE_ARMENIAN 0x042B
+#define LANGUAGE_ASSAMESE 0x044D
+#define LANGUAGE_AZERI 0x002C /* primary only, not a locale! */
+#define LANGUAGE_AZERI_CYRILLIC 0x082C
+#define LANGUAGE_AZERI_LATIN 0x042C
+#define LANGUAGE_BASHKIR_RUSSIA 0x046D
+#define LANGUAGE_BASQUE 0x042D
+#define LANGUAGE_BELARUSIAN 0x0423
+#define LANGUAGE_BENGALI 0x0445 /* in India */
+#define LANGUAGE_BENGALI_BANGLADESH 0x0845
+#define LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA 0x141A
+#define LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x201A
+#define LANGUAGE_BOSNIAN_BOSNIA_HERZEGOVINA LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA /* TODO: remove, only for langtab.src & localize.sdf compatibility */
+#define LANGUAGE_BRETON_FRANCE 0x047E /* obsoletes LANGUAGE_USER_BRETON 0x0629 */
+#define LANGUAGE_BULGARIAN 0x0402
+#define LANGUAGE_BURMESE 0x0455
+#define LANGUAGE_CATALAN 0x0403
+#define LANGUAGE_CHEROKEE_UNITED_STATES 0x045C
+#define LANGUAGE_CHINESE 0x0004 /* primary only, not a locale! */
+#define LANGUAGE_CHINESE_HONGKONG 0x0C04
+#define LANGUAGE_CHINESE_MACAU 0x1404
+#define LANGUAGE_CHINESE_SIMPLIFIED 0x0804
+#define LANGUAGE_CHINESE_SINGAPORE 0x1004
+#define LANGUAGE_CHINESE_TRADITIONAL 0x0404
+/* #define LANGUAGE_CHINESE_SIMPLIFIED 0x0004 */ /* artificial political? Defined as 'zh-CHS' by MS. Primary only! */
+/* #define LANGUAGE_CHINESE_TRADITIONAL 0x7C04 */ /* artificial political? Defined as 'zh-CHT' by MS. */
+#define LANGUAGE_CORSICAN_FRANCE 0x0483
+#define LANGUAGE_CROATIAN 0x041A
+#define LANGUAGE_CROATIAN_BOSNIA_HERZEGOVINA 0x101A
+#define LANGUAGE_CZECH 0x0405
+#define LANGUAGE_DANISH 0x0406
+#define LANGUAGE_DARI_AFGHANISTAN 0x048C /* AKA Zoroastrian Dari */
+#define LANGUAGE_DHIVEHI 0x0465 /* AKA Divehi */
+#define LANGUAGE_DUTCH 0x0413
+#define LANGUAGE_DUTCH_BELGIAN 0x0813
+#define LANGUAGE_EDO 0x0466
+#define LANGUAGE_ENGLISH 0x0009 /* primary only, not a locale! */
+#define LANGUAGE_ENGLISH_AUS 0x0C09
+#define LANGUAGE_ENGLISH_BELIZE 0x2809
+#define LANGUAGE_ENGLISH_CAN 0x1009
+#define LANGUAGE_ENGLISH_CARRIBEAN 0x2409
+#define LANGUAGE_ENGLISH_EIRE 0x1809
+#define LANGUAGE_ENGLISH_HONG_KONG_SAR 0x3C09
+#define LANGUAGE_ENGLISH_INDIA 0x4009
+#define LANGUAGE_ENGLISH_INDONESIA 0x3809
+#define LANGUAGE_ENGLISH_JAMAICA 0x2009
+#define LANGUAGE_ENGLISH_MALAYSIA 0x4409
+#define LANGUAGE_ENGLISH_NZ 0x1409
+#define LANGUAGE_ENGLISH_PHILIPPINES 0x3409
+#define LANGUAGE_ENGLISH_SAFRICA 0x1C09
+#define LANGUAGE_ENGLISH_SINGAPORE 0x4809
+#define LANGUAGE_ENGLISH_TRINIDAD 0x2C09
+#define LANGUAGE_ENGLISH_UK 0x0809
+#define LANGUAGE_ENGLISH_US 0x0409
+#define LANGUAGE_ENGLISH_ZIMBABWE 0x3009
+#define LANGUAGE_ESTONIAN 0x0425
+#define LANGUAGE_FAEROESE 0x0438
+#define LANGUAGE_FARSI 0x0429
+#define LANGUAGE_FILIPINO 0x0464
+#define LANGUAGE_FINNISH 0x040B
+#define LANGUAGE_FRENCH 0x040C
+#define LANGUAGE_FRENCH_BELGIAN 0x080C
+#define LANGUAGE_FRENCH_CAMEROON 0x2C0C
+#define LANGUAGE_FRENCH_CANADIAN 0x0C0C
+#define LANGUAGE_FRENCH_COTE_D_IVOIRE 0x300C
+
+#define LANGUAGE_FRENCH_HAITI 0x3C0C
+#define LANGUAGE_FRENCH_LUXEMBOURG 0x140C
+#define LANGUAGE_FRENCH_MALI 0x340C
+#define LANGUAGE_FRENCH_MONACO 0x180C
+#define LANGUAGE_FRENCH_MOROCCO 0x380C
+#define LANGUAGE_FRENCH_NORTH_AFRICA 0xE40C
+#define LANGUAGE_FRENCH_REUNION 0x200C
+#define LANGUAGE_FRENCH_SENEGAL 0x280C
+#define LANGUAGE_FRENCH_SWISS 0x100C
+#define LANGUAGE_FRENCH_WEST_INDIES 0x1C0C
+#define LANGUAGE_FRENCH_ZAIRE 0x240C
+#define LANGUAGE_FRISIAN_NETHERLANDS 0x0462
+#define LANGUAGE_FULFULDE_NIGERIA 0x0467
+#define LANGUAGE_GAELIC_IRELAND 0x083C
+#define LANGUAGE_GAELIC_SCOTLAND 0x043C
+#define LANGUAGE_GALICIAN 0x0456
+#define LANGUAGE_GEORGIAN 0x0437
+#define LANGUAGE_GERMAN 0x0407
+#define LANGUAGE_GERMAN_AUSTRIAN 0x0C07
+#define LANGUAGE_GERMAN_LIECHTENSTEIN 0x1407
+#define LANGUAGE_GERMAN_LUXEMBOURG 0x1007
+#define LANGUAGE_GERMAN_SWISS 0x0807
+#define LANGUAGE_GREEK 0x0408
+#define LANGUAGE_GUARANI_PARAGUAY 0x0474
+#define LANGUAGE_GUJARATI 0x0447
+#define LANGUAGE_HAUSA_NIGERIA 0x0468
+#define LANGUAGE_HAWAIIAN_UNITED_STATES 0x0475
+#define LANGUAGE_HEBREW 0x040D
+#define LANGUAGE_HINDI 0x0439
+#define LANGUAGE_HUNGARIAN 0x040E
+#define LANGUAGE_IBIBIO_NIGERIA 0x0469
+#define LANGUAGE_ICELANDIC 0x040F
+#define LANGUAGE_IGBO_NIGERIA 0x0470
+#define LANGUAGE_INDONESIAN 0x0421
+#define LANGUAGE_INUKTITUT_SYLLABICS_CANADA 0x045D
+#define LANGUAGE_INUKTITUT_LATIN_CANADA 0x085D
+#define LANGUAGE_ITALIAN 0x0410
+#define LANGUAGE_ITALIAN_SWISS 0x0810
+#define LANGUAGE_JAPANESE 0x0411
+#define LANGUAGE_KALAALLISUT_GREENLAND 0x046F /* obsoletes LANGUAGE_USER_KALAALLISUT 0x062A */
+#define LANGUAGE_KANNADA 0x044B
+#define LANGUAGE_KANURI_NIGERIA 0x0471
+#define LANGUAGE_KASHMIRI 0x0460
+#define LANGUAGE_KASHMIRI_INDIA 0x0860
+#define LANGUAGE_KAZAKH 0x043F
+#define LANGUAGE_KHMER 0x0453
+#define LANGUAGE_KICHE_GUATEMALA 0x0486 /* AKA K'iche', West Central Quiche, */
+#define LANGUAGE_KINYARWANDA_RWANDA 0x0487 /* obsoletes LANGUAGE_USER_KINYARWANDA 0x0621 */
+#define LANGUAGE_KIRGHIZ 0x0440 /* AKA Kyrgyz */
+#define LANGUAGE_KONKANI 0x0457
+#define LANGUAGE_KOREAN 0x0412
+#define LANGUAGE_KOREAN_JOHAB 0x0812
+#define LANGUAGE_LAO 0x0454
+#define LANGUAGE_LATIN 0x0476 /* obsoletes LANGUAGE_USER_LATIN 0x0610 */
+#define LANGUAGE_LATVIAN 0x0426
+#define LANGUAGE_LITHUANIAN 0x0427
+#define LANGUAGE_LITHUANIAN_CLASSIC 0x0827
+#define LANGUAGE_LUXEMBOURGISH_LUXEMBOURG 0x046E /* obsoletes LANGUAGE_USER_LUXEMBOURGISH 0x0630 */
+#define LANGUAGE_MACEDONIAN 0x042F
+#define LANGUAGE_MALAY 0x003E /* primary only, not a locale! */
+#define LANGUAGE_MALAYALAM 0x044C /* in India */
+#define LANGUAGE_MALAY_BRUNEI_DARUSSALAM 0x083E
+#define LANGUAGE_MALAY_MALAYSIA 0x043E
+#define LANGUAGE_MALTESE 0x043A
+#define LANGUAGE_MANIPURI 0x0458
+#define LANGUAGE_MAORI_NEW_ZEALAND 0x0481 /* obsoletes LANGUAGE_USER_MAORI 0x0620 */
+#define LANGUAGE_MAPUDUNGUN_CHILE 0x047A /* AKA Araucanian */
+#define LANGUAGE_MARATHI 0x044E
+#define LANGUAGE_MOHAWK_CANADA 0x047C
+#define LANGUAGE_MONGOLIAN 0x0450 /* Cyrillic script */
+#define LANGUAGE_MONGOLIAN_MONGOLIAN 0x0850
+#define LANGUAGE_NEPALI 0x0461
+#define LANGUAGE_NEPALI_INDIA 0x0861
+#define LANGUAGE_NORWEGIAN 0x0014 /* primary only, not a locale! */
+#define LANGUAGE_NORWEGIAN_BOKMAL 0x0414
+#define LANGUAGE_NORWEGIAN_NYNORSK 0x0814
+#define LANGUAGE_OCCITAN_FRANCE 0x0482 /* obsoletes LANGUAGE_USER_OCCITAN 0x0625 */
+#define LANGUAGE_ORIYA 0x0448
+#define LANGUAGE_OROMO 0x0472
+#define LANGUAGE_PAPIAMENTU 0x0479
+#define LANGUAGE_PASHTO 0x0463
+#define LANGUAGE_POLISH 0x0415
+#define LANGUAGE_PORTUGUESE 0x0816
+#define LANGUAGE_PORTUGUESE_BRAZILIAN 0x0416
+#define LANGUAGE_PUNJABI 0x0446
+#define LANGUAGE_PUNJABI_PAKISTAN 0x0846
+#define LANGUAGE_QUECHUA_BOLIVIA 0x046B
+#define LANGUAGE_QUECHUA_ECUADOR 0x086B
+#define LANGUAGE_QUECHUA_PERU 0x0C6B
+#define LANGUAGE_RHAETO_ROMAN 0x0417
+#define LANGUAGE_ROMANIAN 0x0418
+#define LANGUAGE_ROMANIAN_MOLDOVA 0x0818
+#define LANGUAGE_RUSSIAN 0x0419
+#define LANGUAGE_RUSSIAN_MOLDOVA 0x0819
+#define LANGUAGE_SAMI_NORTHERN_NORWAY 0x043B
+#define LANGUAGE_SAMI_LAPPISH LANGUAGE_SAMI_NORTHERN_NORWAY /* the old MS definition */
+#define LANGUAGE_SAMI_INARI 0x243B
+#define LANGUAGE_SAMI_LULE_NORWAY 0x103B
+#define LANGUAGE_SAMI_LULE_SWEDEN 0x143B
+#define LANGUAGE_SAMI_NORTHERN_FINLAND 0x0C3B
+#define LANGUAGE_SAMI_NORTHERN_SWEDEN 0x083B
+#define LANGUAGE_SAMI_SKOLT 0x203B
+#define LANGUAGE_SAMI_SOUTHERN_NORWAY 0x183B
+#define LANGUAGE_SAMI_SOUTHERN_SWEDEN 0x1C3B
+#define LANGUAGE_SANSKRIT 0x044F
+#define LANGUAGE_SEPEDI 0x046C
+#define LANGUAGE_NORTHERNSOTHO LANGUAGE_SEPEDI /* just an alias for the already existing localization */
+#define LANGUAGE_SERBIAN 0x001A /* primary only, not a locale! */
+#define LANGUAGE_SERBIAN_CYRILLIC 0x0C1A /* MS lists this as Serbian (Cyrillic, Serbia) 'sr-Cyrl-SP', but they use 'SP' since at least Windows2003 where it was Serbia and Montenegro! */
+#define LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA 0x1C1A
+#define LANGUAGE_SERBIAN_LATIN 0x081A /* MS lists this as Serbian (Latin, Serbia) 'sr-Latn-SP', but they use 'SP' since at least Windows2003 where it was Serbia and Montenegro! */
+#define LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA 0x181A
+#define LANGUAGE_SERBIAN_LATIN_NEUTRAL 0x7C1A /* MS lists this as 'sr' only. What a mess. */
+#define LANGUAGE_SESOTHO 0x0430 /* also called Sutu now by MS */
+#define LANGUAGE_SINDHI 0x0459
+#define LANGUAGE_SINDHI_PAKISTAN 0x0859
+#define LANGUAGE_SINHALESE_SRI_LANKA 0x045B
+#define LANGUAGE_SLOVAK 0x041B
+#define LANGUAGE_SLOVENIAN 0x0424
+#define LANGUAGE_SOMALI 0x0477
+#define LANGUAGE_UPPER_SORBIAN_GERMANY 0x042E /* obsoletes LANGUAGE_USER_UPPER_SORBIAN 0x0623 */
+#define LANGUAGE_LOWER_SORBIAN_GERMANY 0x082E /* obsoletes LANGUAGE_USER_LOWER_SORBIAN 0x0624. NOTE: the primary ID is identical to Upper Sorbian, which is not quite correct because they're distinct languages */
+#define LANGUAGE_SORBIAN LANGUAGE_USER_UPPER_SORBIAN /* a strange MS definition */
+#define LANGUAGE_SPANISH_DATED 0x040A /* old collation, not supported, see #i94435# */
+#define LANGUAGE_SPANISH_ARGENTINA 0x2C0A
+#define LANGUAGE_SPANISH_BOLIVIA 0x400A
+#define LANGUAGE_SPANISH_CHILE 0x340A
+#define LANGUAGE_SPANISH_COLOMBIA 0x240A
+#define LANGUAGE_SPANISH_COSTARICA 0x140A
+#define LANGUAGE_SPANISH_DOMINICAN_REPUBLIC 0x1C0A
+#define LANGUAGE_SPANISH_ECUADOR 0x300A
+#define LANGUAGE_SPANISH_EL_SALVADOR 0x440A
+#define LANGUAGE_SPANISH_GUATEMALA 0x100A
+#define LANGUAGE_SPANISH_HONDURAS 0x480A
+#define LANGUAGE_SPANISH_LATIN_AMERICA 0xE40A /* no locale possible */
+#define LANGUAGE_SPANISH_MEXICAN 0x080A
+#define LANGUAGE_SPANISH_MODERN 0x0C0A
+#define LANGUAGE_SPANISH_NICARAGUA 0x4C0A
+#define LANGUAGE_SPANISH_PANAMA 0x180A
+#define LANGUAGE_SPANISH_PARAGUAY 0x3C0A
+#define LANGUAGE_SPANISH_PERU 0x280A
+#define LANGUAGE_SPANISH_PUERTO_RICO 0x500A
+#define LANGUAGE_SPANISH_UNITED_STATES 0x540A
+#define LANGUAGE_SPANISH_URUGUAY 0x380A
+#define LANGUAGE_SPANISH_VENEZUELA 0x200A
+#define LANGUAGE_SPANISH LANGUAGE_SPANISH_MODERN /* modern collation, see #i94435# */
+#define LANGUAGE_SWAHILI 0x0441 /* Kenya */
+#define LANGUAGE_SWEDISH 0x041D
+#define LANGUAGE_SWEDISH_FINLAND 0x081D
+#define LANGUAGE_SYRIAC 0x045A
+#define LANGUAGE_TAJIK 0x0428
+#define LANGUAGE_TAMAZIGHT_ARABIC 0x045F
+#define LANGUAGE_TAMAZIGHT_LATIN 0x085F
+#define LANGUAGE_TAMAZIGHT_TIFINAGH 0x0C5F
+#define LANGUAGE_TAMIL 0x0449
+#define LANGUAGE_TATAR 0x0444
+#define LANGUAGE_TELUGU 0x044A
+#define LANGUAGE_THAI 0x041E
+#define LANGUAGE_TIBETAN 0x0451
+#define LANGUAGE_DZONGKHA 0x0851
+#define LANGUAGE_TIBETAN_BHUTAN LANGUAGE_DZONGKHA /* a MS error, see #i53497# */
+#define LANGUAGE_TIGRIGNA_ERITREA 0x0873
+#define LANGUAGE_TIGRIGNA_ETHIOPIA 0x0473
+#define LANGUAGE_TSONGA 0x0431
+#define LANGUAGE_TSWANA 0x0432 /* AKA Setsuana, for South Africa */
+#define LANGUAGE_TURKISH 0x041F
+#define LANGUAGE_TURKMEN 0x0442
+#define LANGUAGE_UIGHUR_CHINA 0x0480
+#define LANGUAGE_UKRAINIAN 0x0422
+#define LANGUAGE_URDU 0x0020 /* primary only, not a locale! */
+#define LANGUAGE_URDU_INDIA 0x0820
+#define LANGUAGE_URDU_PAKISTAN 0x0420
+#define LANGUAGE_UZBEK_CYRILLIC 0x0843
+#define LANGUAGE_UZBEK_LATIN 0x0443
+#define LANGUAGE_VENDA 0x0433
+#define LANGUAGE_VIETNAMESE 0x042A
+#define LANGUAGE_WELSH 0x0452
+#define LANGUAGE_WOLOF_SENEGAL 0x0488
+#define LANGUAGE_XHOSA 0x0434 /* AKA isiZhosa */
+#define LANGUAGE_YAKUT_RUSSIA 0x0485
+#define LANGUAGE_YI 0x0478 /* Sichuan Yi */
+#define LANGUAGE_YIDDISH 0x043D
+#define LANGUAGE_YORUBA 0x046A
+#define LANGUAGE_ZULU 0x0435
+
+/*! use only for import/export of MS documents, number formatter maps it to
+ *! LANGUAGE_SYSTEM and then to effective system language */
+#define LANGUAGE_SYSTEM_DEFAULT 0x0800
+
+/*! use only for import/export of MS documents, number formatter maps it to
+ *! LANGUAGE_SYSTEM and then to effective system language */
+#define LANGUAGE_PROCESS_OR_USER_DEFAULT 0x0400
+
+/* And now the extensions we define, valid from
+ * 0x0610 to 0x07FF with sublanguage ID 0x01 (default)
+ * 0x0A00 to 0x0BFF with sublanguage ID 0x02
+ * ...
+ * 0x8200 to 0x83FF with sublanguage ID 0x20
+ * 0x8600 to 0x87FF with sublanguage ID 0x21
+ * ...
+ * 0xFA00 to 0xFBFF with sublanguage ID 0x3E
+ * 0xFE00 to 0xFFFF with sublanguage ID 0x3F
+ *
+ * Obsolete OOo user defines now have other values assigned by MS, and
+ * different name. Mapping an obsolete value to ISO code should work provided
+ * that such a mapping exists in i18nlangtag/source/isolang/isolang.cxx, but
+ * mapping ISO back to LANGID will return the new value.
+ */
+#define LANGUAGE_OBSOLETE_USER_LATIN 0x0610
+#define LANGUAGE_USER_LATIN LANGUAGE_LATIN
+#define LANGUAGE_USER_ESPERANTO 0x0611 /* no locale possible */
+#define LANGUAGE_USER_INTERLINGUA 0x0612 /* no locale, but conventions */
+#define LANGUAGE_OBSOLETE_USER_MAORI 0x0620
+#define LANGUAGE_USER_MAORI LANGUAGE_MAORI_NEW_ZEALAND
+#define LANGUAGE_OBSOLETE_USER_KINYARWANDA 0x0621
+#define LANGUAGE_USER_KINYARWANDA LANGUAGE_KINYARWANDA_RWANDA
+/* was reserved for Northern Sotho but never used: 0x0622 */ /* obsoleted by LANGUAGE_SEPEDI */
+#define LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN 0x0623
+#define LANGUAGE_USER_UPPER_SORBIAN LANGUAGE_UPPER_SORBIAN_GERMANY
+#define LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN 0x0624
+#define LANGUAGE_USER_LOWER_SORBIAN LANGUAGE_LOWER_SORBIAN_GERMANY
+#define LANGUAGE_OBSOLETE_USER_OCCITAN 0x0625
+#define LANGUAGE_USER_OCCITAN LANGUAGE_OCCITAN_FRANCE /* reserved to languedocian */
+
+#define LANGUAGE_USER_KOREAN_NORTH 0x8012 /* North Korean as opposed to South Korean, makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_KOREAN)) */
+#define LANGUAGE_USER_KURDISH_TURKEY 0x0626 /* sublang 0x01, Latin script */
+#define LANGUAGE_USER_KURDISH_SYRIA 0x0A26 /* sublang 0x02, Latin script */
+#define LANGUAGE_USER_KURDISH_IRAQ 0x0E26 /* sublang 0x03, Arabic script */
+#define LANGUAGE_USER_KURDISH_IRAN 0x1226 /* sublang 0x04, Arabic script */
+#define LANGUAGE_USER_SARDINIAN 0x0627
+/* was reserved for Dzongkha but turned down with #i53497#: 0x0628 */ /* obsoleted by LANGUAGE_DZONGKHA */
+#define LANGUAGE_USER_SWAHILI_TANZANIA 0x8041 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SWAHILI)) */
+#define LANGUAGE_OBSOLETE_USER_BRETON 0x0629
+#define LANGUAGE_USER_BRETON LANGUAGE_BRETON_FRANCE
+#define LANGUAGE_OBSOLETE_USER_KALAALLISUT 0x062A
+#define LANGUAGE_USER_KALAALLISUT LANGUAGE_KALAALLISUT_GREENLAND
+#define LANGUAGE_USER_SWAZI 0x062B
+#define LANGUAGE_USER_NDEBELE_SOUTH 0x062C
+#define LANGUAGE_USER_TSWANA_BOTSWANA 0x8032 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_TSWANA)) */
+#define LANGUAGE_USER_MOORE 0x062D
+#define LANGUAGE_USER_BAMBARA 0x062E
+#define LANGUAGE_USER_AKAN 0x062F
+#define LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH 0x0630
+#define LANGUAGE_USER_LUXEMBOURGISH LANGUAGE_LUXEMBOURGISH_LUXEMBOURG
+#define LANGUAGE_USER_FRIULIAN 0x0631
+#define LANGUAGE_USER_FIJIAN 0x0632
+#define LANGUAGE_USER_AFRIKAANS_NAMIBIA 0x8036 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_AFRIKAANS)) */
+#define LANGUAGE_USER_ENGLISH_NAMIBIA 0x8009 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_WALLOON 0x0633
+#define LANGUAGE_USER_COPTIC 0x0634
+#define LANGUAGE_USER_CHUVASH 0x0635
+#define LANGUAGE_USER_GASCON 0x0636 /* Gascon France */
+#define LANGUAGE_USER_GERMAN_BELGIUM 0x8007 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_GERMAN)) */
+#define LANGUAGE_USER_CATALAN_VALENCIAN 0x8003 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_CATALAN)) */
+#define LANGUAGE_USER_HAUSA_GHANA 0x8068 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_HAUSA_NIGERIA)) */
+#define LANGUAGE_USER_EWE_GHANA 0x0637
+#define LANGUAGE_USER_ENGLISH_GHANA 0x8409 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ENGLISH_US)) */
+#define LANGUAGE_USER_TAGALOG 0x0638
+#define LANGUAGE_USER_LINGALA_DRCONGO 0x0639
+#define LANGUAGE_USER_SANGO 0x063A
+#define LANGUAGE_USER_GANDA 0x063B
+#define LANGUAGE_USER_LOW_GERMAN 0x063C
+#define LANGUAGE_USER_HILIGAYNON 0x063D
+#define LANGUAGE_USER_NYANJA 0x063E
+#define LANGUAGE_USER_KASHUBIAN 0x063F
+#define LANGUAGE_USER_SPANISH_CUBA 0x800A /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SPANISH)) */
+#define LANGUAGE_USER_TETUN 0x0640
+#define LANGUAGE_USER_QUECHUA_NORTH_BOLIVIA 0x0641
+#define LANGUAGE_USER_QUECHUA_SOUTH_BOLIVIA 0x0642
+#define LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA 0x8C1A /* makeLangID( 0x20+0x03, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC)) */
+#define LANGUAGE_USER_SERBIAN_LATIN_SERBIA 0x881A /* makeLangID( 0x20+0x02, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN)) */
+#define LANGUAGE_USER_SERBIAN_CYRILLIC_MONTENEGRO 0xCC1A /* makeLangID( 0x20+0x13, getPrimaryLanguage( LANGUAGE_SERBIAN_CYRILLIC)) */
+#define LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO 0xC81A /* makeLangID( 0x20+0x12, getPrimaryLanguage( LANGUAGE_SERBIAN_LATIN)) */
+#define LANGUAGE_USER_SAMI_KILDIN_RUSSIA 0x803B /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_SAMI_NORTHERN_NORWAY)) */
+#define LANGUAGE_USER_BODO_INDIA 0x0643
+#define LANGUAGE_USER_DOGRI_INDIA 0x0644
+#define LANGUAGE_USER_MAITHILI_INDIA 0x0645
+#define LANGUAGE_USER_SANTALI_INDIA 0x0646
+#define LANGUAGE_USER_TETUN_TIMOR_LESTE 0x0A40 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_TETUN)) */
+#define LANGUAGE_USER_TOK_PISIN 0x0647
+#define LANGUAGE_USER_SHUSWAP 0x0648
+#define LANGUAGE_USER_ARABIC_CHAD 0x8001 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_COMOROS 0x8401 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_DJIBOUTI 0x8801 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_ERITREA 0x8C01 /* makeLangID( 0x23, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_ISRAEL 0x9001 /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_MAURITANIA 0x9401 /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_PALESTINE 0x9801 /* makeLangID( 0x26, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_SOMALIA 0x9C01 /* makeLangID( 0x27, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ARABIC_SUDAN 0xA001 /* makeLangID( 0x28, getPrimaryLanguage( LANGUAGE_ARABIC_SAUDI_ARABIA)) */
+#define LANGUAGE_USER_ANCIENT_GREEK 0x0649
+#define LANGUAGE_USER_ASTURIAN 0x064A
+#define LANGUAGE_USER_LATGALIAN 0x064B
+#define LANGUAGE_USER_MAORE 0x064C
+#define LANGUAGE_USER_BUSHI 0x064D
+#define LANGUAGE_USER_TAHITIAN 0x064E
+#define LANGUAGE_USER_MALAGASY_PLATEAU 0x064F
+#define LANGUAGE_USER_PAPIAMENTU_ARUBA 0x8079 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_SARDINIAN_CAMPIDANESE 0x0650
+#define LANGUAGE_USER_SARDINIAN_GALLURESE 0x0651
+#define LANGUAGE_USER_SARDINIAN_LOGUDORESE 0x0652
+#define LANGUAGE_USER_SARDINIAN_SASSARESE 0x0653
+#define LANGUAGE_USER_BAFIA 0x0654
+#define LANGUAGE_USER_GIKUYU 0x0655
+#define LANGUAGE_USER_RUSYN_UKRAINE 0x0656
+#define LANGUAGE_USER_RUSYN_SLOVAKIA 0x8256 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_RUSYN_UKRAINE)) */
+#define LANGUAGE_USER_YIDDISH_US 0x083D /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_YIDDISH)) */
+#define LANGUAGE_USER_LIMBU 0x0657
+#define LANGUAGE_USER_LOJBAN 0x0658 /* no locale */
+#define LANGUAGE_OBSOLETE_USER_KABYLE 0x0659
+#define LANGUAGE_USER_KABYLE LANGUAGE_TAMAZIGHT_LATIN
+#define LANGUAGE_USER_HAITIAN 0x065A
+#define LANGUAGE_USER_BEEMBE 0x065B
+#define LANGUAGE_USER_BEKWEL 0x065C
+#define LANGUAGE_USER_KITUBA 0x065D
+#define LANGUAGE_USER_LARI 0x065E
+#define LANGUAGE_USER_MBOCHI 0x065F
+#define LANGUAGE_USER_TEKE_IBALI 0x0660
+#define LANGUAGE_USER_TEKE_TYEE 0x0661
+#define LANGUAGE_USER_VILI 0x0662
+#define LANGUAGE_USER_PORTUGUESE_ANGOLA 0x8016 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_PORTUGUESE)) */
+#define LANGUAGE_USER_MANX 0x0663
+#define LANGUAGE_USER_TEKE_EBOO 0x0664
+#define LANGUAGE_USER_ARAGONESE 0x0665
+#define LANGUAGE_USER_KEYID 0x0666 /* key id pseudolanguage */
+#define LANGUAGE_USER_PALI_LATIN 0x0667
+#define LANGUAGE_USER_KYRGYZ_CHINA 0x0668 /* not derived from LANGUAGE_KIRGHIZ as these may be different scripts, see http://www.omniglot.com/writing/kirghiz.htm */
+#define LANGUAGE_USER_KOMI_ZYRIAN 0x0669
+#define LANGUAGE_USER_KOMI_PERMYAK 0x066A
+#define LANGUAGE_USER_PITJANTJATJARA 0x066B
+#define LANGUAGE_USER_ENGLISH_MALAWI 0x8809 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
+#define LANGUAGE_USER_ERZYA 0x066C
+#define LANGUAGE_USER_MARI_MEADOW 0x066D
+#define LANGUAGE_USER_KHANTY 0x066E
+#define LANGUAGE_USER_LIVONIAN 0x066F
+#define LANGUAGE_USER_MOKSHA 0x0670
+#define LANGUAGE_USER_MARI_HILL 0x0671
+#define LANGUAGE_USER_NGANASAN 0x0672
+#define LANGUAGE_USER_OLONETS 0x0673
+#define LANGUAGE_USER_VEPS 0x0674
+#define LANGUAGE_USER_VORO 0x0675
+#define LANGUAGE_USER_NENETS 0x0676
+#define LANGUAGE_USER_PAPIAMENTU_CURACAO 0x8479 /* makeLangID( 0x21, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_PAPIAMENTU_BONAIRE 0x8879 /* makeLangID( 0x22, getPrimaryLanguage( LANGUAGE_PAPIAMENTU)) */
+#define LANGUAGE_USER_AKA 0x0677
+#define LANGUAGE_USER_AKA_CONGO 0x8277 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_AKA)) */
+#define LANGUAGE_USER_DIBOLE 0x0678
+#define LANGUAGE_USER_DOONDO 0x0679
+#define LANGUAGE_USER_KAAMBA 0x067A
+#define LANGUAGE_USER_KOONGO 0x067B
+#define LANGUAGE_USER_KOONGO_CONGO 0x827B /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_KOONGO)) */
+#define LANGUAGE_USER_KUNYI 0x067C
+#define LANGUAGE_USER_NGUNGWEL 0x067D
+#define LANGUAGE_USER_NJYEM 0x067E
+#define LANGUAGE_USER_NJYEM_CONGO 0x827E /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_NJYEM)) */
+#define LANGUAGE_USER_PUNU 0x067F
+#define LANGUAGE_USER_PUNU_CONGO 0x827F /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_PUNU)) */
+#define LANGUAGE_USER_SUUNDI 0x0680
+#define LANGUAGE_USER_TEKE_KUKUYA 0x0681
+#define LANGUAGE_USER_TSAANGI 0x0682
+#define LANGUAGE_USER_YAKA 0x0683
+#define LANGUAGE_USER_YOMBE 0x0684
+#define LANGUAGE_USER_YOMBE_CONGO 0x8284 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_USER_YOMBE)) */
+#define LANGUAGE_USER_SIDAMA 0x0685
+
+#define LANGUAGE_USER_PRIV_JOKER 0xFFEB /* privateuse "*" (sic! bad! nasty!), primary 0x3eb, sub 0x3f */
+#define LANGUAGE_USER_PRIV_COMMENT 0xFFEC /* privateuse "x-comment", primary 0x3ec, sub 0x3f */
+#define LANGUAGE_USER_PRIV_DEFAULT 0xFFED /* privateuse "x-default", primary 0x3ed, sub 0x3f */
+#define LANGUAGE_USER_PRIV_NOTRANSLATE 0xFFEE /* privateuse "x-no-translate" (sic!), primary 0x3ee, sub 0x3f */
+#define LANGUAGE_MULTIPLE 0xFFEF /* multiple languages, primary 0x3ef, sub 0x3f */
+#define LANGUAGE_UNDETERMINED 0xFFF0 /* undetermined language, primary 0x3f0, sub 0x3f */
+#define LANGUAGE_USER_SYSTEM_CONFIG 0xFFFE /* not a locale, to be used only in configuration context to obtain system default, primary 0x3fe, sub 0x3f */
+
+#endif /* INCLUDED_I18NLANGTAG_LANG_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
new file mode 100644
index 000000000000..e5ba011ab2ba
--- /dev/null
+++ b/include/i18nlangtag/languagetag.hxx
@@ -0,0 +1,400 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+#define INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+
+#include <sal/config.h>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+#include <i18nlangtag/i18nlangtagdllapi.h>
+#include <i18nlangtag/lang.h>
+
+#include <vector>
+
+typedef struct _rtl_Locale rtl_Locale; // as in rtl/locale.h
+
+
+/** Wrapper for liblangtag BCP 47 language tags, MS-LangIDs, locales and
+ conversions in between.
+
+ Note that member variables are mutable and may change their values even in
+ const methods. Getter methods return either the original value or matching
+ converted values.
+ */
+class I18NLANGTAG_DLLPUBLIC LanguageTag
+{
+public:
+
+ /** Init LanguageTag with existing BCP 47 language tag string.
+
+ @param bCanonicalize
+ If TRUE, canonicalize tag and reparse, the resulting tag string may
+ be different.
+ IF FALSE, the tag is simply stored and can be retrieved with
+ getBcp47().
+
+ Note that conversions to ISO codes, locales or LanguageType or
+ obtaining language or script will canonicalize the tag string anyway,
+ so specifying bCanonicalize=false is not a guarantee that the tag will
+ stay identical to what was passed.
+ */
+ explicit LanguageTag( const OUString & rBcp47LanguageTag, bool bCanonicalize = false );
+
+ /** Init LanguageTag with Locale. */
+ explicit LanguageTag( const com::sun::star::lang::Locale & rLocale );
+
+ /** Init LanguageTag with LanguageType MS-LangID. */
+ explicit LanguageTag( LanguageType nLanguage );
+
+ /** Init LanguageTag with language and country strings.
+
+ This is a convenience ctor for places that so far use only language and
+ country to replace the MsLangId::convert...IsoNames...() calls. Avoid
+ use in new code.
+ */
+ explicit LanguageTag( const OUString& rLanguage, const OUString& rCountry );
+
+ /** Init LanguageTag with rtl_Locale.
+
+ This is a convenience ctor.
+ */
+ explicit LanguageTag( const rtl_Locale & rLocale );
+
+ LanguageTag( const LanguageTag & rLanguageTag );
+ ~LanguageTag();
+ LanguageTag& operator=( const LanguageTag & rLanguageTag );
+
+ /** Obtain BCP 47 language tag.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty OUString for such a tag.
+ */
+ const OUString & getBcp47( bool bResolveSystem = true ) const;
+
+ /** Obtain language tag as Locale.
+
+ As a convention, language tags that can not be expressed as "pure"
+ com::sun::star::lang::Locale content using Language and Country fields
+ store "qlt" (ISO 639 reserved for local use) in the Language field and
+ the entire BCP 47 language tag in the Variant field. The Country field
+ contains the corresponding ISO 3166 country code _if_ there is one, or
+ otherwise is empty.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return an empty Locale for such a tag.
+ */
+ const com::sun::star::lang::Locale & getLocale( bool bResolveSystem = true ) const;
+
+ /** Obtain mapping to MS-LangID.
+
+ @param bResolveSystem
+ If TRUE, resolve an empty language tag denoting the system
+ locale to the real locale used.
+ If FALSE, return LANGUAGE_SYSTEM for such a tag.
+ */
+ LanguageType getLanguageType( bool bResolveSystem = true ) const;
+
+ /** Obtain ISO strings for language and country.
+
+ This is a convenience method for places that so far use only language and
+ country to replace the MsLangId::convert...IsoNames...() calls. Avoid
+ use in new code.
+
+ ATTENTION! May return empty strings if the language tag is not
+ expressable in valid ISO codes!
+
+ @see isIsoLocale()
+
+ Always resolves an empty tag to the system locale.
+ */
+ void getIsoLanguageCountry( OUString& rLanguage, OUString& rCountry ) const;
+
+ /** Get ISO 639 language code, or BCP 47 language.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getLanguage() const;
+
+ /** Get ISO 15924 script code, if not the default script according to
+ BCP 47. For default script an empty string is returned.
+
+ @see hasScript()
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getScript() const;
+
+ /** Get combined language and script code, separated by '-' if
+ non-default script, if default script only language.
+
+ @see hasScript()
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getLanguageAndScript() const;
+
+ /** Get ISO 3166 country alpha code. Empty if the BCP 47 tags denote a
+ region not expressable as 2 character country code.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getCountry() const;
+
+ /** Get BCP 47 region tag, which may be an ISO 3166 country alpha code or
+ any other BCP 47 region tag.
+
+ Always resolves an empty tag to the system locale.
+ */
+ OUString getRegion() const;
+
+ /** Get a GLIBC locale string.
+
+ Always resolves an empty tag to the system locale.
+
+ @param rEncoding
+ An encoding to be appended to language_country, for example
+ ".UTF-8" including the dot.
+
+ @return The resulting GLIBC locale string if it could be constructed,
+ if not an empty string is returned.
+ */
+ OUString getGlibcLocaleString( const OUString & rEncoding ) const;
+
+ /** If language tag has a non-default script specified.
+ */
+ bool hasScript() const;
+
+ /** If language tag is a locale that can be expressed using only ISO 639
+ language codes and ISO 3166 country codes, thus is convertible to a
+ conforming Locale struct without using extension mechanisms.
+
+ Note that an empty language tag or empty Locale::Language field or
+ LanguageType LANGUAGE_SYSTEM could be treated as a valid ISO locale in
+ some context, but here is not. If you want that ask for
+ aTag.isSystemLocale() || aTag.isIsoLocale()
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isIsoLocale() const;
+
+ /** If language tag is a locale that can be expressed using only ISO 639
+ language codes and ISO 15924 script codes and ISO 3166 country codes,
+ thus can be stored in an ODF document using only fo:language, fo:script
+ and fo:country attributes. If this is FALSE, the locale must be stored
+ as a <*:rfc-language-tag> element.
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isIsoODF() const;
+
+ /** If this is a valid BCP 47 language tag.
+
+ Always resolves an empty tag to the system locale.
+ */
+ bool isValidBcp47() const;
+
+ /** If this tag was contructed as an empty tag denoting the system locale.
+ */
+ bool isSystemLocale() const;
+
+
+ /** Reset with existing BCP 47 language tag string. See ctor. */
+ void reset( const OUString & rBcp47LanguageTag, bool bCanonicalize = false );
+
+ /** Reset with Locale. */
+ void reset( const com::sun::star::lang::Locale & rLocale );
+
+ /** Reset with LanguageType MS-LangID. */
+ void reset( LanguageType nLanguage );
+
+ /** Reset with rtl_Locale. */
+ void reset( const rtl_Locale & rLocale );
+
+
+ /** Fall back to a known locale.
+
+ If the current tag does not represent a known (by us) locale, fall back
+ to the most likely locale possible known.
+ If the current tag is known, no change occurs.
+ */
+ LanguageTag & makeFallback();
+
+ /** Return a vector of fall-back strings.
+
+ In order:
+ full BCP 47 tag, same as getBcp47()
+ lll-Ssss-CC
+ lll-Ssss
+ lll-CC
+ lll
+
+ Only strings that differ from a higher order are included, for example
+ if there is no script the elements will be bcp47, lll-CC, lll; if the
+ bcp47 string is identical to lll-CC then only lll-CC, lll.
+
+ Note that lll is only ISO 639-1/2 alpha code and CC is only ISO 3166
+ alpha code. If the region can not be expressed as ISO 3166 then no -CC
+ tags are included.
+ */
+ ::std::vector< OUString > getFallbackStrings() const;
+
+
+ /** @short search for an equal or at least for a similar locale in a list
+ of possible ones.
+
+ @descr First search for a locale that is equal to the reference
+ locale. (means: same BCP47 string)
+
+ If the reference locale could not be located, check for
+ "similar" locales, in the same order as obtained by
+ getFallbackStrings().
+
+ If no similar locale could be located, we search for a locale
+ "en-US" inside the given locale list.
+
+ If "en-US" could not be located, we search for a locale "en"
+ inside the given list.
+
+ If no "same" nor any "similar" locale could be found, we try
+ "x-default" and "x-no-translate" explicitly. Sometimes
+ variables don't use real localization. For example, in case the
+ localized value is a fix product name.
+
+ If no locale matched until then, we use any other locale that
+ exists inside the set of given ones, namely the first
+ encountered!
+
+ @param rList
+ the vector of possible locales as BCP47 strings.
+
+ @param rReference
+ the reference locale, BCP47 string.
+
+ @return An iterator that points to the found element inside the given
+ locale list. If no matching locale could be found it points to
+ the end of the list.
+ */
+ static ::std::vector< OUString >::const_iterator getFallback( const ::std::vector< OUString > & rList,
+ const OUString & rReference );
+
+
+ /** Test equality of two LanguageTag, possibly resolving system locale.
+
+ @param bResolveSystem
+ If TRUE, resolve empty language tags denoting the system
+ locale to the real locale used before comparing.
+ If FALSE, the behavior is identical to operator==(), system
+ locales are not resolved first.
+ */
+ bool equals( const LanguageTag & rLanguageTag, bool bResolveSystem = false ) const;
+
+ /** Test equality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")==LanguageTag("en-US") returns false! Use
+ equals(...,true) instead if system locales shall be resolved.
+ */
+ bool operator==( const LanguageTag & rLanguageTag ) const;
+
+ /** Test inequality of two LanguageTag.
+
+ Does NOT resolve system, i.e. if the system locale is en-US
+ LanguageTag("")!=LanguageTag("en-US") returns true! Use
+ !equals(,...true) instead if system locales shall be resolved.
+ */
+ bool operator!=( const LanguageTag & rLanguageTag ) const;
+
+private:
+
+ enum Decision
+ {
+ DECISION_DONTKNOW,
+ DECISION_NO,
+ DECISION_YES
+ };
+
+ mutable com::sun::star::lang::Locale maLocale;
+ mutable OUString maBcp47;
+ mutable OUString maCachedLanguage; ///< cache getLanguage()
+ mutable OUString maCachedScript; ///< cache getScript()
+ mutable OUString maCachedCountry; ///< cache getCountry()
+ mutable void* mpImplLangtag; ///< actually lt_tag_t pointer, encapsulated
+ mutable LanguageType mnLangID;
+ mutable Decision meIsValid;
+ mutable Decision meIsIsoLocale;
+ mutable Decision meIsIsoODF;
+ mutable Decision meIsLiblangtagNeeded; ///< whether processing with liblangtag needed
+ bool mbSystemLocale : 1;
+ mutable bool mbInitializedBcp47 : 1;
+ mutable bool mbInitializedLocale : 1;
+ mutable bool mbInitializedLangID : 1;
+ mutable bool mbCachedLanguage : 1;
+ mutable bool mbCachedScript : 1;
+ mutable bool mbCachedCountry : 1;
+ bool mbIsFallback : 1;
+
+ void convertLocaleToBcp47();
+ void convertLocaleToLang();
+ void convertBcp47ToLocale();
+ void convertBcp47ToLang();
+ void convertLangToLocale();
+ void convertLangToBcp47();
+
+ void convertFromRtlLocale();
+
+ bool canonicalize();
+
+ OUString getLanguageFromLangtag();
+ OUString getScriptFromLangtag();
+ OUString getRegionFromLangtag();
+
+ void resetVars();
+
+ /** Obtain Language, Script and Country via simpleExtract() and assign them
+ to the cached variables if successful.
+
+ @return return of simpleExtract()
+ */
+ bool cacheSimpleLSC();
+
+ static bool isIsoLanguage( const OUString& rLanguage );
+ static bool isIsoScript( const OUString& rScript );
+ static bool isIsoCountry( const OUString& rRegion );
+
+ enum Extraction
+ {
+ EXTRACTED_NONE,
+ EXTRACTED_LSC,
+ EXTRACTED_X,
+ EXTRACTED_X_JOKER
+ };
+
+ /** Of a simple language tag of the form lll[-Ssss][-CC] (i.e. one that
+ would fulfill the isIsoODF() condition) extract the portions.
+
+ Does not check case or content!
+
+ @return EXTRACTED_LSC if simple tag was detected, EXTRACTED_X if x-...
+ privateuse tag was detected, EXTRACTED_X_JOKER if "*" joker was
+ detected, else EXTRACTED_NONE.
+ */
+ static Extraction simpleExtract( const OUString& rBcp47,
+ OUString& rLanguage,
+ OUString& rScript,
+ OUString& rCountry );
+};
+
+#endif // INCLUDED_I18NLANGTAG_LANGUAGETAG_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx
new file mode 100644
index 000000000000..8148d1760de0
--- /dev/null
+++ b/include/i18nlangtag/mslangid.hxx
@@ -0,0 +1,309 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NLANGTAG_MSLANGID_HXX
+#define INCLUDED_I18NLANGTAG_MSLANGID_HXX
+
+#include <sal/config.h>
+
+#include "i18nlangtag/i18nlangtagdllapi.h"
+#include "i18nlangtag/lang.h"
+#include <com/sun/star/lang/Locale.hpp>
+
+/** Methods related to Microsoft language IDs. For details about MS-LANGIDs
+ please see lang.h */
+class I18NLANGTAG_DLLPUBLIC MsLangId
+{
+public:
+
+ /// Create a LangID from a primary and a sublanguage.
+ static inline LanguageType makeLangID( LanguageType nSubLangId, LanguageType nPriLangId)
+ {
+ return (nSubLangId << 10) | nPriLangId;
+ }
+
+ /// Get the primary language of a LangID.
+ static inline LanguageType getPrimaryLanguage( LanguageType nLangID)
+ {
+ return nLangID & LANGUAGE_MASK_PRIMARY;
+ }
+
+ /// Get the sublanguage of a LangID.
+ static inline LanguageType getSubLanguage( LanguageType nLangID)
+ {
+ return (nLangID & ~LANGUAGE_MASK_PRIMARY) >> 10;
+ }
+
+ /** Language/locale of category LC_CTYPE (on Unix, else the system
+ language).
+ Evaluation order: LC_ALL, LC_CTYPE, LANG */
+ static LanguageType getSystemLanguage();
+
+ /** Language/locale of category LC_MESSAGES (on Unix, else same as
+ GetSystemLanguage()).
+ Evaluation order: LANGUAGE, LC_ALL, LC_MESSAGES, LANG */
+ static LanguageType getSystemUILanguage();
+
+
+ /** @short: A proper language/locale if the nLang parameter designates some
+ special value.
+
+ @descr: NOTE: The "system" values may be overridden by the
+ application's configuration.
+
+ @returns
+ case LANGUAGE_PROCESS_OR_USER_DEFAULT : configured or system language
+ case LANGUAGE_SYSTEM_DEFAULT : configured or system language
+ case LANGUAGE_SYSTEM : configured or system language
+ case LANGUAGE_HID_HUMAN_INTERFACE_DEVICE : configured or system UI language
+ case LANGUAGE_DONTKNOW : LANGUAGE_ENGLISH_US
+ else: nLang
+
+ In case the configured language is LANGUAGE_SYSTEM, which is also
+ the initial default, the system language is obtained. In case the
+ configured or resulting system language is LANGUAGE_DONTKNOW,
+ LANGUAGE_ENGLISH_US is returned instead.
+ */
+ static LanguageType getRealLanguage( LanguageType nLang );
+
+
+ // TODO: refactor to LanguageTag? Used only in
+ // i18npool/source/localedata/localedata.cxx
+
+ /** Get fall-back Locale for Locale with handling of an empty language name
+ designating the SYSTEM language. Returns the same Locale if an exact
+ match was found.
+ */
+ static ::com::sun::star::lang::Locale getFallbackLocale(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+
+ // TODO: refactor to LanguageTag, used only in
+ // i18npool/source/isolang/inunx.cxx to convert Unix locale string
+
+ static LanguageType convertUnxByteStringToLanguage( const OString& rString );
+
+
+ static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType );
+
+
+ /** Whether locale has a Right-To-Left orientation. */
+ static bool isRightToLeft( LanguageType nLang );
+
+ /** Whether locale is a CJK locale */
+ static bool isCJK( LanguageType nLang );
+
+ /** Whether locale is a chinese locale */
+ static bool isChinese( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( LanguageType nLang );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( LanguageType nLang );
+
+ /** Whether locale is a korean locale */
+ static bool isKorean( LanguageType nLang );
+
+ /** Whether locale is a simplified chinese locale */
+ static bool isSimplifiedChinese( const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Whether locale is a traditional chinese locale */
+ static bool isTraditionalChinese( const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Whether locale is one where family name comes first, e.g. Japan, Hungary, Samoa */
+ static bool isFamilyNameFirst( LanguageType nLang );
+
+ /** Whether there are "forbidden characters at start or end of line" in
+ this locale. CJK locales.
+
+ @see offapi/com/sun/star/i18n/ForbiddenCharacters.idl
+ */
+ static bool hasForbiddenCharacters( LanguageType nLang );
+
+
+ /** Whether locale needs input sequence checking. CTL locales. */
+ static bool needsSequenceChecking( LanguageType nLang );
+
+
+ /** Get ::com::sun::star::i18n::ScriptType of locale. */
+ static sal_Int16 getScriptType( LanguageType nLang );
+
+
+ /** Map an obsolete user defined LANGID (see lang.h
+ LANGUAGE_OBSOLETE_USER_...) to the new value defined by MS in the
+ meantime.
+
+ Also used to map UI localizations using reserved ISO codes to something
+ "official" but not identical in order to not pollute documents with
+ invalid ISO codes.
+
+ @param bUserInterfaceSelection
+ If TRUE, don't replace such UI-only locale. Only use for
+ Tools->Options->LanguageSettings->UserInterface listbox.
+ If FALSE, do replace.
+ */
+ static LanguageType getReplacementForObsoleteLanguage( LanguageType nLang,
+ bool bUserInterfaceSelection = false );
+
+
+ /** @ATTENTION: these are _ONLY_ to be called by the application's
+ configuration! */
+ static void setConfiguredSystemLanguage( LanguageType nLang );
+ static void setConfiguredSystemUILanguage( LanguageType nLang );
+ static void setConfiguredWesternFallback( LanguageType nLang );
+ static void setConfiguredComplexFallback( LanguageType nLang );
+ static void setConfiguredAsianFallback( LanguageType nLang );
+
+// ---------------------------------------------------------------------------
+
+ /** @internal - Access to fields of an element of the simple conversion table.
+ For resource compiler build environment usage only! */
+ struct IsoLangEntry
+ {
+ LanguageType mnLang;
+ sal_Char maLangStr[4];
+ sal_Char maCountry[3];
+
+ /** Obtain a language tag string with '-' separator. */
+ I18NLANGTAG_DLLPUBLIC OUString getTagString() const;
+ };
+
+ /** @internal - Return a pointer to the IsoLangEntry of the underlying table,
+ matching the offset passed by nIndex. Only meaningful for the resource
+ compiler to build a list of known languages.
+
+ @returns address of IsoLangEntry, or NULL pointer if nIndex exceeds the
+ table elements' count.
+ */
+ static const IsoLangEntry* getIsoLangEntry( size_t nIndex );
+
+// ---------------------------------------------------------------------------
+
+ /** Encapsulated conversion methods used by LanguageTag and conversions,
+ not to be used by anything else.
+ */
+ class Conversion
+ {
+ private:
+
+ friend class LanguageTag;
+
+ friend ::com::sun::star::lang::Locale MsLangId::getFallbackLocale(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+ friend LanguageType MsLangId::convertUnxByteStringToLanguage(
+ const OString& rString );
+
+
+ /** Convert a Locale to a LanguageType with handling of an empty
+ language name designating LANGUAGE_SYSTEM.
+ */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertLocaleToLanguage(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+ /** Convert x-... privateuse, used by convertLocaleToLanguage(Locale) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertPrivateUseToLanguage(
+ const OUString& rPriv );
+
+ /** Used by convertLocaleToLanguage(Locale) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage(
+ const OUString& rLang, const OUString& rCountry );
+
+
+ /** Used by convertUnxByteStringToLanguage(OString) */
+ I18NLANGTAG_DLLPRIVATE static LanguageType convertIsoNamesToLanguage(
+ const OString& rLang, const OString& rCountry );
+
+
+ /** Convert a LanguageType to a Locale.
+
+ @param bResolveSystem
+ If bResolveSystem==true, a LANGUAGE_SYSTEM is resolved.
+ If bResolveSystem==false, a LANGUAGE_SYSTEM results in an
+ empty Locale.
+ */
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale convertLanguageToLocale(
+ LanguageType nLang, bool bResolveSystem );
+
+ /** Convert a LanguageType to a Locale, resolving LANGUAGE_SYSTEM.
+
+ Used by convertLanguageToLocale(LanguageType,bool)
+ */
+ I18NLANGTAG_DLLPRIVATE static void convertLanguageToLocale(
+ LanguageType nLang, ::com::sun::star::lang::Locale & rLocale );
+
+ /** Used by convertLanguageToLocale(LanguageType,Locale) */
+ I18NLANGTAG_DLLPRIVATE static void convertLanguageToIsoNames(
+ LanguageType nLang, OUString& rLangStr, OUString& rCountry );
+
+
+ I18NLANGTAG_DLLPRIVATE static LanguageType lookupFallbackLanguage( LanguageType nLang );
+
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale lookupFallbackLocale(
+ const ::com::sun::star::lang::Locale & rLocale );
+
+
+ /** Convert a LanguageType to a Locale, resolving LANGUAGE_SYSTEM,
+ falling back to a default locale if no exact match was found.
+
+ Used by getFallbackLocale(Locale)
+ */
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale convertLanguageToLocaleWithFallback(
+ LanguageType nLang );
+
+ /** Used by convertLanguageToLocaleWithFallback(LanguageType) */
+ I18NLANGTAG_DLLPRIVATE static ::com::sun::star::lang::Locale lookupFallbackLocale(
+ LanguageType nLang );
+ };
+
+private:
+
+ static LanguageType nConfiguredSystemLanguage;
+ static LanguageType nConfiguredSystemUILanguage;
+
+ static LanguageType nConfiguredWesternFallback;
+ static LanguageType nConfiguredAsianFallback;
+ static LanguageType nConfiguredComplexFallback;
+
+ static LanguageType getPlatformSystemLanguage();
+ static LanguageType getPlatformSystemUILanguage();
+
+ // Substitute LANGUAGE_SYSTEM for LANGUAGE_SYSTEM_DEFAULT and
+ // LANGUAGE_PROCESS_OR_USER_DEFAULT, other values aren't touched.
+ I18NLANGTAG_DLLPRIVATE static inline LanguageType simplifySystemLanguages( LanguageType nLang );
+};
+
+
+// static
+inline LanguageType MsLangId::getSystemLanguage()
+{
+ return getPlatformSystemLanguage();
+}
+
+
+// static
+inline LanguageType MsLangId::getSystemUILanguage()
+{
+ return getPlatformSystemUILanguage();
+}
+
+#endif // INCLUDED_I18NLANGTAG_MSLANGID_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/casefolding.hxx b/include/i18nutil/casefolding.hxx
new file mode 100644
index 000000000000..a0867d1e687c
--- /dev/null
+++ b/include/i18nutil/casefolding.hxx
@@ -0,0 +1,79 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_CASEFOLDING_HXX
+#define INCLUDED_I18NUTIL_CASEFOLDING_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include "i18nutildllapi.h"
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+#define MappingTypeLowerToUpper (1 << 0) // Upper to Lower mapping
+#define MappingTypeUpperToLower (1 << 1) // Lower to Upper mapping
+#define MappingTypeToUpper (1 << 2) // to Upper mapping
+#define MappingTypeToLower (1 << 3) // to Lower mapping
+#define MappingTypeToTitle (1 << 4) // to Title mapping
+#define MappingTypeSimpleFolding (1 << 5) // Simple Case Folding
+#define MappingTypeFullFolding (1 << 6) // Full Case Folding
+#define MappingTypeMask (MappingTypeLowerToUpper|MappingTypeUpperToLower|\
+ MappingTypeToUpper|MappingTypeToLower|MappingTypeToTitle|\
+ MappingTypeSimpleFolding|MappingTypeFullFolding)
+
+#define ValueTypeNotValue (1 << 7) // Value field is an address
+
+#define CasedLetter (MappingTypeMask) // for final sigmar
+
+struct Value
+{
+ sal_uInt8 type;
+ sal_uInt16 value; // value or address, depend on the type
+};
+
+struct Mapping
+{
+ sal_uInt8 type;
+ sal_Int8 nmap;
+#define NMAPPINGMAX 3
+ sal_Unicode map[NMAPPINGMAX];
+}; // for Unconditional mapping
+
+struct MappingElement
+{
+ MappingElement() {element.nmap = current = 0;}
+ Mapping element;
+ sal_Int8 current;
+};
+
+class I18NUTIL_DLLPUBLIC casefolding
+{
+public:
+ static Mapping& getValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException);
+ static Mapping& getConditionalValue(const sal_Unicode* str, sal_Int32 pos, sal_Int32 len, com::sun::star::lang::Locale& aLocale, sal_uInt8 nMappingType) throw (com::sun::star::uno::RuntimeException);
+ static sal_Unicode getNextChar(const sal_Unicode *str, sal_Int32& idx, sal_Int32 len, MappingElement& e, com::sun::star::lang::Locale& aLocale,sal_uInt8 nMappingtype, TransliterationModules moduleLoaded) throw (com::sun::star::uno::RuntimeException);
+
+};
+
+} } } }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/i18nutildllapi.h b/include/i18nutil/i18nutildllapi.h
new file mode 100644
index 000000000000..b208b51e9ee0
--- /dev/null
+++ b/include/i18nutil/i18nutildllapi.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NUTILDLLAPI_H
+#define INCLUDED_I18NUTILDLLAPI_H
+
+#include "sal/types.h"
+
+#if defined(I18NUTIL_DLLIMPLEMENTATION)
+#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define I18NUTIL_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define I18NUTIL_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif /* INCLUDED_I18NUTILDLLAPI_H */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/oneToOneMapping.hxx b/include/i18nutil/oneToOneMapping.hxx
new file mode 100644
index 000000000000..533e4ad52c59
--- /dev/null
+++ b/include/i18nutil/oneToOneMapping.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_TRANSLITERATION_ONETOONEMAPPING_HXX
+#define INCLUDED_I18NUTIL_TRANSLITERATION_ONETOONEMAPPING_HXX
+
+#include <boost/noncopyable.hpp>
+#include <rtl/ustring.hxx>
+#include "i18nutildllapi.h"
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+class widthfolding;
+
+struct OneToOneMappingTable_t
+{
+ sal_Unicode first;
+ sal_Unicode second;
+};
+
+typedef sal_Int8 UnicodePairFlag;
+struct UnicodePairWithFlag
+{
+ sal_Unicode first;
+ sal_Unicode second;
+ UnicodePairFlag flag;
+};
+
+class I18NUTIL_DLLPUBLIC oneToOneMapping : private boost::noncopyable
+{
+public:
+ oneToOneMapping( OneToOneMappingTable_t *rpTable, const size_t rnSize, const size_t rnUnitSize = sizeof(OneToOneMappingTable_t) );
+ virtual ~oneToOneMapping();
+
+ // binary search
+ virtual sal_Unicode find( const sal_Unicode nKey ) const;
+
+ // translator
+ sal_Unicode operator[] ( const sal_Unicode nKey ) const { return find( nKey ); };
+
+protected:
+ OneToOneMappingTable_t *mpTable;
+ size_t mnSize;
+};
+
+class I18NUTIL_DLLPUBLIC oneToOneMappingWithFlag : public oneToOneMapping
+{
+ friend class widthfolding;
+
+public:
+ oneToOneMappingWithFlag( UnicodePairWithFlag *rpTableWF, const size_t rnSize, const UnicodePairFlag rnFlag );
+ virtual ~oneToOneMappingWithFlag();
+
+ // make index for fast search
+ void makeIndex();
+
+ // index search
+ virtual sal_Unicode find( const sal_Unicode nKey ) const;
+protected:
+ UnicodePairWithFlag *mpTableWF;
+ UnicodePairFlag mnFlag;
+ UnicodePairWithFlag **mpIndex[256];
+ bool mbHasIndex;
+};
+
+} } } }
+
+#endif // _I18N_TRANSLITERATION_ONETOONEMAPPING_HXX_
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/paper.hxx b/include/i18nutil/paper.hxx
new file mode 100644
index 000000000000..8847b294fbdb
--- /dev/null
+++ b/include/i18nutil/paper.hxx
@@ -0,0 +1,148 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_I18NUTIL_PAPER_HXX
+#define INCLUDED_I18NUTIL_PAPER_HXX
+
+#include "i18nutildllapi.h"
+#include <rtl/string.hxx>
+#include <com/sun/star/lang/Locale.hpp>
+
+//!! WARNING: be aware of cui/source/tabpages/page.h where someone had the broken idea
+//!! of duplicating the values of this enum in order to use those defines within
+//!! src files.
+//!! Thus don't reorder the enum values here without changing the code there as well.
+enum Paper
+{
+ PAPER_A0,
+ PAPER_A1,
+ PAPER_A2,
+ PAPER_A3,
+ PAPER_A4,
+ PAPER_A5,
+ PAPER_B4_ISO,
+ PAPER_B5_ISO,
+ PAPER_LETTER,
+ PAPER_LEGAL,
+ PAPER_TABLOID,
+ PAPER_USER,
+ PAPER_B6_ISO,
+ PAPER_ENV_C4,
+ PAPER_ENV_C5,
+ PAPER_ENV_C6,
+ PAPER_ENV_C65,
+ PAPER_ENV_DL,
+ PAPER_SLIDE_DIA,
+ PAPER_SCREEN_4_3,
+ PAPER_C,
+ PAPER_D,
+ PAPER_E,
+ PAPER_EXECUTIVE,
+ PAPER_FANFOLD_LEGAL_DE,
+ PAPER_ENV_MONARCH,
+ PAPER_ENV_PERSONAL,
+ PAPER_ENV_9,
+ PAPER_ENV_10,
+ PAPER_ENV_11,
+ PAPER_ENV_12,
+ PAPER_KAI16,
+ PAPER_KAI32,
+ PAPER_KAI32BIG,
+ PAPER_B4_JIS,
+ PAPER_B5_JIS,
+ PAPER_B6_JIS,
+ PAPER_LEDGER,
+ PAPER_STATEMENT,
+ PAPER_QUARTO,
+ PAPER_10x14,
+ PAPER_ENV_14,
+ PAPER_ENV_C3,
+ PAPER_ENV_ITALY,
+ PAPER_FANFOLD_US,
+ PAPER_FANFOLD_DE,
+ PAPER_POSTCARD_JP,
+ PAPER_9x11,
+ PAPER_10x11,
+ PAPER_15x11,
+ PAPER_ENV_INVITE,
+ PAPER_A_PLUS,
+ PAPER_B_PLUS,
+ PAPER_LETTER_PLUS,
+ PAPER_A4_PLUS,
+ PAPER_DOUBLEPOSTCARD_JP,
+ PAPER_A6,
+ PAPER_12x11,
+ PAPER_A7,
+ PAPER_A8,
+ PAPER_A9,
+ PAPER_A10,
+ PAPER_B0_ISO,
+ PAPER_B1_ISO,
+ PAPER_B2_ISO,
+ PAPER_B3_ISO,
+ PAPER_B7_ISO,
+ PAPER_B8_ISO,
+ PAPER_B9_ISO,
+ PAPER_B10_ISO,
+ PAPER_ENV_C2,
+ PAPER_ENV_C7,
+ PAPER_ENV_C8,
+ PAPER_ARCHA,
+ PAPER_ARCHB,
+ PAPER_ARCHC,
+ PAPER_ARCHD,
+ PAPER_ARCHE,
+ PAPER_SCREEN_16_9,
+ PAPER_SCREEN_16_10
+};
+
+// defined for 'equal size' test with the implementation array
+#define NUM_PAPER_ENTRIES (PAPER_SCREEN_16_10 - PAPER_A0 + 1)
+
+// ---------
+// - Paper -
+// ---------
+
+class I18NUTIL_DLLPUBLIC PaperInfo
+{
+ Paper m_eType;
+ long m_nPaperWidth; // width in 100thMM
+ long m_nPaperHeight; // height in 100thMM
+public:
+ PaperInfo(Paper eType);
+ PaperInfo(long nPaperWidth, long nPaperHeight);
+
+ Paper getPaper() const { return m_eType; }
+ long getWidth() const { return m_nPaperWidth; }
+ long getHeight() const { return m_nPaperHeight; }
+ bool sloppyEqual(const PaperInfo &rOther) const;
+ bool doSloppyFit();
+
+ static PaperInfo getSystemDefaultPaper();
+ static PaperInfo getDefaultPaperForLocale(const ::com::sun::star::lang::Locale & rLocale);
+
+ static Paper fromPSName(const OString &rName);
+ static OString toPSName(Paper eType);
+
+ static long sloppyFitPageDimension(long nDimension);
+};
+
+#endif // INCLUDED_I18NUTIL_PAPER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/scripttypedetector.hxx b/include/i18nutil/scripttypedetector.hxx
new file mode 100644
index 000000000000..cf3b9b71e11b
--- /dev/null
+++ b/include/i18nutil/scripttypedetector.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_
+#define _I18N_SCRIPTTYPEDETECTOR_HXX_
+
+#include "i18nutildllapi.h"
+#include <rtl/ustring.hxx>
+
+class I18NUTIL_DLLPUBLIC ScriptTypeDetector
+{
+public:
+ static sal_Int32 beginOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int32 endOfScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection );
+ static sal_Int16 getScriptDirection( const OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection );
+ static sal_Int32 beginOfCTLScriptType( const OUString& Text, sal_Int32 nPos );
+ static sal_Int32 endOfCTLScriptType( const OUString& Text, sal_Int32 nPos );
+ static sal_Int16 getCTLScriptType( const OUString& Text, sal_Int32 nPos );
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/unicode.hxx b/include/i18nutil/unicode.hxx
new file mode 100644
index 000000000000..7da0f5329803
--- /dev/null
+++ b/include/i18nutil/unicode.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_UNICODE_HXX
+#define INCLUDED_I18NUTIL_UNICODE_HXX
+
+#include <com/sun/star/i18n/UnicodeScript.hpp>
+#include <sal/types.h>
+#include <unicode/uscript.h>
+#include "i18nutildllapi.h"
+
+typedef struct _ScriptTypeList {
+ sal_Int16 from;
+ sal_Int16 to;
+ sal_Int16 value;
+} ScriptTypeList;
+
+class I18NUTIL_DLLPUBLIC unicode
+{
+public:
+
+ static sal_Int16 SAL_CALL getUnicodeType( const sal_Unicode ch );
+ static sal_Int16 SAL_CALL getUnicodeScriptType( const sal_Unicode ch, ScriptTypeList *typeList = NULL, sal_Int16 unknownType = 0 );
+ static sal_Unicode SAL_CALL getUnicodeScriptStart(com::sun::star::i18n::UnicodeScript type);
+ static sal_Unicode SAL_CALL getUnicodeScriptEnd(com::sun::star::i18n::UnicodeScript type);
+ static sal_uInt8 SAL_CALL getUnicodeDirection( const sal_Unicode ch );
+ static sal_Bool SAL_CALL isUpper( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isLower( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isDigit( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isControl( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isPrint( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isAlpha( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isSpace( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isWhiteSpace( const sal_Unicode ch);
+ static sal_Bool SAL_CALL isAlphaDigit( const sal_Unicode ch);
+
+ //Map an ISO 15924 script code to Latin/Asian/Complex/Weak
+ static sal_Int16 SAL_CALL getScriptClassFromUScriptCode(UScriptCode eScript);
+
+ //Return a language that can be written in a given ISO 15924 script code
+ static OString SAL_CALL getExemplerLanguageForUScriptCode(UScriptCode eScript);
+};
+
+#endif
+
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nutil/widthfolding.hxx b/include/i18nutil/widthfolding.hxx
new file mode 100644
index 000000000000..481239deca88
--- /dev/null
+++ b/include/i18nutil/widthfolding.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef INCLUDED_I18NUTIL_WIDTHFOLDING_HXX
+#define INCLUDED_I18NUTIL_WIDTHFOLDING_HXX
+
+#include <sal/types.h>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <i18nutil/oneToOneMapping.hxx>
+#include "i18nutildllapi.h"
+
+namespace com { namespace sun { namespace star { namespace i18n {
+
+#define WIDTHFOLDNIG_DONT_USE_COMBINED_VU 0x01
+
+class I18NUTIL_DLLPUBLIC widthfolding
+{
+public:
+ static oneToOneMapping& getfull2halfTable();
+ static oneToOneMapping& gethalf2fullTable();
+
+ static oneToOneMapping& getfull2halfTableForASC();
+ static oneToOneMapping& gethalf2fullTableForJIS();
+
+ static oneToOneMapping& getfullKana2halfKanaTable();
+ static oneToOneMapping& gethalfKana2fullKanaTable();
+
+ static OUString decompose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Bool useOffset);
+ static sal_Unicode decompose_ja_voiced_sound_marksChar2Char (sal_Unicode inChar);
+ static OUString compose_ja_voiced_sound_marks(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset, sal_Bool useOffset, sal_Int32 nFlags = 0 );
+ static sal_Unicode getCompositionChar(sal_Unicode c1, sal_Unicode c2);
+};
+
+
+} } } }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/classpath.hxx b/include/jvmaccess/classpath.hxx
new file mode 100644
index 000000000000..1cc8d83ab348
--- /dev/null
+++ b/include/jvmaccess/classpath.hxx
@@ -0,0 +1,139 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_CLASSPATH_HXX
+#define INCLUDED_JVMACCESS_CLASSPATH_HXX
+
+#include "jvmaccessdllapi.h"
+#include "sal/config.h"
+#include "com/sun/star/uno/Reference.hxx"
+
+#include "jni.h"
+
+namespace com { namespace sun { namespace star { namespace uno {
+ class XComponentContext;
+} } } }
+
+namespace jvmaccess {
+
+/**
+ Helper functions for class path handling.
+*/
+class JVMACCESS_DLLPUBLIC ClassPath {
+public:
+ /**
+ translates a class path into a java.net.URL[] instance.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular,
+ separate adjacent URI references). Any vnd.sun.star.expand URL
+ references in the list are expanded using the
+ com.sun.star.util.theMacroExpander singleton of the given context.
+
+ @returns
+ a local reference to a java.net.URL[] instance containing the external
+ (see the com.sun.star.uri.ExternalUriReferenceTranslator service)
+ equivalents of all the URI references in the given classPath. If null, a
+ (still pending) JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+ static inline ::jobjectArray
+ translateToUrls(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ ::JNIEnv * environment, OUString const & classPath)
+ {
+ return
+ static_cast< ::jobjectArray >(
+ doTranslateToUrls(context, environment, classPath));
+ }
+
+ /**
+ loads a class via a java.net.URLClassLoader.
+
+ @param context
+ a component context; must not be null.
+
+ @param environment
+ a JNI environment; must not be null.
+
+ @param classPath
+ a list of zero or more internal (see the
+ com.sun.star.uri.ExternalUriReferenceTranslator service) URI references,
+ where any space characters (U+0020) are ignored (and, in particular,
+ separate adjacent URI references). Any vnd.sun.star.expand URL
+ references in the list are expanded using the
+ com.sun.star.util.theMacroExpander singleton of the given context.
+
+ @param name
+ the Java binary name of the class to load.
+
+ @returns
+ a local reference to a java.lang.Class instance. If null, a (still
+ pending) JNI exception occurred.
+
+ @throws com::sun::star::uno::RuntimeException
+ */
+ static inline ::jclass loadClass(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ ::JNIEnv * environment, OUString const & classPath,
+ OUString const & name)
+ {
+ return
+ static_cast< ::jclass >(
+ doLoadClass(context, environment, classPath, name));
+ }
+
+private:
+ ClassPath(); // not defined
+ ClassPath(ClassPath &); // not defined
+ ~ClassPath(); // not defined
+ void operator =(ClassPath &); // not defined
+
+ // Functions that replace JNIEnv, jobjectArray, and jclass with void *, so
+ // that their mangled C++ names do not depend on the JDK version used at
+ // compile time:
+
+ static void * doTranslateToUrls(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ void * environment, OUString const & classPath);
+
+ static void * doLoadClass(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > const & context,
+ void * environment, OUString const & classPath,
+ OUString const & name);
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/jvmaccessdllapi.h b/include/jvmaccess/jvmaccessdllapi.h
new file mode 100644
index 000000000000..0f6651b5dbf8
--- /dev/null
+++ b/include/jvmaccess/jvmaccessdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMACCESS_JVMACCESSDLLAPI_H
+#define INCLUDED_JVMACCESS_JVMACCESSDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMACCESS_DLLIMPLEMENTATION
+# define JVMACCESS_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+# define JVMACCESS_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMACCESS_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/unovirtualmachine.hxx b/include/jvmaccess/unovirtualmachine.hxx
new file mode 100644
index 000000000000..4d618d14d863
--- /dev/null
+++ b/include/jvmaccess/unovirtualmachine.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_UNOVIRTUALMACHINE_HXX
+
+#include "jvmaccessdllapi.h"
+#include "sal/config.h"
+#include "salhelper/simplereferenceobject.hxx"
+#include "rtl/ref.hxx"
+
+namespace jvmaccess {
+
+class VirtualMachine;
+
+/** An encapsulating wrapper around a Java virtual machine and an appropriate
+ UNO class loader.
+ */
+class JVMACCESS_DLLPUBLIC UnoVirtualMachine: public salhelper::SimpleReferenceObject {
+public:
+ /** An exception indicating failure to create a UnoVirtualMachine.
+ */
+ class JVMACCESS_DLLPUBLIC CreationException
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const &);
+
+ virtual ~CreationException();
+
+ CreationException & operator =(CreationException const &);
+ };
+
+ /** Create a wrapper around a Java virtual machine and an appropriate UNO
+ class loader.
+
+ @param virtualMachine
+ A Java virtual machine wrapper. Must not be null.
+
+ @param classLoader
+ A local or global JNI reference, relative to the given virtualMachine,
+ to an appropriate UNO class loader instance. Must not be null. This
+ parameter should be of type jobject, not void *, but the exact
+ definition of jobject is different for different JDK versions, so that
+ the mangled C++ name of the constructor would depend on the JDK version
+ used at compile time.
+
+ @exception CreationException
+ Thrown in case creation fails (due to a JNI problem).
+ */
+ UnoVirtualMachine(
+ rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
+ void * classLoader);
+
+ /** Get the Java virtual machine wrapper.
+
+ @return
+ The Java virtual machine wrapper. Will never be null.
+ */
+ rtl::Reference< jvmaccess::VirtualMachine > getVirtualMachine() const;
+
+ /** Get the UNO class loader.
+
+ @return
+ A global JNI reference to the UNO class loader. (The JNI reference must
+ not be deleted by client code.) Will never be null. This should be of
+ type jobject, not void *, but the exact definition of jobject is
+ different for different JDK versions, so that the mangled C++ name of
+ the function would depend on the JDK version used at compile time.
+ */
+ void * getClassLoader() const;
+
+private:
+ UnoVirtualMachine(UnoVirtualMachine &); // not defined
+ void operator =(UnoVirtualMachine &); // not defined
+
+ virtual ~UnoVirtualMachine();
+
+ rtl::Reference< jvmaccess::VirtualMachine > m_virtualMachine;
+ void * m_classLoader;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmaccess/virtualmachine.hxx b/include/jvmaccess/virtualmachine.hxx
new file mode 100644
index 000000000000..57ac5ead39f4
--- /dev/null
+++ b/include/jvmaccess/virtualmachine.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+#define INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+#include "jvmaccessdllapi.h"
+#include "rtl/ref.hxx"
+#include "salhelper/simplereferenceobject.hxx"
+
+#include "jni.h"
+
+namespace jvmaccess {
+
+/** An encapsulating wrapper around a Java virtual machine.
+ */
+class JVMACCESS_DLLPUBLIC VirtualMachine: public salhelper::SimpleReferenceObject
+{
+public:
+ /** A helper to attach a thread to a Java virtual machine.
+
+ @descr
+ Upon construction of a guard the current thread is attached to the
+ virtual machine, and upon destruction of the guard the thread is
+ detached again. For any one thread, multiple instances of this class
+ may be used in a stack-like fashion (care is taken to only really
+ detach the thread from the virtual machine upon destruction of the guard
+ at the bottom of the stack).
+ */
+ class JVMACCESS_DLLPUBLIC AttachGuard
+ {
+ public:
+ /** An exception indicating failure to create an AttachGuard.
+ */
+ class JVMACCESS_DLLPUBLIC CreationException
+ {
+ public:
+ CreationException();
+
+ CreationException(CreationException const &);
+
+ virtual ~CreationException();
+
+ CreationException & operator =(CreationException const &);
+ };
+
+ /** Attach the current thread to a virtual machine.
+
+ @param rMachine
+ The virtual machine to attach to. Must not be a null reference.
+
+ @exception CreationException
+ Thrown in case attaching fails (due to a JNI problem).
+ */
+ explicit AttachGuard(rtl::Reference< VirtualMachine > const & rMachine);
+
+ /** Detach the current thread from the virtual machine again.
+ */
+ ~AttachGuard();
+
+ /** Get a JNI environment pointer for the current thread.
+
+ @return
+ A valid JNI environment pointer. Will never be null.
+ */
+ inline JNIEnv * getEnvironment() const { return m_pEnvironment; }
+
+ private:
+ AttachGuard(AttachGuard &); // not implemented
+ void operator =(AttachGuard); // not implemented
+
+ rtl::Reference< VirtualMachine > m_xMachine;
+ JNIEnv * m_pEnvironment;
+ bool m_bDetach;
+ };
+
+ /** Create a wrapper around a Java virtual machine.
+
+ @param pVm
+ A JNI pointer to virtual machine. Must not be null.
+
+ @param nVersion
+ The JNI version of the virtual machine pointed to by pVm. Must be at
+ least JNI_VERSION_1_2. This parameter should be of type jint, not int,
+ but at least on some platforms the definition of jint changed from
+ JDK 1.3 (long) to JDK 1.4 (int), so that the mangled C++ name of the
+ constructor would depend on the JDK version used at compile time.
+
+ @param bDestroy
+ Whether to destroy the virtual machine when destructing the wrapper
+ (i.e., whether the wrapper owns the virtual machine pointed to by pVm).
+
+ @param pMainThreadEnv
+ A valid JNI environment pointer for the current thread; must not be
+ null. The current thread must be "initially attached" to the virtual
+ machine while this constructor is being called (i.e., it must be the
+ thread that has called JNI_CreateJavaVM in case the virtual machine has
+ been started via the JNI Invocation API, and it must not already have
+ called DetachCurrentThread; or it must be executing native code called
+ from a "primordial" virtual machine). This environment pointer was
+ formerly used to obtain a reference to the thread's current context
+ class loader (java.lang.Thread.getCurrentClassLoader; if later a native
+ thread was attached to the virtual machine, that thread's context class
+ loader would be null, so the AttachGuard first of all set it to the
+ saved value; this feature has been removed again for performance reasons
+ and because the default context class loader is often not useful, so
+ that code relying on a context class loader has to set one explicitly,
+ anyway). This parameter is currently unused (but may be used again in
+ the future).
+ */
+ VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy,
+ JNIEnv * pMainThreadEnv);
+
+private:
+ VirtualMachine(VirtualMachine &); // not implemented
+ void operator =(VirtualMachine); // not implemented
+
+ virtual ~VirtualMachine();
+
+ JNIEnv * attachThread(bool * pAttached) const;
+
+ void detachThread() const;
+
+ JavaVM * m_pVm;
+ jint m_nVersion;
+ bool m_bDestroy;
+
+ friend class AttachGuard; // to access attachThread, detachThread
+};
+
+}
+
+#endif // INCLUDED_JVMACCESS_VIRTUALMACHINE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/framework.h b/include/jvmfwk/framework.h
new file mode 100644
index 000000000000..f1399e0b88f1
--- /dev/null
+++ b/include/jvmfwk/framework.h
@@ -0,0 +1,835 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @HTML */
+
+#ifndef INCLUDED_JVMFWK_FRAMEWORK_H
+#define INCLUDED_JVMFWK_FRAMEWORK_H
+
+#include "jvmfwkdllapi.h"
+#include "rtl/ustring.h"
+#include "osl/mutex.h"
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @file
+ <p>This library can operate in two modes, application mode and direct mode.</p>
+
+
+ <h2>Application Mode</h2>
+ In application mode the Java related settings are stored in files.
+ There are currently three files which need to be accessed. They are determined
+ by bootstrap parameters:</p>
+ <dl>
+ <dt>UNO_JAVA_JFW_VENDOR_SETTINGS</dt>
+ <dd>contains vendor and version information about JREs as well as the
+ location of plugin-libraries which are responsible for providing information
+ about these JREs as well as starting the VMs.</dd>
+ <dt>UNO_JAVA_JFW_USER_DATA</dt>
+ <dd>The file contains settings for a particular user. One can use the macro
+ $SYSUSERCONFIG in the URL which expands to a directory whery the user's data are
+ kept. On UNIX this would be the home directory and on Windows some sub-directory
+ of the &quot;Documents and Settings&quot; folder.The content of this file is an
+ implementation detail and may change in the future.</dd>
+ <dt>UNO_JAVA_JFW_SHARED_DATA</dt>
+ <dd>The file contains settings valid for all users. If a user changes a setting
+ then it takes precedence over the setting from UNO_JAVA_JFW_SHARED_DATA.
+ The content of this file is an implementation detail and may change in the future.</dd>
+ </dl>
+
+ <p>The values for these parameters must be file URLs and include the file name, for
+ example:<br>
+ file:///d:/MyApp/javavendors.xml<br>
+ All files are XML files and must have the extension .xml.</p>
+ <p>
+ Modifying the shared settings is currently not supported by the framework. To provide
+ Java settings for all users one can run OOo and change the settings in the
+ options dialog. These settings are made persistent in the UNO_JAVA_JFW_USER_DATA.
+ The file can then be copied into the base installation.
+ Other users will use automatically these data but can override the settings in
+ the options dialog. This mechanism may change in the future.
+ </p>
+ <p>If shared Java settings are not supported by an application then it is not
+ necessary to specify the bootstrap parameter <code>UNO_JAVA_JFW_SHARED_DATA</code>.
+ </p>
+
+ <p>Setting the class path used by a Java VM should not be necesarry. The locations
+ of Jar files should be knows by a class loader. If a jar file depends on another
+ jar file then it can be referenced in the manifest file of the first jar. However,
+ a user may add jars to the class path by using this API. If it becomes necessary
+ to add files to the class path which is to be used by all users then one can use
+ the bootrap parameter UNO_JAVA_JFW_CLASSPATH_URLS. The value contains of file URLs
+ which must be separated by spaces.</p>
+
+
+ <h2>Direct Mode</h2>
+
+ <p>The direct mode is intended for a scenario where no configuration files
+ are available and a Java VM shall be run. That is,
+ the files containing the user and shared settings are not specified by the
+ bootstrap parameters UNO_JAVA_JFW_SHARED_DATA and UNO_JAVA_JFW_USER_DATA.
+ For example, tools, such as regcomp, may use this framework in a build
+ environment. Then one would want to use settings which have been specified
+ by the build environment. The framework would automatically use the
+ current settings when they change in the environment.
+ </p>
+
+ <p> Here are examples how regcomp could be invoked using bootstrap parameters:
+ </p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar&quot;
+ -register ....
+ </p>
+ <p>If UNO_JAVA_JFW_VENDOR_SETTINGS is not set then a plugin library must be specified. For example:</p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar&quot;
+ -env:UNO_JAVA_JFW_PLUGIN=file:\\solver\\bin\\libsunjavaplugin.dll -register ....
+ </p>
+ <p>Additionall parameters for the Java VM can be provided. For every parameter
+ a seperate bootstrap parameter must be specified. The names are
+ <code>UNO_JAVA_JFW_PARAMETER_X</code>, where X is 1,2, .. n. For example:</p>
+ <p>
+ regcomp -env:UNO_JAVA_JFW_PARAMETER_1=-Xdebug
+ -env:UNO_JAVA_JFW_PARAMETER_2=-Xrunjdwp:transport=dt_socket,server=y,address=8100
+ -env:UNO_JAVA_JFW_JREHOME=file:///d:/j2re1.4.2
+ -env:&quot;UNO_JAVA_JFW_CLASSPATH=d:\\solver\\bin\\classes.jar;d:\\solver\\bin\\jurt.jar&quot;
+ -register ....</p>
+ <p>
+ Here is a complete list of the bootstrap parameter for the direct mode:
+ </p>
+ <dl>
+ <dt>UNO_JAVA_JFW_JREHOME</dt>
+ <dd>Specifies a file URL to a JRE installation.It must ALWAYS be specified
+ in direct mode</dd>
+ <dt>UNO_JAVA_JFW_ENV_JREHOME</dt>
+ <dd>Setting this parameter, for example to &quot;1&quot; or &quot;true&quot;,
+ causes the framework to use the environment variable JAVA_HOME. It is expected
+ that JAVA_HOME contains a system path rather than a file URL. This parameter
+ and UNO_JAVA_JFW_JREHOME are mutually exclusive</dd>
+ <dt>UNO_JAVA_JFW_CLASSPATH</dt>
+ <dd>Contains the class path which is to be used by the VM. Special character,
+ such as '\','{','}','$' must be preceded with '\'. See documentation about the
+ bootstrap parameter.</dd>
+ <dt>UNO_JAVA_JFW_ENV_CLASSPATH</dt>
+ <dd>Setting this parameter,for example to &quot;1&quot; or &quot;true&quot;,
+ causes the framework to use the
+ environment variable CLASSPATH. If this variable and UNO_JAVA_JFW_CLASSPATH are
+ set then the class path is composed from UNO_JAVA_JFW_CLASSPATH and the environment
+ variable CLASSPATH.</dd>
+ <dt>UNO_JAVA_JFW_PLUGIN</dt>
+ <dd>Specified a file URL to a plugin library. If this variable is provided
+ then a javavendors.xml is ignored. It must be provided if no
+ javavendors.xml is available.</dd>
+ <dt>UNO_JAVA_JFW_PARAMETER_X</dt>
+ <dd>Specifies a parameter for the Java VM. The X is replaced by
+ non-negative natural numbers starting with 1.</dd>
+ </dl>
+
+ <p>A note about bootstrap parameters. The implementation of the bootstrap
+ parameter mechanism interprets the characters '\', '$', '{', '}' as
+ escape characters. Thats why the Windows path contain double back-slashes.
+ One should also take into account that a console may have also special
+ escape characters.</p>
+
+ <h2>What mode is used</h2>
+ <p>
+ The default mode is application mode. If at least one bootstrap parameter
+ for the direct mode is provided then direct mode is used. </p>
+
+ <p>
+ All settings made by this API are done for the current user if not
+ mentioned differently.</p>
+
+ <h2>Other bootstrap variables</h2>
+ <dl>
+ <dt>JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY</dt>
+ <dd>This is a unofficial variable which was introduced to workaround external issues.
+ It may be removed in the future. By setting it to 1, the framework will not try to
+ find out if the system is configured to use accessibility tools or if a JRE has an
+ accessibiliy bridge installed</dd>
+ </dl>
+*/
+
+/** indicates that a JRE has an accessibility bridge installed.
+ <p>
+ The flag is used with JavaInfo::nFeatures.</p>
+ */
+#define JFW_FEATURE_ACCESSBRIDGE 0x1l
+/** indicates that there must be an environment set up before the Java process
+ runs.
+ <p>Therefore, when a Java is selected in OO then the office must be
+ restarted, so that the changes can take effect.</p>
+ */
+#define JFW_REQUIRE_NEEDRESTART 0x1l
+
+/** error codes which are returned by functions of this API.
+ */
+typedef enum _javaFrameworkError
+{
+ JFW_E_NONE,
+ JFW_E_ERROR,
+ JFW_E_INVALID_ARG,
+ JFW_E_NO_SELECT,
+ JFW_E_INVALID_SETTINGS,
+ JFW_E_NEED_RESTART,
+ JFW_E_RUNNING_JVM,
+ JFW_E_JAVA_DISABLED,
+ JFW_E_NO_PLUGIN,
+ JFW_E_NOT_RECOGNIZED,
+ JFW_E_FAILED_VERSION,
+ JFW_E_NO_JAVA_FOUND,
+ JFW_E_VM_CREATION_FAILED,
+ JFW_E_CONFIGURATION,
+ JFW_E_DIRECT_MODE
+} javaFrameworkError;
+
+/** an instance of this struct represents an installation of a Java
+ Runtime Environment (JRE).
+
+ <p>
+ Instances of this struct are created by the plug-in libraries which are used by
+ this framework (jvmfwk/vendorplugin.h). The memory of the instances is created
+ by <code>rtl_allocateMemory</code> (rtl/alloc.h). Therefore, the memory must
+ be freed by <code>rtl_freeMemory</code>. Also the contained members must be
+ freed particularly.
+ For convenience this API provides the function <code>jfw_freeJavaInfo</code>
+ which frees the objects properly. </p>
+ */
+struct _JavaInfo
+{
+ /** contains the vendor.
+
+ <p>string must be the same as the one obtained from the
+ Java system property <code>java.vendor</code>.
+ </p>
+ */
+ rtl_uString *sVendor;
+ /** contains the file URL to the installation directory.
+ */
+ rtl_uString *sLocation;
+ /** contains the version of this Java distribution.
+
+ <p>The version string must adhere to the rules
+ about how a version string has to be formed. These rules may
+ be vendor-dependent. Essentially the strings must syntactically
+ equal the Java system property <code>java.version</code>.
+ </p>
+ */
+ rtl_uString *sVersion;
+ /** indicates supported special features.
+
+ <p>For example, <code>JFW_FEATURE_ACCESSBRIDGE</code> indicates that
+ assistive technology tools are supported.</p>
+ */
+ sal_uInt64 nFeatures;
+ /** indicates requirments for running the java runtime.
+
+ <p>For example, it may be necessary to prepare the environment before
+ the runtime is created. That could mean, setting the
+ <code>LD_LIBRARY_PATH</code>
+ when <code>nRequirements</code> contains the flag
+ <code>JFW_REQUIRE_NEEDRESTART</code></p>
+ */
+ sal_uInt64 nRequirements;
+ /** contains data needed for the creation of the java runtime.
+
+ <p>There is no rule about the format and content of the sequence's
+ values. The plug-in libraries can put all data, necessary for
+ starting the java runtime into this sequence. </p>
+ */
+ sal_Sequence * arVendorData;
+};
+
+typedef struct _JavaInfo JavaInfo;
+
+/** frees the memory of a <code>JavaInfo</code> object.
+ @param pInfo
+ The object which is to be freed. It can be NULL;
+ */
+JVMFWK_DLLPUBLIC void SAL_CALL jfw_freeJavaInfo(JavaInfo *pInfo);
+
+
+/** compares two <code>JavaInfo</code> objects for equality.
+
+ <p>Two <code>JavaInfo</code> objects are said to be equal if the contained
+ members of the first <code>JavaInfo</code> are equal to their counterparts
+ in the second <code>JavaInfo</code> object. The equality of the
+ <code>rtl_uString</code> members is determined
+ by the respective comparison function (see
+ <code>OUString::equals</code>).
+ Similiarly the equality of the <code>sal_Sequence</code> is
+ also determined by a comparison
+ function (see <code>rtl::ByteSequence::operator ==</code>). </p>
+ <p>
+ Both argument pointers must be valid.</p>
+ @param pInfoA
+ the first argument.
+ @param pInfoB
+ the second argument which is compared with the first.
+ @return
+ sal_True - both object represent the same JRE.</br>
+ sal_False - the objects represend different JREs
+ */
+JVMFWK_DLLPUBLIC sal_Bool SAL_CALL jfw_areEqualJavaInfo(
+ JavaInfo const * pInfoA,JavaInfo const * pInfoB);
+
+/** determines if a Java Virtual Machine is already running.
+
+ <p>As long as the office and the JREs only support one
+ Virtual Machine per process the Java settings, particulary the
+ selected Java, are not effective immediately after changing when
+ a VM has already been running. That is, if a JRE A was used to start
+ a VM and then a JRE B is selected, then JRE B will only be used
+ after a restart of the office.</p>
+ <p>
+ By determining if a VM is running, the user can be presented a message,
+ that the changed setting may not be effective immediately.</p>
+
+ @param bRunning
+ [out] sal_True - a VM is running. <br/>
+ sal_False - no VM is running.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG the parameter <code>bRunning</code> was NULL.
+*/
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_isVMRunning(sal_Bool *bRunning);
+
+/** detects a suitable JRE and configures the framework to use it.
+
+ <p>Which JREs can be used is determined by the file javavendors.xml,
+ which contains version requirements, as well as information about available
+ plug-in libraries. Only these libraries are responsible for locating JRE
+ installations.</p>
+ <p>
+ JREs can be provided by different vendors. In order to find the JREs of
+ a certain vendor a plug-in library must be provided. There must be only one
+ library for one vendor. The names of locations of those libraries have to
+ be put into the javavendors.xml file.<br/>
+ The function uses the plug-in libraries to obtain information about JRE
+ installation and checks if they there is one among them that supports
+ a set of features (currently only accessibilty is possible). If none was
+ found then it also uses a list of paths, which have been registered
+ by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>
+ to find JREs. Found JREs are examined in the same way.</p>
+ <p>
+ A JRE installation is only selected if it meets the version requirements.
+ Information about the selected JRE are made persistent so that
+ subsequent calls to <code>jfw_getSelectedJRE</code> returns this
+ information.</p>
+ <p>
+ While determining a proper JRE this function takes into account if a
+ user requires support for assistive technology tools. If user
+ need that support they have to set up their system accordingly. When support
+ for assistive technology is required, then the lists of
+ <code>JavaInfo</code> objects,
+ which are provided by the <code>getJavaInfo</code> functions of the plug-ins, are
+ examined for a suitable JRE. That is, the <code>JavaInfo</code> objects
+ from the list
+ obtained from the first plug-in, are examined. If no <code>JavaInfo</code>
+ object has the flag
+ <code>JFW_FEATURE_ACCESSBRIDGE</code> in the member <code>nFeatures</code>
+ then the
+ next plug-in is used to obtain a list of <code>JavaInfo</code> objects.
+ This goes on until a <code>JavaInfo</code> object was found which
+ represents a suitable JRE. Or neither plug-in provided such a
+ <code>JavaInfo</code> object. In that case the first
+ <code>JavaInfo</code> object from the first plug-in is used to determine
+ the JRE which is to be used.</p>
+ <p>
+ If there is no need for the support of assistive technology tools then
+ the first <code>JavaInfo</code> object from the list obtained by the
+ first plug-in is used. If this plug-in does not find any JREs then the
+ next plug-in is used, and so on.</p>
+
+ @param ppInfo
+ [out] a <code>JavaInfo</code> pointer, representing the selected JRE.
+ The caller has to free it by calling <code>jfw_freeJavaInfo<code>. The
+ <code>JavaInfo</code> is for informational purposes only. It is not
+ necessary to call <code>jfw_setSelectedJRE</code> afterwards.<br/>
+ <code>ppInfo</code>can be NULL. If <code>*ppInfo</code> is not null, then it is
+ overwritten, without attempting to free <code>*ppInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ JFW_E_NO_JAVA_FOUND no JRE was found that meets the requirements.</br>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode. </br>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo);
+
+/** provides information about all availabe JRE installations.
+
+ <p>The function determines dynamically what JREs are available. It uses
+ the plug-in libraries to provide lists of available <code>JavaInfo</code>
+ objects where each object represents a JRE (see vendorplugin.h,
+ getAllJavaInfos). It also uses a list of paths, which have been registered
+ by <code>jfw_addJRELocation</code> or <code>jfw_setJRELocations</code>.
+ It is checked if the path still contains a valid JRE and if so the respective
+ <code>JavaInfo</code> object will be appended to the array unless there is
+ already an equal object.</p>
+
+ @param parInfo
+ [out] on returns it contains a pointer to an array of <code>JavaInfo</code>
+ pointers.
+ The caller must free the array with <code>rtl_freeMemory</code> and each
+ element of the array must be freed with <code>jfw_freeJavaInfo</code>.
+ @param pSize
+ [out] on return contains the size of array returned in <code>parInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.
+*/
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_findAllJREs(
+ JavaInfo ***parInfo, sal_Int32 *pSize);
+
+/** determines if a path points to a Java installation.
+
+ <p>If the path belongs to a JRE installation then it returns the
+ respective <code>JavaInfo</code> object. The function uses the
+ <code>getJavaInfoByPath</code> function of the plug-ins to obtain the
+ <code>JavaInfo</code> object. Only if the JRE found at the specified location
+ meets the version requirements as specified in the javavendors.xml file a
+ <code>JavaInfo</code> object is returned.<br/>
+ <p>
+ The functions only checks if a JRE exists but does not modify any settings.
+ To make the found JRE the &quot;selected JRE&quot; one has
+ to call <code>jfw_setSelectedJRE</code>.</p>
+
+ @param pPath
+ [in] a file URL to a directory.
+ @param pInfo
+ [out] the <code>JavaInfo</code> object which represents a JRE found at the
+ location specified by <code>pPath</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG at least on of the parameters was NULL<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.</br>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ JFW_E_NOT_RECOGNIZED neither plug-in library could detect a JRE. <br/>
+ JFW_E_FAILED_VERSION a JRE was detected but if failed the version
+ requirements as determined by the javavendors.xml
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getJavaInfoByPath(
+ rtl_uString *pPath, JavaInfo **ppInfo);
+
+
+/** starts a Java Virtual Machine (JVM).
+
+ <p>The function uses the current settings to start a JVM. The actual
+ start-up code, however, is provided by the plug-in libraries. The setting
+ of the &quot;selected Java&quot; contains the information as to what vendor
+ the respective JRE comes from. In the javavendors.xml there is a mapping of
+ vendor names to the respective plug-in libraries.</p>
+ <p>
+ The function ultimately calls <code>startJavaVirtualMachine</code> from
+ the plug-in library.</p>
+ <p>
+ The <code>arOptions</code>
+ argument contains start arguments which are passed in JavaVMOption structures
+ to the VM during its creation. These
+ could be things, such as language settings, proxy settings or any other
+ properties which shall be obtainable by
+ <code>java.lang.System.getProperties</code>. One can also pass options which
+ have a certain meaning to the runtime behaviour such as -ea or -X... However,
+ one must be sure that these options can be interpreted by the VM.<br/>
+ The class path cannot be set this way. The class path is internally composed by
+ the paths to archives in a certain directory, which is preconfigured in
+ the internal data store and the respective user setting (see
+ <code>jfw_setUserClassPath</code>.</p>
+ <p>
+ If a JRE was selected at runtime which was different from the previous
+ setting and that JRE needs a prepared environment, for example an adapted
+ <code>LD_LIBRARY_PATH</code> environment variable, then the VM will not be
+ created and JFW_E_NEED_RESTART error is returned. If a VM is already running
+ then a JFW_E_RUNNING_JVM is returned.</p>
+
+ @param pInfo
+ [in] optional pointer to a specific JRE; must be caller-freed if not NULL
+ @param arOptions
+ [in] the array containing additional start arguments or NULL.
+ @param nSize
+ [in] the size of the array <code>arOptions</code>.
+ @param ppVM
+ [out] the <code>JavaVM</code> pointer.
+ @param ppEnv
+ [out] the <code>JNIenv</code> pointer.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALID_ARG <code>ppVM</code>, <code>ppEnv</code> are NULL or
+ <code>arOptions</code> was NULL but <code>nSize</code> was greater 0.<br/>
+ JFW_E_ERROR an error occurred. <br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.</br>
+ JFW_E_NO_PLUGIN the plug-in library responsible for creating the VM
+ could not be found.<br/>
+ JFW_E_JAVA_DISABLED the use of Java is currently disabled. <br/>
+ JFW_E_NO_SELECT there is no JRE selected yet. <br/>
+ JFW_E_RUNNIN_JVM there is already a VM running.<br/>
+ JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
+ JRE has been selected afterwards. <br/>
+ JFW_E_NEED_RESTART in the current process a different JRE has been selected
+ which needs a prepared environment, which has to be done before the office
+ process. Therefore the new JRE may not be used until the office was restarted.<br/>
+ JFW_E_NEED_RESTART is also returned when Java was disabled at the beginning and
+ then the user enabled it. If then the selected JRE has the requirement
+ JFW_REQUIRE_NEEDRESTART then this error is returned. </br>
+ JFW_E_VM_CREATION_FAILED the creation of the JVM failed. The creation is performed
+ by a plug-in library and not by this API.
+ JFW_E_FAILED_VERSION the &quot;Default Mode&quot; is active. The JRE determined by
+ <code>JAVA_HOME</code>does not meet the version requirements.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_startVM(
+ JavaInfo const * pInfo, JavaVMOption * arOptions, sal_Int32 nSize,
+ JavaVM ** ppVM, JNIEnv ** ppEnv);
+
+/** determines the JRE that is to be used.
+
+ <p>When calling <code>jfw_startVM</code> then a VM is startet from
+ the JRE that is determined by this function.<br/>
+ It is not verified if the JRE represented by the <code>JavaInfo</code>
+ argument meets the requirements as specified by the javavendors.xml file.
+ However, usually one obtains the <code>JavaInfo</code> object from the
+ functions <code>jfw_findAllJREs</code> or <code>jfw_getJavaInfoByPath</code>,
+ which do verify the JREs and pass out only <code>JavaInfo</code> objects
+ which comply with the version requirements.</p>
+ <p>
+ If <code>pInfo</code> is NULL then the meaning is that no JRE will be
+ selected. <code>jfw_startVM</code> will then return
+ <code>JFW_E_NO_SELECT</code>.</p>
+
+ @param pInfo
+ [in] pointer to <code>JavaInfo</code> structure, containing data about a
+ JRE. The caller must still free <code>pInfo</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo);
+
+
+/** provides information about the JRE that is to be used.
+
+ <p>If no JRE is currently selected then <code>ppInfo</code> will contain
+ NULL on return.</br>
+ If the value of the element <updated> in the javavendors.xml file was
+ changed since the time when the last Java was selected then this
+ function returns <code>JFW_E_INVALID_SETTINGS</code>. This could happen during
+ a product patch. Then new version requirements may be introduced, so that
+ the currently selected JRE may not meet these requirements anymore.
+ </p>
+ <p>In direct mode the function returns information about a JRE that was
+ set by the bootstrap parameter UNO_JAVA_JFW_JREHOME.
+ </p>
+ @param ppInfo
+ [out] on return it contains a pointer to a <code>JavaInfo</code> object
+ that represents the currently selected JRE. When <code>*ppInfo</code> is not
+ NULL then the function overwrites the pointer. It is not attempted to free
+ the pointer.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG <code>ppInfo</code> is a NULL.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_INVALID_SETTINGS the javavendors.xml has been changed and no
+ JRE has been selected afterwards. <br/>
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo);
+
+
+/** determines if Java can be used.
+
+ <p>If <code>bEnabled</code> is <code>sal_False</code> then a call
+ to jfw_startVM will result in an error with the errorcode
+ <code>JFW_E_JAVA_DISABLED</code></p>
+
+ @param bEnabled
+ [in] use of Java enabled/disabled.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setEnabled(sal_Bool bEnabled);
+
+/** provides the information if Java can be used.
+
+ <p>That is if the user enabled or disabled the use of Java.
+ </p>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG pbEnabled is NULL<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getEnabled(sal_Bool *pbEnabled);
+
+/** determines parameters which are passed to VM during its creation.
+
+ <p>The strings must be exactly as they are passed on the command line.
+ For example, one could pass<br/>
+ -Xdebug <br/>
+ -Xrunjdw:transport=dt_socket,server=y,address=8000<br/>
+ in order to enable debugging support.
+ </p>
+
+ @param arParameters
+ [in] contains the arguments. It can be NULL if nSize is 0.
+ @param nSize
+ [i] the size of <code>arArgs</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG arArgs is NULL and nSize is not 0
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setVMParameters(
+ rtl_uString ** arArgs, sal_Int32 nSize);
+
+/** obtains the currently used start parameters.
+
+ <p>The caller needs to free the returned array with
+ <code>rtl_freeMemory</code>. The contained strings must be released with
+ <code>rtl_uString_release</code>.
+ </p>
+
+ @param parParameters
+ [out] on returns contains a pointer to the array of the start arguments.
+ If *parParameters is not NULL then the value is overwritten.
+ @param pSize
+ [out] on return contains the size of array returned in
+ <code>parParameters</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG parParameters or pSize are NULL<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getVMParameters(
+ rtl_uString *** parParameters,
+ sal_Int32 * pSize);
+
+/** sets the user class path.
+
+ <p>When the VM is started then it is passed the class path. The
+ class path also contains the user class path set by this function.
+ The paths contained in <code>pCP</code> must be separated with a
+ system dependent path separator.</p>
+
+ @param pCP
+ [in] the user class path.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG pCP is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setUserClassPath(rtl_uString * pCP);
+/** provides the value of the current user class path.
+
+ <p>The function returns an empty string if no user class path is set.
+ </p>
+
+ @param ppCP
+ [out] contains the user class path on return. If <code>*ppCP</code> was
+ not NULL then the value is overwritten. No attempt at freeing that string
+ is made.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG ppCP is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getUserClassPath(rtl_uString ** ppCP);
+
+/** saves the location of a JRE.
+
+ <p>When <code>jfw_findAllJREs</code> is called then the paths added by this
+ function are evaluated. If the location still represents a
+ JRE then a <code>JavaInfo</code> object is created which is returned along
+ with all other <code>JavaInfo</code> objects by
+ <code>jfw_findAllJREs</code>. If the location
+ cannot be recognized then the location string is ignored. </p>
+ <p>
+ A validation if <code>sLocation</code> points to a JRE is not
+ performed. To do that one has to use <code>jfw_getJavaInfoByPath</code>.
+ </p>
+ <p>
+ Adding a path that is already stored causes no error.</p>
+
+ @param sLocation
+ [in] file URL to a directory which contains a JRE.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG sLocation is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ @see jfw_setJRELocations
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_addJRELocation(rtl_uString * sLocation);
+
+/** saves the locations of a number of JREs.
+
+ <p>
+ The function does not verify if the paths points to JRE. However,
+ it makes sure that every path is unique. That is, if the array
+ contains strings which are the same then only one is stored.</p>
+ <p>
+ If <code>arLocations</code> is NULL or it has the length null (nSize = 0)
+ then all previously stored paths are deleted. Otherwise,
+ the old values are overwritten.</p>
+
+ @param arLocations
+ [in] array of paths to locations of JREs.
+
+ @param nSize
+ [in] the size of the array <code>arLocations</code>
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG arLocation is NULL and nSize is not null.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ @see jfw_addJRELocations
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_setJRELocations(
+ rtl_uString ** arLocations, sal_Int32 nSize);
+/** obtains an array containing paths to JRE installations.
+
+ <p>
+ It is not guaranteed that the returned paths represent
+ a valid JRE. One can use <code>jfw_getJavaInfoByPath</code> to check this.
+ </p>
+
+ @param parLocations
+ [out] on return it contains the array of paths.
+ @param pSize
+ [out] on return it contains the size of the array <code>parLocations</code>.
+
+ @return
+ JFW_E_NONE function ran successfully.<br/>
+ JFW_E_INVALIDARG parLocation is NULL or pSize is NULL.<br/>
+ JFW_E_ERROR An error occurred.<br/>
+ JFW_E_CONFIGURATION mode was not properly set or their prerequisites
+ were not met.<br/>
+ JFW_E_DIRECT_MODE the function cannot be used in this mode.
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_getJRELocations(
+ rtl_uString *** parLocations, sal_Int32 * pSize);
+
+
+/** checks if the installation of the jre still exists.
+
+ This function checks if the JRE described by pInfo still
+ exists. The check must be very quick because it is called by javaldx
+ (Linux, Solaris) at start up.
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param pp_exist
+ [out] the parameter is set to either sal_True or sal_False. The value is
+ only valid if the function returns JFW_E_NONE.
+
+ @return
+ JFW_E_NONE the function ran successfully.</br>
+ JFW_E_ERROR an error occurred during execution.</br>
+ JFW_E_INVALID_ARG pInfo contains invalid data</br>
+ JFW_E_NO_PLUGIN a plug-in library could not be found.<br/>
+ */
+JVMFWK_DLLPUBLIC javaFrameworkError SAL_CALL jfw_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+
+
+/** locks this API so that it cannot be used by other threads.
+
+ <p>If a different thread called this function before then the
+ current call is blocked until the other thread has called
+ <code>jfw_unlock()</code>. The function should be called if one
+ needs an exact snapshot of the current settings. Then the settings
+ are retrieved one by one without risk that the settings may be changed
+ by a different thread. Similiary if one needs to make settings which
+ should become effective at the same time then <code>jfw_lock</code>
+ should be called. That is, <code>jfw_startVM</code> which uses the
+ settings cannot be called before all settings have be made.</p>
+ <p>
+ The only functions which are not effected by <code>jfw_lock</code> are
+ <code>jfw_freeJavaInfo</code> and <code>jfw_areEqualJavaInfo</code>.
+ */
+JVMFWK_DLLPUBLIC void SAL_CALL jfw_lock();
+
+/** unlocks this API.
+
+ <p>This function is called after <code>jfw_lock</code>. It allows other
+ threads to use this API concurrently.</p>
+*/
+JVMFWK_DLLPUBLIC void SAL_CALL jfw_unlock();
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/jvmfwkdllapi.h b/include/jvmfwk/jvmfwkdllapi.h
new file mode 100644
index 000000000000..52c8273b5954
--- /dev/null
+++ b/include/jvmfwk/jvmfwkdllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMFWK_JVMFWKDLLAPI_H
+#define INCLUDED_JVMFWK_JVMFWKDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMFWK_DLLIMPLEMENTATION
+# define JVMFWK_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+# define JVMFWK_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMFWK_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/jvmfwkplugindllapi.h b/include/jvmfwk/jvmfwkplugindllapi.h
new file mode 100644
index 000000000000..d96016e261bb
--- /dev/null
+++ b/include/jvmfwk/jvmfwkplugindllapi.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_JVMFWK_JVMFWKPLUGINDLLAPI_H
+#define INCLUDED_JVMFWK_JVMFWKPLUGINDLLAPI_H
+
+#include <sal/types.h>
+
+#if defined JVMFWK_PLUGIN_DLLIMPLEMENTATION
+# define JVMFWK_PLUGIN_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+# define JVMFWK_PLUGIN_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define JVMFWK_PLUGIN_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/jvmfwk/vendorplugin.h b/include/jvmfwk/vendorplugin.h
new file mode 100644
index 000000000000..5ca5e10009ba
--- /dev/null
+++ b/include/jvmfwk/vendorplugin.h
@@ -0,0 +1,258 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+/** @HTML */
+#ifndef INCLUDED_JVMFWK_VENDORPLUGIN_H
+#define INCLUDED_JVMFWK_VENDORPLUGIN_H
+
+#include "jvmfwkplugindllapi.h"
+#include "jvmfwk/framework.h"
+#include "rtl/ustring.h"
+#include "jni.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ @file
+ <p>
+ This API shall be implemented if one wants to support a Java Runtime
+ Environment (JRE) of a particular vendor. Because there is currently no
+ specification which rules the structure and location of JRE installations
+ and the format of version strings it is not possible to supply a general
+ implementation for all possible vendors. If an application determines exactly
+ what version a JRE must have then it relies on certain features and bug
+ fixes of that version. Because a version 1.4.2_1 from vendor X may contain
+ different fixes as the same version from vendor Y it is important to see
+ version an vendor as one entity. One without the other does not guarantee
+ the existence of a particular set of features or bug fixes. An implementation
+ of this API may support multiple vendors. </p>
+ <p>
+ Libraries which implement this interface will be dynamically loaded and
+ unloaded by the java framework (jvmfwk/framework.h). Therefore they must not
+ keep global variables.
+ </p>
+ */
+
+typedef enum
+{
+ JFW_PLUGIN_E_NONE,
+ JFW_PLUGIN_E_ERROR,
+ JFW_PLUGIN_E_INVALID_ARG,
+ JFW_PLUGIN_E_WRONG_VERSION_FORMAT,
+ JFW_PLUGIN_E_FAILED_VERSION,
+ JFW_PLUGIN_E_NO_JRE,
+ JFW_PLUGIN_E_WRONG_VENDOR,
+ JFW_PLUGIN_E_VM_CREATION_FAILED
+} javaPluginError;
+
+
+
+/** obtains information about installations of Java Runtime Environments (JREs).
+
+ <p>The function gathers information about available JREs which have the same
+ vendor as determined by the <code>sVendor</code> parameter. Only information
+ about those JREs which match the version requirements are returned. These
+ requirements are specified by the parameters <code>sMinVersion</code>,
+ <code>sMaxVersion</code> and <code>arExcludeList</code>.
+ </p>
+ <p>
+ The JavaInfo structures returned in <code>parJavaInfo</code> should be ordered
+ according to their version. The one, representing a JRE with the highest
+ version should be the first in the array. </p>
+ <p>
+ The function allocates memory for an array and all the JavaInfo objects returned
+ in <code>parJavaInfo</code>. The caller must free each JavaInfo object by calling
+ <code>jfw_freeJavaInfo</code> (#include "jvmfwk/framework.h"). The array is to be
+ freed by rtl_freeMemory.
+ In case an error occurred <code>parJavaInfo</code> need not be freed.
+ </p>
+ @param sVendor
+ [in] only JREs from this vendor are examined. This parameter always contains
+ a vendor string. That is, the string it is not empty.
+ @param sMinVersion
+ [in] represents the minimum version of a JRE. The string can be empty but
+ a null pointer is not allowed.
+ @param sMaxVersion
+ [in] represents the maximum version of a JRE. The string can be empty but
+ a null pointer is not allowed.
+ @param arExcludeList
+ [in] contains a list of &quot;bad&quot; versions. JREs which have one of these
+ versions must not be returned by this function. It can be NULL.
+ @param nSizeExcludeList
+ [in] the number of version strings contained in <code>arExcludeList</code>.
+ @param parJavaInfo
+ [out] if the function runs successfully then <code>parJavaInfo</code> contains
+ on return an array of pointers to <code>JavaInfo</code> objects.
+ @param nSizeJavaInfo
+ [out] the number of <code>JavaInfo</code> pointers contained in
+ <code>parJavaInfo</code>.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+ <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
+ is NULL or NULL pointer were passed for at least on of the strings.</br>
+ JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+ <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
+ version strings.
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_getAllJavaInfos(
+ rtl_uString *sVendor,
+ rtl_uString *sMinVersion,
+ rtl_uString *sMaxVersion,
+ rtl_uString * * arExcludeList,
+ sal_Int32 nSizeExcludeList,
+ JavaInfo*** parJavaInfo,
+ sal_Int32 *nSizeJavaInfo);
+
+/** obtains information for a JRE at a given location.
+
+ <p>If the given location belongs to a JRE whoose vendor matches the
+ sVendor argument and the JRE has a version which meets the requirements as
+ specified by <code>sMinVersion, sMaxVersion, arExcludeList</code> then
+ this function shall return a JavaInfo object for this JRE if this implementation
+ supports this vendor.</p>
+
+ @param sLocation
+ [in] a file URL to the directory of the JRE.
+ @param sVendor
+ [in] a name of a vendor. This parameter always contains
+ a vendor string. That is, the string it is not empty.
+ @param sMinVersion
+ [in] represents the minimum version of a JRE.
+ @param sMaxVersion
+ [in] represents the maximum version of a JRE.
+ @param arExcludeList
+ [in] contains a list of &quot;bad&quot; versions. JREs which have one of these
+ versions must not be returned by this function. It can be NULL.
+ @param nSizeExcludeList
+ [in] the number of version strings contained in <code>arExcludeList</code>.
+ @param ppInfo
+ [out] if the function runs successfully then <code>ppInfo</code> contains
+ on return a pointer to a <code>JavaInfo</code> object.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+ <code>nSizeExcludeList</code> is greater null but <code>arExcludeList</code>
+ is NULL, NULL pointer were passed for at least on of the strings, sLocation
+ is an empty string.</br>
+ JFW_PLUGIN_E_WRONG_VERSION_FORMAT the version strings in
+ <code>sMinVersion,sMaxVersion,arExcludeList</code> are not recognized as valid
+ version strings.
+ JFW_PLUGIN_E_FAILED_VERSION there is a JRE at the given location but it does not
+ meet the version requirements.
+ JFW_PLUGIN_E_NO_JRE no JRE could be detected at the given location. However, that
+ does not mean necessarily that there is no JRE. There could be a JRE but it has
+ a vendor which is not supported by this API implementation.
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_getJavaInfoByPath(
+ rtl_uString *sLocation,
+ rtl_uString *sVendor,
+ rtl_uString *sMinVersion,
+ rtl_uString *sMaxVersion,
+ rtl_uString * *arExcludeList,
+ sal_Int32 nSizeExcludeList,
+ JavaInfo ** ppInfo);
+
+/** starts a Java Virtual Machine.
+
+ <p>The caller should provide all essential JavaVMOptions, such as the
+ class path (-Djava.class.path=xxx). It is assumed that the caller
+ knows what JRE is used. Hence the implementation does not need to check
+ the options for validity. If a user configured the application to
+ use specific options, such as -X..., then it is in his responsibility to
+ ensure that the application works properly. The function may add or modify
+ properties. For example, it may add to the class path property.
+ <p>
+ The function must ensure, that the VM does not abort the process
+ during instantiation.</p>
+ <p>
+ The function receives a <code>JavaInfo</code> object that was created
+ by the functions <code>jfw_plugin_getJavaInfoByPath</code> or
+ <code>jfw_plugin_getAllJavaInfos</code> from the same library. This can be
+ guaranteed if an application uses exactly one library for one vendor.
+ Therefore the functions which create the <code>JavaInfo</code> can store all
+ necessary information which are needed for starting the VM into that
+ structure. </p>
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param arOptions
+ [in] the options which are passed into the JNI_CreateJavaVM function.
+ Can be NULL.
+ @param nSizeOptions
+ [in] the number of elements in <code>arOptions</code>.
+ @param ppVM
+ [out] the JavaVM pointer of the created VM.
+ @param ppEnv
+ [out] the JNIEnv pointer of the created VM.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_WRONG_VENDOR the <code>JavaInfo</code> object was not created
+ in by this library and the VM cannot be started.</br>
+ JFW_PLUGIN_E_INVALID_ARG an argument was not valid. For example
+ <code>pInfo</code> or , <code>ppVM</code> or <code>ppEnv</code> are NULL.
+ </br>
+ JFW_PLUGIN_E_VM_CREATION_FAILED a VM could not be created. The error was caused
+ by the JRE.
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_startJavaVirtualMachine(
+ const JavaInfo *pInfo,
+ const JavaVMOption *arOptions,
+ sal_Int32 nSizeOptions,
+ JavaVM ** ppVM,
+ JNIEnv ** ppEnv);
+
+
+
+/** checks if the installation of the jre still exists.
+
+ This function checks if the JRE described by pInfo still
+ exists. The check must be very quick because it is called by javaldx
+ (Linux, Solaris) at start up.
+
+ @param pInfo
+ [in] the JavaInfo object with information about the JRE.
+ @param pp_exist
+ [out] the parameter is set to either sal_True or sal_False. The value is
+ only valid if the function returns JFW_E_NONE.
+
+ @return
+ JFW_PLUGIN_E_NONE the function ran successfully.</br>
+ JFW_PLUGIN_E_ERROR an error occurred during execution.</br>
+ JFW_PLUGIN_E_INVALID_ARG pInfo contains invalid data</br>
+ */
+JVMFWK_PLUGIN_DLLPUBLIC javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/hyphdta.hxx b/include/linguistic/hyphdta.hxx
new file mode 100644
index 000000000000..9dec2d6dc15e
--- /dev/null
+++ b/include/linguistic/hyphdta.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_HYPHDTA_HXX_
+#define _LINGUISTIC_HYPHDTA_HXX_
+
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+#include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
+#include <tools/solar.h>
+#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <linguistic/lngdllapi.h>
+
+namespace linguistic
+{
+
+class HyphenatedWord :
+ public cppu::WeakImplHelper1
+ <
+ ::com::sun::star::linguistic2::XHyphenatedWord
+ >
+{
+ OUString aWord;
+ OUString aHyphenatedWord;
+ sal_Int16 nHyphPos;
+ sal_Int16 nHyphenationPos;
+ sal_Int16 nLanguage;
+ sal_Bool bIsAltSpelling;
+
+ // disallow copy-constructor and assignment-operator for now
+ HyphenatedWord(const HyphenatedWord &);
+ HyphenatedWord & operator = (const HyphenatedWord &);
+
+public:
+ HyphenatedWord(const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
+ const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
+ virtual ~HyphenatedWord();
+
+ // XHyphenatedWord
+ virtual OUString SAL_CALL
+ getWord()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL
+ getHyphenationPos()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL
+ getHyphenatedWord()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Int16 SAL_CALL
+ getHyphenPos()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ isAlternativeSpelling()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ OUString GetWord() { return aWord; }
+ OUString GetHyphenatedWord() { return aHyphenatedWord; }
+ sal_Int16 GetLanguage() { return nLanguage; }
+ void SetWord( OUString &rTxt ) { aWord = rTxt; }
+ void SetHyphenatedWord( OUString &rTxt ) { aHyphenatedWord = rTxt; }
+ void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
+ static com::sun::star::uno::Reference <com::sun::star::linguistic2::XHyphenatedWord> LNG_DLLPUBLIC CreateHyphenatedWord(
+ const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
+ const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
+};
+
+
+class PossibleHyphens :
+ public cppu::WeakImplHelper1
+ <
+ ::com::sun::star::linguistic2::XPossibleHyphens
+ >
+{
+ OUString aWord;
+ OUString aWordWithHyphens;
+ ::com::sun::star::uno::Sequence< sal_Int16 > aOrigHyphenPos;
+ sal_Int16 nLanguage;
+
+ // disallow copy-constructor and assignment-operator for now
+ PossibleHyphens(const PossibleHyphens &);
+ PossibleHyphens & operator = (const PossibleHyphens &);
+
+public:
+ PossibleHyphens(const OUString &rWord, sal_Int16 nLang,
+ const OUString &rHyphWord,
+ const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions);
+ virtual ~PossibleHyphens();
+
+ // XPossibleHyphens
+ virtual OUString SAL_CALL
+ getWord()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL
+ getLocale()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL
+ getPossibleHyphens()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL
+ getHyphenationPositions()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ OUString GetWord() { return aWord; }
+ sal_Int16 GetLanguage() { return nLanguage; }
+ void SetWord( OUString &rTxt ) { aWord = rTxt; }
+ void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
+
+ static com::sun::star::uno::Reference < com::sun::star::linguistic2::XPossibleHyphens > LNG_DLLPUBLIC CreatePossibleHyphens
+ (const OUString &rWord, sal_Int16 nLang,
+ const OUString &rHyphWord,
+ const ::com::sun::star::uno::Sequence< sal_Int16 > &rPositions);
+};
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngdllapi.h b/include/linguistic/lngdllapi.h
new file mode 100644
index 000000000000..0da35fe7e123
--- /dev/null
+++ b/include/linguistic/lngdllapi.h
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LNG_DLLAPI_H
+#define _LNG_DLLAPI_H
+
+#include "sal/config.h"
+#include "sal/types.h"
+
+#if defined(LNG_DLLIMPLEMENTATION)
+#define LNG_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define LNG_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+#define LNG_DLLPRIVATE SAL_DLLPRIVATE
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngprophelp.hxx b/include/linguistic/lngprophelp.hxx
new file mode 100644
index 000000000000..3995d87cc1e4
--- /dev/null
+++ b/include/linguistic/lngprophelp.hxx
@@ -0,0 +1,360 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_LNGPROPHELP_HXX_
+#define _LINGUISTIC_LNGPROPHELP_HXX_
+
+#include <tools/solar.h>
+#include <uno/lbnames.h>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/interfacecontainer.h>
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/linguistic2/XLinguServiceEventBroadcaster.hpp>
+#include <linguistic/lngdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySet;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace linguistic2 {
+ struct LinguServiceEvent;
+}}}}
+
+
+namespace linguistic
+{
+
+// PropertyChgHelper
+// Base class for all XPropertyChangeListener members of the
+// various lingu services.
+
+
+// Flags for type of events allowed to be launched
+#define AE_SPELLCHECKER 1
+#define AE_HYPHENATOR 2
+
+typedef cppu::WeakImplHelper2
+<
+ ::com::sun::star::beans::XPropertyChangeListener,
+ ::com::sun::star::linguistic2::XLinguServiceEventBroadcaster
+> PropertyChgHelperBase;
+
+class PropertyChgHelper :
+ public PropertyChgHelperBase
+{
+ ::com::sun::star::uno::Sequence< OUString > aPropNames;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > xMyEvtObj;
+ ::cppu::OInterfaceContainerHelper aLngSvcEvtListeners;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > xPropSet;
+
+ int nEvtFlags; // flags for event types allowed to be launched
+
+ // default values
+ sal_Bool bIsIgnoreControlCharacters;
+ sal_Bool bIsUseDictionaryList;
+
+ // return values, will be set to default value or current temporary value
+ sal_Bool bResIsIgnoreControlCharacters;
+ sal_Bool bResIsUseDictionaryList;
+
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyChgHelper( const PropertyChgHelper & );
+ PropertyChgHelper & operator = ( const PropertyChgHelper & );
+
+protected:
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+
+ ::com::sun::star::uno::Sequence< OUString > &
+ GetPropNames() { return aPropNames; }
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &
+ GetPropSet() { return xPropSet; }
+
+ void AddPropNames( const char *pNewNames[], sal_Int32 nCount );
+
+ virtual sal_Bool propertyChange_Impl(
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyChgHelper(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet,
+ int nAllowedEvents );
+ virtual ~PropertyChgHelper();
+
+ virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+
+ // XEventListener
+ virtual void SAL_CALL
+ disposing( const ::com::sun::star::lang::EventObject& rSource )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XLinguServiceEventBroadcaster
+ virtual sal_Bool SAL_CALL
+ addLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL
+ removeLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // non-UNO functions
+ void LNG_DLLPUBLIC AddAsPropListener();
+ void LNG_DLLPUBLIC RemoveAsPropListener();
+ void LaunchEvent(
+ const ::com::sun::star::linguistic2::LinguServiceEvent& rEvt );
+
+ const ::com::sun::star::uno::Sequence< OUString > &
+ GetPropNames() const { return aPropNames; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &
+ GetPropSet() const { return xPropSet; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &
+ GetEvtObj() const { return xMyEvtObj; }
+
+ sal_Bool IsIgnoreControlCharacters() const { return bResIsIgnoreControlCharacters; }
+ sal_Bool IsUseDictionaryList() const { return bResIsUseDictionaryList; }
+};
+
+
+class PropertyHelper_Thes :
+ public PropertyChgHelper
+{
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Thes( const PropertyHelper_Thes & );
+ PropertyHelper_Thes & operator = ( const PropertyHelper_Thes & );
+
+public:
+ PropertyHelper_Thes(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ virtual ~PropertyHelper_Thes();
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+class LNG_DLLPUBLIC PropertyHelper_Thesaurus
+{
+ PropertyHelper_Thes* pInst;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Thesaurus( const PropertyHelper_Thes & );
+ PropertyHelper_Thesaurus & operator = ( const PropertyHelper_Thes & );
+
+public:
+ PropertyHelper_Thesaurus(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ ~PropertyHelper_Thesaurus();
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+};
+
+
+class LNG_DLLPUBLIC PropertyHelper_Spell :
+ public PropertyChgHelper
+{
+ // default values
+ sal_Bool bIsSpellUpperCase;
+ sal_Bool bIsSpellWithDigits;
+ sal_Bool bIsSpellCapitalization;
+
+ // return values, will be set to default value or current temporary value
+ sal_Int16 nResMaxNumberOfSuggestions; // special value that is not part of the property set and thus needs to be handled differently
+ sal_Bool bResIsSpellUpperCase;
+ sal_Bool bResIsSpellWithDigits;
+ sal_Bool bResIsSpellCapitalization;
+
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Spell( const PropertyHelper_Spell & );
+ PropertyHelper_Spell & operator = ( const PropertyHelper_Spell & );
+
+protected:
+ // PropertyChgHelper
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+ virtual sal_Bool propertyChange_Impl(
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyHelper_Spell(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ virtual ~PropertyHelper_Spell();
+
+ virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Int16 GetDefaultNumberOfSuggestions() const;
+
+ sal_Int16 GetMaxNumberOfSuggestions() const { return nResMaxNumberOfSuggestions; }
+ sal_Bool IsSpellUpperCase() const { return bResIsSpellUpperCase; }
+ sal_Bool IsSpellWithDigits() const { return bResIsSpellWithDigits; }
+ sal_Bool IsSpellCapitalization() const { return bResIsSpellCapitalization; }
+};
+
+
+class LNG_DLLPUBLIC PropertyHelper_Spelling
+{
+ PropertyHelper_Spell* pInst;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Spelling( const PropertyHelper_Spell & );
+ PropertyHelper_Spelling & operator = ( const PropertyHelper_Spell & );
+
+public:
+ PropertyHelper_Spelling(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+ ~PropertyHelper_Spelling();
+
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+ sal_Bool IsSpellUpperCase() const;
+ sal_Bool IsSpellWithDigits() const;
+ sal_Bool IsSpellCapitalization() const;
+ sal_Bool addLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool removeLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+
+class PropertyHelper_Hyphen :
+ public PropertyChgHelper
+{
+ // default values
+ sal_Int16 nHyphMinLeading,
+ nHyphMinTrailing,
+ nHyphMinWordLength;
+
+ // return values, will be set to default value or current temporary value
+ sal_Int16 nResHyphMinLeading,
+ nResHyphMinTrailing,
+ nResHyphMinWordLength;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Hyphen( const PropertyHelper_Hyphen & );
+ PropertyHelper_Hyphen & operator = ( const PropertyHelper_Hyphen & );
+
+protected:
+ // PropertyChgHelper
+ virtual void SetDefaultValues();
+ virtual void GetCurrentValues();
+ virtual sal_Bool propertyChange_Impl(
+ const ::com::sun::star::beans::PropertyChangeEvent& rEvt );
+
+public:
+ PropertyHelper_Hyphen(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet);
+ virtual ~PropertyHelper_Hyphen();
+
+ virtual void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+
+ // XPropertyChangeListener
+ virtual void SAL_CALL
+ propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& rEvt )
+ throw(::com::sun::star::uno::RuntimeException);
+
+ sal_Int16 GetMinLeading() const { return nResHyphMinLeading; }
+ sal_Int16 GetMinTrailing() const { return nResHyphMinTrailing; }
+ sal_Int16 GetMinWordLength() const { return nResHyphMinWordLength; }
+};
+
+class LNG_DLLPUBLIC PropertyHelper_Hyphenation
+{
+ PropertyHelper_Hyphen* pInst;
+ com::sun::star::uno::Reference< com::sun::star::beans::XPropertyChangeListener > xPropHelper;
+
+ // disallow use of copy-constructor and assignment-operator
+ PropertyHelper_Hyphenation( const PropertyHelper_Hyphen & );
+ PropertyHelper_Hyphenation & operator = ( const PropertyHelper_Hyphen & );
+
+public:
+ PropertyHelper_Hyphenation(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XInterface > &rxSource,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet);
+ ~PropertyHelper_Hyphenation();
+
+ void AddAsPropListener();
+ void RemoveAsPropListener();
+ void SetTmpPropVals( const com::sun::star::beans::PropertyValues &rPropVals );
+ sal_Int16 GetMinLeading() const;
+ sal_Int16 GetMinTrailing() const;
+ sal_Int16 GetMinWordLength() const;
+ sal_Bool addLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+ sal_Bool removeLinguServiceEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XLinguServiceEventListener >& rxListener )
+ throw(::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/lngprops.hxx b/include/linguistic/lngprops.hxx
new file mode 100644
index 000000000000..2f8339f9b0b8
--- /dev/null
+++ b/include/linguistic/lngprops.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_LNGPROPS_HHX_
+#define _LINGUISTIC_LNGPROPS_HHX_
+
+#include <unotools/linguprops.hxx>
+
+// maximal number of suggestions to be returned in spelling context-menu
+// (may not include results added by looking up user dictionaries)
+#define UPN_MAX_NUMBER_OF_SUGGESTIONS "MaxNumberOfSuggestions"
+
+// WIDs for property names
+//!! Don't change values! They are used as the property handles in
+//!! the service description
+#define WID_IS_GERMAN_PRE_REFORM UPH_IS_GERMAN_PRE_REFORM /*! deprecated !*/
+#define WID_IS_USE_DICTIONARY_LIST UPH_IS_USE_DICTIONARY_LIST
+#define WID_IS_IGNORE_CONTROL_CHARACTERS UPH_IS_IGNORE_CONTROL_CHARACTERS
+#define WID_IS_SPELL_UPPER_CASE UPH_IS_SPELL_UPPER_CASE
+#define WID_IS_SPELL_WITH_DIGITS UPH_IS_SPELL_WITH_DIGITS
+#define WID_IS_SPELL_CAPITALIZATION UPH_IS_SPELL_CAPITALIZATION
+#define WID_HYPH_MIN_LEADING UPH_HYPH_MIN_LEADING
+#define WID_HYPH_MIN_TRAILING UPH_HYPH_MIN_TRAILING
+#define WID_HYPH_MIN_WORD_LENGTH UPH_HYPH_MIN_WORD_LENGTH
+#define WID_DEFAULT_LOCALE UPH_DEFAULT_LOCALE
+#define WID_IS_SPELL_AUTO UPH_IS_SPELL_AUTO
+#define WID_IS_SPELL_HIDE UPH_IS_SPELL_HIDE /*! deprecated !*/
+#define WID_IS_SPELL_IN_ALL_LANGUAGES UPH_IS_SPELL_IN_ALL_LANGUAGES /*! deprecated !*/
+#define WID_IS_SPELL_SPECIAL UPH_IS_SPELL_SPECIAL
+#define WID_IS_HYPH_AUTO UPH_IS_HYPH_AUTO
+#define WID_IS_HYPH_SPECIAL UPH_IS_HYPH_SPECIAL
+#define WID_IS_WRAP_REVERSE UPH_IS_WRAP_REVERSE
+#define WID_DEFAULT_LANGUAGE UPH_DEFAULT_LANGUAGE
+#define WID_DEFAULT_LOCALE_CJK UPH_DEFAULT_LOCALE_CJK
+#define WID_DEFAULT_LOCALE_CTL UPH_DEFAULT_LOCALE_CTL
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx
new file mode 100644
index 000000000000..c15d2fc70dab
--- /dev/null
+++ b/include/linguistic/misc.hxx
@@ -0,0 +1,215 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_MISC_HXX_
+#define _LINGUISTIC_MISC_HXX_
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/uno/Reference.h>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/frame/XTerminateListener.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/linguistic2/XDictionaryEntry.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+#include <com/sun/star/linguistic2/XHyphenatedWord.hpp>
+
+#include <uno/lbnames.h> // CPPU_CURRENT_LANGUAGE_BINDING_NAME macro, which specify the environment type
+#include <cppuhelper/implbase1.hxx> // helper for implementations
+#include <unotools/pathoptions.hxx>
+#include <i18nlangtag/lang.h>
+#include <tools/string.hxx>
+#include <unotools/charclass.hxx>
+#include <osl/thread.h>
+#include <osl/mutex.hxx>
+#include <linguistic/lngdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace beans {
+ class XPropertySet;
+ class XFastPropertySet;
+}}}}
+
+namespace com { namespace sun { namespace star { namespace frame {
+ class XDesktop2;
+}}}}
+
+class LocaleDataWrapper;
+
+
+#define SN_GRAMMARCHECKER "com.sun.star.linguistic2.Proofreader"
+#define SN_SPELLCHECKER "com.sun.star.linguistic2.SpellChecker"
+#define SN_HYPHENATOR "com.sun.star.linguistic2.Hyphenator"
+#define SN_THESAURUS "com.sun.star.linguistic2.Thesaurus"
+#define SN_LINGU_PROPERTIES "com.sun.star.linguistic2.LinguProperties"
+
+
+namespace linguistic
+{
+
+/// Flags to be used with the multi-path related functions
+/// @see GetDictionaryPaths
+#define PATH_FLAG_INTERNAL 0x01
+#define PATH_FLAG_USER 0x02
+#define PATH_FLAG_WRITABLE 0x04
+#define PATH_FLAG_ALL (PATH_FLAG_INTERNAL | PATH_FLAG_USER | PATH_FLAG_WRITABLE)
+
+
+// AddEntryToDic return values
+#define DIC_ERR_NONE 0
+#define DIC_ERR_FULL 1
+#define DIC_ERR_READONLY 2
+#define DIC_ERR_UNKNOWN 3
+#define DIC_ERR_NOT_EXISTS 4
+
+// values asigned to capitalization types
+enum CapType
+{
+ CAPTYPE_UNKNOWN,
+ CAPTYPE_NOCAP,
+ CAPTYPE_INITCAP,
+ CAPTYPE_ALLCAP,
+ CAPTYPE_MIXED
+};
+
+LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex();
+
+LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang );
+
+sal_Int32 LevDistance( const OUString &rTxt1, const OUString &rTxt2 );
+
+/** Convert Locale to LanguageType for legacy handling.
+ Linguistic specific handling of an empty locale denoting LANGUAGE_NONE.
+ Does not resolve empty locale as system locale.
+ */
+LNG_DLLPUBLIC LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale );
+
+/** Convert LanguageType to Locale for legacy handling.
+ Linguistic specific handling of LANGUAGE_NONE resulting in an empty locale.
+ Avoid use!
+ */
+LNG_DLLPUBLIC ::com::sun::star::lang::Locale LinguLanguageToLocale( LanguageType nLanguage );
+
+/** Checks if a LanguageType is one of the values that denote absence of
+ language or undetermined language or multiple languages, in short all
+ values used in linguistic context that do not denote a specific language.
+ */
+LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
+
+::com::sun::star::uno::Sequence< sal_Int16 >
+ LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence<
+ ::com::sun::star::lang::Locale > &rLocaleSeq );
+
+// checks if file pointed to by rURL is readonly
+// and may also check return if such a file exists or not
+sal_Bool IsReadOnly( const String &rURL, sal_Bool *pbExist = 0 );
+
+// checks if a file with the given URL exists
+sal_Bool FileExists( const String &rURL );
+
+
+OUString GetDictionaryWriteablePath();
+::com::sun::star::uno::Sequence< OUString > GetDictionaryPaths( sal_Int16 nPathFlags = PATH_FLAG_ALL );
+
+/// @returns an URL for a new and writable dictionary rDicName.
+/// The URL will point to the path given by 'GetDictionaryWriteablePath'
+LNG_DLLPUBLIC String GetWritableDictionaryURL( const String &rDicName );
+
+LNG_DLLPUBLIC sal_Int32 GetPosInWordToCheck( const OUString &rTxt, sal_Int32 nPos );
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord >
+ RebuildHyphensAndControlChars( const OUString &rOrigWord,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XHyphenatedWord > &rxHyphWord );
+
+
+LNG_DLLPUBLIC sal_Bool IsUpper( const String &rText, xub_StrLen nPos, xub_StrLen nLen, sal_Int16 nLanguage );
+
+inline sal_Bool IsUpper( const String &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.Len(), nLanguage ); }
+LNG_DLLPUBLIC CapType SAL_CALL capitalType(const OUString&, CharClass *);
+
+String ToLower( const String &rText, sal_Int16 nLanguage );
+LNG_DLLPUBLIC sal_Bool HasDigits( const OUString &rText );
+LNG_DLLPUBLIC sal_Bool IsNumeric( const String &rText );
+
+
+::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > GetOneInstanceService( const char *pServiceName );
+LNG_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetLinguProperties();
+::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > GetDictionaryList();
+::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetIgnoreAllList();
+
+
+sal_Bool IsUseDicList( const ::com::sun::star::beans::PropertyValues &rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+
+sal_Bool IsIgnoreControlChars( const ::com::sun::star::beans::PropertyValues &rProperties,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > &rxPropSet );
+
+::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XDictionaryEntry >
+ SearchDicList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList >& rDicList,
+ const OUString& rWord, sal_Int16 nLanguage,
+ sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry );
+
+LNG_DLLPUBLIC sal_uInt8 AddEntryToDic(
+ ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > &rxDic,
+ const OUString &rWord, sal_Bool bIsNeg,
+ const OUString &rRplcTxt, sal_Int16 nRplcLang,
+ sal_Bool bStripDot = sal_True );
+
+LNG_DLLPUBLIC sal_Bool SaveDictionaries( const ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList );
+
+// AppExitLstnr:
+// virtual base class that calls it AtExit function when the application
+// (ie the Desktop) is about to terminate
+
+class AppExitListener :
+ public cppu::WeakImplHelper1
+ <
+ ::com::sun::star::frame::XTerminateListener
+ >
+{
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XDesktop2 > xDesktop;
+
+public:
+ AppExitListener();
+ virtual ~AppExitListener();
+
+ virtual void AtExit() = 0;
+
+ void Activate();
+ void Deactivate();
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTerminateListener
+ virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
+};
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/linguistic/spelldta.hxx b/include/linguistic/spelldta.hxx
new file mode 100644
index 000000000000..92f9cd680c77
--- /dev/null
+++ b/include/linguistic/spelldta.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _LINGUISTIC_SPELLDTA_HXX_
+#define _LINGUISTIC_SPELLDTA_HXX_
+
+#include <vector>
+#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSetSpellAlternatives.hpp>
+#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
+
+#include <tools/solar.h>
+
+#include <uno/lbnames.h>
+#include <cppuhelper/implbase2.hxx>
+#include <linguistic/lngdllapi.h>
+
+#include <boost/noncopyable.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace linguistic2 {
+ class XDictionaryList;
+ }
+} } }
+
+
+namespace linguistic
+{
+
+::com::sun::star::uno::Sequence< OUString >
+ MergeProposalSeqs(
+ ::com::sun::star::uno::Sequence< OUString > &rAlt1,
+ ::com::sun::star::uno::Sequence< OUString > &rAlt2,
+ sal_Bool bAllowDuplicates );
+
+void SeqRemoveNegEntries(
+ ::com::sun::star::uno::Sequence< OUString > &rSeq,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &rxDicList,
+ sal_Int16 nLanguage );
+
+sal_Bool SeqHasEntry(
+ const ::com::sun::star::uno::Sequence< OUString > &rSeq,
+ const OUString &rTxt);
+
+///////////////////////////////////////////////////////////////////////////
+
+void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::linguistic2::XSearchableDictionaryList > &xDicList,
+ std::vector< OUString > & rDicListProps );
+
+///////////////////////////////////////////////////////////////////////////
+
+
+class SpellAlternatives
+ : public cppu::WeakImplHelper2
+ <
+ ::com::sun::star::linguistic2::XSpellAlternatives,
+ ::com::sun::star::linguistic2::XSetSpellAlternatives
+ >
+ , private ::boost::noncopyable
+{
+ ::com::sun::star::uno::Sequence< OUString > aAlt; // list of alternatives, may be empty.
+ OUString aWord;
+ sal_Int16 nType; // type of failure
+ sal_Int16 nLanguage;
+
+public:
+ LNG_DLLPUBLIC SpellAlternatives();
+ SpellAlternatives(const OUString &rWord, sal_Int16 nLang, sal_Int16 nFailureType,
+ const ::com::sun::star::uno::Sequence< OUString > &rAlternatives );
+ virtual ~SpellAlternatives();
+
+ // XSpellAlternatives
+ virtual OUString SAL_CALL getWord( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getFailureType( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Int16 SAL_CALL getAlternativesCount( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAlternatives( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XSetSpellAlternatives
+ virtual void SAL_CALL setAlternatives( const ::com::sun::star::uno::Sequence< OUString >& aAlternatives ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) throw (::com::sun::star::uno::RuntimeException);
+
+ // non-interface specific functions
+ void LNG_DLLPUBLIC SetWordLanguage(const OUString &rWord, sal_Int16 nLang);
+ void LNG_DLLPUBLIC SetFailureType(sal_Int16 nTypeP);
+ void LNG_DLLPUBLIC SetAlternatives( const ::com::sun::star::uno::Sequence< OUString > &rAlt );
+ static com::sun::star::uno::Reference < com::sun::star::linguistic2::XSpellAlternatives > LNG_DLLPUBLIC CreateSpellAlternatives(
+ const OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const ::com::sun::star::uno::Sequence< OUString > &rAlt );
+};
+
+
+///////////////////////////////////////////////////////////////////////////
+
+} // namespace linguistic
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/compat_functional.hxx b/include/o3tl/compat_functional.hxx
new file mode 100644
index 000000000000..00ae33cb23bb
--- /dev/null
+++ b/include/o3tl/compat_functional.hxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Copyright (c) 1996-1998
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Copyright (c) 1997
+ * Moscow Center for SPARC Technology
+ *
+ * Copyright (c) 1999
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Lifted and paraphrased from STLport - with additions from Fridrich
+ * Strba and Thorsten Behrens
+ */
+
+#ifndef INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX
+#define INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX
+
+#include <functional>
+
+namespace o3tl
+{
+
+/// Identity functor - return the input value
+template<class T>
+struct identity : public std::unary_function<T, T>
+{
+ T operator()(const T& y) const
+ {
+ return (y);
+ }
+};
+
+/// Functor, given two parameters, return the first
+template<class T1,class T2>
+struct project1st : public std::binary_function<T1, T2, T1>
+{
+ T1 operator()(const T1& y, const T2&) const
+ {
+ return (y);
+ }
+};
+
+/// Functor, given two parameters, return the second
+template<class T1,class T2>
+struct project2nd : public std::binary_function<T1, T2, T2>
+{
+ T2 operator()(const T1&, const T2& x) const
+ {
+ return (x);
+ }
+};
+
+/// Select first value of a pair
+template<class P>
+struct select1st : public std::unary_function<P, typename P::first_type>
+{
+ const typename P::first_type& operator()(const P& y) const
+ {
+ return (y.first);
+ }
+};
+
+/// Select second value of a pair
+template<class P>
+struct select2nd : public std::unary_function<P, typename P::second_type>
+{
+ const typename P::second_type& operator()(const P& y) const
+ {
+ return (y.second);
+ }
+};
+
+/// Call F1 with the result of F2 applied to the one input parameter
+template<class F1, class F2>
+class unary_compose : public std::unary_function<typename F2::argument_type, typename F1::result_type>
+{
+ public:
+ unary_compose(const F1& fnction1, const F2& fnction2) : ftor1(fnction1), ftor2(fnction2) {}
+
+ typename F1::result_type operator()(const typename F2::argument_type& y) const
+ {
+ return (ftor1(ftor2(y)));
+ }
+
+ protected:
+ F1 ftor1;
+ F2 ftor2;
+};
+
+/// Create functor that calls F1 with the result of F2 applied to the one input parameter
+template<class F1, class F2>
+inline unary_compose<F1, F2> compose1(const F1& fnction1, const F2& fnction2)
+{
+ return (unary_compose<F1, F2>(fnction1, fnction2));
+}
+
+/// Calls F2 and F3 for the two args of F1, respectively
+template<class F1, class F2, class F3>
+class binary_compose : public std::unary_function<typename F2::argument_type,typename F1::result_type>
+{
+ public:
+ binary_compose(const F1& fnction1, const F2& fnction2, const F3& fnction3) : ftor1(fnction1), ftor2(fnction2), ftor3(fnction3) {}
+
+ typename F1::result_type operator()(const typename F2::argument_type& y) const
+ {
+ return (ftor1(ftor2(y), ftor3(y)));
+ }
+
+ protected:
+ F1 ftor1;
+ F2 ftor2;
+ F3 ftor3;
+};
+
+/// Creates functor that calls F2 and F3 for the two args of F1, respectively
+template<class F1, class F2, class F3>
+inline binary_compose<F1, F2, F3> compose2(const F1& fnction1, const F2& fnction2, const F3& fnction3)
+{
+ return (binary_compose<F1, F2, F3>(fnction1, fnction2, fnction3));
+}
+
+/// Algo that assigns val, val+1, ... to the given range
+template<typename FwdIter, typename ValueType>
+inline void iota(FwdIter first, FwdIter last, ValueType val)
+{
+ while(first != last)
+ *first++ = val++;
+}
+
+} // namespace o3tl
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx
new file mode 100644
index 000000000000..b54f99d0f190
--- /dev/null
+++ b/include/o3tl/cow_wrapper.hxx
@@ -0,0 +1,322 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_COW_WRAPPER_HXX
+#define INCLUDED_O3TL_COW_WRAPPER_HXX
+
+#include <osl/interlck.h>
+
+#include <algorithm>
+
+#include <boost/utility.hpp>
+#include <boost/checked_delete.hpp>
+
+namespace o3tl
+{
+ /** Thread-unsafe refcounting
+
+ This is the default locking policy for cow_wrapper. No
+ locking/guarding against concurrent access is performed
+ whatsoever.
+ */
+ struct UnsafeRefCountingPolicy
+ {
+ typedef sal_uInt32 ref_count_t;
+ static void incrementCount( ref_count_t& rCount ) { ++rCount; }
+ static bool decrementCount( ref_count_t& rCount ) { return --rCount != 0; }
+ };
+
+ /** Thread-safe refcounting
+
+ Use this to have the cow_wrapper refcounting mechanisms employ
+ the thread-safe oslInterlockedCount .
+ */
+ struct ThreadSafeRefCountingPolicy
+ {
+ typedef oslInterlockedCount ref_count_t;
+ static void incrementCount( ref_count_t& rCount ) { osl_atomic_increment(&rCount); }
+ static bool decrementCount( ref_count_t& rCount )
+ {
+ if( rCount == 1 ) // caller is already the only/last reference
+ return false;
+ else
+ return osl_atomic_decrement(&rCount) != 0;
+ }
+ };
+
+ /** Copy-on-write wrapper.
+
+ This template provides copy-on-write semantics for the wrapped
+ type: when copying, the operation is performed shallow,
+ i.e. different cow_wrapper objects share the same underlying
+ instance. Only when accessing the underlying object via
+ non-const methods, a unique copy is provided.
+
+ The type parameter <code>T</code> must satisfy the following
+ requirements: it must be default-constructible, copyable (it
+ need not be assignable), and be of non-reference type. Note
+ that, despite the fact that this template provides access to
+ the wrapped type via pointer-like methods
+ (<code>operator->()</code> and <code>operator*()</code>), it does
+ <em>not</em> work like e.g. the boost pointer wrappers
+ (shared_ptr, scoped_ptr, etc.). Internally, the cow_wrapper
+ holds a by-value instance of the wrapped object. This is to
+ avoid one additional heap allocation, and providing access via
+ <code>operator->()</code>/<code>operator*()</code> is because
+ <code>operator.()</code> cannot be overridden.
+
+ Regarding thread safety: this wrapper is <em>not</em>
+ thread-safe per se, because cow_wrapper has no way of
+ syncronizing the potentially many different cow_wrapper
+ instances, that reference a single shared value_type
+ instance. That said, when passing
+ <code>ThreadSafeRefCountingPolicy</code> as the
+ <code>MTPolicy</code> parameter, accessing a thread-safe
+ pointee through multiple cow_wrapper instances might be
+ thread-safe, if the individual pointee methods are
+ thread-safe, <em>including</em> pointee's copy
+ constructor. Any wrapped object that needs external
+ synchronisation (e.g. via an external mutex, which arbitrates
+ access to object methods, and can be held across multiple
+ object method calls) cannot easily be dealt with in a
+ thread-safe way, because, as noted, objects are shared behind
+ the client's back.
+
+ @attention if one wants to use the pimpl idiom together with
+ cow_wrapper (i.e. put an opaque type into the cow_wrapper),
+ then <em>all<em> methods in the surrounding class needs to be
+ non-inline (<em>including</em> destructor, copy constructor
+ and assignment operator).
+
+ @example
+ <pre>
+class cow_wrapper_client_impl;
+
+class cow_wrapper_client
+{
+public:
+ cow_wrapper_client();
+ cow_wrapper_client( const cow_wrapper_client& );
+ ~cow_wrapper_client();
+
+ cow_wrapper_client& operator=( const cow_wrapper_client& );
+
+ void modify( int nVal );
+ int queryUnmodified() const;
+
+private:
+ otl::cow_wrapper< cow_wrapper_client_impl > maImpl;
+};
+ </pre>
+ and the implementation file would look like this:
+ <pre>
+class cow_wrapper_client_impl
+{
+public:
+ void setValue( int nVal ) { mnValue = nVal; }
+ int getValue() const { return mnValue; }
+
+private:
+ int mnValue;
+}
+
+cow_wrapper_client::cow_wrapper_client() :
+ maImpl()
+{
+}
+cow_wrapper_client::cow_wrapper_client( const cow_wrapper_client& rSrc ) :
+ maImpl( rSrc.maImpl )
+{
+}
+cow_wrapper_client::~cow_wrapper_client()
+{
+}
+cow_wrapper_client& cow_wrapper_client::operator=( const cow_wrapper_client& rSrc )
+{
+ maImpl = rSrc.maImpl;
+ return *this;
+}
+void cow_wrapper_client::modify( int nVal )
+{
+ maImpl->setValue( nVal );
+}
+int cow_wrapper_client::queryUnmodified() const
+{
+ return maImpl->getValue();
+}
+ </pre>
+ */
+ template<typename T, class MTPolicy=UnsafeRefCountingPolicy> class cow_wrapper
+ {
+ /** shared value object - gets cloned before cow_wrapper hands
+ out a non-const reference to it
+ */
+ struct impl_t : private boost::noncopyable
+ {
+ impl_t() :
+ m_value(),
+ m_ref_count(1)
+ {
+ }
+
+ explicit impl_t( const T& v ) :
+ m_value(v),
+ m_ref_count(1)
+ {
+ }
+
+ T m_value;
+ typename MTPolicy::ref_count_t m_ref_count;
+ };
+
+ void release()
+ {
+ if( !MTPolicy::decrementCount(m_pimpl->m_ref_count) )
+ boost::checked_delete(m_pimpl), m_pimpl=0;
+ }
+
+ public:
+ typedef T value_type;
+ typedef T* pointer;
+ typedef const T* const_pointer;
+ typedef MTPolicy mt_policy;
+
+ /** Default-construct wrapped type instance
+ */
+ cow_wrapper() :
+ m_pimpl( new impl_t() )
+ {
+ }
+
+ /** Copy-construct wrapped type instance from given object
+ */
+ explicit cow_wrapper( const value_type& r ) :
+ m_pimpl( new impl_t(r) )
+ {
+ }
+
+ /** Shallow-copy given cow_wrapper
+ */
+ explicit cow_wrapper( const cow_wrapper& rSrc ) : // nothrow
+ m_pimpl( rSrc.m_pimpl )
+ {
+ MTPolicy::incrementCount( m_pimpl->m_ref_count );
+ }
+
+ ~cow_wrapper() // nothrow, if ~T does not throw
+ {
+ release();
+ }
+
+ /// now sharing rSrc cow_wrapper instance with us
+ cow_wrapper& operator=( const cow_wrapper& rSrc ) // nothrow
+ {
+ // this already guards against self-assignment
+ MTPolicy::incrementCount( rSrc.m_pimpl->m_ref_count );
+
+ release();
+ m_pimpl = rSrc.m_pimpl;
+
+ return *this;
+ }
+
+ /// unshare with any other cow_wrapper instance
+ value_type& make_unique()
+ {
+ if( m_pimpl->m_ref_count > 1 )
+ {
+ impl_t* pimpl = new impl_t(m_pimpl->m_value);
+ release();
+ m_pimpl = pimpl;
+ }
+
+ return m_pimpl->m_value;
+ }
+
+ /// true, if not shared with any other cow_wrapper instance
+ bool is_unique() const // nothrow
+ {
+ return m_pimpl->m_ref_count == 1;
+ }
+
+ /// return number of shared instances (1 for unique object)
+ typename MTPolicy::ref_count_t use_count() const // nothrow
+ {
+ return m_pimpl->m_ref_count;
+ }
+
+ void swap(cow_wrapper& r) // never throws
+ {
+ std::swap(m_pimpl, r.m_pimpl);
+ }
+
+ pointer operator->() { return &make_unique(); }
+ value_type& operator*() { return make_unique(); }
+ const_pointer operator->() const { return &m_pimpl->m_value; }
+ const value_type& operator*() const { return m_pimpl->m_value; }
+
+ pointer get() { return &make_unique(); }
+ const_pointer get() const { return &m_pimpl->m_value; }
+
+ /// true, if both cow_wrapper internally share the same object
+ bool same_object( const cow_wrapper& rOther ) const
+ {
+ return rOther.m_pimpl == m_pimpl;
+ }
+
+ private:
+ impl_t* m_pimpl;
+ };
+
+
+ template<class T, class P> inline bool operator==( const cow_wrapper<T,P>& a,
+ const cow_wrapper<T,P>& b )
+ {
+ return a.same_object(b) ? true : *a == *b;
+ }
+
+ template<class T, class P> inline bool operator!=( const cow_wrapper<T,P>& a,
+ const cow_wrapper<T,P>& b )
+ {
+ return a.same_object(b) ? false : *a != *b;
+ }
+
+ template<class A, class B, class P> inline bool operator<( const cow_wrapper<A,P>& a,
+ const cow_wrapper<B,P>& b )
+ {
+ return *a < *b;
+ }
+
+ template<class T, class P> inline void swap( cow_wrapper<T,P>& a,
+ cow_wrapper<T,P>& b )
+ {
+ a.swap(b);
+ }
+
+ // to enable boost::mem_fn on cow_wrapper
+ template<class T, class P> inline T * get_pointer( const cow_wrapper<T,P>& r )
+ {
+ return r.get();
+ }
+
+}
+
+#endif /* INCLUDED_O3TL_COW_WRAPPER_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/heap_ptr.hxx b/include/o3tl/heap_ptr.hxx
new file mode 100644
index 000000000000..713aa21c41b8
--- /dev/null
+++ b/include/o3tl/heap_ptr.hxx
@@ -0,0 +1,305 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_HEAP_PTR_HXX
+#define INCLUDED_O3TL_HEAP_PTR_HXX
+
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+
+
+namespace o3tl
+{
+/** heap_ptr<> owns an object on the heap, which will be automatically
+ deleted, when ~heap_ptr<>() is called.
+
+ Applicability
+ -------------
+ heap_ptr<> can be used for class members on the heap.
+ - One cannot forget to delete them in the destructor.
+ - Constness will be transfered from the owning instance.
+
+ heap_ptr<> can also be used as smart pointer in function bodies to
+ ensure exception safety.
+
+ Special Characteristics
+ -----------------------
+ - heap_ptr<> transfers constness from the owning object to
+ the pointed to object. Such it behaves like if *get() would be
+ a normal member of the owning object, not a pointer member.
+ This is preferable to the normal pointer behaviour, because
+ if an object is owned by another one, it is normally part of
+ its state.
+
+ - heap_ptr<> provides a ->release() function
+
+ - For reasons of simplicity and portability ->is()
+ is preferred over the safe-bool idiom.
+
+ Copyability
+ -----------
+ heap_ptr is non copyable.
+ - It forbids the copyconstructor and operator=(self).
+
+ - Owning classes will automatically be non copyable, if they do not
+ redefine those two functions themselves.
+
+ Incomplete Types
+ ----------------
+ heap_ptr<> also works with incomplete types. You only need to write
+ class T;
+ but need not include <T>.hxx.
+
+ If you use heap_ptr<> with an incomplete type, the owning class
+ needs to define a non-inline destructor. Else the compiler will
+ complain.
+*/
+template <class T>
+class heap_ptr
+{
+ public:
+ typedef T element_type; /// Provided for generic programming.
+ typedef heap_ptr<T> self;
+
+#ifndef __SUNPRO_CC
+ typedef T * (self::* safe_bool )();
+#endif
+
+ /// Now, pass_heapObject is owned by this.
+ explicit heap_ptr(
+ T * pass_heapObject = 0 );
+ ~heap_ptr();
+
+
+ /** Identical to reset(), except of the return value.
+ @see heap_ptr<>::reset()
+ */
+ self & operator=(
+ T * pass_heapObject );
+ const T & operator*() const;
+ T & operator*();
+ const T * operator->() const;
+ T * operator->();
+
+ /// True, if pHeapObject != 0.
+#ifndef __SUNPRO_CC
+ operator safe_bool() const;
+#else // workaround opt bug of Sun C++ compiler, when compiling with -xO3
+ operator bool() const;
+#endif
+
+
+ /** This deletes any prevoiusly existing ->pHeapObject.
+ Now, pass_heapObject, if != 0, is owned by this.
+
+ @onerror
+ Ignores self-assignment.
+ Such, multiple assignment of the same pointer to the same
+ instance of heap_ptr<> is possible (though not recommended).
+ */
+ void reset(
+ T * pass_heapObject );
+ /** @return An object on the heap that must be deleted by the caller,
+ or 0.
+
+ @postcond get() == 0;
+ */
+ T * release();
+ void swap(
+ self & io_other );
+
+ /// True, if pHeapObject != 0.
+ bool is() const;
+ const T * get() const;
+ T * get();
+
+ private:
+ // Forbidden functions:
+ heap_ptr( const self & ); /// Prevent copies.
+ self & operator=( const self & ); /// Prevent copies.
+
+ /// @attention Does not set ->pHeapObject = 0.
+ void internal_delete();
+
+ // DATA
+ /// Will be deleted, when *this is destroyed.
+ T * pHeapObject;
+};
+
+
+/** Supports the semantic of std::swap(). Provided as an aid to
+ generic programming.
+*/
+template<class T>
+inline void
+swap( heap_ptr<T> & io_a,
+ heap_ptr<T> & io_b )
+{
+ io_a.swap(io_b);
+}
+
+
+
+// IMPLEMENTATION
+
+template <class T>
+inline void
+heap_ptr<T>::internal_delete()
+{
+ ::boost::checked_delete(pHeapObject);
+
+ // Do not set pHeapObject to 0, because
+ // that is reset to a value in all code
+ // where internal_delete() is used.
+}
+
+template <class T>
+inline
+heap_ptr<T>::heap_ptr( T * pass_heapObject )
+ : pHeapObject(pass_heapObject)
+{
+}
+
+template <class T>
+inline
+heap_ptr<T>::~heap_ptr()
+{
+ internal_delete();
+}
+
+template <class T>
+inline heap_ptr<T> &
+heap_ptr<T>::operator=(T * pass_heapObject)
+{
+ reset(pass_heapObject);
+ return *this;
+}
+
+template <class T>
+inline const T &
+heap_ptr<T>::operator*() const
+{
+ BOOST_ASSERT( pHeapObject != 0
+ && "Accessing a heap_ptr<>(0)." );
+ return *pHeapObject;
+}
+
+template <class T>
+inline T &
+heap_ptr<T>::operator*()
+{
+ BOOST_ASSERT( pHeapObject != 0
+ && "Accessing a heap_ptr<>(0)." );
+ return *pHeapObject;
+}
+
+template <class T>
+inline const T *
+heap_ptr<T>::operator->() const
+{
+ return pHeapObject;
+}
+
+template <class T>
+inline T *
+heap_ptr<T>::operator->()
+{
+ return pHeapObject;
+}
+
+#ifndef __SUNPRO_CC
+
+template <class T>
+inline
+heap_ptr<T>::operator typename heap_ptr<T>::safe_bool() const
+{
+ return is()
+ ? safe_bool(&self::get)
+ : safe_bool(0);
+}
+
+#else
+
+template <class T>
+inline heap_ptr<T>::operator bool() const
+{
+ return is();
+}
+
+#endif // !defined(__SUNPRO_CC)
+
+
+
+template <class T>
+void
+heap_ptr<T>::reset(T * pass_heapObject)
+{
+ if ( pHeapObject != 0
+ && pHeapObject == pass_heapObject)
+ return;
+
+ internal_delete();
+ pHeapObject = pass_heapObject;
+}
+
+template <class T>
+T *
+heap_ptr<T>::release()
+{
+ T * ret = pHeapObject;
+ pHeapObject = 0;
+ return ret;
+}
+
+template <class T>
+void
+heap_ptr<T>::swap(self & io_other)
+{
+ T * temp = io_other.pHeapObject;
+ io_other.pHeapObject = pHeapObject;
+ pHeapObject = temp;
+}
+
+template <class T>
+inline bool
+heap_ptr<T>::is() const
+{
+ return pHeapObject != 0;
+}
+
+template <class T>
+inline const T *
+heap_ptr<T>::get() const
+{
+ return pHeapObject;
+}
+
+template <class T>
+inline T *
+heap_ptr<T>::get()
+{
+ return pHeapObject;
+}
+
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/lazy_update.hxx b/include/o3tl/lazy_update.hxx
new file mode 100644
index 000000000000..b05bda37ba40
--- /dev/null
+++ b/include/o3tl/lazy_update.hxx
@@ -0,0 +1,265 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_LAZY_UPDATE_HXX
+#define INCLUDED_O3TL_LAZY_UPDATE_HXX
+
+#include <sal/types.h>
+#include <boost/function.hpp>
+
+namespace o3tl
+{
+ /** Update output object lazily
+
+ This template collects data in input type, and updates the
+ output type with the given update functor, but only if the
+ output is requested. Usefl if updating is expensive, or input
+ changes frequently, but output is only comparatively seldom
+ used.
+
+ @example
+ <pre>
+LazyUpdate<InType,OutType,LAZYUPDATE_DIRECT_TAG> myValue;
+*myValue = newInput;
+myValue->updateInput( this, that, those );
+
+output( *myValue );
+ </pre>
+ or
+ <pre>
+output( myValue.getOutValue() );
+ </pre>
+ if the compiler does not recognize the const context.
+ */
+ template< typename InputType, typename OutputType, typename Tag > class LazyUpdate;
+
+ /// LazyUpdate specialization takes boost::function argument
+ struct LAZYUPDATE_FUNCTOR_TAG {};
+ /// LazyUpdate specialization takes OutputType (*FunctionType)( InputType const& ) argument
+ struct LAZYUPDATE_FUNCTION_TAG {};
+ /// LazyUpdate specialization can directly convert, OutputType ctor must take InputType argument
+ struct LAZYUPDATE_DIRECT_TAG {};
+
+ // -----------------------------------------------------------------------------------------------------
+
+ namespace detail
+ {
+ /// @internal
+ template< typename InputType, typename OutputType, typename Functor > class LazyUpdateImpl : private Functor
+ {
+ public:
+ typedef OutputType output_type;
+ typedef InputType input_type;
+
+ LazyUpdateImpl() :
+ m_aInput()
+ {}
+
+ template< typename ParamType > explicit LazyUpdateImpl( ParamType const& rParm ) :
+ Functor(rParm),
+ m_aInput()
+ {}
+
+ enum UnaryConstructorTag{ UNARY_CONSTRUCTOR_TAG };
+ LazyUpdateImpl( const input_type& rInput, UnaryConstructorTag ) :
+ m_aInput(rInput)
+ {}
+
+ template< typename ParamType > LazyUpdateImpl( ParamType const& rParm,
+ const input_type& rInput ) :
+ Functor(rParm),
+ m_aInput(rInput)
+ {}
+
+ // default copy ctor/assignment operator are ok
+ // LazyUpdate( const LazyUpdate& );
+ // LazyUpdate& operator=( const LazyUpdate& );
+
+ void setInValue( input_type const& rIn ) { Functor::m_bCacheDirty = true; m_aInput = rIn; }
+ input_type const& getInValue() const { return m_aInput; }
+ output_type const& getOutValue() const { return this->implUpdateValue(m_aInput); }
+
+ input_type& operator*() { Functor::m_bCacheDirty = true; return m_aInput; }
+ input_type* operator->() { Functor::m_bCacheDirty = true; return &m_aInput; }
+
+ output_type const& operator*() const { return this->implUpdateValue(m_aInput); }
+ output_type const* operator->() const { return &(this->implUpdateValue(m_aInput)); }
+
+ private:
+ input_type m_aInput;
+ };
+
+ template< typename InputType, typename OutputType > struct DefaultFunctor
+ {
+ protected:
+ typedef OutputType output_type;
+ typedef InputType input_type;
+
+ DefaultFunctor() :
+ m_aOutput(),
+ m_bCacheDirty(true)
+ {}
+
+ OutputType const& implUpdateValue( input_type const& rIn ) const
+ {
+ if( m_bCacheDirty )
+ {
+ m_aOutput = output_type( rIn );
+ m_bCacheDirty = false;
+ }
+
+ return m_aOutput;
+ }
+
+ mutable output_type m_aOutput;
+ mutable bool m_bCacheDirty; // when true, m_aOutput needs update
+ };
+
+ template< typename InputType, typename OutputType, typename FunctionType > struct FunctionPointer
+ {
+ protected:
+ typedef OutputType output_type;
+ typedef InputType input_type;
+ typedef FunctionType function_type;
+
+ FunctionPointer() :
+ m_pFunc(),
+ m_aOutput(),
+ m_bCacheDirty(true)
+
+ {}
+
+ explicit FunctionPointer( function_type const& pFunc ) :
+ m_pFunc(pFunc),
+ m_aOutput(),
+ m_bCacheDirty(true)
+
+ {}
+
+ output_type const& implUpdateValue( input_type const& rIn ) const
+ {
+ if( m_bCacheDirty )
+ {
+ m_aOutput = m_pFunc( rIn );
+ m_bCacheDirty = false;
+ }
+
+ return m_aOutput;
+ }
+
+ function_type m_pFunc;
+ mutable output_type m_aOutput;
+ mutable bool m_bCacheDirty; // when true, m_aOutput needs update
+ };
+ }
+
+ // -----------------------------------------------------------------------------------------------------
+
+ // partial specializations for the three LAZYUPDATE_* tags
+
+ template< typename InputType, typename OutputType > class LazyUpdate<InputType,
+ OutputType,
+ LAZYUPDATE_DIRECT_TAG> :
+ public detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::DefaultFunctor<InputType, OutputType> >
+ {
+ public:
+ LazyUpdate() {}
+ explicit LazyUpdate( InputType const& rIn ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::DefaultFunctor<InputType, OutputType> >(
+ rIn,
+ detail::LazyUpdateImpl<
+ InputType,
+ OutputType,
+ detail::DefaultFunctor<InputType, OutputType> >::UNARY_CONSTRUCTOR_TAG )
+ {}
+ };
+
+ // -----------------------------------------------------------------------------------------------------
+
+ template< typename InputType, typename OutputType > class LazyUpdate<InputType,
+ OutputType,
+ LAZYUPDATE_FUNCTION_TAG> :
+ public detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ OutputType (*)( InputType const& ) > >
+ {
+ public:
+ explicit LazyUpdate( OutputType (*pFunc)( InputType const& ) ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ OutputType (*)( InputType const& )> >(pFunc)
+ {}
+ LazyUpdate( OutputType (*pFunc)( InputType const& ),
+ InputType const& rIn ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ OutputType (*)( InputType const& )> >(pFunc,rIn)
+ {}
+ };
+
+ // -----------------------------------------------------------------------------------------------------
+
+ template< typename InputType, typename OutputType > class LazyUpdate<InputType,
+ OutputType,
+ LAZYUPDATE_FUNCTOR_TAG> :
+ public detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ boost::function1<OutputType,InputType> > >
+ {
+ public:
+ explicit LazyUpdate( boost::function1<OutputType,InputType> const& rFunc ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ boost::function1<OutputType,InputType> > >(rFunc)
+ {}
+ LazyUpdate( boost::function1<OutputType,InputType> const& rFunc,
+ InputType const& rIn ) :
+ detail::LazyUpdateImpl<InputType,
+ OutputType,
+ detail::FunctionPointer<
+ InputType,
+ OutputType,
+ boost::function1<OutputType,InputType> > >(rFunc,rIn)
+ {}
+ };
+
+}
+
+#endif /* INCLUDED_O3TL_LAZY_UPDATE_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/range.hxx b/include/o3tl/range.hxx
new file mode 100644
index 000000000000..a5ebacb4c6b8
--- /dev/null
+++ b/include/o3tl/range.hxx
@@ -0,0 +1,183 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_RANGE_HXX
+#define INCLUDED_O3TL_RANGE_HXX
+
+
+#include <cstring> // for std::size_t
+#include <boost/assert.hpp>
+
+
+
+namespace o3tl
+{
+/** Represents a range of integer or iterator values.
+
+ @tpl T
+ Has to be assignable, add- and subtractable. That is:
+ either it is
+ - an integral type
+ - or a random access iterator.
+*/
+template <class T>
+class range
+{
+ public:
+ typedef T element_type; /// Provided for generic programming.
+ typedef range<T> self;
+
+ // LIFECYCLE
+ range(
+ T i_inclusiveLowerBorder,
+ T i_exclusiveUpperBorder );
+ ~range();
+ // INQUIRY
+ T begin() const;
+ T end() const;
+ std::size_t size() const;
+
+ bool contains(
+ T i_value ) const;
+ bool contains(
+ const self & i_other ) const;
+ bool overlaps(
+ const self & i_other ) const;
+ /// @return i_other.begin() - this->end()
+ long distance_to(
+ const self & i_other ) const;
+ private:
+ // DATA
+ T nBegin;
+ T nEnd;
+};
+
+
+template <class T>
+inline range<T>
+make_range(T i1, T i2)
+{
+ return range<T>(i1, i2);
+}
+
+template <class T>
+inline range<typename T::const_iterator>
+range_of(const T & i_container)
+{
+ return make_range( i_container.begin(),
+ i_container.end()
+ );
+}
+
+template <class T>
+inline range<typename T::iterator>
+range_of(T & io_container)
+{
+ return make_range( io_container.begin(),
+ io_container.end()
+ );
+}
+
+
+
+
+
+// IMPLEMENTATION
+
+template <class T>
+range<T>::range( T i_inclusiveLowerBorder,
+ T i_exclusiveUpperBorder )
+ : nBegin(i_inclusiveLowerBorder),
+ nEnd(i_exclusiveUpperBorder)
+{
+ BOOST_ASSERT( nBegin <= nEnd
+ && "Invalid parameters for range<> constructor.");
+}
+
+template <class T>
+range<T>::~range()
+{
+}
+
+template <class T>
+inline T
+range<T>::begin() const
+{
+ return nBegin;
+}
+
+template <class T>
+inline T
+range<T>::end() const
+{
+ return nEnd;
+}
+
+template <class T>
+inline std::size_t
+range<T>::size() const
+{
+ BOOST_ASSERT( nBegin <= nEnd
+ && "Invalid range limits in range<>::size().");
+ return static_cast<std::size_t>( end() - begin() );
+}
+
+template <class T>
+bool
+range<T>::contains(T i_value ) const
+{
+ return begin() <= i_value
+ && i_value < end();
+}
+
+template <class T>
+bool
+range<T>::contains(const self & i_other) const
+{
+ // This is subtle, because this would be wrong:
+ // begin() <= i_other.begin()
+ // && i_other.end() <= end();
+ // An empty range that begins and starts at my end()
+ // must not be contained.
+
+ return contains(i_other.begin())
+ && i_other.end() <= end();
+}
+
+template <class T>
+bool
+range<T>::overlaps(const self & i_other) const
+{
+ return contains(i_other.begin())
+ || i_other.contains(begin());
+}
+
+template <class T>
+long
+range<T>::distance_to(const self & i_other) const
+{
+ return i_other.begin() - end();
+}
+
+
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/sorted_vector.hxx b/include/o3tl/sorted_vector.hxx
new file mode 100644
index 000000000000..776fd5605e6f
--- /dev/null
+++ b/include/o3tl/sorted_vector.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_SORTED_VECTOR_HXX
+#define INCLUDED_O3TL_SORTED_VECTOR_HXX
+
+#include <vector>
+#include <functional>
+#include <algorithm>
+
+namespace o3tl
+{
+
+// forward declared because it's default tempate arg for sorted_vector
+template<class Value, class Compare>
+struct find_unique;
+
+/** Represents a sorted vector of values.
+
+ @tpl Value class of item to be stored in container
+ @tpl Compare comparison method
+ @tpl Find look up index of a Value in the array
+*/
+template<typename Value, typename Compare = std::less<Value>,
+ template<typename, typename> class Find = find_unique >
+class sorted_vector
+ : private std::vector<Value>
+{
+private:
+ typedef Find<Value, Compare> Find_t;
+ typedef typename std::vector<Value> base_t;
+ typedef typename std::vector<Value>::iterator iterator;
+public:
+ typedef typename std::vector<Value>::const_iterator const_iterator;
+ typedef typename std::vector<Value>::size_type size_type;
+
+ using base_t::clear;
+ using base_t::empty;
+ using base_t::size;
+
+ // MODIFIERS
+
+ std::pair<const_iterator,bool> insert( const Value& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
+ if (!ret.second)
+ {
+ const_iterator const it = base_t::insert(
+ begin_nonconst() + (ret.first - begin()), x);
+ return std::make_pair(it, true);
+ }
+ return std::make_pair(ret.first, false);
+ }
+
+ size_type erase( const Value& x )
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
+ if (ret.second)
+ {
+ base_t::erase(begin_nonconst() + (ret.first - begin()));
+ return 1;
+ }
+ return 0;
+ }
+
+ void erase( size_t index )
+ {
+ base_t::erase( begin_nonconst() + index );
+ }
+
+ // like C++ 2011: erase with const_iterator (doesn't change sort order)
+ void erase(const_iterator const& position)
+ { // C++98 has vector::erase(iterator), so call that
+ base_t::erase(begin_nonconst() + (position - begin()));
+ }
+
+ void erase(const_iterator const& first, const_iterator const& last)
+ {
+ base_t::erase(begin_nonconst() + (first - begin()),
+ begin_nonconst() + (last - begin()));
+ }
+
+ // ACCESSORS
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_iterator begin() const
+ {
+ return base_t::begin();
+ }
+
+ // Only return a const iterator, so that the vector cannot be directly updated.
+ const_iterator end() const
+ {
+ return base_t::end();
+ }
+
+ const Value& front() const
+ {
+ return base_t::front();
+ }
+
+ const Value& back() const
+ {
+ return base_t::back();
+ }
+
+ const Value& operator[]( size_t index ) const
+ {
+ return base_t::operator[]( index );
+ }
+
+ // OPERATIONS
+
+ const_iterator lower_bound( const Value& x ) const
+ {
+ return std::lower_bound( base_t::begin(), base_t::end(), x, Compare() );
+ }
+
+ const_iterator upper_bound( const Value& x ) const
+ {
+ return std::upper_bound( base_t::begin(), base_t::end(), x, Compare() );
+ }
+
+ /* Searches the container for an element with a value of x
+ * and returns an iterator to it if found, otherwise it returns an
+ * iterator to sorted_vector::end (the element past the end of the container).
+ *
+ * Only return a const iterator, so that the vector cannot be directly updated.
+ */
+ const_iterator find( const Value& x ) const
+ {
+ std::pair<const_iterator, bool> const ret(Find_t()(begin(), end(), x));
+ return (ret.second) ? ret.first : end();
+ }
+
+ void insert(sorted_vector<Value,Compare,Find> const& rOther)
+ {
+ // optimisation for the rather common case that we are overwriting this with the contents
+ // of another sorted vector
+ if ( empty() )
+ {
+ base_t::insert(begin_nonconst(), rOther.begin(), rOther.end());
+ }
+ else
+ for( const_iterator it = rOther.begin(); it != rOther.end(); ++it )
+ insert( *it );
+ }
+
+ /* Clear() elements in the vector, and free them one by one. */
+ void DeleteAndDestroyAll()
+ {
+ for( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
+ clear();
+ }
+
+ // fdo#58793: some existing code in Writer (SwpHintsArray)
+ // routinely modifies the members of the vector in a way that
+ // violates the sort order, and then re-sorts the array.
+ // This is a kludge to enable that code to work.
+ // If you are calling this function, you are Doing It Wrong!
+ void Resort()
+ {
+ std::stable_sort(begin_nonconst(), end_nonconst(), Compare());
+ }
+
+private:
+
+ typename base_t::iterator begin_nonconst() { return base_t::begin(); }
+ typename base_t::iterator end_nonconst() { return base_t::end(); }
+
+};
+
+
+/** Implements an ordering function over a pointer, where the comparison uses the < operator on the pointed-to types.
+ Very useful for the cases where we put pointers to objects inside a sorted_vector.
+*/
+template <class T> struct less_ptr_to : public std::binary_function <T*,T*,bool>
+{
+ bool operator() ( T* const& lhs, T* const& rhs ) const
+ {
+ return (*lhs) < (*rhs);
+ }
+};
+
+/** the elements are totally ordered by Compare,
+ for no 2 elements !Compare(a,b) && !Compare(b,a) is true
+ */
+template<class Value, class Compare>
+struct find_unique
+{
+ typedef typename sorted_vector<Value, Compare,
+ o3tl::find_unique> ::const_iterator const_iterator;
+ std::pair<const_iterator, bool> operator()(
+ const_iterator first, const_iterator last,
+ Value const& v)
+ {
+ const_iterator const it = std::lower_bound(first, last, v, Compare());
+ return std::make_pair(it, (it != last && !Compare()(v, *it)));
+ }
+};
+
+/** the elements are partially ordered by Compare,
+ 2 elements are allowed if they are not the same element (pointer equal)
+ */
+template<class Value, class Compare>
+struct find_partialorder_ptrequals
+{
+ typedef typename sorted_vector<Value, Compare,
+ o3tl::find_partialorder_ptrequals>::const_iterator const_iterator;
+ std::pair<const_iterator, bool> operator()(
+ const_iterator first, const_iterator last,
+ Value const& v)
+ {
+ std::pair<const_iterator, const_iterator> const its =
+ std::equal_range(first, last, v, Compare());
+ for (const_iterator it = its.first; it != its.second; ++it)
+ {
+ if (v == *it)
+ {
+ return std::make_pair(it, true);
+ }
+ }
+ return std::make_pair(its.first, false);
+ }
+};
+
+} // namespace o3tl
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/o3tl/vector_pool.hxx b/include/o3tl/vector_pool.hxx
new file mode 100644
index 000000000000..b132289af3ab
--- /dev/null
+++ b/include/o3tl/vector_pool.hxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_O3TL_VECTOR_POOL_HXX
+#define INCLUDED_O3TL_VECTOR_POOL_HXX
+
+#include <sal/types.h>
+#include <vector>
+
+namespace o3tl
+{
+ namespace detail
+ {
+ template<typename ValueType, class Container> class simple_pool_impl :
+ public Container
+ {
+ typedef typename Container::value_type value_type;
+ std::ptrdiff_t mnFirstFreeIndex;
+
+ public:
+ simple_pool_impl() :
+ mnFirstFreeIndex(-1)
+ {}
+
+ std::ptrdiff_t alloc()
+ {
+ return store(ValueType());
+ }
+
+ std::ptrdiff_t store(const ValueType& rCopy)
+ {
+ if( mnFirstFreeIndex != -1 )
+ {
+ std::ptrdiff_t nIdx=mnFirstFreeIndex;
+ mnFirstFreeIndex = this->at(mnFirstFreeIndex).nextFree;
+ this->at(nIdx).value = rCopy;
+ this->at(nIdx).nextFree = -1;
+
+ return nIdx;
+ }
+ else
+ {
+ this->push_back(value_type(rCopy));
+ return this->size()-1;
+ }
+ }
+
+ void free( std::ptrdiff_t nIdx )
+ {
+ this->at(nIdx).nextFree = mnFirstFreeIndex;
+ mnFirstFreeIndex = nIdx;
+ }
+
+ const ValueType& get( std::ptrdiff_t nIdx ) const
+ {
+ return this->operator[](nIdx).value;
+ }
+ ValueType& get( std::ptrdiff_t nIdx )
+ {
+ return this->operator[](nIdx).value;
+ }
+ };
+
+ template< typename ValueType > struct struct_from_value
+ {
+ struct type
+ {
+ type() :
+ value(),
+ nextFree(-1)
+ {}
+ explicit type( const ValueType& val ) :
+ value(val),
+ nextFree(-1)
+ {}
+
+ ValueType value;
+ std::ptrdiff_t nextFree;
+ };
+ };
+ }
+
+ /** Simple vector-based memory pool allocator
+
+ This template can be used to provide simple pooled memory
+ allocation from a container class that adheres to the stl
+ random access container concept. Note that alloc/free works
+ with _indices_ into the container!
+
+ @example
+ <pre>
+vector_pool<type> myPool;
+int nIdx=myPool.alloc();
+myPool[nIdx] = myVal;
+ ... do stuff ...
+myPool.free(nIdx);
+ </pre>
+ */
+ template<typename ValueType> struct vector_pool :
+ public detail::simple_pool_impl<ValueType,
+ std::vector<typename detail::struct_from_value<ValueType>::type > >
+ {};
+}
+
+#endif /* INCLUDED_O3TL_VECTOR_POOL_HXX */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/binarycodec.hxx b/include/oox/core/binarycodec.hxx
new file mode 100644
index 000000000000..64b06d4244ef
--- /dev/null
+++ b/include/oox/core/binarycodec.hxx
@@ -0,0 +1,316 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_BINARYCODEC_HXX
+#define OOX_CORE_BINARYCODEC_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+
+#include <rtl/cipher.h>
+#include <rtl/digest.h>
+#include "oox/dllapi.h"
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC CodecHelper
+{
+public:
+ /** Returns the password hash if it is in the required 16-bit limit. */
+ static sal_uInt16 getPasswordHash( const AttributeList& rAttribs, sal_Int32 nElement );
+
+private:
+ CodecHelper();
+ ~CodecHelper();
+};
+
+// ============================================================================
+
+/** Encodes and decodes data from/to protected MS Office documents.
+
+ Implements a simple XOR encoding/decoding algorithm used in MS Office
+ versions up to MSO 95.
+ */
+class OOX_DLLPUBLIC BinaryCodec_XOR
+{
+public:
+ /** Enumerates codec types supported by this XOR codec implementation. */
+ enum CodecType
+ {
+ CODEC_WORD, ///< MS Word XOR codec.
+ CODEC_EXCEL ///< MS Excel XOR codec.
+ };
+
+public:
+ /** Default constructor.
+
+ Two-step construction in conjunction with the initKey() and verifyKey()
+ functions allows to try to initialize with different passwords (e.g.
+ built-in default password used for Excel workbook protection).
+ */
+ explicit BinaryCodec_XOR( CodecType eCodecType );
+
+ ~BinaryCodec_XOR();
+
+ /** Initializes the algorithm with the specified password.
+
+ @param pnPassData
+ Character array containing the password. Must be zero terminated,
+ which results in a maximum length of 15 characters.
+ */
+ void initKey( const sal_uInt8 pnPassData[ 16 ] );
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData();
+
+ /** Verifies the validity of the password using the passed key and hash.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nKey
+ Password key value read from the file.
+ @param nHash
+ Password hash value read from the file.
+
+ @return
+ True = test was successful.
+ */
+ bool verifyKey( sal_uInt16 nKey, sal_uInt16 nHash ) const;
+
+ /** Reinitializes the codec to start a new memory block.
+
+ Resets the internal key offset to 0.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+ */
+ void startBlock();
+
+ /** Decodes a block of memory.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnDestData
+ Destination buffer. Will contain the decrypted data afterwards.
+ @param pnSrcData
+ Encrypted data block.
+ @param nBytes
+ Size of the passed data blocks. pnDestData and pnSrcData must be of
+ this size.
+
+ @return
+ True = decoding was successful (no error occurred).
+ */
+ bool decode(
+ sal_uInt8* pnDestData,
+ const sal_uInt8* pnSrcData,
+ sal_Int32 nBytes );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of decode().
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+
+ @return
+ True = skip was successful (no error occurred).
+ */
+ bool skip( sal_Int32 nBytes );
+
+private:
+ CodecType meCodecType; ///< Codec type.
+ sal_uInt8 mpnKey[ 16 ]; ///< Encryption key.
+ sal_Int32 mnOffset; ///< Key offset.
+ sal_uInt16 mnBaseKey; ///< Base key from password.
+ sal_uInt16 mnHash; ///< Hash value from password.
+};
+
+// ============================================================================
+
+/** Encodes and decodes data from protected MSO 97+ documents.
+
+ This is a wrapper class around low level cryptographic functions from RTL.
+ Implementation is based on the wvDecrypt package by Caolan McNamara:
+ http://www.csn.ul.ie/~caolan/docs/wvDecrypt.html
+ */
+class OOX_DLLPUBLIC BinaryCodec_RCF
+{
+public:
+ /** Default constructor.
+
+ Two-step construction in conjunction with the initKey() and verifyKey()
+ functions allows to try to initialize with different passwords (e.g.
+ built-in default password used for Excel workbook protection).
+ */
+ explicit BinaryCodec_RCF();
+
+ ~BinaryCodec_RCF();
+
+ /** Initializes the algorithm with the encryption data.
+
+ @param aData
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ bool initCodec( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aData );
+
+ /** Retrieves the encryption data
+
+ @return
+ The sequence contains the necessary data to initialize
+ the codec.
+ */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > getEncryptionData();
+
+ /** Initializes the algorithm with the specified password and document ID.
+
+ @param pnPassData
+ Unicode character array containing the password. Must be zero
+ terminated, which results in a maximum length of 15 characters.
+ @param pnSalt
+ Random salt data block read from or written to the file.
+ */
+ void initKey(
+ const sal_uInt16 pnPassData[ 16 ],
+ const sal_uInt8 pnSalt[ 16 ] );
+
+ /** Verifies the validity of the password using the passed salt data.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnVerifier
+ Verifier block read from the file.
+ @param pnVerifierHash
+ Verifier hash read from the file.
+
+ @return
+ True = test was successful.
+ */
+ bool verifyKey(
+ const sal_uInt8 pnVerifier[ 16 ],
+ const sal_uInt8 pnVerifierHash[ 16 ] );
+
+ /** Rekeys the codec using the specified counter.
+
+ After reading a specific amount of data the cipher algorithm needs to
+ be rekeyed using a counter that counts the data blocks.
+
+ The block size is for example 512 bytes for MS Word files and 1024
+ bytes for MS Excel files.
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nCounter
+ Block counter used to rekey the cipher.
+ */
+ bool startBlock( sal_Int32 nCounter );
+
+ /** Decodes a block of memory.
+
+ @see rtl_cipher_decode()
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param pnDestData
+ Destination buffer. Will contain the decrypted data afterwards.
+ @param pnSrcData
+ Encrypted data block.
+ @param nBytes
+ Size of the passed data blocks. pnDestData and pnSrcData must be of
+ this size.
+
+ @return
+ True = decoding was successful (no error occurred).
+ */
+ bool decode(
+ sal_uInt8* pnDestData,
+ const sal_uInt8* pnSrcData,
+ sal_Int32 nBytes );
+
+ /** Lets the cipher skip a specific amount of bytes.
+
+ This function sets the cipher to the same state as if the specified
+ amount of data has been decoded with one or more calls of decode().
+
+ @precond
+ The codec must be initialized with the initKey() function before
+ this function can be used.
+
+ @param nBytes
+ Number of bytes to be skipped (cipher "seeks" forward).
+
+ @return
+ True = skip was successful (no error occurred).
+ */
+ bool skip( sal_Int32 nBytes );
+
+private:
+ void InitKeyImpl(
+ const sal_uInt8 pKeyData[64],
+ const sal_uInt8 pUnique[16] );
+
+ rtlCipher mhCipher;
+ rtlDigest mhDigest;
+ sal_uInt8 mpnDigestValue[ RTL_DIGEST_LENGTH_MD5 ];
+ sal_uInt8 mpnUnique[16];
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler.hxx b/include/oox/core/contexthandler.hxx
new file mode 100644
index 000000000000..f11dc1d6260a
--- /dev/null
+++ b/include/oox/core/contexthandler.hxx
@@ -0,0 +1,117 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_CONTEXTHANDLER_HXX
+#define OOX_CORE_CONTEXTHANDLER_HXX
+
+#include <com/sun/star/xml/sax/XFastContextHandler.hpp>
+#include <boost/shared_ptr.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <rtl/ref.hxx>
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace sax { class XLocator; } }
+} } }
+
+namespace oox { class SequenceInputStream; }
+
+namespace oox {
+namespace core {
+
+class XmlFilterBase;
+class FragmentHandler;
+struct Relation;
+class Relations;
+
+// ============================================================================
+
+class ContextHandler;
+typedef ::rtl::Reference< ContextHandler > ContextHandlerRef;
+
+struct FragmentBaseData;
+typedef ::boost::shared_ptr< FragmentBaseData > FragmentBaseDataRef;
+
+typedef ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastContextHandler > ContextHandler_BASE;
+
+class OOX_DLLPUBLIC ContextHandler : public ContextHandler_BASE
+{
+public:
+ explicit ContextHandler( const ContextHandler& rParent );
+ virtual ~ContextHandler();
+
+ /** Returns the filter instance. */
+ XmlFilterBase& getFilter() const;
+ /** Returns the relations of the current fragment. */
+ const Relations& getRelations() const;
+ /** Returns the full path of the current fragment. */
+ const OUString& getFragmentPath() const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // record context interface -----------------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+protected:
+ /** Helper constructor for the FragmentHandler. */
+ explicit ContextHandler( const FragmentBaseDataRef& rxBaseData );
+
+ void implSetLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator );
+
+#ifdef _MSC_VER
+ ContextHandler() {} // workaround
+#endif
+
+private:
+ ContextHandler& operator=( const ContextHandler& );
+
+private:
+ FragmentBaseDataRef mxBaseData; ///< Base data of the fragment.
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx
new file mode 100644
index 000000000000..f1a0c7db38b2
--- /dev/null
+++ b/include/oox/core/contexthandler2.hxx
@@ -0,0 +1,272 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_CONTEXTHANDLER2_HXX
+#define OOX_CORE_CONTEXTHANDLER2_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+const sal_Int32 XML_ROOT_CONTEXT = SAL_MAX_INT32;
+
+// ============================================================================
+
+struct ElementInfo;
+
+/** Helper class that provides a context stack.
+
+ Fragment handlers and context handlers derived from this helper class will
+ track the identifiers of the visited elements in a stack. The idea is to
+ use the same instance of a fragment handler or context handler to process
+ several nested elements in an XML stream. For that, the abstract function
+ onCreateContext() has to return 'this' for the passed element.
+
+ Derived classes have to implement the createFastChildContext(),
+ startFastElement(), characters(), and endFastElement() functions from the
+ com.sun.star.xml.sax.XFastContextHandler interface by simply forwarding
+ them to the respective implCreateChildContext(), implStartElement(),
+ implCharacters(), and implEndElement() functions of this helper. This is
+ implemented already in the classes ContextHandler2 and FragmentHandler2.
+ The new abstract functions have to be implemented according to the elements
+ to be processed.
+
+ Similarly, for binary import, derived classes have to forward the
+ createRecordContext(), startRecord(), and endRecord() functions from the
+ ContextHandler class to the implCreateRecordContext(), implStartRecord(),
+ and implEndRecord() functions of this helper. Again, this is implemented
+ already in the classes ContextHandler2 and FragmentHandler2.
+ */
+class OOX_DLLPUBLIC ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2Helper( bool bEnableTrimSpace );
+ explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2Helper();
+
+ // allow instances to be stored in ::rtl::Reference
+ virtual void SAL_CALL acquire() throw() = 0;
+ virtual void SAL_CALL release() throw() = 0;
+
+ // interface --------------------------------------------------------------
+
+ /** Will be called to create a context handler for the passed element.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several elements. Used by OOXML import only.
+ */
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
+
+ /** Will be called when a new element has been started.
+
+ This function is called at the context handler returned from
+ onCreateContext(), or, for root elements of an XML stream, at the
+ fragment handler itself.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onStartElement( const AttributeList& rAttribs ) = 0;
+
+ /** Will be called before a new child element starts, or if the current
+ element is about to be left.
+
+ This helper function collects all text fragments received by the
+ characters() function (such as encoded characters which are passed in
+ separate calls to the characters() function), and passes the
+ concatenated and trimmed string.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onCharacters( const OUString& rChars ) = 0;
+
+ /** Will be called when the current element is about to be left.
+
+ The current element identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by OOXML import only.
+ */
+ virtual void onEndElement() = 0;
+
+ /** Will be called to create a context handler for the passed record.
+
+ Usually 'this' can be returned to improve performance by reusing the
+ same instance to process several records. Used by BIFF import only.
+ */
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when a new record block in a binary stream has been
+ started.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onStartRecord( SequenceInputStream& rStrm ) = 0;
+
+ /** Will be called when the current record block is about to be left.
+
+ The current record identifier can be accessed with getCurrentElement()
+ or isCurrentElement(). Used by BIFF import only.
+ */
+ virtual void onEndRecord() = 0;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns the identifier of the currently processed element. Ignores MCE elements in stack */
+ sal_Int32 getCurrentElement() const;
+
+ /** Returns the identifier of the currently processed element - Including MCE root elements */
+ sal_Int32 getCurrentElementWithMce() const;
+
+ /** Returns true, if nElement contains the identifier of the currently
+ processed element. */
+ inline bool isCurrentElement( sal_Int32 nElement ) const
+ { return getCurrentElement() == nElement; }
+
+ /** Returns true, if either nElement1 or nElement2 contain the identifier
+ of the currently processed element. */
+ inline bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 ) const
+ { return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); }
+
+ /** Returns the identifier of the specified parent element. */
+ sal_Int32 getParentElement( sal_Int32 nCountBack = 1 ) const;
+
+ /** Returns true, if nElement contains the identifier of the specified
+ parent element. */
+ inline sal_Int32 isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 ) const
+ { return getParentElement( nCountBack ) == nElement; }
+
+ /** Returns true, if the element currently processed is the root element of
+ the context or fragment handler. */
+ bool isRootElement() const;
+
+ // implementation ---------------------------------------------------------
+
+protected:
+ /** Must be called from createFastChildContext() in derived classes. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ implCreateChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from startFastElement() in derived classes. */
+ void implStartElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Must be called from characters() in derived classes. */
+ void implCharacters( const OUString& rChars );
+
+ /** Must be called from endFastElement() in derived classes. */
+ void implEndElement( sal_Int32 nElement );
+
+ /** Must be called from createRecordContext() in derived classes. */
+ ContextHandlerRef implCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from startRecord() in derived classes. */
+ void implStartRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+
+ /** Must be called from endRecord() in derived classes. */
+ void implEndRecord( sal_Int32 nRecId );
+
+private:
+ ContextHandler2Helper& operator=( const ContextHandler2Helper& );
+
+ ElementInfo& pushElementInfo( sal_Int32 nElement );
+ void popElementInfo();
+ void processCollectedChars();
+
+private:
+ typedef ::std::vector< ElementInfo > ContextStack;
+ typedef ::boost::shared_ptr< ContextStack > ContextStackRef;
+
+ ContextStackRef mxContextStack; ///< Stack of all processed elements.
+ size_t mnRootStackSize; ///< Stack size on construction time.
+ bool mbEnableTrimSpace; ///< True = trim whitespace in characters().
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper
+{
+public:
+ explicit ContextHandler2( ContextHandler2Helper& rParent );
+ virtual ~ContextHandler2();
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() throw() { ContextHandler::acquire(); }
+ virtual void SAL_CALL release() throw() { ContextHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL characters( const OUString& rChars )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+ virtual void onEndRecord();
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fastparser.hxx b/include/oox/core/fastparser.hxx
new file mode 100644
index 000000000000..40b5e763998f
--- /dev/null
+++ b/include/oox/core/fastparser.hxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FASTPARSER_HXX
+#define OOX_CORE_FASTPARSER_HXX
+
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/xml/sax/XFastParser.hpp>
+
+namespace oox {
+ struct NamespaceMap;
+ class StorageBase;
+}
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Wrapper for a fast SAX parser that works on automatically generated OOXML
+ token and namespace identifiers.
+ */
+class FastParser
+{
+public:
+ explicit FastParser(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FastParser();
+
+ /** Registers an OOXML namespace at the parser. */
+ void registerNamespace( sal_Int32 nNamespaceId )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ /** Sets the passed document handler that will receive the SAX parser events. */
+ void setDocumentHandler(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& rxDocHandler )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed SAX input source.
+ @param bCloseStream True = closes the stream in the input source after parsing. */
+ void parseStream( const ::com::sun::star::xml::sax::InputSource& rInputSource, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses the passed input stream.
+ @param bCloseStream True = closes the passed stream after parsing. */
+ void parseStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream,
+ const OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ /** Parses a stream from the passed storage with the specified name.
+ @param bCloseStream True = closes the stream after parsing. */
+ void parseStream( StorageBase& rStorage, const OUString& rStreamName, bool bCloseStream = false )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException );
+
+ OUString getNamespaceURL( const OUString& rPrefix )
+ throw( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException );
+
+ sal_Int32 getNamespaceId( const OUString& aUrl );
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
+ getTokenHandler() const { return mxTokenHandler; }
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastParser >
+ mxParser;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastTokenHandler >
+ mxTokenHandler;
+ const NamespaceMap& mrNamespaceMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fasttokenhandler.hxx b/include/oox/core/fasttokenhandler.hxx
new file mode 100644
index 000000000000..05c7063d3925
--- /dev/null
+++ b/include/oox/core/fasttokenhandler.hxx
@@ -0,0 +1,67 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FASTTOKENHANDLER_HXX
+#define OOX_CORE_FASTTOKENHANDLER_HXX
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XFastTokenHandler.hpp>
+#include <cppuhelper/implbase2.hxx>
+
+namespace oox { class TokenMap; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, ::com::sun::star::xml::sax::XFastTokenHandler > FastTokenHandler_BASE;
+
+/** Wrapper implementing the com.sun.star.xml.sax.XFastTokenHandler API interface
+ that provides access to the tokens generated from the internal token name list.
+ */
+class FastTokenHandler : public FastTokenHandler_BASE
+{
+public:
+ explicit FastTokenHandler();
+ virtual ~FastTokenHandler();
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+ // XFastTokenHandler
+ virtual sal_Int32 SAL_CALL getToken( const OUString& rIdentifier ) throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getIdentifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getUTF8Identifier( sal_Int32 nToken ) throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Int32 SAL_CALL getTokenFromUTF8( const ::com::sun::star::uno::Sequence< sal_Int8 >& Identifier ) throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ const TokenMap& mrTokenMap; ///< Reference to global token map singleton.
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterbase.hxx b/include/oox/core/filterbase.hxx
new file mode 100644
index 000000000000..6f4fc40499c7
--- /dev/null
+++ b/include/oox/core/filterbase.hxx
@@ -0,0 +1,293 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FILTERBASE_HXX
+#define OOX_CORE_FILTERBASE_HXX
+
+#include <memory>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/document/XExporter.hpp>
+#include <com/sun/star/document/XFilter.hpp>
+#include <com/sun/star/document/XImporter.hpp>
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+#include <com/sun/star/io/XStream.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/implbase5.hxx>
+#include <comphelper/sequenceashashmap.hxx>
+#include "oox/helper/binarystreambase.hxx"
+#include "oox/helper/storagebase.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct DeviceInfo; }
+ namespace frame { class XFrame; }
+ namespace frame { class XModel; }
+ namespace drawing { class XShape; }
+ namespace graphic { class XGraphic; }
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XStream; }
+ namespace lang { class XMultiComponentFactory; }
+ namespace lang { class XMultiServiceFactory; }
+ namespace task { class XInteractionHandler; }
+ namespace task { class XStatusIndicator; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+ class IDocPasswordVerifier;
+ class MediaDescriptor;
+}
+
+namespace oox {
+ class GraphicHelper;
+ class ModelObjectHelper;
+}
+
+namespace oox { namespace ole {
+ class OleObjectHelper;
+ class VbaProject;
+} }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+enum OoxmlVersion
+{
+ ECMA_DIALECT,
+ ISOIEC_29500_2008
+};
+
+struct FilterBaseImpl;
+
+typedef ::cppu::WeakImplHelper5<
+ ::com::sun::star::lang::XServiceInfo,
+ ::com::sun::star::lang::XInitialization,
+ ::com::sun::star::document::XImporter,
+ ::com::sun::star::document::XExporter,
+ ::com::sun::star::document::XFilter >
+ FilterBase_BASE;
+
+class OOX_DLLPUBLIC FilterBase : public FilterBase_BASE, public ::cppu::BaseMutex
+{
+public:
+ explicit FilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~FilterBase();
+
+ /** Returns true, if filter is an import filter. */
+ bool isImportFilter() const;
+ /** Returns true, if filter is an export filter. */
+ bool isExportFilter() const;
+
+ OoxmlVersion getVersion() const;
+
+ /** Derived classes implement import of the entire document. */
+ virtual bool importDocument() = 0;
+
+ /** Derived classes implement export of the entire document. */
+ virtual bool exportDocument() = 0;
+
+ // ------------------------------------------------------------------------
+
+ /** Returns the component context passed in the filter constructor (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getComponentContext() const;
+
+ /** Returns the multi service factory of the component (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getServiceFactory() const;
+
+ /** Returns the document model (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
+ getModel() const;
+
+ /** Returns the service factory provided by the document model (always existing). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
+ getModelFactory() const;
+
+ /** Returns the frame that will contain the document model (may be null). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
+ getTargetFrame() const;
+
+ /// Returns the parent shape to load into (if any)
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&
+ getParentShape() const;
+
+ /** Returns the status indicator (may be null). */
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
+ getStatusIndicator() const;
+
+ /** Returns the FilterData */
+ ::comphelper::SequenceAsHashMap& getFilterData() const;
+
+ /** Returns the media descriptor. */
+ ::comphelper::MediaDescriptor& getMediaDescriptor() const;
+
+ /** Returns the URL of the imported or exported file. */
+ const OUString& getFileUrl() const;
+
+ /** Returns an absolute URL for the passed relative or absolute URL. */
+ OUString getAbsoluteUrl( const OUString& rUrl ) const;
+
+ /** Returns the base storage of the imported/exported file. */
+ StorageRef getStorage() const;
+
+ /** Opens and returns the specified input stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream( const OUString& rStreamName ) const;
+
+ /** Opens and returns the specified output stream from the base storage.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream( const OUString& rStreamName ) const;
+
+ /** Commits changes to base storage (and substorages) */
+ void commitStorage() const;
+
+ // helpers ----------------------------------------------------------------
+
+ /** Returns a helper for the handling of graphics and graphic objects. */
+ GraphicHelper& getGraphicHelper() const;
+
+ /** Returns a helper with containers for various named drawing objects for
+ the imported document. */
+ ModelObjectHelper& getModelObjectHelper() const;
+
+ /** Returns a helper for the handling of OLE objects. */
+ ::oox::ole::OleObjectHelper& getOleObjectHelper() const;
+
+ /** Returns the VBA project manager. */
+ ::oox::ole::VbaProject& getVbaProject() const;
+
+ /** Imports the raw binary data from the specified stream.
+ @return True, if the data could be imported from the stream. */
+ bool importBinaryData( StreamDataSequence& orDataSeq, const OUString& rStreamName );
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL
+ getImplementationName()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual sal_Bool SAL_CALL
+ supportsService( const OUString& rServiceName )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL
+ getSupportedServiceNames()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.lang.XInitialization interface ----------------------------
+
+ /** Receives user defined arguments.
+
+ @param rArgs
+ the sequence of arguments passed to the filter. The implementation
+ expects one or two arguments. The first argument shall be the
+ com.sun.star.lang.XMultiServiceFactory interface of the global
+ service factory. The optional second argument may contain a
+ sequence of com.sun.star.beans.NamedValue objects. The different
+ filter implemetations may support different arguments.
+ */
+ virtual void SAL_CALL initialize(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rArgs )
+ throw( ::com::sun::star::uno::Exception,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XImporter interface ------------------------------
+
+ virtual void SAL_CALL setTargetDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDocument )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XExporter interface ------------------------------
+
+ virtual void SAL_CALL setSourceDocument(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxDocument )
+ throw( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XFilter interface --------------------------------
+
+ virtual sal_Bool SAL_CALL filter(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL cancel()
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >
+ implGetOutputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+private:
+ void setMediaDescriptor(
+ const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq );
+
+ /** Derived classes may create a specialized graphic helper, e.g. for
+ resolving palette colors. */
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+
+ /** Derived classes create a VBA project manager object. */
+ virtual ::oox::ole::VbaProject* implCreateVbaProject() const = 0;
+
+ virtual OUString implGetImplementationName() const = 0;
+
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const = 0;
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const = 0;
+
+private:
+ ::std::auto_ptr< FilterBaseImpl > mxImpl;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/filterdetect.hxx b/include/oox/core/filterdetect.hxx
new file mode 100644
index 000000000000..cd9573b0f0bd
--- /dev/null
+++ b/include/oox/core/filterdetect.hxx
@@ -0,0 +1,162 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FILTERDETECT_HXX
+#define OOX_CORE_FILTERDETECT_HXX
+
+#include <vector>
+#include <com/sun/star/document/XExtendedFilterDetection.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper { class MediaDescriptor; }
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Document handler specifically designed for detecting OOXML file formats.
+
+ It takes a reference to the filter string object via its constructor, and
+ puts the name of the detected filter to it, if it successfully finds one.
+ */
+class FilterDetectDocHandler : public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XFastDocumentHandler >
+{
+public:
+ explicit FilterDetectDocHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, OUString& rFilter );
+ virtual ~FilterDetectDocHandler();
+
+ // XFastDocumentHandler
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // XFastContextHandler
+ virtual void SAL_CALL startFastElement( sal_Int32 nElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ void parseRelationship( const AttributeList& rAttribs );
+
+ OUString getFilterNameFromContentType( const OUString& rContentType ) const;
+ void parseContentTypesDefault( const AttributeList& rAttribs );
+ void parseContentTypesOverride( const AttributeList& rAttribs );
+
+private:
+ typedef ::std::vector< sal_Int32 > ContextVector;
+
+ OUString& mrFilterName;
+ ContextVector maContextStack;
+ OUString maTargetPath;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC FilterDetect : public ::cppu::WeakImplHelper2< ::com::sun::star::document::XExtendedFilterDetection, ::com::sun::star::lang::XServiceInfo >
+{
+public:
+ explicit FilterDetect( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+ virtual ~FilterDetect();
+
+ /** Tries to extract an unencrypted ZIP package from the passed media
+ descriptor.
+
+ First, this function checks if the input stream provided by the media
+ descriptor property 'InputStream' contains a ZIP package. If yes, this
+ stream is returned.
+
+ Second, this function checks if the 'ComponentData' property exists and
+ contains a sequence of com.sun.star.beans.NamedValue. If yes, a named
+ value is searched with the name 'DecryptedPackage' and a value of type
+ com.sun.star.io.XStream. If the input stream provided by this XStream
+ contains a ZIP package, this input stream is returned.
+
+ Third, this function checks if the input stream of the media descriptor
+ contains an OLE package. If yes, it checks the existence of the streams
+ 'EncryptionInfo' and 'EncyptedPackage' and tries to decrypt the package
+ into a temporary file. This may include requesting a password from the
+ media descriptor property 'Password' or from the user, using the
+ interaction handler provided by the descriptor. On success, and if the
+ decrypted package is a ZIP package, the XStream of the temporary file
+ is stored in the property 'ComponentData' of the media descriptor and
+ its input stream is returned.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ extractUnencryptedPackage( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+ // com.sun.star.lang.XServiceInfo interface -------------------------------
+
+ virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
+ virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.document.XExtendedFilterDetection interface ---------------
+
+ /** Detects MS Office 2007 file types and supports package decryption.
+
+ The following file types are detected:
+ - MS Word 2007 XML Document (*.docx, *.docm)
+ - MS Word 2007 XML Template (*.dotx, *.dotm)
+ - MS Excel 2007 XML Document (*.xlsx, *.xlsm)
+ - MS Excel 2007 BIFF12 Document (*.xlsb)
+ - MS Excel 2007 XML Template (*.xltx, *.xltm)
+ - MS Powerpoint 2007 XML Document (*.pptx, *.pptm)
+ - MS Powerpoint 2007 XML Template (*.potx, *.potm)
+
+ If the package is encrypted, the detection tries to decrypt it into a
+ temporary file. The user may be asked for a password. The XStream
+ interface of the temporary file will be stored in the 'ComponentData'
+ property of the passed media descriptor.
+ */
+ virtual OUString SAL_CALL
+ detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rMediaDescSeq )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler.hxx b/include/oox/core/fragmenthandler.hxx
new file mode 100644
index 000000000000..236e212e6e32
--- /dev/null
+++ b/include/oox/core/fragmenthandler.hxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FRAGMENTHANDLER_HXX
+#define OOX_CORE_FRAGMENTHANDLER_HXX
+
+#include <com/sun/star/xml/sax/XFastDocumentHandler.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include "oox/core/contexthandler.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Base data of a fragment.
+
+ This data is stored in a separate struct to make it accessible in every
+ child context handler of the fragment.
+ */
+struct FragmentBaseData
+{
+ XmlFilterBase& mrFilter;
+ const OUString maFragmentPath;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >
+ mxLocator;
+ RelationsRef mxRelations;
+
+ explicit FragmentBaseData(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ RelationsRef xRelations );
+};
+
+// ============================================================================
+
+/** Describes record identifiers used to create contexts in a binary stream.
+
+ If a record is used to start a new context, usually the record identifier
+ increased by 1 is used to mark the end of this context, e.g. the Excel
+ record SHEETDATA == 0x0091 starts the <sheetData> context, and the record
+ SHEETDATA_END == 0x0092 ends this context. But some records are used to
+ start a new context, though there is no identifier to end this context,
+ e.g. the ROW or EXTROW records. These record identifiers can be marked by
+ setting the mnEndRecId member of this struct to -1.
+ */
+struct RecordInfo
+{
+ sal_Int32 mnStartRecId; ///< Record identifier for context start.
+ sal_Int32 mnEndRecId; ///< Record identifier for context end, -1 = no record.
+};
+
+// ============================================================================
+
+typedef ::cppu::ImplInheritanceHelper1< ContextHandler, ::com::sun::star::xml::sax::XFastDocumentHandler > FragmentHandler_BASE;
+
+class OOX_DLLPUBLIC FragmentHandler : public FragmentHandler_BASE
+{
+public:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath );
+ virtual ~FragmentHandler();
+
+ /** Returns the com.sun.star.xml.sax.XFastContextHandler interface of this context. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ getFastContextHandler() { return static_cast< ContextHandler* >( this ); }
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& rxLocator ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual void SAL_CALL startFastElement( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL startUnknownElement( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL endUnknownElement( const OUString& Namespace, const OUString& Name ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createUnknownChildContext( const OUString& Namespace, const OUString& Name, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL ignorableWhitespace( const OUString& aWhitespaces ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL processingInstruction( const OUString& aTarget, const OUString& aData ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ // XML stream handling ----------------------------------------------------
+
+ /** Opens the fragment stream referred by the own fragment path. Derived
+ classes may provide specilized stream implementations. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openFragmentStream() const;
+
+ // binary records ---------------------------------------------------------
+
+ virtual const RecordInfo* getRecordInfos() const;
+
+protected:
+ explicit FragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, RelationsRef xRelations );
+};
+
+typedef ::rtl::Reference< FragmentHandler > FragmentHandlerRef;
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/fragmenthandler2.hxx b/include/oox/core/fragmenthandler2.hxx
new file mode 100644
index 000000000000..21ad03619fd1
--- /dev/null
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_FRAGMENTHANDLER2_HXX
+#define OOX_CORE_FRAGMENTHANDLER2_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/core/fragmenthandler.hxx"
+#include <vector>
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
+{
+protected:
+ enum MCE_STATE
+ {
+ MCE_UNUSED,
+ MCE_STARTED,
+ MCE_FOUND_CHOICE
+ };
+ ::std::vector<MCE_STATE> aMceState;
+
+ bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+
+public:
+ explicit FragmentHandler2(
+ XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ bool bEnableTrimSpace = true );
+ virtual ~FragmentHandler2();
+
+ // resolve ambiguity from base classes
+ virtual void SAL_CALL acquire() throw() { FragmentHandler::acquire(); }
+ virtual void SAL_CALL release() throw() { FragmentHandler::release(); }
+
+ // com.sun.star.xml.sax.XFastContextHandler interface ---------------------
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL characters( const OUString& rChars )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endFastElement( sal_Int32 nElement )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // com.sun.star.xml.sax.XFastDocumentHandler interface --------------------
+
+ virtual void SAL_CALL startDocument()
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual void SAL_CALL endDocument()
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // oox.core.ContextHandler interface --------------------------------------
+
+ virtual ContextHandlerRef createRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void startRecord( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void endRecord( sal_Int32 nRecId );
+
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
+ virtual void onStartRecord( SequenceInputStream& rStrm );
+ virtual void onEndRecord();
+
+ // oox.core.FragmentHandler2 interface ------------------------------------
+
+ virtual void initializeImport();
+ virtual void finalizeImport();
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/recordparser.hxx b/include/oox/core/recordparser.hxx
new file mode 100644
index 000000000000..9e417c03d01a
--- /dev/null
+++ b/include/oox/core/recordparser.hxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_RECORDPARSER_HXX
+#define OOX_CORE_RECORDPARSER_HXX
+
+#include <map>
+#include <com/sun/star/io/IOException.hpp>
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <rtl/ref.hxx>
+#include "oox/helper/binaryinputstream.hxx"
+
+namespace oox {
+namespace core {
+
+class FragmentHandler;
+struct RecordInfo;
+
+namespace prv { class Locator; }
+namespace prv { class ContextStack; }
+
+// ============================================================================
+
+struct RecordInputSource
+{
+ BinaryInputStreamRef mxInStream;
+ OUString maPublicId;
+ OUString maSystemId;
+};
+
+// ============================================================================
+
+class RecordParser
+{
+public:
+ explicit RecordParser();
+ virtual ~RecordParser();
+
+ void setFragmentHandler( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ void parseStream( const RecordInputSource& rInputSource )
+ throw( ::com::sun::star::xml::sax::SAXException,
+ ::com::sun::star::io::IOException,
+ ::com::sun::star::uno::RuntimeException );
+
+ inline const RecordInputSource& getInputSource() const { return maSource; }
+
+private:
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context start identifier. */
+ const RecordInfo* getStartRecordInfo( sal_Int32 nRecId ) const;
+ /** Returns a RecordInfo struct that contains the passed record identifier
+ as context end identifier. */
+ const RecordInfo* getEndRecordInfo( sal_Int32 nRecId ) const;
+
+private:
+ typedef ::std::map< sal_Int32, RecordInfo > RecordInfoMap;
+
+ RecordInputSource maSource;
+ ::rtl::Reference< FragmentHandler > mxHandler;
+ ::rtl::Reference< prv::Locator > mxLocator;
+ ::std::auto_ptr< prv::ContextStack > mxStack;
+ RecordInfoMap maStartMap;
+ RecordInfoMap maEndMap;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relations.hxx b/include/oox/core/relations.hxx
new file mode 100644
index 000000000000..b78d0d3056eb
--- /dev/null
+++ b/include/oox/core/relations.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_RELATIONS_HXX
+#define OOX_CORE_RELATIONS_HXX
+
+#include <map>
+#include <boost/shared_ptr.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+/** Expands to an OUString containing an 'officeDocument' relation type created
+ from the passed literal(!) ASCII(!) character array. */
+#define CREATE_OFFICEDOC_RELATION_TYPE( ascii ) \
+ ( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" ascii )
+
+/** Expands to an OUString containing a 'package' relation type created from
+ the passed literal(!) ASCII(!) character array. */
+#define CREATE_PACKAGE_RELATION_TYPE( ascii ) \
+ ( "http://schemas.openxmlformats.org/package/2006/relationships/" ascii )
+
+/** Expands to an OUString containing an MS Office specific relation type
+ created from the passed literal(!) ASCII(!) character array. */
+#define CREATE_MSOFFICE_RELATION_TYPE( ascii ) \
+ ( "http://schemas.microsoft.com/office/2006/relationships/" ascii )
+
+// ============================================================================
+
+struct Relation
+{
+ OUString maId;
+ OUString maType;
+ OUString maTarget;
+ bool mbExternal;
+
+ inline explicit Relation() : mbExternal( false ) {}
+};
+
+// ============================================================================
+
+class Relations;
+typedef ::boost::shared_ptr< Relations > RelationsRef;
+
+class OOX_DLLPUBLIC Relations : public ::std::map< OUString, Relation >
+{
+public:
+ explicit Relations( const OUString& rFragmentPath );
+
+ /** Returns the path of the fragment this relations collection is related to. */
+ inline const OUString& getFragmentPath() const { return maFragmentPath; }
+
+ /** Returns the relation with the passed relation identifier. */
+ const Relation* getRelationFromRelId( const OUString& rId ) const;
+ /** Returns the first relation with the passed type. */
+ const Relation* getRelationFromFirstType( const OUString& rType ) const;
+ /** Finds all relations associated with the passed type. */
+ RelationsRef getRelationsFromType( const OUString& rType ) const;
+
+ /** Returns the external target of the relation with the passed relation identifier. */
+ OUString getExternalTargetFromRelId( const OUString& rRelId ) const;
+ /** Returns the internal target of the relation with the passed relation identifier. */
+ OUString getInternalTargetFromRelId( const OUString& rRelId ) const;
+
+ /** Returns the full fragment path for the target of the passed relation. */
+ OUString getFragmentPathFromRelation( const Relation& rRelation ) const;
+ /** Returns the full fragment path for the passed relation identifier. */
+ OUString getFragmentPathFromRelId( const OUString& rRelId ) const;
+ /** Returns the full fragment path for the first relation of the passed type. */
+ OUString getFragmentPathFromFirstType( const OUString& rType ) const;
+
+private:
+ OUString maFragmentPath;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/relationshandler.hxx b/include/oox/core/relationshandler.hxx
new file mode 100644
index 000000000000..d42e5d1ad8b7
--- /dev/null
+++ b/include/oox/core/relationshandler.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_RELATIONSHANDLER_HXX
+#define OOX_CORE_RELATIONSHANDLER_HXX
+
+#include "oox/core/fragmenthandler.hxx"
+
+namespace oox {
+namespace core {
+
+// ============================================================================
+
+class RelationsFragment : public FragmentHandler
+{
+public:
+ explicit RelationsFragment(
+ XmlFilterBase& rFilter,
+ RelationsRef xRelations );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ RelationsRef mxRelations;
+};
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/core/xmlfilterbase.hxx b/include/oox/core/xmlfilterbase.hxx
new file mode 100644
index 000000000000..4b5c1e093657
--- /dev/null
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -0,0 +1,256 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_CORE_XMLFILTERBASE_HXX
+#define OOX_CORE_XMLFILTERBASE_HXX
+
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextField.hpp>
+#include <rtl/ref.hxx>
+#include <rtl/string.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/core/filterbase.hxx"
+#include "oox/core/relations.hxx"
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/dllapi.h"
+
+namespace com { namespace sun { namespace star {
+ namespace container { class XNameContainer; }
+ namespace document { class XDocumentProperties; }
+ namespace xml { namespace dom { class XDocument; } }
+ namespace xml { namespace sax { class XLocator; } }
+ namespace xml { namespace sax { class XFastDocumentHandler; } }
+ namespace xml { namespace sax { class XFastSAXSerializable; } }
+} } }
+
+namespace oox {
+ namespace drawingml { class Theme; }
+ namespace drawingml { namespace chart { class ChartConverter; } }
+ namespace vml { class Drawing; }
+}
+
+namespace sax_fastparser {
+ class FastSerializerHelper;
+
+ typedef boost::shared_ptr< FastSerializerHelper > FSHelperPtr;
+}
+
+namespace oox {
+namespace core {
+
+class FragmentHandler;
+
+// ============================================================================
+
+struct TextField {
+ com::sun::star::uno::Reference< com::sun::star::text::XText > xText;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextCursor > xTextCursor;
+ com::sun::star::uno::Reference< com::sun::star::text::XTextField > xTextField;
+};
+typedef std::vector< TextField > TextFieldStack;
+
+// ============================================================================
+
+struct XmlFilterBaseImpl;
+
+class OOX_DLLPUBLIC XmlFilterBase : public FilterBase
+{
+public:
+ explicit XmlFilterBase(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
+ throw( ::com::sun::star::uno::RuntimeException );
+
+ virtual ~XmlFilterBase();
+
+ /** Has to be implemented by each filter, returns the current theme. */
+ virtual const ::oox::drawingml::Theme*
+ getCurrentTheme() const = 0;
+
+ /** Has to be implemented by each filter to return the collection of VML shapes. */
+ virtual ::oox::vml::Drawing* getVmlDrawing() = 0;
+
+ /** Has to be implemented by each filter, returns a filter-specific chart
+ converter object, that should be global per imported document. */
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
+
+ /** Has to be implemented by each filter to return the table style list. */
+ virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
+
+ // ------------------------------------------------------------------------
+
+ /** Returns the fragment path from the first relation of the passed type,
+ used for fragments referred by the root relations. */
+ OUString getFragmentPathFromFirstType( const OUString& rType );
+
+ /** Imports a fragment using the passed fragment handler, which contains
+ the full path to the fragment stream.
+
+ @return True, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler );
+
+ /** Imports a fragment into an xml::dom::XDocument.
+
+ @param rFragmentPath path to fragment
+
+ @return a non-empty reference to the XDocument, if the
+ fragment could be imported.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> importFragment( const OUString& rFragmentPath );
+
+ /** Imports a fragment from an xml::dom::XDocument using the
+ passed fragment handler
+
+ @param rxHandler fragment handler; path to fragment is
+ ignored, input source is the rxSerializer
+
+ @param rxSerializer usually retrieved from a
+ xml::dom::XDocument, will get serialized into rxHandler
+
+ @return true, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XFastSAXSerializable >& rxSerializer );
+
+ /** Imports the relations fragment associated with the specified fragment.
+
+ @return The relations collection of the specified fragment.
+ */
+ RelationsRef importRelations( const OUString& rFragmentPath );
+
+ /** Adds new relation.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const OUString& rType, const OUString& rTarget, bool bExternal = false );
+
+ /** Adds new relation to part's relations.
+
+ @param rPartName
+ Part name the relations are related to. The relations will be stored in <rPartName::path>/_rels/<rPartName::name>.rels.
+
+ @param rType
+ Relation type.
+
+ @param rTarget
+ Relation target.
+
+ @return Added relation Id.
+ */
+ OUString addRelation( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutputStream, const OUString& rType, const OUString& rTarget, bool bExternal = false );
+
+ /** Returns a stack of used textfields, used by the pptx importer to replace links to slidepages with rhe real page name */
+ TextFieldStack& getTextFieldStack() const;
+
+ /** Opens and returns the specified output stream from the base storage with specified media type.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return The opened output stream.
+ */
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openFragmentStream(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Opens specified output stream from the base storage with specified
+ media type and returns new fast serializer for that stream.
+
+ @param rStreamName
+ The name of the embedded storage stream. The name may contain
+ slashes to open streams from embedded substorages. If base stream
+ access has been enabled in the storage, the base stream can be
+ accessed by passing an empty string as stream name.
+
+ @param rMediaType
+ The media type string, used in [Content_Types].xml stream in base
+ storage.
+
+ @return newly created serializer helper.
+ */
+ ::sax_fastparser::FSHelperPtr
+ openFragmentStreamWithSerializer(
+ const OUString& rStreamName,
+ const OUString& rMediaType );
+
+ /** Returns new unique ID for exported document.
+
+ @return newly created ID.
+ */
+ inline sal_Int32 GetUniqueId() { return mnMaxDocId++; }
+ inline OString GetUniqueIdOString() { return OString::valueOf( mnMaxDocId++ ); }
+ inline OUString GetUniqueIdOUString() { return OUString::valueOf( mnMaxDocId++ ); }
+
+ /** Write the document properties into into the current OPC package.
+
+ @param xProperties The document properties to export.
+
+ @return *this
+ */
+ XmlFilterBase& exportDocumentProperties( ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > xProperties );
+
+ OUString getNamespaceURL( const OUString& rPrefix );
+
+ sal_Int32 getNamespaceId( const OUString& rUrl );
+
+ void importDocumentProperties();
+
+protected:
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ implGetInputStream( ::comphelper::MediaDescriptor& rMediaDesc ) const;
+
+private:
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStream ) const;
+ virtual StorageRef implCreateStorage(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& rxOutStream ) const;
+
+private:
+ ::std::auto_ptr< XmlFilterBaseImpl > mxImpl;
+ sal_Int32 mnRelId;
+ sal_Int32 mnMaxDocId;
+};
+
+typedef ::rtl::Reference< XmlFilterBase > XmlFilterRef;
+
+// ============================================================================
+
+} // namespace core
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dllapi.h b/include/oox/dllapi.h
new file mode 100644
index 000000000000..6026aef0ae58
--- /dev/null
+++ b/include/oox/dllapi.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_OOX_DLLAPI_H
+#define INCLUDED_OOX_DLLAPI_H
+
+#include "sal/types.h"
+
+#if defined OOX_DLLIMPLEMENTATION
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
+#else
+#define OOX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
+#endif
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axiscontext.hxx b/include/oox/drawingml/chart/axiscontext.hxx
new file mode 100644
index 000000000000..d22a53f23227
--- /dev/null
+++ b/include/oox/drawingml/chart/axiscontext.hxx
@@ -0,0 +1,120 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_AXISCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_AXISCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisDispUnitsModel;
+
+/** Handler for a value axis display units context (c:dispUnits element).
+ */
+class AxisDispUnitsContext : public ContextBase< AxisDispUnitsModel >
+{
+public:
+ explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel );
+ virtual ~AxisDispUnitsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct AxisModel;
+
+/** Base class for axis context handlers (c:catAx, c:dateAx, c:serAx, c:valAx
+ elements).
+ */
+class AxisContextBase : public ContextBase< AxisModel >
+{
+public:
+ explicit AxisContextBase( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~AxisContextBase();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a category axis context (c:catAx element).
+ */
+class CatAxisContext : public AxisContextBase
+{
+public:
+ explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~CatAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a date axis context (c:dateAx element).
+ */
+class DateAxisContext : public AxisContextBase
+{
+public:
+ explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~DateAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a series axis context (c:serAx element).
+ */
+class SerAxisContext : public AxisContextBase
+{
+public:
+ explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~SerAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a value axis context (c:valAx element).
+ */
+class ValAxisContext : public AxisContextBase
+{
+public:
+ explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
+ virtual ~ValAxisContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axisconverter.hxx b/include/oox/drawingml/chart/axisconverter.hxx
new file mode 100644
index 000000000000..fac1d67c8997
--- /dev/null
+++ b/include/oox/drawingml/chart/axisconverter.hxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_AXISCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_AXISCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XAxis; }
+ namespace chart2 { class XCoordinateSystem; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisModel;
+class TypeGroupConverter;
+
+class AxisConverter : public ConverterBase< AxisModel >
+{
+public:
+ explicit AxisConverter(
+ const ConverterRoot& rParent,
+ AxisModel& rModel );
+ virtual ~AxisConverter();
+
+ /** Creates a chart2 axis and inserts it into the passed coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
+ TypeGroupConverter& rTypeGroup,
+ const AxisModel* pCrossingAxis,
+ sal_Int32 nAxesSetIdx,
+ sal_Int32 nAxisIdx );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/axismodel.hxx b/include/oox/drawingml/chart/axismodel.hxx
new file mode 100644
index 000000000000..30ceae499b0a
--- /dev/null
+++ b/include/oox/drawingml/chart/axismodel.hxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_AXISMODEL_HXX
+#define OOX_DRAWINGML_CHART_AXISMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct AxisDispUnitsModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Label frame formatting.
+ TextBodyRef mxTextProp; /// Label text formatting.
+ LayoutRef mxLayout; /// Layout/position of the axis units label.
+ TextRef mxText; /// Text source of the axis units label.
+ double mfCustomUnit; /// Custom unit size on value axis.
+ sal_Int32 mnBuiltInUnit; /// Built-in unit on value axis.
+
+ explicit AxisDispUnitsModel();
+ ~AxisDispUnitsModel();
+};
+
+// ============================================================================
+
+struct AxisModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< TitleModel > TitleRef;
+ typedef ModelRef< AxisDispUnitsModel > AxisDispUnitsRef;
+
+ ShapeRef mxShapeProp; /// Axis line formatting.
+ TextBodyRef mxTextProp; /// Axis label text formatting.
+ TitleRef mxTitle; /// Axis title.
+ AxisDispUnitsRef mxDispUnits; /// Axis units label.
+ ShapeRef mxMajorGridLines; /// Major grid lines formatting.
+ ShapeRef mxMinorGridLines; /// Minor grid lines formatting.
+ NumberFormat maNumberFormat; /// Number format for axis tick labels.
+ OptValue< double > mofCrossesAt; /// Position on this axis where another axis crosses.
+ OptValue< double > mofMajorUnit; /// Unit for major tick marks on date/value axis.
+ OptValue< double > mofMinorUnit; /// Unit for minor tick marks on date/value axis.
+ OptValue< double > mofLogBase; /// Logarithmic base for logarithmic axes.
+ OptValue< double > mofMax; /// Maximum axis value.
+ OptValue< double > mofMin; /// Minimum axis value.
+ OptValue< sal_Int32 > monBaseTimeUnit; /// Base time unit shown on a date axis.
+ sal_Int32 mnAxisId; /// Unique axis identifier.
+ sal_Int32 mnAxisPos; /// Position of the axis (top/bottom/left/right).
+ sal_Int32 mnCrossAxisId; /// Identifier of a crossing axis.
+ sal_Int32 mnCrossBetween; /// This value axis crosses between or inside category.
+ sal_Int32 mnCrossMode; /// Mode this axis crosses another axis (min, max, auto).
+ sal_Int32 mnLabelAlign; /// Tick mark label alignment.
+ sal_Int32 mnLabelOffset; /// Tick mark label distance from axis.
+ sal_Int32 mnMajorTickMark; /// Major tick mark style.
+ sal_Int32 mnMajorTimeUnit; /// Time unit for major tick marks on date axis.
+ sal_Int32 mnMinorTickMark; /// Mainor tick mark style.
+ sal_Int32 mnMinorTimeUnit; /// Time unit for minor tick marks on date axis.
+ sal_Int32 mnOrientation; /// Axis orientation (value order min to max, or max to min).
+ sal_Int32 mnTickLabelPos; /// Position of tick mark labels relative to the axis.
+ sal_Int32 mnTickLabelSkip; /// Number of tick mark labels to skip.
+ sal_Int32 mnTickMarkSkip; /// Number of tick marks to skip.
+ sal_Int32 mnTypeId; /// Type identifier of this axis.
+ bool mbAuto; /// True = automatic selection of text/date axis type.
+ bool mbDeleted; /// True = axis has been deleted manually.
+ bool mbNoMultiLevel; /// True = no multi-level categories supported.
+
+ explicit AxisModel( sal_Int32 nTypeId );
+ ~AxisModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartcontextbase.hxx b/include/oox/drawingml/chart/chartcontextbase.hxx
new file mode 100644
index 000000000000..218e7bf4406e
--- /dev/null
+++ b/include/oox/drawingml/chart/chartcontextbase.hxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
+#define OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox { namespace drawingml { class Shape; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+template< typename ModelType >
+class ContextBase : public ::oox::core::ContextHandler2
+{
+public:
+ inline explicit ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) :
+ ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {}
+ virtual ~ContextBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+template< typename ModelType >
+class FragmentBase : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit FragmentBase( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, ModelType& rModel ) :
+ ::oox::core::FragmentHandler2( rFilter, rFragmentPath, false ), mrModel( rModel ) {}
+ virtual ~FragmentBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+/** Help class for all contexts that have only the c:spPr child element.
+ */
+class ShapePrWrapperContext : public ContextBase< Shape >
+{
+public:
+ explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel );
+ virtual ~ShapePrWrapperContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LayoutModel;
+
+/** Handler for a chart layout context (c:layout element).
+ */
+class LayoutContext : public ContextBase< LayoutModel >
+{
+public:
+ explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel );
+ virtual ~LayoutContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartconverter.hxx b/include/oox/drawingml/chart/chartconverter.hxx
new file mode 100644
index 000000000000..bbc7e0fafd28
--- /dev/null
+++ b/include/oox/drawingml/chart/chartconverter.hxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_CHARTCONVERTER_HXX
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <oox/dllapi.h>
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Point; }
+ namespace awt { struct Size; }
+ namespace drawing { class XShapes; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2 { namespace data { class XDataProvider; } }
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+struct ChartSpaceModel;
+struct DataSequenceModel;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ChartConverter
+{
+public:
+ explicit ChartConverter();
+ virtual ~ChartConverter();
+
+ /** Converts the passed OOXML chart model to the passed chart2 document.
+
+ @param rChartModel The filled MSOOXML chart model structure.
+
+ @param rxChartDoc The UNO chart document model to be initialized.
+
+ @param rxExternalPage If null, all embedded shapes will be inserted
+ into the internal drawing page of the chart document. If not null,
+ all embedded shapes will be inserted into this shapes collection.
+
+ @param rChartPos The position of the chart shape in its drawing page,
+ in 1/100 mm. Will be used only, if parameter rxExternalPage is not
+ null, for correct positioning of the embedded shapes in the
+ external drawing page.
+
+ @param rChartSize The size of the chart shape in 1/100 mm. Needed for
+ calculation of position and size of the chart elements (diagram,
+ titles, legend, etc.) and embedded shapes.
+ */
+ void convertFromModel(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartSpaceModel& rChartModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
+ const ::com::sun::star::awt::Point& rChartPos,
+ const ::com::sun::star::awt::Size& rChartSize );
+
+ /** Creates an internal data provider. Derived classes may override this
+ function to create an external data provider. */
+ virtual void createDataProvider(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc );
+
+ /** Creates a data sequence from a formula. Dummy implementation. Derived
+ classes have to override this function to actually parse the formula. */
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >& rxDataProvider,
+ const DataSequenceModel& rDataSeq );
+
+private:
+ ChartConverter( const ChartConverter& );
+ ChartConverter& operator=( const ChartConverter& );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartdrawingfragment.hxx b/include/oox/drawingml/chart/chartdrawingfragment.hxx
new file mode 100644
index 000000000000..43d27f586514
--- /dev/null
+++ b/include/oox/drawingml/chart/chartdrawingfragment.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
+#define OOX_DRAWINGML_CHART_CHARTDRAWINGFRAGMENT_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Relative shape position in a chart object. */
+struct AnchorPosModel
+{
+ double mfX; /// X coordinate relative to chart object (0.0 to 1.0).
+ double mfY; /// Y coordinate relative to chart object (0.0 to 1.0).
+
+ inline explicit AnchorPosModel() : mfX( -1.0 ), mfY( -1.0 ) {}
+ inline bool isValid() const { return (0.0 <= mfX) && (mfX <= 1.0) && (0.0 <= mfY) && (mfY <= 1.0); }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Absolute shape size in a chart object (in EMUs). */
+struct AnchorSizeModel : public EmuSize
+{
+ inline explicit AnchorSizeModel() : EmuSize( -1, -1 ) {}
+ inline bool isValid() const { return (Width >= 0) && (Height >= 0); }
+};
+
+// ============================================================================
+
+/** Contains the position of a shape in the chart object. Supports different
+ shape anchor modes (absolute, relative).
+ */
+class ShapeAnchor
+{
+public:
+ explicit ShapeAnchor( bool bRelSize );
+
+ /** Imports the absolute anchor size from the cdr:ext element. */
+ void importExt( const AttributeList& rAttribs );
+ /** Sets an the relative anchor position from the cdr:from or cdr:to element. */
+ void setPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue );
+
+ /** Calculates the resulting shape anchor in EMUs. */
+ EmuRectangle calcAnchorRectEmu( const EmuRectangle& rChartRect ) const;
+
+private:
+ AnchorPosModel maFrom; /// Top-left position relative to chart object.
+ AnchorPosModel maTo; /// Bottom-right position relative to chart object.
+ AnchorSizeModel maSize; /// Shape size, if anchor has absolute size.
+ bool mbRelSize; /// True = relative size, false = absolute size.
+};
+
+typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef;
+
+// ============================================================================
+
+/** Handler for a chart drawing fragment (c:userShapes root element).
+ */
+class ChartDrawingFragment : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ChartDrawingFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxDrawPage,
+ const ::com::sun::star::awt::Size& rChartSize,
+ const ::com::sun::star::awt::Point& rShapesOffset,
+ bool bOleSupport );
+ virtual ~ChartDrawingFragment();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+ virtual void onEndElement();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
+ mxDrawPage; /// Drawing page of this sheet.
+ ::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
+ ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
+ EmuRectangle maChartRectEmu; /// Position and size of the chart object for embedded shapes (in EMUs).
+ bool mbOleSupport; /// True = allow to insert OLE objects into the drawing page.
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspaceconverter.hxx b/include/oox/drawingml/chart/chartspaceconverter.hxx
new file mode 100644
index 000000000000..2bdeb013b1b3
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspaceconverter.hxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace drawing { class XShapes; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel;
+
+class ChartSpaceConverter : public ConverterBase< ChartSpaceModel >
+{
+public:
+ explicit ChartSpaceConverter( const ConverterRoot& rParent, ChartSpaceModel& rModel );
+ virtual ~ChartSpaceConverter();
+
+ /** Converts the contained OOXML chart model to a chart2 document. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxExternalPage,
+ const ::com::sun::star::awt::Point& rChartPos );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspacefragment.hxx b/include/oox/drawingml/chart/chartspacefragment.hxx
new file mode 100644
index 000000000000..c9b1e0c6b776
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspacefragment.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACEFRAGMENT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel;
+
+/** Handler for a chart fragment (c:chartSpace root element).
+ */
+class ChartSpaceFragment : public FragmentBase< ChartSpaceModel >
+{
+public:
+ explicit ChartSpaceFragment(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ ChartSpaceModel& rModel );
+ virtual ~ChartSpaceFragment();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/chartspacemodel.hxx b/include/oox/drawingml/chart/chartspacemodel.hxx
new file mode 100644
index 000000000000..b3d3405c4670
--- /dev/null
+++ b/include/oox/drawingml/chart/chartspacemodel.hxx
@@ -0,0 +1,72 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX
+#define OOX_DRAWINGML_CHART_CHARTSPACEMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/plotareamodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct ChartSpaceModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< PlotAreaModel > PlotAreaRef;
+ typedef ModelRef< WallFloorModel > WallFloorRef;
+ typedef ModelRef< View3DModel > View3DRef;
+ typedef ModelRef< TitleModel > TitleRef;
+ typedef ModelRef< LegendModel > LegendRef;
+
+ ShapeRef mxShapeProp; /// Chart frame formatting.
+ TextBodyRef mxTextProp; /// Global chart text formatting.
+ PlotAreaRef mxPlotArea; /// Plot area of the chart.
+ WallFloorRef mxFloor; /// Floor formatting in 3D charts.
+ WallFloorRef mxBackWall; /// Back wall formatting in 3D charts.
+ WallFloorRef mxSideWall; /// Side wall formatting in 3D charts.
+ View3DRef mxView3D; /// 3D settings.
+ TitleRef mxTitle; /// Chart main title.
+ LegendRef mxLegend; /// Chart legend.
+ OUString maDrawingPath; /// Path to drawing fragment with embedded shapes.
+ sal_Int32 mnDispBlanksAs; /// Mode how to display blank values.
+ sal_Int32 mnStyle; /// Index to default formatting.
+ bool mbAutoTitleDel; /// True = automatic title deleted manually.
+ bool mbPlotVisOnly; /// True = plot visible cells in a sheet only.
+ bool mbShowLabelsOverMax;/// True = show labels over chart maximum.
+ bool mbPivotChart; /// True = pivot chart.
+
+ explicit ChartSpaceModel();
+ ~ChartSpaceModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/converterbase.hxx b/include/oox/drawingml/chart/converterbase.hxx
new file mode 100644
index 000000000000..21a03441e803
--- /dev/null
+++ b/include/oox/drawingml/chart/converterbase.hxx
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
+#define OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+#include "oox/drawingml/chart/objectformatter.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace awt { struct Rectangle; }
+ namespace awt { struct Size; }
+ namespace chart2 { class XChartDocument; }
+ namespace chart2 { class XTitle; }
+ namespace drawing { class XShape; }
+} } }
+
+namespace oox { namespace core {
+ class XmlFilterBase;
+} }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+class ChartConverter;
+struct ChartSpaceModel;
+struct ConverterData;
+
+// ============================================================================
+
+const sal_Int32 API_PRIM_AXESSET = 0;
+const sal_Int32 API_SECN_AXESSET = 1;
+
+const sal_Int32 API_X_AXIS = 0;
+const sal_Int32 API_Y_AXIS = 1;
+const sal_Int32 API_Z_AXIS = 2;
+
+// ============================================================================
+
+class ConverterRoot
+{
+public:
+ explicit ConverterRoot(
+ ::oox::core::XmlFilterBase& rFilter,
+ ChartConverter& rChartConverter,
+ const ChartSpaceModel& rChartModel,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ::com::sun::star::awt::Size& rChartSize );
+ virtual ~ConverterRoot();
+
+ /** Creates an instance for the passed service name, using the process service factory. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
+ createInstance( const OUString& rServiceName ) const;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ getComponentContext() const;
+
+protected:
+ /** Returns the filter object of the imported/exported document. */
+ ::oox::core::XmlFilterBase& getFilter() const;
+ /** Returns the chart converter. */
+ ChartConverter* getChartConverter() const;
+ /** Returns the API chart document model. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
+ getChartDocument() const;
+ /** Returns the position and size of the chart shape in 1/100 mm. */
+ const ::com::sun::star::awt::Size& getChartSize() const;
+ /** Returns the object formatter. */
+ ObjectFormatter& getFormatter() const;
+
+ /** Registers a title object and its layout data, needed for conversion of
+ the title position using the old Chart1 API. */
+ void registerTitleLayout(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle,
+ const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType,
+ sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
+ /** Converts the positions of the main title and all axis titles. */
+ void convertTitlePositions();
+
+private:
+ ::boost::shared_ptr< ConverterData > mxData;
+};
+
+// ============================================================================
+
+/** Base class of all converter classes. Holds a reference to a model structure
+ of the specified type.
+ */
+template< typename ModelType >
+class ConverterBase : public ConverterRoot
+{
+public:
+ inline const ModelType& getModel() const { return mrModel; }
+
+protected:
+ inline explicit ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) :
+ ConverterRoot( rParent ), mrModel( rModel ) {}
+ virtual ~ConverterBase() {}
+
+protected:
+ ModelType& mrModel;
+};
+
+// ============================================================================
+
+/** A layout converter calculates positions and sizes for various chart objects.
+ */
+class LayoutConverter : public ConverterBase< LayoutModel >
+{
+public:
+ explicit LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel );
+ virtual ~LayoutConverter();
+
+ /** Tries to calculate the absolute position and size from the contained
+ OOXML layout model. Returns true, if returned rectangle is valid. */
+ bool calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const;
+
+ /** Tries to set the position and size from the contained OOXML layout model.
+ Returns true, if a manual position and size could be calculated. */
+ bool convertFromModel( PropertySet& rPropSet );
+
+ /** Tries to set the position from the contained OOXML layout model.
+ Returns true, if a manual position could be calculated. */
+ bool convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
+ double fRotationAngle );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcecontext.hxx b/include/oox/drawingml/chart/datasourcecontext.hxx
new file mode 100644
index 000000000000..163b99c868e4
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcecontext.hxx
@@ -0,0 +1,94 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCECONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel;
+
+typedef ContextBase< DataSequenceModel > DataSequenceContextBase;
+
+// ============================================================================
+
+/** Handler for a double sequence context (c:numLit, c:numRef elements).
+ */
+class DoubleSequenceContext : public DataSequenceContextBase
+{
+public:
+ explicit DoubleSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
+ virtual ~DoubleSequenceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+private:
+ sal_Int32 mnPtIndex; /// Current data point index.
+};
+
+// ============================================================================
+
+/** Handler for a string sequence context (c:multiLvlStrRef, c:strLit,
+ c:strRef elements).
+ */
+class StringSequenceContext : public DataSequenceContextBase
+{
+public:
+ explicit StringSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
+ virtual ~StringSequenceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+
+private:
+ sal_Int32 mnPtIndex; /// Current data point index.
+};
+
+// ============================================================================
+
+struct DataSourceModel;
+
+/** Handler for a data source context (c:bubbleSize, c:cat, c:minus, c:plus,
+ c:val, c:xVal, c:yVal elements).
+ */
+class DataSourceContext : public ContextBase< DataSourceModel >
+{
+public:
+ explicit DataSourceContext( ::oox::core::ContextHandler2Helper& rParent, DataSourceModel& rModel );
+ virtual ~DataSourceContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourceconverter.hxx b/include/oox/drawingml/chart/datasourceconverter.hxx
new file mode 100644
index 000000000000..e8b5649e1bef
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourceconverter.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel;
+
+class DataSequenceConverter : public ConverterBase< DataSequenceModel >
+{
+public:
+ explicit DataSequenceConverter( const ConverterRoot& rParent, DataSequenceModel& rModel );
+ virtual ~DataSequenceConverter();
+
+ /** Creates a data sequence object from the contained formula link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+};
+
+// ============================================================================
+
+struct DataSourceModel;
+
+class DataSourceConverter : public ConverterBase< DataSourceModel >
+{
+public:
+ explicit DataSourceConverter( const ConverterRoot& rParent, DataSourceModel& rModel );
+ virtual ~DataSourceConverter();
+
+ /** Creates a data sequence object from the contained series data. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/datasourcemodel.hxx b/include/oox/drawingml/chart/datasourcemodel.hxx
new file mode 100644
index 000000000000..d43048ef071c
--- /dev/null
+++ b/include/oox/drawingml/chart/datasourcemodel.hxx
@@ -0,0 +1,65 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+#define OOX_DRAWINGML_CHART_DATASOURCEMODEL_HXX
+
+#include <com/sun/star/uno/Any.hxx>
+#include "oox/drawingml/chart/modelbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataSequenceModel
+{
+ typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > AnyMap;
+
+ AnyMap maData; /// Map of values, indexed by point identifier.
+ OUString maFormula; /// Formula reference, e.g. into a spreadsheet.
+ OUString maFormatCode; /// Number format for double values.
+ sal_Int32 mnPointCount; /// Number of points in this series source.
+
+ explicit DataSequenceModel();
+ ~DataSequenceModel();
+};
+
+// ============================================================================
+
+struct DataSourceModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+
+ DataSequenceRef mxDataSeq; /// The data sequence or formula link of this source.
+
+ explicit DataSourceModel();
+ ~DataSourceModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/modelbase.hxx b/include/oox/drawingml/chart/modelbase.hxx
new file mode 100644
index 000000000000..985221ec394b
--- /dev/null
+++ b/include/oox/drawingml/chart/modelbase.hxx
@@ -0,0 +1,134 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_MODELBASE_HXX
+#define OOX_DRAWINGML_CHART_MODELBASE_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/helper/refmap.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox { class AttributeList; }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+template< typename ModelType >
+class ModelRef : public ::boost::shared_ptr< ModelType >
+{
+public:
+ inline explicit ModelRef() {}
+ inline ModelRef( const ::boost::shared_ptr< ModelType >& rxModel ) : ::boost::shared_ptr< ModelType >( rxModel ) {}
+ inline ~ModelRef() {}
+
+ inline bool is() const { return this->get() != 0; }
+
+ inline ModelType& create() { this->reset( new ModelType ); return **this; }
+ template< typename Param1Type >
+ inline ModelType& create( const Param1Type& rParam1 ) { this->reset( new ModelType( rParam1 ) ); return **this; }
+
+ inline ModelType& getOrCreate() { if( !*this ) this->reset( new ModelType ); return **this; }
+ template< typename Param1Type >
+ inline ModelType& getOrCreate( const Param1Type& rParam1 ) { if( !*this ) this->reset( new ModelType( rParam1 ) ); return **this; }
+};
+
+// ============================================================================
+
+template< typename ModelType >
+class ModelVector : public RefVector< ModelType >
+{
+public:
+ typedef typename RefVector< ModelType >::value_type value_type;
+ typedef typename RefVector< ModelType >::size_type size_type;
+
+ inline explicit ModelVector() {}
+ inline ~ModelVector() {}
+
+ inline ModelType& create() { return append( new ModelType ); }
+ template< typename Param1Type >
+ inline ModelType& create( const Param1Type& rParam1 ) { return append( new ModelType( rParam1 ) ); }
+
+private:
+ inline ModelType& append( ModelType* pModel ) { this->push_back( value_type( pModel ) ); return *pModel; }
+};
+
+// ============================================================================
+
+template< typename KeyType, typename ModelType >
+class ModelMap : public RefMap< KeyType, ModelType >
+{
+public:
+ typedef typename RefMap< KeyType, ModelType >::key_type key_type;
+ typedef typename RefMap< KeyType, ModelType >::mapped_type mapped_type;
+ typedef typename RefMap< KeyType, ModelType >::value_type value_type;
+
+ inline explicit ModelMap() {}
+ inline ~ModelMap() {}
+
+ inline ModelType& create( KeyType eKey ) { return insert( eKey, new ModelType ); }
+ template< typename Param1Type >
+ inline ModelType& create( KeyType eKey, const Param1Type& rParam1 ) { return insert( eKey, new ModelType( rParam1 ) ); }
+
+private:
+ inline ModelType& insert( KeyType eKey, ModelType* pModel ) { (*this)[ eKey ].reset( pModel ); return *pModel; }
+};
+
+// ============================================================================
+
+struct NumberFormat
+{
+ OUString maFormatCode; /// Number format code.
+ bool mbSourceLinked; /// True = number format linked to source data.
+
+ explicit NumberFormat();
+
+ void setAttributes( const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LayoutModel
+{
+ double mfX; /// Left position of this object.
+ double mfY; /// Top position of this object.
+ double mfW; /// Width of this object.
+ double mfH; /// Height of this object.
+ sal_Int32 mnXMode; /// Mode for left position.
+ sal_Int32 mnYMode; /// Mode for top position.
+ sal_Int32 mnWMode; /// Mode for width.
+ sal_Int32 mnHMode; /// Mode for height.
+ sal_Int32 mnTarget; /// Layout target for plot area.
+ bool mbAutoLayout; /// True = automatic positioning.
+
+ explicit LayoutModel();
+ ~LayoutModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/objectformatter.hxx b/include/oox/drawingml/chart/objectformatter.hxx
new file mode 100644
index 000000000000..5b2bb727f4fd
--- /dev/null
+++ b/include/oox/drawingml/chart/objectformatter.hxx
@@ -0,0 +1,157 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
+#define OOX_DRAWINGML_CHART_OBJECTFORMATTER_HXX
+
+#include "oox/helper/propertyset.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/chart/modelbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XChartDocument; }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Enumerates different object types for specific automatic formatting behaviour. */
+enum ObjectType
+{
+ OBJECTTYPE_CHARTSPACE, /// Chart background.
+ OBJECTTYPE_CHARTTITLE, /// Chart title.
+ OBJECTTYPE_LEGEND, /// Legend.
+ OBJECTTYPE_PLOTAREA2D, /// Plot area containing axes and data series in 2D charts.
+ OBJECTTYPE_PLOTAREA3D, /// Plot area containing axes and data series in 3D charts.
+ OBJECTTYPE_WALL, /// Background and side wall in 3D charts.
+ OBJECTTYPE_FLOOR, /// Floor in 3D charts.
+ OBJECTTYPE_AXIS, /// Axis line, labels, tick marks.
+ OBJECTTYPE_AXISTITLE, /// Axis title.
+ OBJECTTYPE_AXISUNIT, /// Axis unit label.
+ OBJECTTYPE_MAJORGRIDLINE, /// Axis major grid line.
+ OBJECTTYPE_MINORGRIDLINE, /// Axis minor grid line.
+ OBJECTTYPE_LINEARSERIES2D, /// Linear series in 2D line/radarline/scatter charts.
+ OBJECTTYPE_FILLEDSERIES2D, /// Filled series in 2D bar/area/radararea/bubble/pie/surface charts.
+ OBJECTTYPE_FILLEDSERIES3D, /// Filled series in 3D charts.
+ OBJECTTYPE_DATALABEL, /// Labels for data points.
+ OBJECTTYPE_TRENDLINE, /// Data series trend line.
+ OBJECTTYPE_TRENDLINELABEL, /// Trend line label.
+ OBJECTTYPE_ERRORBAR, /// Data series error indicator line.
+ OBJECTTYPE_SERLINE, /// Data point connector lines.
+ OBJECTTYPE_LEADERLINE, /// Leader lines between pie slice and data label.
+ OBJECTTYPE_DROPLINE, /// Drop lines between data points and X axis.
+ OBJECTTYPE_HILOLINE, /// High/low lines in line/stock charts.
+ OBJECTTYPE_UPBAR, /// Up-bar in line/stock charts.
+ OBJECTTYPE_DOWNBAR, /// Down-bar in line/stock charts.
+ OBJECTTYPE_DATATABLE /// Data table.
+};
+
+// ============================================================================
+
+struct ChartSpaceModel;
+struct ObjectFormatterData;
+struct PictureOptionsModel;
+
+class ObjectFormatter
+{
+public:
+ explicit ObjectFormatter(
+ const ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
+ const ChartSpaceModel& rChartSpace );
+ ~ObjectFormatter();
+
+ /** Sets the maximum series index used for color cycling/fading. */
+ void setMaxSeriesIndex( sal_Int32 nMaxSeriesIdx );
+ /** Returns the current maximum series index used for color cycling/fading. */
+ sal_Int32 getMaxSeriesIndex() const;
+
+ /** Sets frame formatting properties to the passed property set. */
+ void convertFrameFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Sets frame formatting properties to the passed property set. */
+ void convertFrameFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ const PictureOptionsModel& rPicOptions,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Sets text formatting properties to the passed property set. */
+ void convertTextFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+ /** Sets frame/text formatting properties to the passed property set. */
+ void convertFormatting(
+ PropertySet& rPropSet,
+ const ModelRef< Shape >& rxShapeProp,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+ /** Sets text formatting properties to the passed property set. */
+ void convertTextFormatting(
+ PropertySet& rPropSet,
+ const TextCharacterProperties& rTextProps,
+ ObjectType eObjType );
+
+ /** Sets text rotation properties to the passed property set. */
+ void convertTextRotation(
+ PropertySet& rPropSet,
+ const ModelRef< TextBody >& rxTextProp,
+ bool bSupportsStacked );
+
+ /** Sets number format properties to the passed property set. */
+ void convertNumberFormat(
+ PropertySet& rPropSet,
+ const NumberFormat& rNumberFormat,
+ bool bPercentFormat = false );
+
+ /** Sets automatic fill properties to the passed property set. */
+ void convertAutomaticFill(
+ PropertySet& rPropSet,
+ ObjectType eObjType,
+ sal_Int32 nSeriesIdx = -1 );
+
+ /** Returns true, if the passed shape properties have automatic fill mode. */
+ static bool isAutomaticFill( const ModelRef< Shape >& rxShapeProp );
+
+private:
+ ::boost::shared_ptr< ObjectFormatterData > mxData;
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareacontext.hxx b/include/oox/drawingml/chart/plotareacontext.hxx
new file mode 100644
index 000000000000..d9966a8d8bf4
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareacontext.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREACONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel;
+
+/** Handler for a chart plot area context (c:plotArea element).
+ */
+class View3DContext : public ContextBase< View3DModel >
+{
+public:
+ explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel );
+ virtual ~View3DContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct WallFloorModel;
+
+/** Handler for a chart wall/floor context (c:backWall, c:floor, c:sideWall
+ elements).
+ */
+class WallFloorContext : public ContextBase< WallFloorModel >
+{
+public:
+ explicit WallFloorContext( ::oox::core::ContextHandler2Helper& rParent, WallFloorModel& rModel );
+ virtual ~WallFloorContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct PlotAreaModel;
+
+/** Handler for a chart plot area context (c:plotArea element).
+ */
+class PlotAreaContext : public ContextBase< PlotAreaModel >
+{
+public:
+ explicit PlotAreaContext( ::oox::core::ContextHandler2Helper& rParent, PlotAreaModel& rModel );
+ virtual ~PlotAreaContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareaconverter.hxx b/include/oox/drawingml/chart/plotareaconverter.hxx
new file mode 100644
index 000000000000..6796ffbd6a1c
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareaconverter.hxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREACONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDiagram; }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel;
+class TypeGroupConverter;
+
+class View3DConverter : public ConverterBase< View3DModel >
+{
+public:
+ explicit View3DConverter( const ConverterRoot& rParent, View3DModel& rModel );
+ virtual ~View3DConverter();
+
+ /** Converts the OOXML plot area model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ TypeGroupConverter& rTypeGroup );
+};
+
+// ============================================================================
+
+struct WallFloorModel;
+
+class WallFloorConverter : public ConverterBase< WallFloorModel >
+{
+public:
+ explicit WallFloorConverter( const ConverterRoot& rParent, WallFloorModel& rModel );
+ virtual ~WallFloorConverter();
+
+ /** Converts the OOXML wall/floor model to a chart2 diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ ObjectType eObjType );
+};
+
+// ============================================================================
+
+struct PlotAreaModel;
+
+class PlotAreaConverter : public ConverterBase< PlotAreaModel >
+{
+public:
+ explicit PlotAreaConverter( const ConverterRoot& rParent, PlotAreaModel& rModel );
+ virtual ~PlotAreaConverter();
+
+ /** Converts the OOXML plot area model to a chart2 diagram. */
+ void convertFromModel( View3DModel& rView3DModel );
+ /** Converts the manual plot area position and size, if set. */
+ void convertPositionFromModel();
+
+ /** Returns the automatic chart title if the chart contains only one series. */
+ inline const OUString& getAutomaticTitle() const { return maAutoTitle; }
+ /** Returns true, if the chart is three-dimensional. */
+ inline bool is3dChart() const { return mb3dChart; }
+ /** Returns true, if chart type supports wall and floor format in 3D mode. */
+ inline bool isWall3dChart() const { return mbWall3dChart; }
+
+private:
+ OUString maAutoTitle;
+ bool mb3dChart;
+ bool mbWall3dChart;
+ bool mbPieChart;
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/plotareamodel.hxx b/include/oox/drawingml/chart/plotareamodel.hxx
new file mode 100644
index 000000000000..2afd6ccdd1da
--- /dev/null
+++ b/include/oox/drawingml/chart/plotareamodel.hxx
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
+#define OOX_DRAWINGML_CHART_PLOTAREAMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/axismodel.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
+#include "oox/drawingml/chart/typegroupmodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct View3DModel
+{
+ OptValue< sal_Int32 > monHeightPercent; /// Height of the 3D view, relative to chart width.
+ OptValue< sal_Int32 > monRotationX; /// Horizontal rotation in degrees.
+ OptValue< sal_Int32 > monRotationY; /// Vertical rotation in degrees.
+ sal_Int32 mnDepthPercent; /// Depth of the 3D view, relative to chart width.
+ sal_Int32 mnPerspective; /// Eye distance to the 3D objects.
+ bool mbRightAngled; /// True = right-angled axes in 3D view.
+
+ explicit View3DModel();
+ ~View3DModel();
+};
+
+// ============================================================================
+
+struct WallFloorModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+
+ ShapeRef mxShapeProp; /// Wall/floor frame formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+
+ explicit WallFloorModel();
+ ~WallFloorModel();
+};
+
+// ============================================================================
+
+struct PlotAreaModel
+{
+ typedef ModelVector< TypeGroupModel > TypeGroupVector;
+ typedef ModelVector< AxisModel > AxisVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+
+ TypeGroupVector maTypeGroups; /// All chart type groups contained in the chart.
+ AxisVector maAxes; /// All axes contained in the chart.
+ ShapeRef mxShapeProp; /// Plot area frame formatting.
+ LayoutRef mxLayout; /// Layout/position of the plot area.
+
+ explicit PlotAreaModel();
+ ~PlotAreaModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriescontext.hxx b/include/oox/drawingml/chart/seriescontext.hxx
new file mode 100644
index 000000000000..e31156dd2796
--- /dev/null
+++ b/include/oox/drawingml/chart/seriescontext.hxx
@@ -0,0 +1,266 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_SERIESCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataLabelModel;
+
+/** Handler for a chart data point label context (c:dLbl element).
+ */
+class DataLabelContext : public ContextBase< DataLabelModel >
+{
+public:
+ explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct DataLabelsModel;
+
+/** Handler for a chart data point label context (c:dLbl element).
+ */
+class DataLabelsContext : public ContextBase< DataLabelsModel >
+{
+public:
+ explicit DataLabelsContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelsModel& rModel );
+ virtual ~DataLabelsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct PictureOptionsModel;
+
+/** Handler for fill bitmap settings (c:pictureOptions element).
+ */
+class PictureOptionsContext : public ContextBase< PictureOptionsModel >
+{
+public:
+ explicit PictureOptionsContext( ::oox::core::ContextHandler2Helper& rParent, PictureOptionsModel& rModel );
+ virtual ~PictureOptionsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct ErrorBarModel;
+
+/** Handler for a series error bar context (c:errBars element).
+ */
+class ErrorBarContext : public ContextBase< ErrorBarModel >
+{
+public:
+ explicit ErrorBarContext( ::oox::core::ContextHandler2Helper& rParent, ErrorBarModel& rModel );
+ virtual ~ErrorBarContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TrendlineLabelModel;
+
+/** Handler for a series trendline label context (c:trendlineLbl element).
+ */
+class TrendlineLabelContext : public ContextBase< TrendlineLabelModel >
+{
+public:
+ explicit TrendlineLabelContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineLabelModel& rModel );
+ virtual ~TrendlineLabelContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TrendlineModel;
+
+/** Handler for a series trendline context (c:trendline element).
+ */
+class TrendlineContext : public ContextBase< TrendlineModel >
+{
+public:
+ explicit TrendlineContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineModel& rModel );
+ virtual ~TrendlineContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct DataPointModel;
+
+/** Handler for a chart data point context (c:dPt element).
+ */
+class DataPointContext : public ContextBase< DataPointModel >
+{
+public:
+ explicit DataPointContext( ::oox::core::ContextHandler2Helper& rParent, DataPointModel& rModel );
+ virtual ~DataPointContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct SeriesModel;
+
+/** Handler base class for chart data series contexts (c:ser element).
+ */
+class SeriesContextBase : public ContextBase< SeriesModel >
+{
+public:
+ explicit SeriesContextBase( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~SeriesContextBase();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for area chart types (c:ser element).
+ */
+class AreaSeriesContext : public SeriesContextBase
+{
+public:
+ explicit AreaSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~AreaSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for bar chart types (c:ser element).
+ */
+class BarSeriesContext : public SeriesContextBase
+{
+public:
+ explicit BarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~BarSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for bubble chart types (c:ser element).
+ */
+class BubbleSeriesContext : public SeriesContextBase
+{
+public:
+ explicit BubbleSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~BubbleSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for line and stock chart types (c:ser
+ element).
+ */
+class LineSeriesContext : public SeriesContextBase
+{
+public:
+ explicit LineSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~LineSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for pie and doughnut chart types (c:ser
+ element).
+ */
+class PieSeriesContext : public SeriesContextBase
+{
+public:
+ explicit PieSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~PieSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for radar chart types (c:ser element).
+ */
+class RadarSeriesContext : public SeriesContextBase
+{
+public:
+ explicit RadarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~RadarSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for scatter chart types (c:ser element).
+ */
+class ScatterSeriesContext : public SeriesContextBase
+{
+public:
+ explicit ScatterSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~ScatterSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for a data series context for scatter chart types (c:ser element).
+ */
+class SurfaceSeriesContext : public SeriesContextBase
+{
+public:
+ explicit SurfaceSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
+ virtual ~SurfaceSeriesContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriesconverter.hxx b/include/oox/drawingml/chart/seriesconverter.hxx
new file mode 100644
index 000000000000..073073c5bbe7
--- /dev/null
+++ b/include/oox/drawingml/chart/seriesconverter.hxx
@@ -0,0 +1,167 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_SERIESCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+#include "oox/drawingml/chart/seriesmodel.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDataSeries; }
+ namespace chart2 { namespace data { class XLabeledDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+class TypeGroupConverter;
+
+// #i66858# enable this when Chart2 supports smoothed lines per data series
+#define OOX_CHART_SMOOTHED_PER_SERIES 0
+
+// ============================================================================
+
+class DataLabelConverter : public ConverterBase< DataLabelModel >
+{
+public:
+ explicit DataLabelConverter( const ConverterRoot& rParent, DataLabelModel& rModel );
+ virtual ~DataLabelConverter();
+
+ /** Converts OOXML data label settings for the passed data point. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup );
+
+ /** Conversion helper for data series and data points. */
+ static void convertLabelFormatting(
+ PropertySet& rPropSet,
+ ObjectFormatter& rFormatter,
+ const DataLabelModelBase& rDataLabel,
+ const TypeGroupConverter& rTypeGroup,
+ bool bDataSeriesLabel );
+};
+
+// ============================================================================
+
+class DataLabelsConverter : public ConverterBase< DataLabelsModel >
+{
+public:
+ explicit DataLabelsConverter( const ConverterRoot& rParent, DataLabelsModel& rModel );
+ virtual ~DataLabelsConverter();
+
+ /** Converts OOXML data label settings for the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup );
+};
+
+// ============================================================================
+
+class ErrorBarConverter : public ConverterBase< ErrorBarModel >
+{
+public:
+ explicit ErrorBarConverter( const ConverterRoot& rParent, ErrorBarModel& rModel );
+ virtual ~ErrorBarConverter();
+
+ /** Converts an OOXML errorbar and inserts it into the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence( ErrorBarModel::SourceType eSourceType );
+};
+
+// ============================================================================
+
+class TrendlineLabelConverter : public ConverterBase< TrendlineLabelModel >
+{
+public:
+ explicit TrendlineLabelConverter( const ConverterRoot& rParent, TrendlineLabelModel& rModel );
+ virtual ~TrendlineLabelConverter();
+
+ /** Converts the OOXML trendline label. */
+ void convertFromModel( PropertySet& rPropSet );
+};
+
+// ============================================================================
+
+class TrendlineConverter : public ConverterBase< TrendlineModel >
+{
+public:
+ explicit TrendlineConverter( const ConverterRoot& rParent, TrendlineModel& rModel );
+ virtual ~TrendlineConverter();
+
+ /** Converts an OOXML trendline and inserts it into the passed data series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries );
+};
+
+// ============================================================================
+
+class DataPointConverter : public ConverterBase< DataPointModel >
+{
+public:
+ explicit DataPointConverter( const ConverterRoot& rParent, DataPointModel& rModel );
+ virtual ~DataPointConverter();
+
+ /** Converts settings for a data point in the passed series. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxDataSeries,
+ const TypeGroupConverter& rTypeGroup,
+ const SeriesModel& rSeries );
+};
+
+// ============================================================================
+
+class SeriesConverter : public ConverterBase< SeriesModel >
+{
+public:
+ explicit SeriesConverter( const ConverterRoot& rParent, SeriesModel& rModel );
+ virtual ~SeriesConverter();
+
+ /** Creates a labeled data sequence object from category data link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createCategorySequence( const OUString& rRole );
+ /** Creates a labeled data sequence object from value data link. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createValueSequence( const OUString& rRole );
+ /** Creates a data series object with initialized source links. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
+ createDataSeries( const TypeGroupConverter& rTypeGroup, bool bVaryColorsByPoint );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createLabeledDataSequence(
+ SeriesModel::SourceType eSourceType,
+ const OUString& rRole,
+ bool bUseTextLabel );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/seriesmodel.hxx b/include/oox/drawingml/chart/seriesmodel.hxx
new file mode 100644
index 000000000000..998065f7f8ad
--- /dev/null
+++ b/include/oox/drawingml/chart/seriesmodel.hxx
@@ -0,0 +1,237 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_SERIESMODEL_HXX
+#define OOX_DRAWINGML_CHART_SERIESMODEL_HXX
+
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+#include "oox/drawingml/chart/titlemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct DataLabelModelBase
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ ShapeRef mxShapeProp; /// Data label frame formatting.
+ TextBodyRef mxTextProp; /// Data label text formatting.
+ NumberFormat maNumberFormat; /// Number format for numeric data labels.
+ OptValue< OUString > moaSeparator;/// Separator between label components.
+ OptValue< sal_Int32 > monLabelPos; /// Data label position.
+ OptValue< bool > mobShowBubbleSize; /// True = show size of bubbles in bubble charts.
+ OptValue< bool > mobShowCatName; /// True = show category name of data points.
+ OptValue< bool > mobShowLegendKey; /// True = show legend key of data series.
+ OptValue< bool > mobShowPercent; /// True = show percentual value in pie/doughnut charts.
+ OptValue< bool > mobShowSerName; /// True = show series name.
+ OptValue< bool > mobShowVal; /// True = show data point value.
+ bool mbDeleted; /// True = data label(s) deleted.
+
+ explicit DataLabelModelBase();
+ ~DataLabelModelBase();
+};
+
+// ============================================================================
+
+struct DataLabelModel : public DataLabelModelBase
+{
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ LayoutRef mxLayout; /// Layout/position of the data point label frame.
+ TextRef mxText; /// Manual or linked text for this data point label.
+ sal_Int32 mnIndex; /// Data point index for this data label.
+
+ explicit DataLabelModel();
+ ~DataLabelModel();
+};
+
+// ============================================================================
+
+struct DataLabelsModel : public DataLabelModelBase
+{
+ typedef ModelVector< DataLabelModel > DataLabelVector;
+ typedef ModelRef< Shape > ShapeRef;
+
+ DataLabelVector maPointLabels; /// Settings for individual data point labels.
+ ShapeRef mxLeaderLines; /// Formatting of connector lines between data points and labels.
+ bool mbShowLeaderLines; /// True = show connector lines between data points and labels.
+
+ explicit DataLabelsModel();
+ ~DataLabelsModel();
+};
+
+// ============================================================================
+
+struct PictureOptionsModel
+{
+ double mfStackUnit; /// Bitmap stacking unit.
+ sal_Int32 mnPictureFormat; /// Bitmap mode (stretch/tile).
+ bool mbApplyToFront; /// True = draw picture at front/back side of 3D data points.
+ bool mbApplyToSides; /// True = draw picture at left/right side of 3D data points.
+ bool mbApplyToEnd; /// True = draw picture at top/bottom side of 3D data points.
+
+ explicit PictureOptionsModel();
+ ~PictureOptionsModel();
+};
+
+// ============================================================================
+
+struct ErrorBarModel
+{
+ enum SourceType
+ {
+ PLUS, /// Plus error bar values.
+ MINUS /// Minus error bar values.
+ };
+
+ typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
+ typedef ModelRef< Shape > ShapeRef;
+
+ DataSourceMap maSources; /// Source ranges for manual error bar values.
+ ShapeRef mxShapeProp; /// Error line formatting.
+ double mfValue; /// Fixed value for several error bar types.
+ sal_Int32 mnDirection; /// Direction of the error bars (x/y).
+ sal_Int32 mnTypeId; /// Type of the error bars (plus/minus/both).
+ sal_Int32 mnValueType; /// Type of the values.
+ bool mbNoEndCap; /// True = no end cap at error bar lines.
+
+ explicit ErrorBarModel();
+ ~ErrorBarModel();
+};
+
+// ============================================================================
+
+struct TrendlineLabelModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Label frame formatting.
+ TextBodyRef mxTextProp; /// Label text formatting.
+ LayoutRef mxLayout; /// Layout/position of the frame.
+ TextRef mxText; /// Text source of the label.
+ NumberFormat maNumberFormat; /// Number format for coefficients.
+
+ explicit TrendlineLabelModel();
+ ~TrendlineLabelModel();
+};
+
+// ============================================================================
+
+struct TrendlineModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TrendlineLabelModel > TrendlineLabelRef;
+
+ ShapeRef mxShapeProp; /// Trendline formatting.
+ TrendlineLabelRef mxLabel; /// Trendline label text object.
+ OUString maName; /// User-defined name of the trendline.
+ OptValue< double > mfBackward; /// Size of trendline before first data point.
+ OptValue< double > mfForward; /// Size of trendline behind last data point.
+ OptValue< double > mfIntercept; /// Crossing point with Y axis.
+ sal_Int32 mnOrder; /// Polynomial order in range [2, 6].
+ sal_Int32 mnPeriod; /// Moving average period in range [2, 255].
+ sal_Int32 mnTypeId; /// Type of the trendline.
+ bool mbDispEquation; /// True = show equation of the trendline.
+ bool mbDispRSquared; /// True = show R-squared of the trendline.
+
+ explicit TrendlineModel();
+ ~TrendlineModel();
+};
+
+// ============================================================================
+
+struct DataPointModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+
+ ShapeRef mxShapeProp; /// Data point formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ OptValue< sal_Int32 > monExplosion; /// Pie slice moved from pie center.
+ OptValue< sal_Int32 > monMarkerSize; /// Size of the series line marker (2...72).
+ OptValue< sal_Int32 > monMarkerSymbol; /// Series line marker symbol.
+ OptValue< bool > mobBubble3d; /// True = show bubbles with 3D shade.
+ sal_Int32 mnIndex; /// Unique data point index.
+ bool mbInvertNeg; /// True = invert negative data points (not derived from series!).
+
+ explicit DataPointModel();
+ ~DataPointModel();
+};
+
+// ============================================================================
+
+struct SeriesModel
+{
+ enum SourceType
+ {
+ CATEGORIES, /// Data point categories.
+ VALUES, /// Data point values.
+ POINTS /// Data point size (e.g. bubble size in bubble charts).
+ };
+
+ typedef ModelMap< SourceType, DataSourceModel > DataSourceMap;
+ typedef ModelVector< ErrorBarModel > ErrorBarVector;
+ typedef ModelVector< TrendlineModel > TrendlineVector;
+ typedef ModelVector< DataPointModel > DataPointVector;
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< PictureOptionsModel > PictureOptionsRef;
+ typedef ModelRef< TextModel > TextRef;
+ typedef ModelRef< DataLabelsModel > DataLabelsRef;
+
+ DataSourceMap maSources; /// Series source ranges.
+ ErrorBarVector maErrorBars; /// All error bars of this series.
+ TrendlineVector maTrendlines; /// All trendlines of this series.
+ DataPointVector maPoints; /// Explicit formatted data points.
+ ShapeRef mxShapeProp; /// Series formatting.
+ PictureOptionsRef mxPicOptions; /// Fill bitmap settings.
+ ShapeRef mxMarkerProp; /// Data point marker formatting.
+ TextRef mxText; /// Series title source.
+ DataLabelsRef mxLabels; /// Data point label settings for all points.
+ OptValue< sal_Int32 > monShape; /// 3D bar shape type.
+ sal_Int32 mnExplosion; /// Pie slice moved from pie center.
+ sal_Int32 mnIndex; /// Series index used for automatic formatting.
+ sal_Int32 mnMarkerSize; /// Size of the series line marker (2...72).
+ sal_Int32 mnMarkerSymbol; /// Series line marker symbol.
+ sal_Int32 mnOrder; /// Series order.
+ bool mbBubble3d; /// True = show bubbles with 3D shade.
+ bool mbInvertNeg; /// True = invert negative data points.
+ bool mbSmooth; /// True = smooth series line.
+
+ explicit SeriesModel();
+ ~SeriesModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titlecontext.hxx b/include/oox/drawingml/chart/titlecontext.hxx
new file mode 100644
index 000000000000..b00a9ed45b6d
--- /dev/null
+++ b/include/oox/drawingml/chart/titlecontext.hxx
@@ -0,0 +1,83 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
+#define OOX_DRAWINGML_CHART_TITLECONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel;
+
+/** Handler for a chart text context (c:tx element).
+ */
+class TextContext : public ContextBase< TextModel >
+{
+public:
+ explicit TextContext( ::oox::core::ContextHandler2Helper& rParent, TextModel& rModel );
+ virtual ~TextContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onCharacters( const OUString& rChars );
+};
+
+// ============================================================================
+
+struct TitleModel;
+
+/** Handler for a chart title context (c:title element).
+ */
+class TitleContext : public ContextBase< TitleModel >
+{
+public:
+ explicit TitleContext( ::oox::core::ContextHandler2Helper& rParent, TitleModel& rModel );
+ virtual ~TitleContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct LegendModel;
+
+/** Handler for a chart legend context (c:legend element).
+ */
+class LegendContext : public ContextBase< LegendModel >
+{
+public:
+ explicit LegendContext( ::oox::core::ContextHandler2Helper& rParent, LegendModel& rModel );
+ virtual ~LegendContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titleconverter.hxx b/include/oox/drawingml/chart/titleconverter.hxx
new file mode 100644
index 000000000000..ad3694568efe
--- /dev/null
+++ b/include/oox/drawingml/chart/titleconverter.hxx
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
+#define OOX_DRAWINGML_CHART_TITLECONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XDiagram; }
+ namespace chart2 { class XFormattedString; }
+ namespace chart2 { class XTitled; }
+ namespace chart2 { namespace data { class XDataSequence; } }
+} } }
+
+namespace oox { namespace drawingml { struct TextCharacterProperties; } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel;
+
+class TextConverter : public ConverterBase< TextModel >
+{
+public:
+ explicit TextConverter( const ConverterRoot& rParent, TextModel& rModel );
+ virtual ~TextConverter();
+
+ /** Creates a data sequence object from the contained text data. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >
+ createDataSequence( const OUString& rRole );
+ /** Creates a sequence of formatted string objects. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >
+ createStringSequence(
+ const OUString& rDefaultText,
+ const ModelRef< TextBody >& rxTextProp,
+ ObjectType eObjType );
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString >
+ appendFormattedString(
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > >& orStringVec,
+ const OUString& rString,
+ bool bAddNewLine ) const;
+};
+
+// ============================================================================
+
+struct TitleModel;
+
+class TitleConverter : public ConverterBase< TitleModel >
+{
+public:
+ explicit TitleConverter( const ConverterRoot& rParent, TitleModel& rModel );
+ virtual ~TitleConverter();
+
+ /** Creates a title text object and attaches it at the passed interface. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitled >& rxTitled,
+ const OUString& rAutoTitle, ObjectType eObjType,
+ sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
+};
+
+// ============================================================================
+
+struct LegendModel;
+
+class LegendConverter : public ConverterBase< LegendModel >
+{
+public:
+ explicit LegendConverter( const ConverterRoot& rParent, LegendModel& rModel );
+ virtual ~LegendConverter();
+
+ /** Creates a legend object and attaches it at the passed diagram. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/titlemodel.hxx b/include/oox/drawingml/chart/titlemodel.hxx
new file mode 100644
index 000000000000..f365d0b6ec89
--- /dev/null
+++ b/include/oox/drawingml/chart/titlemodel.hxx
@@ -0,0 +1,89 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TITLEMODEL_HXX
+#define OOX_DRAWINGML_CHART_TITLEMODEL_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/chart/datasourcemodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct TextModel
+{
+ typedef ModelRef< DataSequenceModel > DataSequenceRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+
+ DataSequenceRef mxDataSeq; /// The string data or formula link of this text.
+ TextBodyRef mxTextBody; /// Rich-formatted literal text (for title objects only).
+
+ explicit TextModel();
+ ~TextModel();
+};
+
+// ============================================================================
+
+struct TitleModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+ typedef ModelRef< TextModel > TextRef;
+
+ ShapeRef mxShapeProp; /// Title shape formatting.
+ TextBodyRef mxTextProp; /// Title text formatting.
+ LayoutRef mxLayout; /// Layout/position of the frame.
+ TextRef mxText; /// Text source of the title.
+ bool mbOverlay; /// True = title may overlay other objects.
+
+ explicit TitleModel();
+ ~TitleModel();
+};
+
+// ============================================================================
+
+struct LegendModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+ typedef ModelRef< TextBody > TextBodyRef;
+ typedef ModelRef< LayoutModel > LayoutRef;
+
+ ShapeRef mxShapeProp; /// Legend shape formatting.
+ TextBodyRef mxTextProp; /// Legend text formatting.
+ LayoutRef mxLayout; /// Layout/position of the legend.
+ sal_Int32 mnPosition; /// Legend position.
+ bool mbOverlay; /// True = legend may overlay other objects.
+
+ explicit LegendModel();
+ ~LegendModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupcontext.hxx b/include/oox/drawingml/chart/typegroupcontext.hxx
new file mode 100644
index 000000000000..52667817ff0d
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupcontext.hxx
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/chart/chartcontextbase.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct UpDownBarsModel;
+
+/** Handler for an up/down bars context (c:upDownBars element).
+ */
+class UpDownBarsContext : public ContextBase< UpDownBarsModel >
+{
+public:
+ explicit UpDownBarsContext( ::oox::core::ContextHandler2Helper& rParent, UpDownBarsModel& rModel );
+ virtual ~UpDownBarsContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+typedef ContextBase< TypeGroupModel > TypeGroupContextBase;
+
+// ============================================================================
+
+/** Handler for area type group contexts (c:area3DChart, c:areaChart elements).
+ */
+class AreaTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~AreaTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for bar type group contexts (c:bar3DChart, c:barChart elements).
+ */
+class BarTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~BarTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for bubble type group context (c:bubbleChart element).
+ */
+class BubbleTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~BubbleTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for line type group contexts (c:line3DChart, c:lineChart,
+ c:stockChart elements).
+ */
+class LineTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~LineTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for pie type group contexts (c:doughnutChart, c:ofPieChart,
+ c:pie3DChart, c:pieChart elements).
+ */
+class PieTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~PieTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for radar type group context (c:radarChart element).
+ */
+class RadarTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~RadarTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for scatter type group context (c:scatterChart element).
+ */
+class ScatterTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~ScatterTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+/** Handler for surface type group contexts (c:surface3DChart, c:surfaceChart
+ elements).
+ */
+class SurfaceTypeGroupContext : public TypeGroupContextBase
+{
+public:
+ explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
+ virtual ~SurfaceTypeGroupContext();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupconverter.hxx b/include/oox/drawingml/chart/typegroupconverter.hxx
new file mode 100644
index 000000000000..dfce05065c18
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupconverter.hxx
@@ -0,0 +1,198 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPCONVERTER_HXX
+
+#include "oox/drawingml/chart/converterbase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace chart2 { class XChartType; }
+ namespace chart2 { class XCoordinateSystem; }
+ namespace chart2 { class XDataSeries; }
+ namespace chart2 { class XDiagram; }
+ namespace chart2 { namespace data { class XLabeledDataSequence; } }
+} } }
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+/** Enumerates different chart types. */
+enum TypeId
+{
+ TYPEID_BAR, /// Vertical bar chart.
+ TYPEID_HORBAR, /// Horizontal bar chart.
+ TYPEID_LINE, /// Line chart.
+ TYPEID_AREA, /// Area chart.
+ TYPEID_STOCK, /// Stock chart.
+ TYPEID_RADARLINE, /// Linear radar chart.
+ TYPEID_RADARAREA, /// Filled radar chart.
+ TYPEID_PIE, /// Pie chart.
+ TYPEID_DOUGHNUT, /// Doughnut (ring) chart.
+ TYPEID_OFPIE, /// Pie-to-pie or pie-to-bar chart.
+ TYPEID_SCATTER, /// Scatter (XY) chart.
+ TYPEID_BUBBLE, /// Bubble chart.
+ TYPEID_SURFACE, /// Surface chart.
+ TYPEID_UNKNOWN /// Default for unknown chart types.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates different categories of similar chart types. */
+enum TypeCategory
+{
+ TYPECATEGORY_BAR, /// Bar charts (horizontal or vertical).
+ TYPECATEGORY_LINE, /// Line charts (line, area, stock charts).
+ TYPECATEGORY_RADAR, /// Radar charts (linear or filled).
+ TYPECATEGORY_PIE, /// Pie and donut charts.
+ TYPECATEGORY_SCATTER, /// Scatter and bubble charts.
+ TYPECATEGORY_SURFACE /// Surface charts.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Enumerates modes for varying point colors in a series. */
+enum VarPointMode
+{
+ VARPOINTMODE_NONE, /// No varied colors supported.
+ VARPOINTMODE_SINGLE, /// Only supported, if type group contains only one series.
+ VARPOINTMODE_MULTI /// Supported for multiple series in a chart type group.
+};
+
+// ============================================================================
+
+/** Contains info for a chart type related to the OpenOffice.org chart module. */
+struct TypeGroupInfo
+{
+ TypeId meTypeId; /// Unique chart type identifier.
+ TypeCategory meTypeCategory; /// Category this chart type belongs to.
+ const sal_Char* mpcServiceName; /// Service name of the type.
+ VarPointMode meVarPointMode; /// Mode for varying point colors.
+ sal_Int32 mnDefLabelPos; /// Default data label position (API constant).
+ bool mbCombinable2d; /// True = types can be combined in one axes set.
+ bool mbSupports3d; /// True = 3D type allowed, false = only 2D type.
+ bool mbPolarCoordSystem; /// True = polar, false = cartesian.
+ bool mbSeriesIsFrame2d; /// True = 2D type series with area formatting.
+ bool mbSingleSeriesVis; /// True = only first series visible (e.g. pie charts).
+ bool mbCategoryAxis; /// True = X axis contains categories.
+ bool mbSwappedAxesSet; /// True = X axis and Y axis are swapped.
+ bool mbSupportsStacking; /// True = data points can be stacked on each other.
+ bool mbReverseSeries; /// True = insert unstacked series in reverse order.
+ bool mbTicksBetweenCateg; /// True = X axis ticks between categories.
+ bool mbPictureOptions; /// True = bitmaps support options from c:pictureOptions.
+};
+
+// ============================================================================
+
+struct UpDownBarsModel;
+
+class UpDownBarsConverter : public ConverterBase< UpDownBarsModel >
+{
+public:
+ explicit UpDownBarsConverter( const ConverterRoot& rParent, UpDownBarsModel& rModel );
+ virtual ~UpDownBarsConverter();
+
+ /** Converts the OOXML up/down bars. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType );
+};
+
+// ============================================================================
+
+struct TypeGroupModel;
+struct View3DModel;
+
+class TypeGroupConverter : public ConverterBase< TypeGroupModel >
+{
+public:
+ explicit TypeGroupConverter( const ConverterRoot& rParent, TypeGroupModel& rModel );
+ virtual ~TypeGroupConverter();
+
+ /** Returns the type info struct that describes this chart type group. */
+ inline const TypeGroupInfo& getTypeInfo() const { return maTypeInfo; }
+
+ /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
+ bool isStacked() const;
+ /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
+ bool isPercent() const;
+ /** Returns true, if the chart is three-dimensional. */
+ bool is3dChart() const;
+ /** Returns true, if chart type supports wall and floor format in 3D mode. */
+ bool isWall3dChart() const;
+ /** Returns true, if the series in this chart type group are ordered on the Z axis. */
+ bool isDeep3dChart() const;
+
+ /** Returns true, if this chart type supports area formatting for its series. */
+ bool isSeriesFrameFormat() const;
+ /** Returns the object type for a series depending on the chart type. */
+ ObjectType getSeriesObjectType() const;
+
+ /** Returns true, if this chart type has to reverse its series order. */
+ bool isReverseSeries() const;
+ /** Returns series title, if the chart type group contains only one single series. */
+ OUString getSingleSeriesTitle() const;
+
+ /** Creates a coordinate system according to the contained chart type. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >
+ createCoordinateSystem();
+ /** Creates a labeled data sequence object for axis categories. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >
+ createCategorySequence();
+
+ /** Converts the OOXML type group model into a chart2 coordinate system. */
+ void convertFromModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& rxDiagram,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
+ sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint );
+
+ /** Sets the passed OOXML marker style at the passed property set. */
+ void convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSymbol, sal_Int32 nOoxSize ) const;
+ /** Sets the passed OOXML line smoothing at the passed property set. */
+ void convertLineSmooth( PropertySet& rPropSet, bool bOoxSmooth ) const;
+ /** Sets the passed OOXML bar 3D geometry at the passed property set. */
+ void convertBarGeometry( PropertySet& rPropSet, sal_Int32 nOoxShape ) const;
+ /** Sets the passed OOXML pie rotation at the passed property set. */
+ void convertPieRotation( PropertySet& rPropSet, sal_Int32 nOoxAngle ) const;
+ /** Sets the passed OOXML pie explosion at the passed property set. */
+ void convertPieExplosion( PropertySet& rPropSet, sal_Int32 nOoxExplosion ) const;
+
+private:
+ /** Inserts the passed series into the chart type. Adds additional properties to the series. */
+ void insertDataSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& rxChartType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& rxSeries,
+ sal_Int32 nAxesSetIdx );
+
+private:
+ TypeGroupInfo maTypeInfo; /// Extended type info for contained chart type model.
+ bool mb3dChart; /// True = type is a 3D chart type.
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/chart/typegroupmodel.hxx b/include/oox/drawingml/chart/typegroupmodel.hxx
new file mode 100644
index 000000000000..1949a3ee892e
--- /dev/null
+++ b/include/oox/drawingml/chart/typegroupmodel.hxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
+#define OOX_DRAWINGML_CHART_TYPEGROUPMODEL_HXX
+
+#include "oox/drawingml/chart/seriesmodel.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace chart {
+
+// ============================================================================
+
+struct UpDownBarsModel
+{
+ typedef ModelRef< Shape > ShapeRef;
+
+ ShapeRef mxDownBars; /// Formatting of down bars.
+ ShapeRef mxUpBars; /// Formatting of up bars.
+ sal_Int32 mnGapWidth; /// Space between up/down bars.
+
+ explicit UpDownBarsModel();
+ ~UpDownBarsModel();
+};
+
+// ============================================================================
+
+struct TypeGroupModel
+{
+ typedef ModelVector< SeriesModel > SeriesVector;
+ typedef ::std::vector< sal_Int32 > AxisIdVector;
+ typedef ModelRef< DataLabelsModel > DataLabelsRef;
+ typedef ModelRef< UpDownBarsModel > UpDownBarsRef;
+ typedef ModelRef< Shape > ShapeRef;
+
+ SeriesVector maSeries; /// Series attached to this chart type group.
+ AxisIdVector maAxisIds; /// List of axis identifiers used by this chart type.
+ DataLabelsRef mxLabels; /// Data point label settings for all series.
+ UpDownBarsRef mxUpDownBars; /// Up/down bars in stock charts.
+ ShapeRef mxSerLines; /// Connector lines in stacked bar charts.
+ ShapeRef mxDropLines; /// Drop lines connecting data points with X axis.
+ ShapeRef mxHiLowLines; /// High/low lines connecting lowest and highest data points.
+ double mfSplitPos; /// Threshold value in pie-to charts.
+ sal_Int32 mnBarDir; /// Bar direction in bar charts (vertical/horizontal).
+ sal_Int32 mnBubbleScale; /// Relative scaling of bubble size (percent).
+ sal_Int32 mnFirstAngle; /// Rotation angle of first slice in pie charts.
+ sal_Int32 mnGapDepth; /// Space between series in deep 3D charts.
+ sal_Int32 mnGapWidth; /// Space between bars in bar charts, or space in pie-to charts.
+ sal_Int32 mnGrouping; /// Series grouping mode.
+ sal_Int32 mnHoleSize; /// Hole size in doughnut charts.
+ sal_Int32 mnOfPieType; /// Pie-to-pie or pie-to-bar chart.
+ sal_Int32 mnOverlap; /// Bar overlap per category (2D bar charts only).
+ sal_Int32 mnRadarStyle; /// Type of radar chart (lines, markers, filled).
+ sal_Int32 mnScatterStyle; /// Type of scatter chart (lines, markers, smooth).
+ sal_Int32 mnSecondPieSize; /// relative size of second pie/bar in pie-to charts (percent).
+ sal_Int32 mnShape; /// 3D bar shape type.
+ sal_Int32 mnSizeRepresents; /// Bubble size represents area or width.
+ sal_Int32 mnSplitType; /// Split type in pie-to charts.
+ sal_Int32 mnTypeId; /// Chart type identifier.
+ bool mbBubble3d; /// True = show bubbles with 3D shade.
+ bool mbShowMarker; /// True = show point markers in line charts.
+ bool mbShowNegBubbles; /// True = show absolute value of negative bubbles.
+ bool mbSmooth; /// True = smooth lines in line charts.
+ bool mbVaryColors; /// True = different automatic colors for each point.
+ bool mbWireframe; /// True = wireframe surface chart, false = filled surface chart.
+
+ explicit TypeGroupModel( sal_Int32 nTypeId );
+ ~TypeGroupModel();
+};
+
+// ============================================================================
+
+} // namespace chart
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrscheme.hxx b/include/oox/drawingml/clrscheme.hxx
new file mode 100644
index 000000000000..7c4f0106cb43
--- /dev/null
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CLRSCHEME_HXX
+#define OOX_DRAWINGML_CLRSCHEME_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <map>
+#include <vector>
+#include "oox/drawingml/color.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class ClrMap
+{
+ std::map < sal_Int32, sal_Int32 > maClrMap;
+
+public:
+
+ sal_Bool getColorMap( sal_Int32& nClrToken );
+ void setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken );
+};
+
+typedef boost::shared_ptr< ClrMap > ClrMapPtr;
+
+class OOX_DLLPUBLIC ClrScheme
+{
+ std::map < sal_Int32, sal_Int32 > maClrScheme;
+
+public:
+
+ ClrScheme();
+ ~ClrScheme();
+
+ sal_Bool getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const;
+ void setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor );
+};
+
+typedef boost::shared_ptr< ClrScheme > ClrSchemePtr;
+
+} }
+
+#endif // OOX_DRAWINGML_CLRSCHEME_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/clrschemecontext.hxx b/include/oox/drawingml/clrschemecontext.hxx
new file mode 100644
index 000000000000..466b852a37cf
--- /dev/null
+++ b/include/oox/drawingml/clrschemecontext.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+#define OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/colorchoicecontext.hxx"
+
+namespace oox { namespace drawingml {
+
+class clrMapContext : public oox::core::ContextHandler
+{
+public:
+ clrMapContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, ClrMap& rClrMap );
+};
+
+class clrSchemeColorContext : private Color, public ColorContext
+{
+public:
+ clrSchemeColorContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken );
+ virtual ~clrSchemeColorContext();
+
+private:
+ ClrScheme& mrClrScheme;
+ sal_Int32 mnColorToken;
+};
+
+class clrSchemeContext : public oox::core::ContextHandler
+{
+public:
+ clrSchemeContext( ::oox::core::ContextHandler& rParent, ClrScheme& rClrScheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ClrScheme& mrClrScheme;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CLRSCHEMECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
new file mode 100644
index 000000000000..b58f0b8ae5b3
--- /dev/null
+++ b/include/oox/drawingml/color.hxx
@@ -0,0 +1,144 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_COLOR_HXX
+#define OOX_DRAWINGML_COLOR_HXX
+
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <sal/types.h>
+#include <rtl/instance.hxx>
+#include <rtl/ustring.hxx>
+#include "oox/helper/helper.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { class GraphicHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Color
+{
+public:
+ Color();
+ ~Color();
+
+ /** Returns the RGB value for the passed DrawingML color token, or nDefaultRgb on error. */
+ static sal_Int32 getDmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+ /** Returns the RGB value for the passed VML color token, or nDefaultRgb on error. */
+ static sal_Int32 getVmlPresetColor( sal_Int32 nToken, sal_Int32 nDefaultRgb );
+
+ /** Sets the color to unused state. */
+ void setUnused();
+ /** Sets an RGB value (hexadecimal RRGGBB) from the a:srgbClr element. */
+ void setSrgbClr( sal_Int32 nRgb );
+ /** Sets the percentual RGB values from the a:scrgbClr element. */
+ void setScrgbClr( sal_Int32 nR, sal_Int32 nG, sal_Int32 nB );
+ /** Sets the HSL values from the a:hslClr element. */
+ void setHslClr( sal_Int32 nHue, sal_Int32 nSat, sal_Int32 nLum );
+ /** Sets a predefined color from the a:prstClr element. */
+ void setPrstClr( sal_Int32 nToken );
+ /** Sets a scheme color from the a:schemeClr element. */
+ void setSchemeClr( sal_Int32 nToken );
+ /** Sets a system color from the a:sysClr element. */
+ void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb );
+ /** Sets a palette color index. */
+ void setPaletteClr( sal_Int32 nPaletteIdx );
+
+ /** Inserts the passed color transformation. */
+ void addTransformation( sal_Int32 nElement, sal_Int32 nValue = -1 );
+ /** Inserts Chart specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addChartTintTransformation( double fTint );
+ /** Inserts Excel specific color tint (-1.0...0.0 = shade, 0.0...1.0 = tint). */
+ void addExcelTintTransformation( double fTint );
+ /** Removes all color transformations. */
+ void clearTransformations();
+ /** Removes transparence from the color. */
+ void clearTransparence();
+
+ /** Overwrites this color with the passed color, if it is used. */
+ inline void assignIfUsed( const Color& rColor ) { if( rColor.isUsed() ) *this = rColor; }
+
+ /** Returns true, if the color is initialized. */
+ bool isUsed() const { return meMode != COLOR_UNUSED; }
+ /** Returns true, if the color is a placeholder color in theme style lists. */
+ bool isPlaceHolder() const { return meMode == COLOR_PH; }
+ /** Returns the final RGB color value.
+ @param nPhClr Actual color for the phClr placeholder color used in theme style lists. */
+ sal_Int32 getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+
+ /** Returns true, if the color is transparent. */
+ bool hasTransparency() const;
+ /** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
+ sal_Int16 getTransparency() const;
+
+private:
+ /** Internal helper for getColor(). */
+ void setResolvedRgb( sal_Int32 nRgb ) const;
+
+ /** Converts the color components to RGB values. */
+ void toRgb() const;
+ /** Converts the color components to CRGB values (gamma corrected percentage). */
+ void toCrgb() const;
+ /** Converts the color components to HSL values. */
+ void toHsl() const;
+
+private:
+ enum ColorMode
+ {
+ COLOR_UNUSED, /// Color is not used, or undefined.
+ COLOR_RGB, /// Absolute RGB (r/g/b: 0...255).
+ COLOR_CRGB, /// Relative RGB (r/g/b: 0...100000).
+ COLOR_HSL, /// HSL (hue: 0...21600000, sat/lum: 0...100000).
+ COLOR_SCHEME, /// Color from scheme.
+ COLOR_PALETTE, /// Color from application defined palette.
+ COLOR_SYSTEM, /// Color from system palette.
+ COLOR_PH, /// Placeholder color in theme style lists.
+ COLOR_FINAL /// Finalized RGB color.
+ };
+
+ struct Transformation
+ {
+ sal_Int32 mnToken;
+ sal_Int32 mnValue;
+
+ explicit Transformation( sal_Int32 nToken, sal_Int32 nValue ) : mnToken( nToken ), mnValue( nValue ) {}
+ };
+ typedef ::std::vector< Transformation > TransformVec;
+
+ mutable ColorMode meMode; /// Current color mode.
+ mutable TransformVec maTransforms; /// Color transformations.
+ mutable sal_Int32 mnC1; /// Red, red%, hue, scheme token, palette index, system token, or final RGB.
+ mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB.
+ mutable sal_Int32 mnC3; /// Blue, blue%, or luminance.
+ sal_Int32 mnAlpha; /// Alpha value (color opacity).
+};
+
+typedef boost::shared_ptr< Color > ColorPtr;
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/colorchoicecontext.hxx b/include/oox/drawingml/colorchoicecontext.hxx
new file mode 100644
index 000000000000..aaacfd44d5b7
--- /dev/null
+++ b/include/oox/drawingml/colorchoicecontext.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_COLORCHOICECONTEXT_HXX
+#define OOX_DRAWINGML_COLORCHOICECONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+class Color;
+
+// ============================================================================
+
+/** Context handler for the different color value elements (a:scrgbClr,
+ a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */
+class ColorValueContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorValueContext( ::oox::core::ContextHandler& rParent, Color& rColor );
+
+ virtual void SAL_CALL startFastElement(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+/** Context handler for elements that *contain* a color value element
+ (a:scrgbClr, a:srgbClr, a:hslClr, a:sysClr, a:schemeClr, a:prstClr). */
+class ColorContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorContext( ::oox::core::ContextHandler& rParent, Color& rColor );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/connectorshapecontext.hxx b/include/oox/drawingml/connectorshapecontext.hxx
new file mode 100644
index 000000000000..48a03ae317af
--- /dev/null
+++ b/include/oox/drawingml/connectorshapecontext.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+#define OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ConnectorShapeContext : public ShapeContext
+{
+public:
+ ConnectorShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr );
+ virtual ~ConnectorShapeContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CONNECTORSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/customshapegeometry.hxx b/include/oox/drawingml/customshapegeometry.hxx
new file mode 100644
index 000000000000..3920881f123a
--- /dev/null
+++ b/include/oox/drawingml/customshapegeometry.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+#define OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml {
+
+
+// ---------------------------------------------------------------------
+// CT_CustomGeometry2D
+class CustomShapeGeometryContext : public ::oox::core::ContextHandler
+{
+public:
+ CustomShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+// ---------------------------------------------------------------------
+// CT_PresetGeometry2D
+class PresetShapeGeometryContext : public ::oox::core::ContextHandler
+{
+public:
+ PresetShapeGeometryContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+// ---------------------------------------------------------------------
+// CT_PresetTextShape
+class PresetTextShapeContext : public ::oox::core::ContextHandler
+{
+public:
+ PresetTextShapeContext( ::oox::core::ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, CustomShapeProperties& rCustomShapeProperties );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ CustomShapeProperties& mrCustomShapeProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CUSTOMSHAPEGEOMETRY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/customshapeproperties.hxx b/include/oox/drawingml/customshapeproperties.hxx
new file mode 100644
index 000000000000..e44f20db95e2
--- /dev/null
+++ b/include/oox/drawingml/customshapeproperties.hxx
@@ -0,0 +1,189 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+#define OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <boost/unordered_map.hpp>
+#include <vector>
+#include <map>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
+#include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
+#include <com/sun/star/beans/PropertyValues.hpp>
+#include <com/sun/star/drawing/ProjectionMode.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/token/tokens.hxx"
+
+namespace oox { namespace drawingml {
+
+class CustomShapeProperties;
+
+typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+struct CustomShapeGuide
+{
+ OUString maName;
+ OUString maFormula;
+};
+
+struct AdjustHandle
+{
+ sal_Bool polar;
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair
+ pos;
+
+ // depending to the type (polar or not):
+ OptValue< OUString > gdRef1; // gdRefX or gdRefR
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ min1; // minX or minR
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ max1; // maxX or maxR
+ OptValue< OUString > gdRef2; // gdRefY or gdRefAng
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ min2; // minX or minAng
+ OptValue< com::sun::star::drawing::EnhancedCustomShapeParameter >
+ max2; // maxY or maxAng
+
+ AdjustHandle( sal_Bool bPolar ) : polar( bPolar ) {};
+};
+
+struct ConnectionSite
+{
+ com::sun::star::drawing::EnhancedCustomShapeParameterPair
+ pos;
+ com::sun::star::drawing::EnhancedCustomShapeParameter
+ ang;
+};
+
+struct GeomRect
+{
+ com::sun::star::drawing::EnhancedCustomShapeParameter l;
+ com::sun::star::drawing::EnhancedCustomShapeParameter t;
+ com::sun::star::drawing::EnhancedCustomShapeParameter r;
+ com::sun::star::drawing::EnhancedCustomShapeParameter b;
+};
+
+struct Path2D
+{
+ sal_Int64 w;
+ sal_Int64 h;
+ sal_Int32 fill;
+ sal_Bool stroke;
+ sal_Bool extrusionOk;
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > parameter;
+
+ Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( sal_True ), extrusionOk( sal_True ) {};
+};
+
+
+class CustomShapeProvider {
+protected:
+ struct ParameterPairData {
+ sal_uInt16 nFirstType;
+ sal_uInt16 nSecondType;
+ sal_uInt32 nFirstValue;
+ sal_uInt32 nSecondValue;
+ };
+ static com::sun::star::uno::Any createStringSequence( size_t nStrings, const char **pStrings );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > createSegmentSequence( size_t nElems, const sal_uInt16 *pValues );
+ static com::sun::star::drawing::EnhancedCustomShapeParameterPair createParameterPair( const ParameterPairData *pData );
+ static com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > createParameterPairSequence( size_t nElems, const ParameterPairData *pData );
+public:
+ virtual ~CustomShapeProvider() {}
+ virtual PropertyMap getProperties() = 0;
+};
+
+class CustomShapeProperties
+{
+public:
+
+ CustomShapeProperties();
+ virtual ~CustomShapeProperties();
+
+ void pushToPropSet( const ::oox::core::FilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape);
+
+ sal_Int32 getShapePresetType() const { return mnShapePresetType; }
+ OUString getShapePresetTypeName() const;
+ void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
+
+ std::vector< CustomShapeGuide >& getAdjustmentGuideList(){ return maAdjustmentGuideList; };
+ std::vector< CustomShapeGuide >& getGuideList(){ return maGuideList; };
+ std::vector< AdjustHandle >& getAdjustHandleList(){ return maAdjustHandleList; };
+ std::vector< ConnectionSite >& getConnectionSiteList(){ return maConnectionSiteList; };
+ OptValue< GeomRect >& getTextRect(){ return maTextRect; };
+ std::vector< Path2D >& getPath2DList(){ return maPath2DList; };
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
+ void setMirroredX( sal_Bool bMirroredX ) { mbMirroredX = bMirroredX; };
+ void setMirroredY( sal_Bool bMirroredY ) { mbMirroredY = bMirroredY; };
+ void setTextRotateAngle( sal_Int32 nAngle ) { mnTextRotateAngle = nAngle; };
+
+ static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
+ static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
+
+ sal_Int32 getArcNum() { return mnArcNum++; }
+
+private:
+
+ sal_Int32 mnShapePresetType;
+ std::vector< CustomShapeGuide > maAdjustmentGuideList;
+ std::vector< CustomShapeGuide > maGuideList;
+ std::vector< AdjustHandle > maAdjustHandleList;
+ std::vector< ConnectionSite > maConnectionSiteList;
+ OptValue< GeomRect > maTextRect;
+ std::vector< Path2D > maPath2DList;
+
+ std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >
+ maSegments;
+ sal_Bool mbMirroredX;
+ sal_Bool mbMirroredY;
+ sal_Int32 mnTextRotateAngle;
+
+ typedef boost::unordered_map< sal_Int32, CustomShapeProvider * > PresetsMap;
+
+ static PresetsMap maPresetsMap;
+ static void initializePresetsMap();
+ static void initializePresetsMap1();
+ static void initializePresetsMap2();
+ static void initializePresetsMap3();
+ static void initializePresetsMap4();
+ static void initializePresetsMap5();
+ static void initializePresetsMap6();
+
+ sal_Int32 mnArcNum;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/diagram/diagram.hxx b/include/oox/drawingml/diagram/diagram.hxx
new file mode 100644
index 000000000000..e37c1a44e42f
--- /dev/null
+++ b/include/oox/drawingml/diagram/diagram.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_DIAGRAM_HXX
+#define OOX_DRAWINGML_DIAGRAM_HXX
+
+#include <rtl/ustring.hxx>
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/xml/dom/XDocument.hpp>
+
+namespace oox { namespace drawingml {
+
+/** load diagram data, and put resulting graphic into shape
+
+ This method loads the diagram data fragments from the given paths,
+ generate and layout the shapes, and push it as children into the
+ referenced shape.
+ */
+void loadDiagram( ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const OUString& rDataModelPath,
+ const OUString& rLayoutPath,
+ const OUString& rQStylePath,
+ const OUString& rColorStylePath );
+
+void loadDiagram( const ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXDataModelDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXLayoutDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXQStyleDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXColorStyleDom );
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
new file mode 100644
index 000000000000..5df664ee66a4
--- /dev/null
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -0,0 +1,200 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TYPES_HXX
+#define OOX_DRAWINGML_TYPES_HXX
+
+#include <boost/shared_ptr.hpp>
+#include <com/sun/star/style/TabAlign.hpp>
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+const sal_Int32 PER_PERCENT = 1000;
+const sal_Int32 MAX_PERCENT = 100 * PER_PERCENT;
+
+const sal_Int32 PER_DEGREE = 60000;
+const sal_Int32 MAX_DEGREE = 360 * PER_DEGREE;
+
+// ============================================================================
+
+struct LineProperties;
+typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
+
+struct FillProperties;
+typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
+
+struct GraphicProperties;
+typedef ::boost::shared_ptr< GraphicProperties > GraphicPropertiesPtr;
+
+struct Shape3DProperties;
+typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
+
+struct TextCharacterProperties;
+typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
+
+struct TextBodyProperties;
+typedef ::boost::shared_ptr< TextBodyProperties > TextBodyPropertiesPtr;
+
+struct EffectProperties;
+typedef ::boost::shared_ptr< EffectProperties > EffectPropertiesPtr;
+
+class TextBody;
+typedef ::boost::shared_ptr< TextBody > TextBodyPtr;
+
+class Shape;
+typedef ::boost::shared_ptr< Shape > ShapePtr;
+
+class Theme;
+typedef ::boost::shared_ptr< Theme > ThemePtr;
+
+// ---------------------------------------------------------------------------
+
+namespace table {
+
+class TableProperties;
+typedef ::boost::shared_ptr< TableProperties > TablePropertiesPtr;
+
+} // namespace table
+
+// ============================================================================
+
+/** converts the attributes from an CT_TLPoint into an awt Point with 1/1000% */
+com::sun::star::awt::Point GetPointPercent( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs );
+
+
+/** converts the attributes from an CT_Size2D into an awt Size with 1/100th mm */
+com::sun::star::awt::Size GetSize2D( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts the attributes from a CT_RelativeRect to an IntegerRectangle2D */
+com::sun::star::geometry::IntegerRectangle2D GetRelativeRect( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+/** converts EMUs into 1/100th mmm */
+sal_Int32 GetCoordinate( sal_Int32 nValue );
+
+/** converts an emu string into 1/100th mmm */
+sal_Int32 GetCoordinate( const OUString& sValue );
+
+/** converts a ST_Percentage % string into 1/1000th of % */
+sal_Int32 GetPercent( const OUString& sValue );
+
+/** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */
+double GetPositiveFixedPercentage( const OUString& sValue );
+
+/** converts the ST_TextFontSize to point */
+float GetTextSize( const OUString& rValue );
+
+/** converts the ST_TextSpacingPoint to 1/100mm */
+sal_Int32 GetTextSpacingPoint( const OUString& sValue );
+sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue );
+
+/** */
+::com::sun::star::style::TabAlign GetTabAlign( ::sal_Int32 aToken );
+
+float GetFontHeight( sal_Int32 nHeight );
+
+sal_Int16 GetFontUnderline( sal_Int32 nToken );
+
+sal_Int16 GetFontStrikeout( sal_Int32 nToken );
+
+sal_Int16 GetCaseMap( sal_Int32 nToken );
+
+/** converts a paragraph align to a ParaAdjust */
+sal_Int16 GetParaAdjust( sal_Int32 nAlign );
+
+// ============================================================================
+
+// CT_IndexRange
+struct IndexRange {
+ sal_Int32 start;
+ sal_Int32 end;
+};
+
+/** retrieve the content of CT_IndexRange */
+IndexRange GetIndexRange( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+// ============================================================================
+
+const sal_Int32 EMU_PER_HMM = 360; /// 360 EMUs per 1/100 mm.
+
+/** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
+inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
+{
+ return static_cast< sal_Int64 >( nValue ) * EMU_PER_HMM;
+}
+
+/** Converts the passed 64-bit integer value from EMUs to 1/100 mm. */
+inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
+{
+ return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + EMU_PER_HMM / 2) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
+}
+
+// ============================================================================
+
+/** A structure for a point with 64-bit interger components. */
+struct EmuPoint
+{
+ sal_Int64 X;
+ sal_Int64 Y;
+
+ inline explicit EmuPoint() : X( 0 ), Y( 0 ) {}
+ inline explicit EmuPoint( sal_Int64 nX, sal_Int64 nY ) : X( nX ), Y( nY ) {}
+};
+
+// ============================================================================
+
+/** A structure for a size with 64-bit interger components. */
+struct EmuSize
+{
+ sal_Int64 Width;
+ sal_Int64 Height;
+
+ inline explicit EmuSize() : Width( 0 ), Height( 0 ) {}
+ inline explicit EmuSize( sal_Int64 nWidth, sal_Int64 nHeight ) : Width( nWidth ), Height( nHeight ) {}
+};
+
+// ============================================================================
+
+/** A structure for a rectangle with 64-bit interger components. */
+struct EmuRectangle : public EmuPoint, public EmuSize
+{
+ inline explicit EmuRectangle() {}
+ inline explicit EmuRectangle( const EmuPoint& rPos, const EmuSize& rSize ) : EmuPoint( rPos ), EmuSize( rSize ) {}
+ inline explicit EmuRectangle( sal_Int64 nX, sal_Int64 nY, sal_Int64 nWidth, sal_Int64 nHeight ) : EmuPoint( nX, nY ), EmuSize( nWidth, nHeight ) {}
+
+ inline void setPos( const EmuPoint& rPos ) { static_cast< EmuPoint& >( *this ) = rPos; }
+ inline void setSize( const EmuSize& rSize ) { static_cast< EmuSize& >( *this ) = rSize; }
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/effectproperties.hxx b/include/oox/drawingml/effectproperties.hxx
new file mode 100644
index 000000000000..55c5ec34a20f
--- /dev/null
+++ b/include/oox/drawingml/effectproperties.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef OOX_DRAWINGML_EFFECTPROPERTIES_HXX
+#define OOX_DRAWINGML_EFFECTPROPERTIES_HXX
+
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct EffectShadowProperties
+{
+ OptValue< sal_Int64 > moShadowDist;
+ OptValue< sal_Int64 > moShadowDir;
+ OptValue< sal_Int64 > moShadowAlpha;
+ Color moShadowColor;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const EffectShadowProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC EffectProperties
+{
+ EffectShadowProperties maShadow;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const EffectProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/effectpropertiescontext.hxx b/include/oox/drawingml/effectpropertiescontext.hxx
new file mode 100644
index 000000000000..cd5e2eba28f5
--- /dev/null
+++ b/include/oox/drawingml/effectpropertiescontext.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+// ---------------------------------------------------------------------
+
+struct EffectProperties;
+
+class OOX_DLLPUBLIC EffectPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ EffectPropertiesContext( ::oox::core::ContextHandler& rParent,
+ EffectProperties& rEffectProperties ) throw();
+ ~EffectPropertiesContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ EffectProperties& mrEffectProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_EFFECTPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/embeddedwavaudiofile.hxx b/include/oox/drawingml/embeddedwavaudiofile.hxx
new file mode 100644
index 000000000000..97cebd54947b
--- /dev/null
+++ b/include/oox/drawingml/embeddedwavaudiofile.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
+#define OOX_DRAWINGML_EMBEDDEDWAVAUDIOFILE_HXX
+
+#include <rtl/ustring.hxx>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+
+#include "oox/core/fragmenthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+ struct EmbeddedWAVAudioFile
+ {
+ EmbeddedWAVAudioFile()
+ : mbBuiltIn(false)
+ {
+ }
+ bool mbBuiltIn;
+ OUString msName;
+ OUString msEmbed;
+ };
+
+ void getEmbeddedWAVAudioFile(
+ const ::oox::core::Relations& rRelations,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs,
+ EmbeddedWAVAudioFile & aAudio );
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/fillproperties.hxx b/include/oox/drawingml/fillproperties.hxx
new file mode 100644
index 000000000000..fb9aa849e92e
--- /dev/null
+++ b/include/oox/drawingml/fillproperties.hxx
@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_FILLPROPERTIES_HXX
+#define OOX_DRAWINGML_FILLPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/drawingml/embeddedwavaudiofile.hxx"
+
+namespace oox {
+ class GraphicHelper;
+ class PropertyMap;
+ class PropertySet;
+}
+
+namespace oox {
+namespace drawingml {
+
+class ShapePropertyMap;
+
+// ============================================================================
+
+struct GradientFillProperties
+{
+ typedef ::std::map< double, Color > GradientStopMap;
+
+ GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D > moTileRect;
+ OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
+ OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
+ OptValue< sal_Int32 > moShadeFlip; /// Flip mode of gradient, if not stretched to shape.
+ OptValue< bool > moShadeScaled; /// True = scale gradient into shape.
+ OptValue< bool > moRotateWithShape; /// True = rotate gradient with shape.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const GradientFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct PatternFillProperties
+{
+ Color maPattFgColor; /// Pattern foreground color.
+ Color maPattBgColor; /// Pattern background color.
+ OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const PatternFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct BlipFillProperties
+{
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >
+ mxGraphic; /// The fill graphic.
+ OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moFillRect; /// Stretch fill offsets.
+ OptValue< ::com::sun::star::geometry::IntegerRectangle2D >
+ moClipRect;
+ OptValue< sal_Int32 > moTileOffsetX; /// Width of bitmap tiles (EMUs).
+ OptValue< sal_Int32 > moTileOffsetY; /// Height of bitmap tiles (EMUs).
+ OptValue< sal_Int32 > moTileScaleX; /// Horizontal scaling of bitmap tiles (1/1000 percent).
+ OptValue< sal_Int32 > moTileScaleY; /// Vertical scaling of bitmap tiles (1/1000 percent).
+ OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
+ OptValue< sal_Int32 > moTileFlip; /// Flip mode of bitmap tiles.
+ OptValue< bool > moRotateWithShape; /// True = rotate bitmap with shape.
+ // effects
+ OptValue< sal_Int32 > moColorEffect; /// XML token for a color effect.
+ OptValue< sal_Int32 > moBrightness; /// Brightness in the range [-100000,100000].
+ OptValue< sal_Int32 > moContrast; /// Contrast in the range [-100000,100000].
+ Color maColorChangeFrom; /// Start color of color transformation.
+ Color maColorChangeTo; /// Destination color of color transformation.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const BlipFillProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC FillProperties
+{
+ OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
+ Color maFillColor; /// Solid fill color and transparence.
+ GradientFillProperties maGradientProps; /// Properties for gradient fills.
+ PatternFillProperties maPatternProps; /// Properties for pattern fills.
+ BlipFillProperties maBlipProps; /// Properties for bitmap fills.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const FillProperties& rSourceProps );
+
+ /** Tries to resolve current settings to a solid color, e.g. returns the
+ start color of a gradient. */
+ Color getBestSolidColor() const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nShapeRotation = 0,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT,
+ bool bFlipH = false,
+ bool bFlipV = false ) const;
+};
+
+// ============================================================================
+
+struct GraphicProperties
+{
+ BlipFillProperties maBlipProps; /// Properties for the graphic.
+ EmbeddedWAVAudioFile maAudio; /// Audio file details
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const GraphicProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/fillpropertiesgroupcontext.hxx b/include/oox/drawingml/fillpropertiesgroupcontext.hxx
new file mode 100644
index 000000000000..81d8a6e0db20
--- /dev/null
+++ b/include/oox/drawingml/fillpropertiesgroupcontext.hxx
@@ -0,0 +1,208 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
+#define OOX_DRAWINGML_FILLPROPERTIESGROUPCONTEXT_HPP
+
+#include "oox/drawingml/colorchoicecontext.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Context handler that imports the a:solidFill element. */
+class SolidFillContext : public ColorContext
+{
+public:
+ explicit SolidFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ FillProperties& rFillProps );
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:gradFill element. */
+class GradientFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit GradientFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ GradientFillProperties& rGradientProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ GradientFillProperties& mrGradientProps;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:pattFill element. */
+class PatternFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit PatternFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ PatternFillProperties& rPatternProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ PatternFillProperties& mrPatternProps;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Context handler that imports the a:clrChange element containing the colors
+ of a bitmap color change transformation. */
+class ColorChangeContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit ColorChangeContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+ virtual ~ColorChangeContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+ bool mbUseAlpha;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:blip element containing the fill bitmap
+ and bitmap color transformation settings. */
+class BlipContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit BlipContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+};
+
+// ============================================================================
+
+/** Context handler that imports the a:blipFill element. */
+class BlipFillContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit BlipFillContext(
+ ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ BlipFillProperties& rBlipProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ BlipFillProperties& mrBlipProps;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Context handler for elements that contain a fill property element
+ (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill). */
+class FillPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ explicit FillPropertiesContext(
+ ::oox::core::ContextHandler& rParent,
+ FillProperties& rFillProps );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler >
+ createFillContext(
+ ::oox::core::ContextHandler& rParent,
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs,
+ FillProperties& rFillProps );
+
+protected:
+ FillProperties& mrFillProps;
+};
+
+// ============================================================================
+
+/** Context handler for elements that contain a fill property element
+ (a:noFill, a:solidFill, a:gradFill, a:pattFill, a:blipFill, a:grpFill).
+
+ This context handler takes a simple color instead of a fill properties
+ struct. The imported fill properties are converted automatically to the
+ best fitting solid color.
+ */
+class SimpleFillPropertiesContext : private FillProperties, public FillPropertiesContext
+{
+public:
+ explicit SimpleFillPropertiesContext(
+ ::oox::core::ContextHandler& rParent,
+ Color& rColor );
+ virtual ~SimpleFillPropertiesContext();
+
+protected:
+ Color& mrColor;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx
new file mode 100644
index 000000000000..c5984d503363
--- /dev/null
+++ b/include/oox/drawingml/graphicshapecontext.hxx
@@ -0,0 +1,110 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+#define OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace vml { struct OleObjectInfo; } }
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC GraphicShapeContext : public ShapeContext
+{
+public:
+ GraphicShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+};
+
+// ====================================================================
+
+class OOX_DLLPUBLIC GraphicalObjectFrameContext : public ShapeContext
+{
+public:
+ GraphicalObjectFrameContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr, bool bEmbedShapesInChart );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ bool mbEmbedShapesInChart;
+};
+
+// ====================================================================
+
+class OleObjectGraphicDataContext : public ShapeContext
+{
+public:
+ OleObjectGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ ~OleObjectGraphicDataContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::oox::vml::OleObjectInfo& mrOleObjectInfo;
+};
+
+// ====================================================================
+
+class Diagram;
+
+class DiagramGraphicDataContext
+ : public ShapeContext
+{
+public:
+ DiagramGraphicDataContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ virtual ~DiagramGraphicDataContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ OUString msDm;
+ OUString msLo;
+ OUString msQs;
+ OUString msCs;
+};
+
+// ====================================================================
+
+class ChartGraphicDataContext : public ShapeContext
+{
+public:
+ explicit ChartGraphicDataContext(
+ ::oox::core::ContextHandler& rParent,
+ const ShapePtr& rxShape, bool bEmbedShapes );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext(
+ sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartShapeInfo& mrChartShapeInfo;
+};
+
+// ====================================================================
+
+} }
+
+#endif // OOX_DRAWINGML_GRAPHICSHAPECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/guidcontext.hxx b/include/oox/drawingml/guidcontext.hxx
new file mode 100644
index 000000000000..8a60bf20ab5c
--- /dev/null
+++ b/include/oox/drawingml/guidcontext.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_GUIDCONTEXT_HXX
+#define OOX_DRAWINGML_GUIDCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+ class GuidContext : public ::oox::core::ContextHandler
+ {
+
+ public:
+ GuidContext( ::oox::core::ContextHandler& rParent, OUString& rGuidId );
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ private:
+
+ OUString& mrGuidId;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/lineproperties.hxx b/include/oox/drawingml/lineproperties.hxx
new file mode 100644
index 000000000000..7ffdc04230a0
--- /dev/null
+++ b/include/oox/drawingml/lineproperties.hxx
@@ -0,0 +1,74 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_LINEPROPERTIES_HXX
+#define OOX_DRAWINGML_LINEPROPERTIES_HXX
+
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct LineArrowProperties
+{
+ OptValue< sal_Int32 > moArrowType;
+ OptValue< sal_Int32 > moArrowWidth;
+ OptValue< sal_Int32 > moArrowLength;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const LineArrowProperties& rSourceProps );
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC LineProperties
+{
+ typedef ::std::pair< sal_Int32, sal_Int32 > DashStop;
+ typedef ::std::vector< DashStop > DashStopVector;
+
+ LineArrowProperties maStartArrow; /// Start line arrow style.
+ LineArrowProperties maEndArrow; /// End line arrow style.
+ FillProperties maLineFill; /// Line fill (solid, gradient, ...).
+ DashStopVector maCustomDash; /// User-defined line dash style.
+ OptValue< sal_Int32 > moLineWidth; /// Line width (EMUs).
+ OptValue< sal_Int32 > moPresetDash; /// Preset dash (OOXML token).
+ OptValue< sal_Int32 > moLineCompound; /// Line compound type (OOXML token).
+ OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
+ OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const LineProperties& rSourceProps );
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ ShapePropertyMap& rPropMap,
+ const GraphicHelper& rGraphicHelper,
+ sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/linepropertiescontext.hxx b/include/oox/drawingml/linepropertiescontext.hxx
new file mode 100644
index 000000000000..e0454ddb2250
--- /dev/null
+++ b/include/oox/drawingml/linepropertiescontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+// ---------------------------------------------------------------------
+
+struct LineProperties;
+
+class OOX_DLLPUBLIC LinePropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ LinePropertiesContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
+ LineProperties& rLineProperties ) throw();
+ ~LinePropertiesContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
+ createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ LineProperties& mrLineProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_LINEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/objectdefaultcontext.hxx b/include/oox/drawingml/objectdefaultcontext.hxx
new file mode 100644
index 000000000000..b8b1d5b95ede
--- /dev/null
+++ b/include/oox/drawingml/objectdefaultcontext.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+#define OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class Theme;
+
+class objectDefaultContext : public oox::core::ContextHandler
+{
+public:
+ objectDefaultContext( ::oox::core::ContextHandler& rParent, Theme& rTheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Theme& mrTheme;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_OBJECTDEFAULTCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/scene3dcontext.hxx b/include/oox/drawingml/scene3dcontext.hxx
new file mode 100644
index 000000000000..cc3341ddf310
--- /dev/null
+++ b/include/oox/drawingml/scene3dcontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+#define OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct Shape3DProperties;
+
+// ---------------------------------------------------------------------
+
+class Scene3DPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ Scene3DPropertiesContext( ::oox::core::ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ Shape3DProperties& mr3DProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
new file mode 100644
index 000000000000..f8a58ec5340b
--- /dev/null
+++ b/include/oox/drawingml/shape.hxx
@@ -0,0 +1,273 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPE_HXX
+#define OOX_DRAWINGML_SHAPE_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/customshapeproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/shape3dproperties.hxx"
+
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <vector>
+#include <map>
+#include "oox/dllapi.h"
+
+namespace oox { namespace vml {
+ struct OleObjectInfo;
+} }
+
+namespace oox { namespace drawingml {
+
+class CustomShapeProperties;
+typedef boost::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
+
+typedef ::std::map< OUString, ShapePtr > ShapeIdMap;
+
+struct ShapeStyleRef
+{
+ Color maPhClr;
+ sal_Int32 mnThemedIdx;
+};
+
+typedef ::std::map< sal_Int32, ShapeStyleRef > ShapeStyleRefMap;
+
+// ============================================================================
+
+/** Additional information for a chart embedded in a drawing shape. */
+struct ChartShapeInfo
+{
+ OUString maFragmentPath; ///< Path to related XML stream, e.g. for charts.
+ bool mbEmbedShapes; ///< True = load chart shapes into chart, false = load into parent drawpage.
+
+ inline explicit ChartShapeInfo( bool bEmbedShapes ) : mbEmbedShapes( bEmbedShapes ) {}
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Shape
+ : public boost::enable_shared_from_this< Shape >
+{
+public:
+
+ explicit Shape( const sal_Char* pServiceType = 0 );
+ explicit Shape( const ShapePtr& pSourceShape );
+ virtual ~Shape();
+
+ OUString& getServiceName(){ return msServiceName; }
+ void setServiceName( const sal_Char* pServiceName );
+
+ PropertyMap& getShapeProperties(){ return maShapeProperties; }
+
+ inline LineProperties& getLineProperties() { return *mpLinePropertiesPtr; }
+ inline const LineProperties& getLineProperties() const { return *mpLinePropertiesPtr; }
+
+ inline FillProperties& getFillProperties() { return *mpFillPropertiesPtr; }
+ inline const FillProperties& getFillProperties() const { return *mpFillPropertiesPtr; }
+
+ inline GraphicProperties& getGraphicProperties() { return *mpGraphicPropertiesPtr; }
+ inline const GraphicProperties& getGraphicProperties() const { return *mpGraphicPropertiesPtr; }
+
+ CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
+
+ Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
+ const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
+
+ table::TablePropertiesPtr getTableProperties();
+
+ inline EffectProperties& getEffectProperties() { return *mpEffectPropertiesPtr; }
+
+ void setChildPosition( com::sun::star::awt::Point nPosition ){ maChPosition = nPosition; }
+ void setChildSize( com::sun::star::awt::Size aSize ){ maChSize = aSize; }
+ void moveAllToPosition( const com::sun::star::awt::Point &rPoint );
+
+ void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
+ const com::sun::star::awt::Point& getPosition() const { return maPosition; }
+
+ void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
+ const com::sun::star::awt::Size& getSize() const { return maSize; }
+
+ void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
+ void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
+ void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); }
+ std::vector< ShapePtr >& getChildren() { return maChildren; }
+
+ void setName( const OUString& rName ) { msName = rName; }
+ OUString getName( ) { return msName; }
+ void setId( const OUString& rId ) { msId = rId; }
+ OUString getId() { return msId; }
+ void setHidden( sal_Bool bHidden ) { mbHidden = bHidden; }
+ sal_Bool getHidden() const { return mbHidden; };
+ void setHiddenMasterShape( sal_Bool bHiddenMasterShape ) { mbHiddenMasterShape = bHiddenMasterShape; }
+ void setSubType( sal_Int32 nSubType ) { mnSubType = nSubType; }
+ sal_Int32 getSubType() const { return mnSubType; }
+ void setSubTypeIndex( sal_Int32 nSubTypeIndex ) { moSubTypeIndex = nSubTypeIndex; }
+ const OptValue< sal_Int32 >& getSubTypeIndex() const { return moSubTypeIndex; }
+
+ // setDefaults has to be called if styles are imported (OfficeXML is not storing properties having the default value)
+ void setDefaults();
+
+ ::oox::vml::OleObjectInfo& setOleObjectType();
+ ChartShapeInfo& setChartType( bool bEmbedShapes );
+ void setDiagramType();
+ void setTableType();
+
+ void setTextBody(const TextBodyPtr & pTextBody);
+ TextBodyPtr getTextBody();
+ void setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle );
+ TextListStylePtr getMasterTextListStyle() const { return mpMasterTextListStyle; }
+
+ inline ShapeStyleRefMap& getShapeStyleRefs() { return maShapeStyleRefs; }
+ inline const ShapeStyleRefMap& getShapeStyleRefs() const { return maShapeStyleRefs; }
+ const ShapeStyleRef* getShapeStyleRef( sal_Int32 nRefType ) const;
+
+ // addShape is creating and inserting the corresponding XShape.
+ void addShape(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ FillProperties& rShapeOrParentShapeFillProps,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
+ void dropChildren() { maChildren.clear(); }
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ basegfx::B2DHomMatrix& aTransformation,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
+ void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape )
+ { mxShape = rXShape; };
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
+ getXShape() const { return mxShape; }
+
+ virtual void applyShapeReference( const Shape& rReferencedShape, bool bUseText = true );
+ const ::std::vector<OUString>&
+ getExtDrawings() { return maExtDrawings; }
+ void addExtDrawingRelId( const OUString &rRelId ) { maExtDrawings.push_back( rRelId ); }
+
+protected:
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+ createAndInsert(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ const OUString& rServiceName,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle* pShapeRect,
+ sal_Bool bClearText,
+ sal_Bool bDoNotInsertEmptyTextBody,
+ basegfx::B2DHomMatrix& aTransformation,
+ FillProperties& rShapeOrParentShapeFillProps
+ );
+
+ void addChildren(
+ ::oox::core::XmlFilterBase& rFilterBase,
+ Shape& rMaster,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle& rClientRect,
+ ShapeIdMap* pShapeMap,
+ basegfx::B2DHomMatrix& aTransformation );
+
+ virtual OUString finalizeServiceName(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rServiceName,
+ const ::com::sun::star::awt::Rectangle& rShapeRect );
+
+ virtual void finalizeXShape(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+
+ std::vector< ShapePtr > maChildren; // only used for group shapes
+ com::sun::star::awt::Size maChSize; // only used for group shapes
+ com::sun::star::awt::Point maChPosition; // only used for group shapes
+ com::sun::star::awt::Size maAbsoluteSize; // only used for group shapes
+ com::sun::star::awt::Point maAbsolutePosition; // only used for group shapes
+ sal_Bool mbIsChild;
+
+ TextBodyPtr mpTextBody;
+ LinePropertiesPtr mpLinePropertiesPtr;
+ FillPropertiesPtr mpFillPropertiesPtr;
+ GraphicPropertiesPtr mpGraphicPropertiesPtr;
+ CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
+ table::TablePropertiesPtr mpTablePropertiesPtr;
+ Shape3DPropertiesPtr mp3DPropertiesPtr;
+ EffectPropertiesPtr mpEffectPropertiesPtr;
+ PropertyMap maShapeProperties;
+ PropertyMap maDefaultShapeProperties;
+ TextListStylePtr mpMasterTextListStyle;
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
+
+ OUString msServiceName;
+ OUString msName;
+ OUString msId;
+ sal_Int32 mnSubType; // if this type is not zero, then the shape is a placeholder
+ OptValue< sal_Int32 > moSubTypeIndex;
+
+ ShapeStyleRefMap maShapeStyleRefs;
+
+ com::sun::star::awt::Size maSize;
+ com::sun::star::awt::Point maPosition;
+ ::std::vector<OUString> maExtDrawings;
+
+private:
+ enum FrameType
+ {
+ FRAMETYPE_GENERIC, ///< Generic shape, no special type.
+ FRAMETYPE_OLEOBJECT, ///< OLE object embedded in a shape.
+ FRAMETYPE_CHART, ///< Chart embedded in a shape.
+ FRAMETYPE_DIAGRAM, ///< Complex diagram drawing shape.
+ FRAMETYPE_TABLE ///< A table embedded in a shape.
+ };
+
+ typedef ::boost::shared_ptr< ::oox::vml::OleObjectInfo > OleObjectInfoRef;
+ typedef ::boost::shared_ptr< ChartShapeInfo > ChartShapeInfoRef;
+
+ FrameType meFrameType; ///< Type for graphic frame shapes.
+ OleObjectInfoRef mxOleObjectInfo; ///< Additional data for OLE objects.
+ ChartShapeInfoRef mxChartShapeInfo; ///< Additional data for chart shapes.
+
+ sal_Int32 mnRotation;
+ sal_Bool mbFlipH;
+ sal_Bool mbFlipV;
+ sal_Bool mbHidden;
+ sal_Bool mbHiddenMasterShape; // master shapes can be hidden in layout slides
+ // we need separate flag because we don't want
+ // to propagate it when applying reference shape
+};
+
+// ============================================================================
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
new file mode 100644
index 000000000000..d1891402757c
--- /dev/null
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -0,0 +1,125 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+#define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+
+namespace oox { class PropertyMap; }
+namespace oox { class PropertySet; }
+namespace oox { namespace core { class ModelObjectContainer; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct Shape3DPropertyNames
+{
+ OUString maFillStyle;
+ OUString maFillColor;
+ OUString maFillTransparence;
+ OUString maFillGradient;
+ OUString maFillBitmap;
+ OUString maFillBitmapMode;
+ OUString maFillBitmapTile;
+ OUString maFillBitmapStretch;
+ OUString maFillBitmapLogicalSize;
+ OUString maFillBitmapSizeX;
+ OUString maFillBitmapSizeY;
+ OUString maFillBitmapOffsetX;
+ OUString maFillBitmapOffsetY;
+ OUString maFillBitmapRectanglePoint;
+ bool mbNamedFillGradient;
+ bool mbNamedFillBitmap;
+ bool mbTransformGraphic;
+
+ Shape3DPropertyNames();
+};
+
+// ============================================================================
+
+struct Shape3DProperties
+{
+ typedef ::std::map< double, Color > GradientStopMap;
+
+ OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
+ OptValue< bool > moRotateWithShape; /// True = rotate gradient/bitmap with shape.
+ Color maFillColor; /// Solid fill color and transparence.
+ GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
+ OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
+ OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
+ OptValue< bool > moShadeScaled;
+ OptValue< sal_Int32 > moFlipModeToken;
+ OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
+ OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect;
+ OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
+ Color maPattFgColor; /// Pattern foreground color.
+ Color maPattBgColor; /// Pattern background color.
+ ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic;
+ Color maColorChangeFrom; /// Start color of color transformation.
+ Color maColorChangeTo; /// Destination color of color transformation.
+ OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
+ OptValue< sal_Int32 > moTileX; /// Width of bitmap tiles.
+ OptValue< sal_Int32 > moTileY; /// Height of bitmap tiles.
+ OptValue< sal_Int32 > moTileSX;
+ OptValue< sal_Int32 > moTileSY;
+ OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
+
+ static Shape3DPropertyNames DEFAULTNAMES; /// Default fill property names for shape fill.
+ static Shape3DPropertyNames DEFAULTPICNAMES; /// Default fill property names for pictures.
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const Shape3DProperties& rSourceProps );
+
+ /** Tries to resolve current settings to a solid color, e.g. returns the
+ start color of a gradient. */
+ Color getBestSolidColor() const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const Shape3DPropertyNames& rPropNames,
+ const ::oox::core::XmlFilterBase& rFilter,
+ ::oox::core::ModelObjectContainer& rObjContainer,
+ sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+ const Shape3DPropertyNames& rPropNames,
+ const ::oox::core::XmlFilterBase& rFilter,
+ ::oox::core::ModelObjectContainer& rObjContainer,
+ sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapecontext.hxx b/include/oox/drawingml/shapecontext.hxx
new file mode 100644
index 000000000000..277ee91017ec
--- /dev/null
+++ b/include/oox/drawingml/shapecontext.hxx
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPECONTEXT_HXX
+
+#include <com/sun/star/drawing/XShapes.hpp>
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapepropertiescontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr );
+ virtual ~ShapeContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+ ShapePtr getShape();
+
+protected:
+
+ ShapePtr mpMasterShapePtr;
+ ShapePtr mpShapePtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapegroupcontext.hxx b/include/oox/drawingml/shapegroupcontext.hxx
new file mode 100644
index 000000000000..65b86ac99567
--- /dev/null
+++ b/include/oox/drawingml/shapegroupcontext.hxx
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+#define OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeGroupContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeGroupContext( ::oox::core::ContextHandler& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr );
+ virtual ~ShapeGroupContext();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+
+ ShapePtr mpGroupShapePtr;
+ ShapePtr mpMasterShapePtr;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertiescontext.hxx b/include/oox/drawingml/shapepropertiescontext.hxx
new file mode 100644
index 000000000000..31da8a9c0f23
--- /dev/null
+++ b/include/oox/drawingml/shapepropertiescontext.hxx
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml {
+
+class ShapePropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapePropertiesContext( ::oox::core::ContextHandler& rParent, Shape& rShape );
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapepropertymap.hxx b/include/oox/drawingml/shapepropertymap.hxx
new file mode 100644
index 000000000000..a5cc12f5484c
--- /dev/null
+++ b/include/oox/drawingml/shapepropertymap.hxx
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+#define OOX_DRAWINGML_SHAPEPROPERTYMAP_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/dllapi.h"
+
+namespace oox { class ModelObjectHelper; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** Enumeration for various properties related to drawing shape formatting.
+
+ This is an abstraction for shape formatting properties that have different
+ names in various implementations, e.g. drawing shapes vs. chart objects.
+ */
+enum ShapePropertyId
+{
+ SHAPEPROP_LineStyle,
+ SHAPEPROP_LineWidth,
+ SHAPEPROP_LineColor,
+ SHAPEPROP_LineTransparency,
+ SHAPEPROP_LineDash, /// Explicit line dash or name of a line dash stored in a global container.
+ SHAPEPROP_LineJoint,
+ SHAPEPROP_LineStart, /// Explicit line start marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineStartWidth,
+ SHAPEPROP_LineStartCenter,
+ SHAPEPROP_LineEnd, /// Explicit line end marker or name of a line marker stored in a global container.
+ SHAPEPROP_LineEndWidth,
+ SHAPEPROP_LineEndCenter,
+ SHAPEPROP_FillStyle,
+ SHAPEPROP_FillColor,
+ SHAPEPROP_FillTransparency,
+ SHAPEPROP_GradientTransparency,
+ SHAPEPROP_FillGradient, /// Explicit fill gradient or name of a fill gradient stored in a global container.
+ SHAPEPROP_FillBitmapUrl, /// Explicit fill bitmap URL or name of a fill bitmap URL stored in a global container.
+ SHAPEPROP_FillBitmapMode,
+ SHAPEPROP_FillBitmapSizeX,
+ SHAPEPROP_FillBitmapSizeY,
+ SHAPEPROP_FillBitmapOffsetX,
+ SHAPEPROP_FillBitmapOffsetY,
+ SHAPEPROP_FillBitmapRectanglePoint,
+ SHAPEPROP_ShadowXDistance,
+ SHAPEPROP_END
+};
+
+// ============================================================================
+
+struct OOX_DLLPUBLIC ShapePropertyInfo
+{
+ const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties.
+ bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
+ bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
+ bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
+ bool mbNamedFillBitmapUrl; /// True = use named fill bitmap URL instead of explicit fill bitmap URL.
+
+ static ShapePropertyInfo DEFAULT; /// Default property info (used as default parameter of other methods).
+
+ explicit ShapePropertyInfo(
+ const sal_Int32* pnPropertyIds,
+ bool bNamedLineMarker,
+ bool bNamedLineDash,
+ bool bNamedFillGradient,
+ bool bNamedFillBitmapUrl );
+
+ inline bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
+};
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ShapePropertyMap : public PropertyMap
+{
+public:
+ explicit ShapePropertyMap(
+ ModelObjectHelper& rModelObjHelper,
+ const ShapePropertyInfo& rShapePropInfo = ShapePropertyInfo::DEFAULT );
+
+ /** Returns true, if the specified property is supported. */
+ bool supportsProperty( ShapePropertyId ePropId ) const;
+
+ /** Returns true, if named line markers are supported, and the specified
+ line marker has already been inserted into the marker table. */
+ bool hasNamedLineMarkerInTable( const OUString& rMarkerName ) const;
+
+ /** Sets the specified shape property to the passed value. */
+ bool setAnyProperty( ShapePropertyId ePropId, const ::com::sun::star::uno::Any& rValue );
+
+ /** Sets the specified shape property to the passed value. */
+ template< typename Type >
+ inline bool setProperty( ShapePropertyId ePropId, const Type& rValue )
+ { return setAnyProperty( ePropId, ::com::sun::star::uno::Any( rValue ) ); }
+
+ using PropertyMap::setAnyProperty;
+ using PropertyMap::setProperty;
+ using PropertyMap::operator[];
+
+private:
+ /** Sets an explicit line marker, or creates a named line marker. */
+ bool setLineMarker( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit line dash, or creates a named line dash. */
+ bool setLineDash( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill gradient, or creates a named fill gradient. */
+ bool setFillGradient( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Creates a named transparency gradient. */
+ bool setGradientTrans( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+ /** Sets an explicit fill bitmap URL, or creates a named fill bitmap URL. */
+ bool setFillBitmapUrl( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
+
+ // not implemented, to prevent implicit conversion from enum to int
+ ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId );
+ const ::com::sun::star::uno::Any& operator[]( ShapePropertyId ePropId ) const;
+
+private:
+ ModelObjectHelper& mrModelObjHelper;
+ ShapePropertyInfo maShapePropInfo;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/shapestylecontext.hxx b/include/oox/drawingml/shapestylecontext.hxx
new file mode 100644
index 000000000000..88338a16b59a
--- /dev/null
+++ b/include/oox/drawingml/shapestylecontext.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class ShapeStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ ShapeStyleContext( ::oox::core::ContextHandler& rParent, Shape& rShape );
+ ~ShapeStyleContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPESTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/spdefcontext.hxx b/include/oox/drawingml/spdefcontext.hxx
new file mode 100644
index 000000000000..1fa773fb57dc
--- /dev/null
+++ b/include/oox/drawingml/spdefcontext.hxx
@@ -0,0 +1,42 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_SPDEFCONTEXT_HXX
+#define OOX_DRAWINGML_SPDEFCONTEXT_HXX
+
+#include "oox/drawingml/shape.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class spDefContext : public oox::core::ContextHandler
+{
+public:
+ spDefContext( ::oox::core::ContextHandler& rParent, Shape& rDefaultObject );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrDefaultObject;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SPDEFCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablebackgroundstylecontext.hxx b/include/oox/drawingml/table/tablebackgroundstylecontext.hxx
new file mode 100644
index 000000000000..185987df8ad7
--- /dev/null
+++ b/include/oox/drawingml/table/tablebackgroundstylecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT
+#define OOX_DRAWINGML_TABLEBACKGROUNDSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableBackgroundStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableBackgroundStyleContext( ::oox::core::ContextHandler& rParent, TableStyle& rTableStyle );
+ ~TableBackgroundStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyle& mrTableStyle;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecell.hxx b/include/oox/drawingml/table/tablecell.hxx
new file mode 100644
index 000000000000..9bb721f8599a
--- /dev/null
+++ b/include/oox/drawingml/table/tablecell.hxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLECELL_HXX
+#define OOX_DRAWINGML_TABLECELL_HXX
+
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/lineproperties.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include <com/sun/star/table/XCell.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <vector>
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableCellContext;
+class TableProperties;
+class TableStyle;
+
+class TableCell
+{
+ friend class TableCellContext;
+
+public:
+
+ TableCell();
+ ~TableCell();
+
+ sal_Int32 getRowSpan() const { return mnRowSpan; };
+ void setRowSpan( sal_Int32 nRowSpan ){ mnRowSpan = nRowSpan; };
+ sal_Int32 getGridSpan() const { return mnGridSpan; };
+ void setGridSpan( sal_Int32 nGridSpan ){ mnGridSpan = nGridSpan; };
+ sal_Bool gethMerge() const { return mbhMerge; };
+ void sethMerge( sal_Bool bhMerge ){ mbhMerge = bhMerge; };
+ sal_Bool getvMerge() const { return mbvMerge; };
+ void setvMerge( sal_Bool bvMerge ){ mbvMerge = bvMerge; };
+ sal_Int32 getLeftMargin() const { return mnMarL; };
+ void setLeftMargin( sal_Int32 nMargin ){ mnMarL = nMargin; };
+ sal_Int32 getRightMargin() const { return mnMarR; };
+ void setRightMargin( sal_Int32 nMargin ){ mnMarR = nMargin; };
+ sal_Int32 getTopMargin() const { return mnMarT; };
+ void setTopMargin( sal_Int32 nMargin ){ mnMarT = nMargin; };
+ sal_Int32 getBottomMargin() const { return mnMarB; };
+ void setBottomMargin( sal_Int32 nMargin ){ mnMarB = nMargin; };
+ sal_Int32 getVertToken() const { return mnVertToken; };
+ void setVertToken( sal_Int32 nToken ){ mnVertToken = nToken; };
+ sal_Int32 getAnchorToken() const { return mnAnchorToken; };
+ void setAnchorToken( sal_Int32 nToken ){ mnAnchorToken = nToken; };
+ sal_Bool getAnchorCtr() const { return mbAnchorCtr; };
+ void setAnchorCtr( sal_Bool bAnchorCtr ){ mbAnchorCtr = bAnchorCtr; };
+ sal_Int32 getHorzOverflowToken() const { return mnHorzOverflowToken; };
+ void setHorzOverflowToken( sal_Int32 nToken ){ mnHorzOverflowToken = nToken; };
+
+ void setTextBody( const oox::drawingml::TextBodyPtr& pTextBody ){ mpTextBody = pTextBody; };
+ oox::drawingml::TextBodyPtr getTextBody(){ return mpTextBody; };
+
+ void pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::TextListStylePtr pMasterTextListStyle,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::table::XCell >& rxCell, const TableProperties& rTableProperties,
+ const TableStyle& rTable, sal_Int32 nColumn, sal_Int32 nMaxColumn, sal_Int32 nRow, sal_Int32 nMaxRow );
+
+private:
+
+ oox::drawingml::TextBodyPtr mpTextBody;
+
+ oox::drawingml::LineProperties maLinePropertiesLeft;
+ oox::drawingml::LineProperties maLinePropertiesRight;
+ oox::drawingml::LineProperties maLinePropertiesTop;
+ oox::drawingml::LineProperties maLinePropertiesBottom;
+ oox::drawingml::LineProperties maLinePropertiesTopLeftToBottomRight;
+ oox::drawingml::LineProperties maLinePropertiesBottomLeftToTopRight;
+
+ oox::drawingml::FillProperties maFillProperties;
+
+ sal_Int32 mnRowSpan;
+ sal_Int32 mnGridSpan;
+ sal_Bool mbhMerge;
+ sal_Bool mbvMerge;
+
+ sal_Int32 mnMarL;
+ sal_Int32 mnMarR;
+ sal_Int32 mnMarT;
+ sal_Int32 mnMarB;
+ sal_Int32 mnVertToken;
+ sal_Int32 mnAnchorToken;
+ sal_Bool mbAnchorCtr;
+ sal_Int32 mnHorzOverflowToken;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLECELL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecellcontext.hxx b/include/oox/drawingml/table/tablecellcontext.hxx
new file mode 100644
index 000000000000..a2c04bbff9a7
--- /dev/null
+++ b/include/oox/drawingml/table/tablecellcontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLECELLCONTEXT
+#define OOX_DRAWINGML_TABLECELLCONTEXT
+
+#include "oox/drawingml/shapecontext.hxx"
+#include "oox/drawingml/table/tablecell.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableCellContext : public ::oox::core::ContextHandler
+{
+public:
+ TableCellContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell );
+ ~TableCellContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableCell& mrTableCell;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablecontext.hxx b/include/oox/drawingml/table/tablecontext.hxx
new file mode 100644
index 000000000000..175f7f84cb43
--- /dev/null
+++ b/include/oox/drawingml/table/tablecontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLECONTEXT
+#define OOX_DRAWINGML_TABLECONTEXT
+
+#include "oox/drawingml/shapecontext.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableProperties;
+
+class TableContext : public ShapeContext
+{
+public:
+ TableContext( ::oox::core::ContextHandler& rParent, ShapePtr pShapePtr );
+ ~TableContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableProperties& mrTableProperties;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablepartstylecontext.hxx b/include/oox/drawingml/table/tablepartstylecontext.hxx
new file mode 100644
index 000000000000..14b38547d9f4
--- /dev/null
+++ b/include/oox/drawingml/table/tablepartstylecontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLEPARTSTYLECONTEXT
+#define OOX_DRAWINGML_TABLEPARTSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TablePartStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TablePartStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart );
+ ~TablePartStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tableproperties.hxx b/include/oox/drawingml/table/tableproperties.hxx
new file mode 100644
index 000000000000..8c584b1f8959
--- /dev/null
+++ b/include/oox/drawingml/table/tableproperties.hxx
@@ -0,0 +1,80 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLEPROPERTIES_HXX
+#define OOX_DRAWINGML_TABLEPROPERTIES_HXX
+
+#include "oox/drawingml/table/tablerow.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <boost/optional.hpp>
+#include <vector>
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableProperties
+{
+public:
+
+ TableProperties();
+ ~TableProperties();
+
+ std::vector< sal_Int32 >& getTableGrid() { return mvTableGrid; };
+ std::vector< TableRow >& getTableRows() { return mvTableRows; };
+
+ OUString& getStyleId(){ return maStyleId; };
+ boost::shared_ptr< TableStyle >& getTableStyle(){ return mpTableStyle; };
+ sal_Bool& isRtl(){ return mbRtl; };
+ sal_Bool& isFirstRow(){ return mbFirstRow; };
+ sal_Bool& isFirstCol(){ return mbFirstCol; };
+ sal_Bool& isLastRow(){ return mbLastRow; };
+ sal_Bool& isLastCol(){ return mbLastCol; };
+ sal_Bool& isBandRow(){ return mbBandRow; };
+ sal_Bool& isBandCol(){ return mbBandCol; };
+
+ void pushToPropSet( const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet, ::oox::drawingml::TextListStylePtr pMasterTextListStyle );
+
+private:
+
+ const TableStyle& getUsedTableStyle( const ::oox::core::XmlFilterBase& rFilterBase );
+
+ OUString maStyleId; // either StyleId is available
+ boost::shared_ptr< TableStyle > mpTableStyle; // or the complete TableStyle
+ std::vector< sal_Int32 > mvTableGrid;
+ std::vector< TableRow > mvTableRows;
+
+ sal_Bool mbRtl;
+ sal_Bool mbFirstRow;
+ sal_Bool mbFirstCol;
+ sal_Bool mbLastRow;
+ sal_Bool mbLastCol;
+ sal_Bool mbBandRow;
+ sal_Bool mbBandCol;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLEPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablerow.hxx b/include/oox/drawingml/table/tablerow.hxx
new file mode 100644
index 000000000000..299ffabfd8b1
--- /dev/null
+++ b/include/oox/drawingml/table/tablerow.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLEROW_HXX
+#define OOX_DRAWINGML_TABLEROW_HXX
+
+#include "oox/drawingml/table/tablecell.hxx"
+#include <vector>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableRow
+{
+public:
+
+ TableRow();
+ ~TableRow();
+
+ void setHeight( sal_Int32 nHeight ){ mnHeight = nHeight; };
+ sal_Int32 getHeight() const { return mnHeight; };
+ std::vector< TableCell >& getTableCells() { return mvTableCells; };
+
+private:
+
+ sal_Int32 mnHeight;
+ std::vector< TableCell > mvTableCells;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLEROW_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablerowcontext.hxx b/include/oox/drawingml/table/tablerowcontext.hxx
new file mode 100644
index 000000000000..58ab0da0cd3a
--- /dev/null
+++ b/include/oox/drawingml/table/tablerowcontext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLEROWCONTEXT
+#define OOX_DRAWINGML_TABLEROWCONTEXT
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableRow;
+
+class TableRowContext : public ::oox::core::ContextHandler
+{
+public:
+ TableRowContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow );
+ ~TableRowContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableRow& mrTableRow;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestyle.hxx b/include/oox/drawingml/table/tablestyle.hxx
new file mode 100644
index 000000000000..b31b5891a32b
--- /dev/null
+++ b/include/oox/drawingml/table/tablestyle.hxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLE_HXX
+#define OOX_DRAWINGML_TABLESTYLE_HXX
+
+#include "oox/drawingml/table/tablestylepart.hxx"
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyle
+{
+public:
+
+ TableStyle();
+ ~TableStyle();
+
+ OUString& getStyleId(){ return maStyleId; }
+ OUString& getStyleName() { return maStyleName; }
+
+ ::oox::drawingml::ShapeStyleRef& getBackgroundFillStyleRef(){ return maFillStyleRef; }
+
+ ::oox::drawingml::FillPropertiesPtr& getBackgroundFillProperties(){ return mpFillProperties; }
+
+ TableStylePart& getWholeTbl() { return maWholeTbl; }
+ TableStylePart& getBand1H() { return maBand1H; }
+ TableStylePart& getBand2H() { return maBand2H; }
+ TableStylePart& getBand1V() { return maBand1V; }
+ TableStylePart& getBand2V() { return maBand2V; }
+ TableStylePart& getLastCol() { return maLastCol; }
+ TableStylePart& getFirstCol() { return maFirstCol; }
+ TableStylePart& getLastRow() { return maLastRow; }
+ TableStylePart& getSeCell() { return maSeCell; }
+ TableStylePart& getSwCell() { return maSwCell; }
+ TableStylePart& getFirstRow() { return maFirstRow; }
+ TableStylePart& getNeCell() { return maNeCell; }
+ TableStylePart& getNwCell() { return maNwCell; }
+
+private:
+
+ OUString maStyleId;
+ OUString maStyleName;
+
+ ::oox::drawingml::ShapeStyleRef maFillStyleRef;
+
+ ::oox::drawingml::FillPropertiesPtr mpFillProperties;
+
+ TableStylePart maWholeTbl;
+ TableStylePart maBand1H;
+ TableStylePart maBand2H;
+ TableStylePart maBand1V;
+ TableStylePart maBand2V;
+ TableStylePart maLastCol;
+ TableStylePart maFirstCol;
+ TableStylePart maLastRow;
+ TableStylePart maSeCell;
+ TableStylePart maSwCell;
+ TableStylePart maFirstRow;
+ TableStylePart maNeCell;
+ TableStylePart maNwCell;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylecellstylecontext.hxx b/include/oox/drawingml/table/tablestylecellstylecontext.hxx
new file mode 100644
index 000000000000..ae0997ab6d88
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylecellstylecontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLECELLSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleCellStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleCellStyleContext( ::oox::core::ContextHandler& rParent, TableStylePart& rTableStylePart );
+ ~TableStyleCellStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+ sal_Int32 mnLineType;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylecontext.hxx b/include/oox/drawingml/table/tablestylecontext.hxx
new file mode 100644
index 000000000000..f9600d38365c
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylecontext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLESTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestyle.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs,
+ TableStyle& rTableStyle );
+ ~TableStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyle& mrTableStyle;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylelist.hxx b/include/oox/drawingml/table/tablestylelist.hxx
new file mode 100644
index 000000000000..320609d064d9
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylelist.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLELIST_HXX
+#define OOX_DRAWINGML_TABLESTYLELIST_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyle;
+
+class TableStyleList
+{
+public:
+
+ TableStyleList();
+ ~TableStyleList();
+
+ OUString& getDefaultStyleId() { return maDefaultStyleId; };
+ std::vector< TableStyle >& getTableStyles(){ return maTableStyles; };
+
+private:
+
+ OUString maDefaultStyleId;
+ std::vector< TableStyle > maTableStyles;
+
+};
+
+typedef boost::shared_ptr< TableStyleList > TableStyleListPtr;
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLELIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx b/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx
new file mode 100644
index 000000000000..d6ef77f8614c
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylelistfragmenthandler.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX
+#define OOX_DRAWINGML_TABLESTYLELISTFRAGMENTHANDLER_HXX
+
+#include "oox/drawingml/table/tablestylelist.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+
+namespace oox {
+namespace drawingml {
+namespace table {
+
+// ============================================================================
+
+class TableStyleListFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit TableStyleListFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ TableStyleList& rTableStyleList );
+ virtual ~TableStyleListFragmentHandler();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStyleList& mrTableStyleList;
+};
+
+// ============================================================================
+
+} // namespace table
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestylepart.hxx b/include/oox/drawingml/table/tablestylepart.hxx
new file mode 100644
index 000000000000..abfb21c890d9
--- /dev/null
+++ b/include/oox/drawingml/table/tablestylepart.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TABLESTYLEPART_HXX
+#define OOX_DRAWINGML_TABLESTYLEPART_HXX
+
+#include <rtl/ustring.hxx>
+#include <boost/optional.hpp>
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/textfont.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+#include "oox/drawingml/lineproperties.hxx"
+#include "oox/drawingml/shape.hxx"
+#include <map>
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStylePart
+{
+public:
+
+ TableStylePart();
+ ~TableStylePart();
+
+ ::oox::drawingml::Color& getTextColor(){ return maTextColor; }
+ ::boost::optional< sal_Bool >& getTextBoldStyle(){ return maTextBoldStyle; }
+ ::boost::optional< sal_Bool >& getTextItalicStyle(){ return maTextItalicStyle; }
+ ::oox::drawingml::TextFont& getAsianFont(){ return maAsianFont; }
+ ::oox::drawingml::TextFont& getComplexFont(){ return maComplexFont; }
+ ::oox::drawingml::TextFont& getSymbolFont(){ return maSymbolFont; }
+ ::oox::drawingml::TextFont& getLatinFont(){ return maLatinFont; }
+
+ ::oox::drawingml::FillPropertiesPtr& getFillProperties(){ return mpFillProperties; }
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& getLineBorders(){ return maLineBorders; }
+
+ ::oox::drawingml::ShapeStyleRefMap& getStyleRefs(){ return maStyleRefs; }
+
+private:
+
+ ::oox::drawingml::Color maTextColor;
+ ::boost::optional< sal_Bool > maTextBoldStyle;
+ ::boost::optional< sal_Bool > maTextItalicStyle;
+ ::oox::drawingml::TextFont maAsianFont;
+ ::oox::drawingml::TextFont maComplexFont;
+ ::oox::drawingml::TextFont maSymbolFont;
+ ::oox::drawingml::TextFont maLatinFont;
+
+ ::oox::drawingml::FillPropertiesPtr mpFillProperties;
+ std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr > maLineBorders;
+ ::oox::drawingml::ShapeStyleRefMap maStyleRefs;
+};
+
+} } }
+
+#endif // OOX_DRAWINGML_TABLESTYLEPART_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/table/tablestyletextstylecontext.hxx b/include/oox/drawingml/table/tablestyletextstylecontext.hxx
new file mode 100644
index 000000000000..10714743ad58
--- /dev/null
+++ b/include/oox/drawingml/table/tablestyletextstylecontext.hxx
@@ -0,0 +1,49 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#ifndef OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT
+#define OOX_DRAWINGML_TABLESTYLETEXTSTYLECONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/table/tablestylepart.hxx"
+
+namespace oox { namespace drawingml { namespace table {
+
+class TableStyleTextStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TableStyleTextStyleContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs,
+ TableStylePart& rTableStylePart );
+ ~TableStyleTextStyleContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ TableStylePart& mrTableStylePart;
+};
+
+} } }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbody.hxx b/include/oox/drawingml/textbody.hxx
new file mode 100644
index 000000000000..2d77cf277df6
--- /dev/null
+++ b/include/oox/drawingml/textbody.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODY_HXX
+#define OOX_DRAWINGML_TEXTBODY_HXX
+
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/textbodyproperties.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace text { class XText; }
+ namespace text { class XTextCursor; }
+} } }
+
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox { namespace drawingml {
+
+class TextParagraph;
+typedef RefVector< TextParagraph > TextParagraphVector;
+
+class TextBody
+{
+public:
+ TextBody();
+ TextBody( TextBodyPtr pBody );
+ ~TextBody();
+
+ inline const TextParagraphVector& getParagraphs() const { return maParagraphs; }
+ TextParagraph& addParagraph();
+
+ inline const TextListStyle& getTextListStyle() const { return maTextListStyle; }
+ inline TextListStyle& getTextListStyle() { return maTextListStyle; }
+
+ inline const TextBodyProperties& getTextProperties() const { return maTextProperties; }
+ inline TextBodyProperties& getTextProperties() { return maTextProperties; }
+
+ /** insert the text body at the text cursor */
+ void insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > & xAt,
+ const TextCharacterProperties& rTextStyleProperties,
+ const TextListStylePtr& pMasterTextListStyle ) const;
+ bool isEmpty();
+protected:
+ TextParagraphVector maParagraphs;
+ TextBodyProperties maTextProperties;
+ TextListStyle maTextListStyle;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODY_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodycontext.hxx b/include/oox/drawingml/textbodycontext.hxx
new file mode 100644
index 000000000000..d46272e853a6
--- /dev/null
+++ b/include/oox/drawingml/textbodycontext.hxx
@@ -0,0 +1,63 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+
+#include <com/sun/star/text/XText.hpp>
+
+#include "oox/drawingml/textbody.hxx"
+#include "oox/drawingml/textrun.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextBodyContext : public ::oox::core::ContextHandler
+{
+public:
+ TextBodyContext( ::oox::core::ContextHandler& rParent, TextBody& rTextBody );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextBody& mrTextBody;
+ ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > mxText;
+};
+
+// CT_RegularTextRun
+class RegularTextRunContext : public ::oox::core::ContextHandler
+{
+public:
+ RegularTextRunContext( ::oox::core::ContextHandler& rParent, TextRunPtr pRunPtr );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextRunPtr mpRunPtr;
+ bool mbIsInText;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODYCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodyproperties.hxx b/include/oox/drawingml/textbodyproperties.hxx
new file mode 100644
index 000000000000..f8800be29659
--- /dev/null
+++ b/include/oox/drawingml/textbodyproperties.hxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTBODYPROPERTIES_HXX
+
+#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include <boost/optional.hpp>
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct TextBodyProperties
+{
+ PropertyMap maPropertyMap;
+ OptValue< sal_Int32 > moRotation;
+ OptValue< sal_Int32 > moVert;
+ boost::optional< sal_Int32 > moInsets[4];
+ boost::optional< sal_Int32 > moTextOffX;
+ boost::optional< sal_Int32 > moTextOffY;
+ ::com::sun::star::drawing::TextVerticalAdjust meVA;
+
+ explicit TextBodyProperties();
+
+ void pushRotationAdjustments( sal_Int32 nRotation );
+ void pushVertSimulation();
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textbodypropertiescontext.hxx b/include/oox/drawingml/textbodypropertiescontext.hxx
new file mode 100644
index 000000000000..e907a60b94d8
--- /dev/null
+++ b/include/oox/drawingml/textbodypropertiescontext.hxx
@@ -0,0 +1,47 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextBodyProperties;
+
+class TextBodyPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextBodyPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
+ TextBodyProperties& rTextBodyProp );
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextBodyProperties& mrTextBodyProp;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTBODYPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx
new file mode 100644
index 000000000000..99792fe7725d
--- /dev/null
+++ b/include/oox/drawingml/textcharacterproperties.hxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIES_HXX
+
+#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/drawingml/textfont.hxx"
+
+namespace oox { class PropertySet; }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct TextCharacterProperties
+{
+ PropertyMap maHyperlinkPropertyMap;
+ TextFont maLatinFont;
+ TextFont maAsianFont;
+ TextFont maComplexFont;
+ TextFont maSymbolFont;
+ Color maCharColor;
+ Color maUnderlineColor;
+ Color maHighlightColor;
+ OptValue< OUString > moLang;
+ OptValue< sal_Int32 > moHeight;
+ OptValue< sal_Int32 > moSpacing;
+ OptValue< sal_Int32 > moUnderline;
+ OptValue< sal_Int32 > moStrikeout;
+ OptValue< sal_Int32 > moCaseMap;
+ OptValue< bool > moBold;
+ OptValue< bool > moItalic;
+ OptValue< bool > moUnderlineLineFollowText;
+ OptValue< bool > moUnderlineFillFollowText;
+
+ /** Overwrites all members that are explicitly set in rSourceProps. */
+ void assignUsed( const TextCharacterProperties& rSourceProps );
+
+ /** Returns the current character size. If possible the masterstyle should
+ have been applied before, otherwise the character size can be zero and
+ the default value is returned. */
+ float getCharHeightPoints( float fDefault ) const;
+
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+ const ::oox::core::XmlFilterBase& rFilter,
+ bool bUseOptional = false ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+ const ::oox::core::XmlFilterBase& rFilter,
+ bool bUseOptional = false ) const;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textcharacterpropertiescontext.hxx b/include/oox/drawingml/textcharacterpropertiescontext.hxx
new file mode 100644
index 000000000000..f31e86b27ca4
--- /dev/null
+++ b/include/oox/drawingml/textcharacterpropertiescontext.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextCharacterProperties;
+
+class TextCharacterPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextCharacterPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextCharacterProperties& rTextCharacterProperties );
+ virtual ~TextCharacterPropertiesContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextCharacterProperties& mrTextCharacterProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTCHARACTERPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfield.hxx b/include/oox/drawingml/textfield.hxx
new file mode 100644
index 000000000000..df98b0302560
--- /dev/null
+++ b/include/oox/drawingml/textfield.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTFIELD_HXX
+#define OOX_DRAWINGML_TEXTFIELD_HXX
+
+#include <boost/shared_ptr.hpp>
+
+#include "oox/drawingml/textrun.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+struct TextCharacterProperties;
+
+class TextField
+ : public TextRun
+{
+public:
+ TextField();
+
+ inline TextParagraphProperties& getTextParagraphProperties() { return maTextParagraphProperties; }
+ inline const TextParagraphProperties& getTextParagraphProperties() const { return maTextParagraphProperties; }
+
+ inline void setType( const OUString& sType ) { msType = sType; }
+ inline void setUuid( const OUString & sUuid ) { msUuid = sUuid; }
+
+ virtual sal_Int32 insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt,
+ const TextCharacterProperties& rTextCharacterStyle ) const;
+
+private:
+ TextParagraphProperties maTextParagraphProperties;
+ OUString msType;
+ OUString msUuid;
+};
+
+typedef boost::shared_ptr< TextField > TextFieldPtr;
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfieldcontext.hxx b/include/oox/drawingml/textfieldcontext.hxx
new file mode 100644
index 000000000000..3a50ea93620f
--- /dev/null
+++ b/include/oox/drawingml/textfieldcontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTFIELDCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextField;
+
+class TextFieldContext
+ : public ::oox::core::ContextHandler
+{
+public:
+ TextFieldContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextField& rTextField);
+ virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL characters( const OUString& aChars ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
+ sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rXAttributes )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ TextField& mrTextField;
+ bool mbIsInText;
+};
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textfont.hxx b/include/oox/drawingml/textfont.hxx
new file mode 100644
index 000000000000..95a7a1716a0d
--- /dev/null
+++ b/include/oox/drawingml/textfont.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGNML_TEXTFONT_HXX
+#define OOX_DRAWINGNML_TEXTFONT_HXX
+
+#include <rtl/ustring.hxx>
+
+namespace oox { class AttributeList; }
+namespace oox { namespace core { class XmlFilterBase; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+/** carries a CT_TextFont*/
+class TextFont
+{
+public:
+ explicit TextFont();
+
+ /** Sets attributes from the passed attribute list. */
+ void setAttributes( const AttributeList& rAttribs );
+
+ /** Overwrites this text font with the passed text font, if it is used. */
+ void assignIfUsed( const TextFont& rTextFont );
+
+ /** Returns the font name, pitch, and family; tries to resolve theme
+ placeholder names, e.g. '+mj-lt' for the major latin theme font. */
+ bool getFontData(
+ OUString& rFontName,
+ sal_Int16& rnFontPitch,
+ sal_Int16& rnFontFamily,
+ const ::oox::core::XmlFilterBase& rFilter ) const;
+
+private:
+ bool implGetFontData(
+ OUString& rFontName,
+ sal_Int16& rnFontPitch,
+ sal_Int16& rnFontFamily ) const;
+
+private:
+ OUString maTypeface;
+ OUString maPanose;
+ sal_Int32 mnPitch;
+ sal_Int32 mnCharset;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textliststyle.hxx b/include/oox/drawingml/textliststyle.hxx
new file mode 100644
index 000000000000..851c506af17e
--- /dev/null
+++ b/include/oox/drawingml/textliststyle.hxx
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+#define OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/helper/refvector.hxx"
+
+namespace oox { namespace drawingml {
+
+typedef RefVector< TextParagraphProperties > TextParagraphPropertiesVector;
+
+class TextListStyle
+{
+public:
+
+ TextListStyle();
+ ~TextListStyle();
+
+ void apply( const TextListStyle& rTextListStyle );
+
+ inline const TextParagraphPropertiesVector& getListStyle() const { return maListStyle; };
+ inline TextParagraphPropertiesVector& getListStyle() { return maListStyle; };
+
+ inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; };
+ inline TextParagraphPropertiesVector& getAggregationListStyle() { return maAggregationListStyle; };
+
+#if defined(DBG_UTIL) && OSL_DEBUG_LEVEL > 1
+ void dump() const;
+#endif
+
+protected:
+
+ TextParagraphPropertiesVector maListStyle;
+ TextParagraphPropertiesVector maAggregationListStyle;
+};
+
+typedef boost::shared_ptr< TextListStyle > TextListStylePtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTLISTSTYLE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textliststylecontext.hxx b/include/oox/drawingml/textliststylecontext.hxx
new file mode 100644
index 000000000000..2d480c709be5
--- /dev/null
+++ b/include/oox/drawingml/textliststylecontext.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+#define OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextListStyleContext : public ::oox::core::ContextHandler
+{
+public:
+ TextListStyleContext( ::oox::core::ContextHandler& rParent, TextListStyle& rTextListStyle );
+ ~TextListStyleContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextListStyle& mrTextListStyle;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTLISTSTYLECONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraph.hxx b/include/oox/drawingml/textparagraph.hxx
new file mode 100644
index 000000000000..37c53268b001
--- /dev/null
+++ b/include/oox/drawingml/textparagraph.hxx
@@ -0,0 +1,73 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/textrun.hxx"
+#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+typedef RefVector< TextRun > TextRunVector;
+
+class TextParagraph
+{
+public:
+ TextParagraph();
+ ~TextParagraph();
+
+ inline TextRunVector& getRuns() { return maRuns; }
+ inline const TextRunVector& getRuns() const { return maRuns; }
+ inline void addRun( const TextRunPtr & pRun ) { maRuns.push_back( pRun ); }
+
+ inline TextParagraphProperties& getProperties() { return maProperties; }
+ inline const TextParagraphProperties& getProperties() const { return maProperties; }
+
+ inline TextCharacterProperties& getEndProperties() { return maEndProperties; }
+ inline const TextCharacterProperties& getEndProperties() const { return maEndProperties; }
+
+ //inline void setProperties( TextParagraphPropertiesPtr pProps ) { mpProperties = pProps; }
+
+ void insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText > & xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor > &xAt,
+ const TextCharacterProperties& rTextStyleProperties,
+ const TextListStyle& rTextListStyle,
+ bool bFirst = false ) const;
+
+private:
+ TextParagraphProperties maProperties;
+ TextCharacterProperties maEndProperties;
+ TextRunVector maRuns;
+};
+
+typedef boost::shared_ptr< TextParagraph > TextParagraphPtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPH_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraphproperties.hxx b/include/oox/drawingml/textparagraphproperties.hxx
new file mode 100644
index 000000000000..1cb8215a3fc1
--- /dev/null
+++ b/include/oox/drawingml/textparagraphproperties.hxx
@@ -0,0 +1,128 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
+#include "oox/drawingml/textcharacterproperties.hxx"
+#include <com/sun/star/style/NumberingType.hpp>
+#include "oox/drawingml/textfont.hxx"
+#include "textspacing.hxx"
+#include <boost/optional.hpp>
+
+namespace com { namespace sun { namespace star {
+ namespace graphic { class XGraphic; }
+} } }
+
+namespace oox { namespace drawingml {
+
+class TextParagraphProperties;
+
+typedef boost::shared_ptr< TextParagraphProperties > TextParagraphPropertiesPtr;
+
+class BulletList
+{
+public:
+ BulletList( );
+ bool is() const;
+ void apply( const BulletList& );
+ void pushToPropMap( const ::oox::core::XmlFilterBase* pFilterBase, PropertyMap& xPropMap ) const;
+ void setBulletChar( const OUString & sChar );
+ void setStartAt( sal_Int32 nStartAt ){ mnStartAt <<= static_cast< sal_Int16 >( nStartAt ); }
+ void setType( sal_Int32 nType );
+ void setNone( );
+ void setSuffixParenBoth();
+ void setSuffixParenRight();
+ void setSuffixPeriod();
+ void setSuffixNone();
+ void setSuffixMinusRight();
+ void setBulletSize(sal_Int16 nSize);
+ void setFontSize(sal_Int16 nSize);
+ void setStyleName( const OUString& rStyleName ) { maStyleName <<= rStyleName; }
+ void setGraphic( ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic >& rXGraphic );
+
+ ::oox::drawingml::ColorPtr maBulletColorPtr;
+ ::com::sun::star::uno::Any mbBulletColorFollowText;
+ ::com::sun::star::uno::Any mbBulletFontFollowText;
+ ::oox::drawingml::TextFont maBulletFont;
+ ::com::sun::star::uno::Any msBulletChar;
+ ::com::sun::star::uno::Any mnStartAt;
+ ::com::sun::star::uno::Any mnNumberingType;
+ ::com::sun::star::uno::Any msNumberingPrefix;
+ ::com::sun::star::uno::Any msNumberingSuffix;
+ ::com::sun::star::uno::Any mnSize;
+ ::com::sun::star::uno::Any mnFontSize;
+ ::com::sun::star::uno::Any maStyleName;
+ ::com::sun::star::uno::Any maGraphic;
+ boost::optional< float > maFollowFontSize;
+};
+
+class TextParagraphProperties
+{
+public:
+
+ TextParagraphProperties();
+ ~TextParagraphProperties();
+
+ void setLevel( sal_Int16 nLevel ) { mnLevel = nLevel; }
+ sal_Int16 getLevel( ) const { return mnLevel; }
+ PropertyMap& getTextParagraphPropertyMap() { return maTextParagraphPropertyMap; }
+ BulletList& getBulletList() { return maBulletList; }
+ TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
+ const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
+
+ TextSpacing& getParaTopMargin() { return maParaTopMargin; }
+ TextSpacing& getParaBottomMargin() { return maParaBottomMargin; }
+ boost::optional< sal_Int32 >& getParaLeftMargin(){ return moParaLeftMargin; }
+ boost::optional< sal_Int32 >& getFirstLineIndentation(){ return moFirstLineIndentation; }
+
+ void apply( const TextParagraphProperties& rSourceProps );
+ void pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
+ PropertyMap& rioBulletList, const BulletList* pMasterBuList, sal_Bool bApplyBulletList, float fFontSize, bool bPushDefaultValues = false ) const;
+ void pushToPropSet( const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet) const;
+
+ /** Returns the largest character size of this paragraph. If possible the
+ masterstyle should have been applied before, otherwise the character
+ size can be zero and the default value is returned. */
+ float getCharHeightPoints( float fDefault ) const;
+
+#ifdef DBG_UTIL
+ void dump() const;
+#endif
+
+protected:
+
+ TextCharacterProperties maTextCharacterProperties;
+ PropertyMap maTextParagraphPropertyMap;
+ BulletList maBulletList;
+ TextSpacing maParaTopMargin;
+ TextSpacing maParaBottomMargin;
+ boost::optional< sal_Int32 > moParaLeftMargin;
+ boost::optional< sal_Int32 > moFirstLineIndentation;
+ sal_Int16 mnLevel;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textparagraphpropertiescontext.hxx b/include/oox/drawingml/textparagraphpropertiescontext.hxx
new file mode 100644
index 000000000000..db0f3426a680
--- /dev/null
+++ b/include/oox/drawingml/textparagraphpropertiescontext.hxx
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+#define OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+
+#include <list>
+
+#include <com/sun/star/style/TabStop.hpp>
+#include "oox/drawingml/drawingmltypes.hxx"
+#include "oox/drawingml/textparagraphproperties.hxx"
+#include "oox/drawingml/textspacing.hxx"
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextParagraphPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ TextParagraphPropertiesContext( ::oox::core::ContextHandler& rParent,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& rXAttributes,
+ TextParagraphProperties& rTextParagraphProperties );
+ ~TextParagraphPropertiesContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ TextParagraphProperties& mrTextParagraphProperties;
+ TextSpacing maLineSpacing;
+ TextSpacing& mrSpaceBefore;
+ TextSpacing& mrSpaceAfter;
+ BulletList& mrBulletList;
+ ::std::list< ::com::sun::star::style::TabStop > maTabList;
+ ::boost::shared_ptr< BlipFillProperties > mxBlipProps;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTPARAGRAPHPROPERTIESCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textrun.hxx b/include/oox/drawingml/textrun.hxx
new file mode 100644
index 000000000000..0e215bf68973
--- /dev/null
+++ b/include/oox/drawingml/textrun.hxx
@@ -0,0 +1,62 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TEXTRUN_HXX
+#define OOX_DRAWINGML_TEXTRUN_HXX
+
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include "oox/drawingml/textcharacterproperties.hxx"
+
+namespace oox { namespace drawingml {
+
+class TextRun
+{
+public:
+ TextRun();
+ virtual ~TextRun();
+
+ inline OUString& getText() { return msText; }
+ inline const OUString& getText() const { return msText; }
+
+ inline TextCharacterProperties& getTextCharacterProperties() { return maTextCharacterProperties; }
+ inline const TextCharacterProperties& getTextCharacterProperties() const { return maTextCharacterProperties; }
+
+ inline void setLineBreak() { mbIsLineBreak = true; }
+
+ virtual sal_Int32 insertAt(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XText >& xText,
+ const ::com::sun::star::uno::Reference < ::com::sun::star::text::XTextCursor >& xAt,
+ const TextCharacterProperties& rTextCharacterStyle ) const;
+
+private:
+ OUString msText;
+ TextCharacterProperties maTextCharacterProperties;
+ bool mbIsLineBreak;
+};
+
+typedef boost::shared_ptr< TextRun > TextRunPtr;
+
+} }
+
+#endif // OOX_DRAWINGML_TEXTRUN_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/textspacing.hxx b/include/oox/drawingml/textspacing.hxx
new file mode 100644
index 000000000000..c85936283b4b
--- /dev/null
+++ b/include/oox/drawingml/textspacing.hxx
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGNML__TEXTSPACING_HXX
+#define OOX_DRAWINGNML__TEXTSPACING_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/LineSpacingMode.hpp>
+
+namespace oox { namespace drawingml {
+
+
+ /** carries a CT_TextSpacing */
+ class TextSpacing
+ {
+ public:
+ enum {
+ POINTS = 0,
+ PERCENT
+ };
+ TextSpacing()
+ : nUnit( POINTS ), nValue( 0 ), bHasValue( false )
+ {
+ }
+ TextSpacing( sal_Int32 nPoints ) : nUnit( POINTS ), nValue( nPoints ), bHasValue( true ){};
+ ::com::sun::star::style::LineSpacing toLineSpacing() const
+ {
+ ::com::sun::star::style::LineSpacing aSpacing;
+ aSpacing.Mode = ( nUnit == PERCENT
+ ? ::com::sun::star::style::LineSpacingMode::PROP
+ : ::com::sun::star::style::LineSpacingMode::MINIMUM );
+ aSpacing.Height = static_cast< sal_Int16 >( nUnit == PERCENT ? nValue / 1000 : nValue );
+ return aSpacing;
+ }
+ sal_Int32 toMargin( float fFontSize ) const
+ {
+ if ( nUnit == PERCENT )
+ return (sal_Int32) ((((fFontSize*nValue)/1000)*254 + 360)/720);
+ else
+ return nValue;
+ }
+ sal_Int32 nUnit;
+ sal_Int32 nValue;
+ bool bHasValue;
+ };
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/theme.hxx b/include/oox/drawingml/theme.hxx
new file mode 100644
index 000000000000..f167c43a4fd4
--- /dev/null
+++ b/include/oox/drawingml/theme.hxx
@@ -0,0 +1,116 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_THEME_HXX
+#define OOX_DRAWINGML_THEME_HXX
+
+#include "oox/drawingml/clrscheme.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/textfont.hxx"
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+const sal_Int32 THEMED_STYLE_SUBTLE = 1;
+const sal_Int32 THEMED_STYLE_MODERATE = 2;
+const sal_Int32 THEMED_STYLE_INTENSE = 3;
+
+typedef RefVector< FillProperties > FillStyleList;
+typedef RefVector< LineProperties > LineStyleList;
+typedef RefVector< EffectProperties > EffectStyleList;
+typedef RefMap< sal_Int32, TextCharacterProperties > FontScheme;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC Theme
+{
+public:
+ explicit Theme();
+ ~Theme();
+
+ inline void setStyleName( const OUString& rStyleName ) { maStyleName = rStyleName; }
+ inline const OUString& getStyleName() const { return maStyleName; }
+
+ inline ClrScheme& getClrScheme() { return maClrScheme; }
+ inline const ClrScheme& getClrScheme() const { return maClrScheme; }
+
+ inline FillStyleList& getFillStyleList() { return maFillStyleList; }
+ inline const FillStyleList& getFillStyleList() const { return maFillStyleList; }
+ inline FillStyleList& getBgFillStyleList() { return maBgFillStyleList; }
+ inline const FillStyleList& getBgFillStyleList() const { return maBgFillStyleList; }
+ /** Returns the fill properties of the passed one-based themed style index. */
+ const FillProperties* getFillStyle( sal_Int32 nIndex ) const;
+
+ inline LineStyleList& getLineStyleList() { return maLineStyleList; }
+ inline const LineStyleList& getLineStyleList() const { return maLineStyleList; }
+ /** Returns the line properties of the passed one-based themed style index. */
+ const LineProperties* getLineStyle( sal_Int32 nIndex ) const;
+
+ inline EffectStyleList& getEffectStyleList() { return maEffectStyleList; }
+ inline const EffectStyleList& getEffectStyleList() const { return maEffectStyleList; }
+ const EffectProperties* getEffectStyle( sal_Int32 nIndex ) const;
+
+ inline FontScheme& getFontScheme() { return maFontScheme; }
+ inline const FontScheme& getFontScheme() const { return maFontScheme; }
+ /** Returns theme font properties by scheme type (major/minor). */
+ const TextCharacterProperties* getFontStyle( sal_Int32 nSchemeType ) const;
+ /** Returns theme font by placeholder name, e.g. the major latin theme font for the font name '+mj-lt'. */
+ const TextFont* resolveFont( const OUString& rName ) const;
+
+ inline Shape& getSpDef() { return maSpDef; }
+ inline const Shape& getSpDef() const { return maSpDef; }
+
+ inline Shape& getLnDef() { return maLnDef; }
+ inline const Shape& getLnDef() const { return maLnDef; }
+
+ inline Shape& getTxDef() { return maTxDef; }
+ inline const Shape& getTxDef() const { return maTxDef; }
+
+ void setFragment( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& getFragment() const { return mxFragment; }
+
+private:
+ OUString maStyleName;
+ ClrScheme maClrScheme;
+ FillStyleList maFillStyleList;
+ FillStyleList maBgFillStyleList;
+ LineStyleList maLineStyleList;
+ EffectStyleList maEffectStyleList;
+ FontScheme maFontScheme;
+ Shape maSpDef;
+ Shape maLnDef;
+ Shape maTxDef;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> mxFragment;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themeelementscontext.hxx b/include/oox/drawingml/themeelementscontext.hxx
new file mode 100644
index 000000000000..a3d36a9d8225
--- /dev/null
+++ b/include/oox/drawingml/themeelementscontext.hxx
@@ -0,0 +1,51 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
+#define OOX_DRAWINGML_THEMEELEMENTSCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+// ============================================================================
+
+class ThemeElementsContext : public oox::core::ContextHandler
+{
+public:
+ ThemeElementsContext( ::oox::core::ContextHandler& rParent, Theme& rTheme );
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ Theme& mrTheme;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/themefragmenthandler.hxx b/include/oox/drawingml/themefragmenthandler.hxx
new file mode 100644
index 000000000000..61062775fa37
--- /dev/null
+++ b/include/oox/drawingml/themefragmenthandler.hxx
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+#define OOX_DRAWINGML_THEMEFRAGMENTHANDLER_HXX
+
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+namespace drawingml {
+
+class Theme;
+
+// ============================================================================
+
+class OOX_DLLPUBLIC ThemeFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ explicit ThemeFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ Theme& rTheme );
+ virtual ~ThemeFragmentHandler();
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ Theme& mrTheme;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/drawingml/transform2dcontext.hxx b/include/oox/drawingml/transform2dcontext.hxx
new file mode 100644
index 000000000000..6bbbe191e77c
--- /dev/null
+++ b/include/oox/drawingml/transform2dcontext.hxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX
+#define OOX_DRAWINGML_TRANSFORM2DCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+class Shape;
+
+/** context to import a CT_Transform2D */
+class Transform2DContext : public ::oox::core::ContextHandler
+{
+public:
+ Transform2DContext( ::oox::core::ContextHandler& rParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, Shape& rShape, bool btxXfrm = false ) throw();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ Shape& mrShape;
+ bool mbtxXfrm;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dffdumper.hxx b/include/oox/dump/dffdumper.hxx
new file mode 100644
index 000000000000..d041dcc0be66
--- /dev/null
+++ b/include/oox/dump/dffdumper.hxx
@@ -0,0 +1,70 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_DFFDUMPER_HXX
+#define OOX_DUMP_DFFDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+class DffStreamObject : public SequenceRecordObjectBase
+{
+public:
+ inline sal_uInt16 getVer() const { return mnInstVer & 0x000F; }
+ inline sal_uInt16 getInst() const { return (mnInstVer & 0xFFF0) >> 4; }
+ inline bool isContainer() const { return getVer() == 15; }
+
+protected:
+ inline explicit DffStreamObject() {}
+
+ using SequenceRecordObjectBase::construct;
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+ virtual void implDumpClientAnchor();
+
+private:
+ sal_uInt32 dumpDffSimpleColor( const String& rName );
+
+ void dumpDffOpt();
+ sal_uInt16 dumpDffOptPropHeader();
+
+private:
+ ItemFormatMap maSimpleProps;
+ ItemFormatMap maComplexProps;
+ sal_uInt16 mnInstVer;
+ sal_Int32 mnRealSize;
+};
+
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/dumperbase.hxx b/include/oox/dump/dumperbase.hxx
new file mode 100644
index 000000000000..043bb73ecfa8
--- /dev/null
+++ b/include/oox/dump/dumperbase.hxx
@@ -0,0 +1,1871 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_DUMPERBASE_HXX
+#define OOX_DUMP_DUMPERBASE_HXX
+
+#include <math.h>
+#include <vector>
+#include <stack>
+#include <set>
+#include <map>
+#include <boost/shared_ptr.hpp>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/util/DateTime.hpp>
+#include "oox/helper/binaryinputstream.hxx"
+#include "oox/helper/helper.hxx"
+#include "oox/helper/storagebase.hxx"
+
+#define OOX_INCLUDE_DUMPER (OSL_DEBUG_LEVEL > 0)
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+ namespace io { class XOutputStream; }
+ namespace io { class XTextOutputStream2; }
+ namespace uno { class XComponentContext; }
+} } }
+
+namespace comphelper {
+ class IDocPasswordVerifier;
+}
+
+namespace oox {
+ class BinaryOutputStream;
+ class TextInputStream;
+}
+
+namespace oox { namespace core {
+ class FilterBase;
+} }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+
+#define OOX_DUMP_UNUSED "unused"
+#define OOX_DUMP_UNKNOWN "?unknown"
+
+#define OOX_DUMP_ERRASCII( ascii ) "?err:" ascii
+
+#define OOX_DUMP_ERR_NOMAP "no-map"
+#define OOX_DUMP_ERR_NONAME "no-name"
+#define OOX_DUMP_ERR_STREAM "stream-error"
+
+#define OOX_DUMP_DUMPEXT ".dump"
+
+const sal_Unicode OOX_DUMP_STRQUOTE = '\'';
+const sal_Unicode OOX_DUMP_FMLASTRQUOTE = '"';
+const sal_Unicode OOX_DUMP_ADDRABS = '$';
+const sal_Unicode OOX_DUMP_R1C1ROW = 'R';
+const sal_Unicode OOX_DUMP_R1C1COL = 'C';
+const sal_Unicode OOX_DUMP_R1C1OPEN = '[';
+const sal_Unicode OOX_DUMP_R1C1CLOSE = ']';
+const sal_Unicode OOX_DUMP_RANGESEP = ':';
+const sal_Unicode OOX_DUMP_BASECLASS = 'B';
+const sal_Unicode OOX_DUMP_FUNCSEP = ',';
+const sal_Unicode OOX_DUMP_LISTSEP = ',';
+const sal_Unicode OOX_DUMP_TABSEP = '!';
+const sal_Unicode OOX_DUMP_ARRAYSEP = ';';
+const sal_Unicode OOX_DUMP_EMPTYVALUE = '~';
+const sal_Unicode OOX_DUMP_CMDPROMPT = '?';
+const sal_Unicode OOX_DUMP_PLACEHOLDER = '\x01';
+
+typedef ::std::pair< OUString, OUString > OUStringPair;
+typedef ::std::pair< sal_Int64, sal_Int64 > Int64Pair;
+
+typedef ::std::vector< OUString > OUStringVector;
+typedef ::std::vector< sal_Int64 > Int64Vector;
+
+// ============================================================================
+// ============================================================================
+
+/** Static helper functions for system file and stream access. */
+class InputOutputHelper
+{
+public:
+ // file names -------------------------------------------------------------
+
+ static OUString convertFileNameToUrl( const OUString& rFileName );
+ static sal_Int32 getFileNamePos( const OUString& rFileUrl );
+ static OUString getFileNameExtension( const OUString& rFileUrl );
+
+ // input streams ----------------------------------------------------------
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ openInputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // output streams ---------------------------------------------------------
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >
+ openOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rxOutStrm,
+ rtl_TextEncoding eTextEnc );
+
+ static ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 >
+ openTextOutputStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName,
+ rtl_TextEncoding eTextEnc );
+};
+
+// ============================================================================
+
+class BinaryInputStreamRef : public ::oox::BinaryInputStreamRef
+{
+public:
+ inline BinaryInputStreamRef() {}
+
+ inline /*implicit*/ BinaryInputStreamRef( BinaryInputStream* pInStrm ) :
+ ::oox::BinaryInputStreamRef( pInStrm ) {}
+
+ inline /*implicit*/ BinaryInputStreamRef( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( new BinaryXInputStream( rxInStrm, true ) ) {}
+
+ template< typename StreamType >
+ inline /*implicit*/ BinaryInputStreamRef( const ::boost::shared_ptr< StreamType >& rxInStrm ) :
+ ::oox::BinaryInputStreamRef( rxInStrm ) {}
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Specifiers for atomic data types. */
+enum DataType
+{
+ DATATYPE_VOID, ///< No data type.
+ DATATYPE_INT8, ///< Signed 8-bit integer.
+ DATATYPE_UINT8, ///< Unsigned 8-bit integer.
+ DATATYPE_INT16, ///< Signed 16-bit integer.
+ DATATYPE_UINT16, ///< Unsigned 16-bit integer.
+ DATATYPE_INT32, ///< Signed 32-bit integer.
+ DATATYPE_UINT32, ///< Unsigned 32-bit integer.
+ DATATYPE_INT64, ///< Signed 64-bit integer.
+ DATATYPE_UINT64, ///< Unsigned 64-bit integer.
+ DATATYPE_FLOAT, ///< Floating-point, single precision.
+ DATATYPE_DOUBLE ///< Floating-point, double precision.
+};
+
+// ----------------------------------------------------------------------------
+
+/** Specifiers for the output format of values. */
+enum FormatType
+{
+ FORMATTYPE_NONE, ///< No numeric format (e.g. show name only).
+ FORMATTYPE_DEC, ///< Decimal.
+ FORMATTYPE_HEX, ///< Hexadecimal.
+ FORMATTYPE_SHORTHEX, ///< Hexadecimal, as short as possible (no leading zeros).
+ FORMATTYPE_BIN, ///< Binary.
+ FORMATTYPE_FIX, ///< Fixed-point.
+ FORMATTYPE_BOOL ///< Boolean ('true' or 'false').
+};
+
+// ----------------------------------------------------------------------------
+
+/** Describes the output format of a data item.
+
+ Data items are written in the following format:
+
+ <NAME>=<VALUE>=<NAME-FROM-LIST>
+
+ NAME is the name of the data item. The name is contained in the member
+ maItemName. If the name is empty, only the value is written (without a
+ leading equality sign).
+
+ VALUE is the numeric value of the data item. Its format is dependent on the
+ output format given in the member meFmtType. If the format type is
+ FORMATTYPE_NONE, no value is written.
+
+ NAME-FROM-LIST is a symbolic name for the current value of the data item.
+ Various types of name lists produce different names for values, which can
+ be used for enumerations or names for single bits in bitfields (see class
+ NameListBase and derived classes). The name of the list is given in the
+ member maListName. If it is empty, no name is written for the value.
+ */
+struct ItemFormat
+{
+ DataType meDataType; ///< Data type of the item.
+ FormatType meFmtType; ///< Output format for the value.
+ OUString maItemName; ///< Name of the item.
+ OUString maListName; ///< Name of a name list to be used for this item.
+
+ explicit ItemFormat();
+
+ void set( DataType eDataType, FormatType eFmtType, const OUString& rItemName );
+
+ /** Initializes the struct from a vector of strings containing the item format.
+
+ The vector must contain at least 2 strings. The struct is filled from
+ the strings in the vector in the following order:
+ 1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
+ 2) Format type (one of: dec, hex, shorthex, bin, fix, bool, unused, unknown).
+ 3) Item name (optional).
+ 4) Name list name (optional).
+
+ @return Iterator pointing to the first unhandled string.
+ */
+ OUStringVector::const_iterator parse( const OUStringVector& rFormatVec );
+
+ /** Initializes the struct from a string containing the item format.
+
+ The string must have the following format:
+ DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]]
+
+ DATATYPE is the data type of the item (see above for possible values).
+ FORMATTYPE is the format type of the item (see above for possible values).
+ ITEMNAME is the name of the item (optional).
+ LISTNAME is the name of a name list (optional).
+
+ @return List containing remaining unhandled format strings.
+ */
+ OUStringVector parse( const OUString& rFormatStr );
+};
+
+// ============================================================================
+// ============================================================================
+
+struct Address
+{
+ sal_Int32 mnCol;
+ sal_Int32 mnRow;
+ inline explicit Address() : mnCol( 0 ), mnRow( 0 ) {}
+ inline explicit Address( sal_Int32 nCol, sal_Int32 nRow ) : mnCol( nCol ), mnRow( nRow ) {}
+};
+
+// ----------------------------------------------------------------------------
+
+struct Range
+{
+ Address maFirst;
+ Address maLast;
+ inline explicit Range() {}
+};
+
+// ----------------------------------------------------------------------------
+
+typedef ::std::vector< Range > RangeList;
+
+// ============================================================================
+
+struct TokenAddress : public Address
+{
+ bool mbRelCol;
+ bool mbRelRow;
+ inline explicit TokenAddress() : mbRelCol( false ), mbRelRow( false ) {}
+};
+
+// ----------------------------------------------------------------------------
+
+struct TokenRange
+{
+ TokenAddress maFirst;
+ TokenAddress maLast;
+ inline explicit TokenRange() {}
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Static helper functions for formatted output to strings. */
+class StringHelper
+{
+public:
+ // append string to string ------------------------------------------------
+
+ static void appendChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1 );
+ static void appendString( OUStringBuffer& rStr, const OUString& rData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append decimal ---------------------------------------------------------
+
+ static void appendDec( OUStringBuffer& rStr, sal_uInt8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int8 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int16 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int32 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_uInt64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, sal_Int64 nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+ static void appendDec( OUStringBuffer& rStr, double fData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' );
+
+ // append hexadecimal -----------------------------------------------------
+
+ static void appendHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append shortened hexadecimal -------------------------------------------
+
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int8 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int16 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int32 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_uInt64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, sal_Int64 nData, bool bPrefix = true );
+ static void appendShortHex( OUStringBuffer& rStr, double fData, bool bPrefix = true );
+
+ // append binary ----------------------------------------------------------
+
+ static void appendBin( OUStringBuffer& rStr, sal_uInt8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int8 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int16 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int32 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_uInt64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, sal_Int64 nData, bool bDots = true );
+ static void appendBin( OUStringBuffer& rStr, double fData, bool bDots = true );
+
+ // append fixed-point decimal ---------------------------------------------
+
+ template< typename Type >
+ static void appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth = 0 );
+
+ // append formatted value -------------------------------------------------
+
+ static void appendBool( OUStringBuffer& rStr, bool bData );
+ template< typename Type >
+ static void appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType );
+
+ // encoded text output ----------------------------------------------------
+
+ static void appendCChar( OUStringBuffer& rStr, sal_Unicode cChar, bool bPrefix = true );
+ static void appendEncChar( OUStringBuffer& rStr, sal_Unicode cChar, sal_Int32 nCount = 1, bool bPrefix = true );
+ static void appendEncString( OUStringBuffer& rStr, const OUString& rData, bool bPrefix = true );
+
+ // token list -------------------------------------------------------------
+
+ static void appendToken( OUStringBuffer& rStr, const OUString& rToken, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ static void appendIndex( OUStringBuffer& rStr, const OUString& rIdx );
+ static void appendIndex( OUStringBuffer& rStr, sal_Int64 nIdx );
+
+ static OUString getToken( const OUString& rData, sal_Int32& rnPos, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+
+ /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */
+ static void enclose( OUStringBuffer& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
+
+ // string conversion ------------------------------------------------------
+
+ static OUString trimSpaces( const OUString& rStr );
+ static OUString trimTrailingNul( const OUString& rStr );
+
+ static OString convertToUtf8( const OUString& rStr );
+ static DataType convertToDataType( const OUString& rStr );
+ static FormatType convertToFormatType( const OUString& rStr );
+
+ static bool convertFromDec( sal_Int64& ornData, const OUString& rData );
+ static bool convertFromHex( sal_Int64& ornData, const OUString& rData );
+
+ static bool convertStringToInt( sal_Int64& ornData, const OUString& rData );
+ static bool convertStringToDouble( double& orfData, const OUString& rData );
+ static bool convertStringToBool( const OUString& rData );
+
+ static OUStringPair convertStringToPair( const OUString& rString, sal_Unicode cSep = '=' );
+
+ // string to list conversion ----------------------------------------------
+
+ static void convertStringToStringList( OUStringVector& orVec, const OUString& rData, bool bIgnoreEmpty );
+ static void convertStringToIntList( Int64Vector& orVec, const OUString& rData, bool bIgnoreEmpty );
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void StringHelper::appendFix( OUStringBuffer& rStr, Type nData, sal_Int32 nWidth )
+{
+ appendDec( rStr, static_cast< double >( nData ) / pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
+}
+
+template< typename Type >
+void StringHelper::appendValue( OUStringBuffer& rStr, Type nData, FormatType eFmtType )
+{
+ switch( eFmtType )
+ {
+ case FORMATTYPE_DEC: appendDec( rStr, nData ); break;
+ case FORMATTYPE_HEX: appendHex( rStr, nData ); break;
+ case FORMATTYPE_SHORTHEX: appendShortHex( rStr, nData ); break;
+ case FORMATTYPE_BIN: appendBin( rStr, nData ); break;
+ case FORMATTYPE_FIX: appendFix( rStr, nData ); break;
+ case FORMATTYPE_BOOL: appendBool( rStr, nData ); break;
+ default:;
+ }
+}
+
+// ============================================================================
+
+class String : public OUString
+{
+public:
+ inline String() {}
+ inline /*implicit*/ String( const OUString& rStr ) : OUString( rStr ) {}
+ inline /*implicit*/ String( const sal_Char* pcStr ) : OUString( OUString::createFromAscii( pcStr ? pcStr : "" ) ) {}
+ inline /*implicit*/ String( sal_Unicode cChar ) : OUString( cChar ) {}
+
+ inline bool has() const { return getLength() > 0; }
+ inline OUString operator()( const sal_Char* pcDefault ) const { if( has() ) return *this; return String( pcDefault ); }
+};
+
+static const String EMPTY_STRING;
+
+// ============================================================================
+// ============================================================================
+
+class Base;
+typedef ::boost::shared_ptr< Base > BaseRef;
+
+/** Base class for all dumper classes.
+
+ Derived classes implement the virtual function implIsValid(). It should
+ check all members the other functions rely on. If the function
+ implIsValid() returns true, all references and pointers can be used without
+ further checking.
+
+ Overview of all classes in this header file based on this Base class:
+
+ Base
+ |
+ +----> NameListBase
+ | |
+ | +----> ConstList ------> MultiList
+ | |
+ | +----> FlagsList ------> CombiList
+ | |
+ | +----> UnitConverter
+ |
+ +----> SharedConfigData
+ |
+ +----> Config
+ |
+ +----> Output
+ |
+ +----> StorageIterator
+ |
+ +----> ObjectBase
+ |
+ +----> StorageObjectBase
+ |
+ +----> OutputObjectBase
+ | |
+ | +----> InputObjectBase
+ | |
+ | +----> BinaryStreamObject
+ | |
+ | +----> TextStreamObjectBase
+ | | |
+ | | +----> TextStreamObject
+ | | |
+ | | +----> XmlStreamObject
+ | |
+ | +----> RecordObjectBase
+ | |
+ | +----> SequenceRecordObjectBase
+ |
+ +----> DumperBase
+ */
+class Base
+{
+public:
+ virtual ~Base();
+
+ inline bool isValid() const { return implIsValid(); }
+ inline static bool isValid( const BaseRef& rxBase ) { return rxBase.get() && rxBase->isValid(); }
+
+protected:
+ inline explicit Base() {}
+
+ virtual bool implIsValid() const = 0;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ConfigItemBase
+{
+public:
+ virtual ~ConfigItemBase();
+ void readConfigBlock( TextInputStream& rStrm );
+
+protected:
+ inline explicit ConfigItemBase() {}
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ void readConfigBlockContents(
+ TextInputStream& rStrm );
+
+private:
+ enum LineType { LINETYPE_DATA, LINETYPE_END };
+
+ LineType readConfigLine(
+ TextInputStream& rStrm,
+ OUString& orKey,
+ OUString& orData ) const;
+
+ void processConfigItem(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+};
+
+// ============================================================================
+
+class SharedConfigData;
+class Config;
+
+class NameListBase;
+typedef ::boost::shared_ptr< NameListBase > NameListRef;
+
+/** Base class of all classes providing names for specific values (name lists).
+
+ The idea is to provide a unique interfase for all different methods to
+ write specific names for any values. This can be enumerations (dedicated
+ names for a subset of values), or names for bits in bit fields. Classes
+ derived from this base class implement the specific behaviour for the
+ desired purpose.
+ */
+class NameListBase : public Base, public ConfigItemBase
+{
+public:
+ typedef ::std::map< sal_Int64, OUString > OUStringMap;
+ typedef OUStringMap::const_iterator const_iterator;
+
+public:
+ virtual ~NameListBase();
+
+ /** Sets a name for the specified key. */
+ void setName( sal_Int64 nKey, const String& rName );
+
+ /** Include all names of the passed list. */
+ void includeList( const NameListRef& rxList );
+
+ /** Returns true, if the map contains an entry for the passed key. */
+ template< typename Type >
+ inline bool hasName( Type nKey ) const
+ { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
+
+ /** Returns the name for the passed key. */
+ template< typename Type >
+ inline OUString getName( const Config& rCfg, Type nKey ) const
+ { return implGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
+
+ /** Returns a display name for the passed double value. */
+ inline OUString getName( const Config& rCfg, double fValue ) const
+ { return implGetNameDbl( rCfg, fValue ); }
+
+ /** Returns a map iterator pointing to the first contained name. */
+ inline const_iterator begin() const { return maMap.begin(); }
+ /** Returns a map iterator pointing one past the last contained name. */
+ inline const_iterator end() const { return maMap.end(); }
+
+protected:
+ inline explicit NameListBase( const SharedConfigData& rCfgData ) : mrCfgData( rCfgData ) {}
+
+ virtual bool implIsValid() const;
+
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implProcessConfigItemInt(
+ TextInputStream& rStrm,
+ sal_Int64 nKey,
+ const OUString& rData );
+
+ /** Derived classes set the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName ) = 0;
+ /** Derived classes generate and return the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
+ /** Derived classes generate and return the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const = 0;
+ /** Derived classes insert all names and other settings from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList ) = 0;
+
+ /** Inserts the passed name into the internal map. */
+ void insertRawName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or 0, if nothing found. */
+ const OUString* findRawName( sal_Int64 nKey ) const;
+
+private:
+ /** Includes name lists, given in a comma separated list of names of the lists. */
+ void include( const OUString& rListKeys );
+ /** Excludes names from the list, given in a comma separated list of their keys. */
+ void exclude( const OUString& rKeys );
+
+private:
+ OUStringMap maMap;
+ const SharedConfigData& mrCfgData;
+};
+
+// ============================================================================
+
+class ConstList : public NameListBase
+{
+public:
+ explicit ConstList( const SharedConfigData& rCfgData );
+
+ /** Sets a default name for unknown keys. */
+ inline void setDefaultName( const String& rDefName ) { maDefName = rDefName; }
+ /** Enables or disables automatic quotation of returned names. */
+ inline void setQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key, or the default name, if key is not contained. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Inserts all names from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ OUString maDefName;
+ bool mbQuoteNames;
+};
+
+// ============================================================================
+
+class MultiList : public ConstList
+{
+public:
+ explicit MultiList( const SharedConfigData& rCfgData );
+
+ void setNamesFromVec( sal_Int64 nStartKey, const OUStringVector& rNames );
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+
+private:
+ void insertNames( sal_Int64 nStartKey, const OUString& rData );
+
+private:
+ bool mbIgnoreEmpty;
+};
+
+// ============================================================================
+
+class FlagsList : public NameListBase
+{
+public:
+ explicit FlagsList( const SharedConfigData& rCfgData );
+
+ /** Returns the flags to be ignored on output. */
+ inline sal_Int64 getIgnoreFlags() const { return mnIgnore; }
+ /** Sets flags to be ignored on output. */
+ inline void setIgnoreFlags( sal_Int64 nIgnore ) { mnIgnore = nIgnore; }
+
+protected:
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the name for the passed double value. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ sal_Int64 mnIgnore;
+};
+
+// ============================================================================
+
+class CombiList : public FlagsList
+{
+public:
+ explicit CombiList( const SharedConfigData& rCfgData );
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the name for the passed key. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Inserts all flags from the passed list. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ struct ExtItemFormatKey
+ {
+ sal_Int64 mnKey;
+ Int64Pair maFilter;
+ inline explicit ExtItemFormatKey( sal_Int64 nKey ) : mnKey( nKey ), maFilter( 0, 0 ) {}
+ bool operator<( const ExtItemFormatKey& rRight ) const;
+
+ };
+ struct ExtItemFormat : public ItemFormat
+ {
+ bool mbShiftValue;
+ inline explicit ExtItemFormat() : mbShiftValue( true ) {}
+ };
+ typedef ::std::map< ExtItemFormatKey, ExtItemFormat > ExtItemFormatMap;
+ ExtItemFormatMap maFmtMap;
+};
+
+// ============================================================================
+
+class UnitConverter : public NameListBase
+{
+public:
+ explicit UnitConverter( const SharedConfigData& rCfgData );
+
+ inline void setUnitName( const String& rUnitName ) { maUnitName = rUnitName; }
+ inline void setFactor( double fFactor ) { mfFactor = fFactor; }
+
+protected:
+ /** Sets the name for the passed key. */
+ virtual void implSetName( sal_Int64 nKey, const OUString& rName );
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetName( const Config& rCfg, sal_Int64 nKey ) const;
+ /** Returns the converted value with appended unit name. */
+ virtual OUString implGetNameDbl( const Config& rCfg, double fValue ) const;
+ /** Empty implementation. */
+ virtual void implIncludeList( const NameListBase& rList );
+
+private:
+ OUString maUnitName;
+ double mfFactor;
+};
+
+// ============================================================================
+
+class NameListWrapper
+{
+public:
+ inline NameListWrapper() {}
+ inline /*implicit*/ NameListWrapper( const OUString& rListName ) : maName( rListName ) {}
+ inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maName( pcListName ) {}
+ inline /*implicit*/ NameListWrapper( const NameListRef& rxList ) : mxList( rxList ) {}
+
+ inline bool isEmpty() const { return !mxList && !maName.has(); }
+ NameListRef getNameList( const Config& rCfg ) const;
+
+private:
+ String maName;
+ mutable NameListRef mxList;
+};
+
+static const NameListWrapper NO_LIST;
+
+// ============================================================================
+
+class ItemFormatMap : public ::std::map< sal_Int64, ItemFormat >
+{
+public:
+ inline explicit ItemFormatMap() {}
+ inline explicit ItemFormatMap( const NameListRef& rxNameList ) { insertFormats( rxNameList ); }
+
+ void insertFormats( const NameListRef& rxNameList );
+};
+
+// ============================================================================
+// ============================================================================
+
+class SharedConfigData : public Base, public ConfigItemBase
+{
+public:
+ explicit SharedConfigData(
+ const OUString& rFileName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~SharedConfigData();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxContext; }
+ inline const StorageRef& getRootStorage() const { return mxRootStrg; }
+ inline const OUString& getSysFileName() const { return maSysFileName; }
+
+ void setOption( const OUString& rKey, const OUString& rData );
+ const OUString* getOption( const OUString& rKey ) const;
+
+ template< typename ListType >
+ ::boost::shared_ptr< ListType > createNameList( const OUString& rListName );
+ void setNameList( const OUString& rListName, const NameListRef& rxList );
+ void eraseNameList( const OUString& rListName );
+ NameListRef getNameList( const OUString& rListName ) const;
+
+ inline bool isPasswordCancelled() const { return mbPwCancelled; }
+
+protected:
+ virtual bool implIsValid() const;
+ virtual void implProcessConfigItemStr(
+ TextInputStream& rStrm,
+ const OUString& rKey,
+ const OUString& rData );
+
+private:
+ bool readConfigFile( const OUString& rFileUrl );
+ template< typename ListType >
+ void readNameList( TextInputStream& rStrm, const OUString& rListName );
+ void createShortList( const OUString& rData );
+ void createUnitConverter( const OUString& rData );
+
+private:
+ typedef ::std::set< OUString > ConfigFileSet;
+ typedef ::std::map< OUString, OUString > ConfigDataMap;
+ typedef ::std::map< OUString, NameListRef > NameListMap;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
+ StorageRef mxRootStrg;
+ OUString maSysFileName;
+ ConfigFileSet maConfigFiles;
+ ConfigDataMap maConfigData;
+ NameListMap maNameLists;
+ OUString maConfigPath;
+ bool mbLoaded;
+ bool mbPwCancelled;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename ListType >
+::boost::shared_ptr< ListType > SharedConfigData::createNameList( const OUString& rListName )
+{
+ ::boost::shared_ptr< ListType > xList;
+ if( !rListName.isEmpty() )
+ {
+ xList.reset( new ListType( *this ) );
+ setNameList( rListName, xList );
+ }
+ return xList;
+}
+
+template< typename ListType >
+void SharedConfigData::readNameList( TextInputStream& rStrm, const OUString& rListName )
+{
+ NameListRef xList = createNameList< ListType >( rListName );
+ if( xList.get() )
+ xList->readConfigBlock( rStrm );
+}
+
+// ============================================================================
+
+class Config : public Base
+{
+public:
+ explicit Config( const Config& rParent );
+ explicit Config(
+ const sal_Char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ explicit Config(
+ const sal_Char* pcEnvVar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual ~Config();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& getContext() const { return mxCfgData->getContext(); }
+ inline const StorageRef& getRootStorage() const { return mxCfgData->getRootStorage(); }
+ inline const OUString& getSysFileName() const { return mxCfgData->getSysFileName(); }
+
+ const OUString& getStringOption( const String& rKey, const OUString& rDefault ) const;
+ bool getBoolOption( const String& rKey, bool bDefault ) const;
+ template< typename Type >
+ Type getIntOption( const String& rKey, Type nDefault ) const;
+
+ bool isDumperEnabled() const;
+ bool isImportEnabled() const;
+
+ template< typename ListType >
+ ::boost::shared_ptr< ListType > createNameList( const String& rListName );
+ void eraseNameList( const String& rListName );
+ NameListRef getNameList( const String& rListName ) const;
+
+ /** Returns the name for the passed key from the passed name list. */
+ template< typename Type >
+ OUString getName( const NameListWrapper& rListWrp, Type nKey ) const;
+ /** Returns true, if the passed name list contains an entry for the passed key. */
+ template< typename Type >
+ bool hasName( const NameListWrapper& rListWrp, Type nKey ) const;
+
+ bool isPasswordCancelled() const;
+
+protected:
+ inline explicit Config() {}
+ void construct( const Config& rParent );
+ void construct(
+ const sal_Char* pcEnvVar,
+ const ::oox::core::FilterBase& rFilter );
+ void construct(
+ const sal_Char* pcEnvVar,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const StorageRef& rxRootStrg,
+ const OUString& rSysFileName );
+
+ virtual bool implIsValid() const;
+ virtual const OUString* implGetOption( const OUString& rKey ) const;
+ virtual NameListRef implGetNameList( const OUString& rListName ) const;
+
+private:
+ typedef ::boost::shared_ptr< SharedConfigData > SharedConfigDataRef;
+ SharedConfigDataRef mxCfgData;
+};
+
+typedef ::boost::shared_ptr< Config > ConfigRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+Type Config::getIntOption( const String& rKey, Type nDefault ) const
+{
+ sal_Int64 nRawData;
+ const OUString* pData = implGetOption( rKey );
+ return (pData && StringHelper::convertStringToInt( nRawData, *pData )) ?
+ static_cast< Type >( nRawData ) : nDefault;
+}
+
+template< typename ListType >
+::boost::shared_ptr< ListType > Config::createNameList( const String& rListName )
+{
+ return mxCfgData->createNameList< ListType >( rListName );
+}
+
+template< typename Type >
+OUString Config::getName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() ? xList->getName( *this, nKey ) : OOX_DUMP_ERR_NOMAP;
+}
+
+template< typename Type >
+bool Config::hasName( const NameListWrapper& rListWrp, Type nKey ) const
+{
+ NameListRef xList = rListWrp.getNameList( *this );
+ return xList.get() && xList->hasName( nKey );
+}
+
+// ============================================================================
+// ============================================================================
+
+class Output : public Base
+{
+public:
+ explicit Output(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const OUString& rFileName );
+
+ // ------------------------------------------------------------------------
+
+ void newLine();
+ void emptyLine( size_t nCount = 1 );
+ inline OUStringBuffer& getLine() { return maLine; }
+
+ void incIndent();
+ void decIndent();
+
+ void startTable( sal_Int32 nW1 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2 );
+ void startTable( sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 );
+ void startTable( size_t nColCount, const sal_Int32* pnColWidths );
+ void tab();
+ void tab( size_t nCol );
+ void endTable();
+
+ void resetItemIndex( sal_Int64 nIdx = 0 );
+ void startItem( const String& rItemName );
+ void contItem();
+ void endItem();
+ inline const OUString& getLastItemValue() const { return maLastItem; }
+
+ void startMultiItems();
+ void endMultiItems();
+
+ // ------------------------------------------------------------------------
+
+ void writeChar( sal_Unicode cChar, sal_Int32 nCount = 1 );
+ void writeAscii( const sal_Char* pcStr );
+ void writeString( const OUString& rStr );
+ void writeArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeBool( bool bData );
+ void writeDateTime( const ::com::sun::star::util::DateTime& rDateTime );
+
+ template< typename Type >
+ inline void writeDec( Type nData, sal_Int32 nWidth = 0, sal_Unicode cFill = ' ' )
+ { StringHelper::appendDec( maLine, nData, nWidth, cFill ); }
+ template< typename Type >
+ inline void writeHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ inline void writeShortHex( Type nData, bool bPrefix = true )
+ { StringHelper::appendShortHex( maLine, nData, bPrefix ); }
+ template< typename Type >
+ inline void writeBin( Type nData, bool bDots = true )
+ { StringHelper::appendBin( maLine, nData, bDots ); }
+ template< typename Type >
+ inline void writeFix( Type nData, sal_Int32 nWidth = 0 )
+ { StringHelper::appendFix( maLine, nData, nWidth ); }
+ template< typename Type >
+ inline void writeValue( Type nData, FormatType eFmtType )
+ { StringHelper::appendValue( maLine, nData, eFmtType ); }
+ template< typename Type >
+ inline void writeName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
+ { writeString( rCfg.getName( rListWrp, nData ) ); }
+
+ // ------------------------------------------------------------------------
+protected:
+ virtual bool implIsValid() const;
+
+private:
+ void writeItemName( const String& rItemName );
+
+private:
+ typedef ::std::vector< sal_Int32 > StringLenVec;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XTextOutputStream2 > mxStrm;
+ OUString maIndent;
+ OUStringBuffer maLine;
+ OUString maLastItem;
+ StringLenVec maColPos;
+ size_t mnCol;
+ size_t mnItemLevel;
+ size_t mnMultiLevel;
+ sal_Int64 mnItemIdx;
+ sal_Int32 mnLastItem;
+};
+
+typedef ::boost::shared_ptr< Output > OutputRef;
+
+// ============================================================================
+
+class IndentGuard
+{
+public:
+ inline explicit IndentGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.incIndent(); }
+ inline ~IndentGuard() { mrOut.decIndent(); }
+private:
+ IndentGuard( const IndentGuard& );
+ IndentGuard& operator=( const IndentGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class TableGuard
+{
+public:
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, sal_Int32 nW1, sal_Int32 nW2, sal_Int32 nW3, sal_Int32 nW4 ) :
+ mrOut( *rxOut ) { mrOut.startTable( nW1, nW2, nW3, nW4 ); }
+ inline explicit TableGuard( const OutputRef& rxOut, size_t nColCount,
+ const sal_Int32* pnColWidths ) :
+ mrOut( *rxOut ) { mrOut.startTable( nColCount, pnColWidths ); }
+ inline ~TableGuard() { mrOut.endTable(); }
+ inline void tab() { mrOut.tab(); }
+ inline void tab( size_t nCol ) { mrOut.tab( nCol ); }
+private:
+ TableGuard( const TableGuard& );
+ TableGuard& operator=( const TableGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class ItemGuard
+{
+public:
+ inline explicit ItemGuard( const OutputRef& rxOut, const String& rName = EMPTY_STRING ) :
+ mrOut( *rxOut ) { mrOut.startItem( rName ); }
+ inline ~ItemGuard() { mrOut.endItem(); }
+ inline void cont() { mrOut.contItem(); }
+private:
+ ItemGuard( const ItemGuard& );
+ ItemGuard& operator=( const ItemGuard& );
+private:
+ Output& mrOut;
+};
+
+// ----------------------------------------------------------------------------
+
+class MultiItemsGuard
+{
+public:
+ inline explicit MultiItemsGuard( const OutputRef& rxOut ) : mrOut( *rxOut ) { mrOut.startMultiItems(); }
+ inline ~MultiItemsGuard() { mrOut.endMultiItems(); }
+private:
+ MultiItemsGuard( const MultiItemsGuard& );
+ MultiItemsGuard& operator=( const MultiItemsGuard& );
+private:
+ Output& mrOut;
+};
+
+// ============================================================================
+
+class StorageIterator : public Base
+{
+public:
+ explicit StorageIterator( const StorageRef& rxStrg );
+ virtual ~StorageIterator();
+
+ StorageIterator& operator++();
+
+ OUString getName() const;
+ bool isStream() const;
+ bool isStorage() const;
+
+private:
+ virtual bool implIsValid() const;
+
+private:
+ StorageRef mxStrg;
+ OUStringVector maNames;
+ OUStringVector::const_iterator maIt;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ObjectBase : public Base
+{
+public:
+ virtual ~ObjectBase();
+
+ inline const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
+ getContext() const { return mxConfig->getContext(); }
+
+ void dump();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit ObjectBase() {}
+
+ void construct( const ConfigRef& rxConfig );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ // ------------------------------------------------------------------------
+
+ inline Config& cfg() const { return *mxConfig; }
+
+private:
+ ConfigRef mxConfig;
+};
+
+typedef ::boost::shared_ptr< ObjectBase > ObjectRef;
+
+// ============================================================================
+// ============================================================================
+
+class StorageObjectBase : public ObjectBase
+{
+protected:
+ inline explicit StorageObjectBase() {}
+
+protected:
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+ void construct( const ObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+ void addPreferredStream( const String& rStrmName );
+ void addPreferredStorage( const String& rStrgPath );
+
+private:
+ OUString getSysFileName(
+ const OUString& rStrmName,
+ const OUString& rSysOutPath );
+
+ void extractStream(
+ StorageBase& rStrg,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+ void extractStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+ void extractItem(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rItemName,
+ const OUString& rSysPath,
+ bool bIsStrg, bool bIsStrm );
+
+private:
+ struct PreferredItem
+ {
+ OUString maName;
+ bool mbStorage;
+
+ inline explicit PreferredItem( const OUString rName, bool bStorage ) :
+ maName( rName ), mbStorage( bStorage ) {}
+ };
+ typedef ::std::vector< PreferredItem > PreferredItemVector;
+
+ StorageRef mxStrg;
+ OUString maSysPath;
+ PreferredItemVector maPreferred;
+};
+
+typedef ::boost::shared_ptr< StorageObjectBase > StorageObjectRef;
+
+// ============================================================================
+// ============================================================================
+
+class OutputObjectBase : public ObjectBase
+{
+public:
+ virtual ~OutputObjectBase();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit OutputObjectBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ObjectBase& rParent, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+
+ // ------------------------------------------------------------------------
+
+ void writeEmptyItem( const String& rName );
+ void writeInfoItem( const String& rName, const String& rData );
+ void writeCharItem( const String& rName, sal_Unicode cData );
+ void writeStringItem( const String& rName, const OUString& rData );
+ void writeArrayItem( const String& rName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ void writeDateTimeItem( const String& rName, const ::com::sun::star::util::DateTime& rDateTime );
+ void writeGuidItem( const String& rName, const OUString& rGuid );
+
+ template< typename Type >
+ void addNameToItem( Type nData, const NameListWrapper& rListWrp );
+
+ template< typename Type >
+ void writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp );
+ template< typename Type >
+ void writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ void writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
+
+ template< typename Type >
+ void writeValueItem( const ItemFormat& rItemFmt, Type nData );
+
+ template< typename Type >
+ void writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep = ',' );
+
+protected:
+ OutputRef mxOut;
+ OUString maSysFileName;
+};
+
+typedef ::boost::shared_ptr< OutputObjectBase > OutputObjectRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void OutputObjectBase::addNameToItem( Type nData, const NameListWrapper& rListWrp )
+{
+ if( !rListWrp.isEmpty() )
+ {
+ mxOut->contItem();
+ mxOut->writeName( cfg(), nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeNameItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeName( cfg(), nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeShortHexItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeShortHex( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeBinItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeBin( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeFixItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeFix( nData );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecBoolItem( const String& rName, Type nData, const NameListWrapper& rListWrp )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData );
+ aItem.cont();
+ mxOut->writeBool( nData != 0 );
+ addNameToItem( nData, rListWrp );
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const String& rName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
+{
+ if( eFmtType == FORMATTYPE_BOOL )
+ writeDecBoolItem( rName, nData, rListWrp );
+ else
+ {
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeValue( nData, eFmtType );
+ addNameToItem( nData, rListWrp );
+ }
+}
+
+template< typename Type >
+void OutputObjectBase::writeValueItem( const ItemFormat& rItemFmt, Type nData )
+{
+ OString aNameUtf8 = StringHelper::convertToUtf8( rItemFmt.maItemName );
+ writeValueItem( aNameUtf8.getStr(), nData, rItemFmt.meFmtType, rItemFmt.maListName );
+}
+
+template< typename Type >
+void OutputObjectBase::writeDecPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeDec( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeDec( nData2 );
+}
+
+template< typename Type >
+void OutputObjectBase::writeHexPairItem( const String& rName, Type nData1, Type nData2, sal_Unicode cSep )
+{
+ ItemGuard aItem( mxOut, rName );
+ mxOut->writeHex( nData1 );
+ mxOut->writeChar( cSep );
+ mxOut->writeHex( nData2 );
+}
+
+// ============================================================================
+// ============================================================================
+
+class InputObjectBase : public OutputObjectBase
+{
+public:
+ virtual ~InputObjectBase();
+
+ // ------------------------------------------------------------------------
+protected:
+ inline explicit InputObjectBase() {}
+
+ using OutputObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const OutputObjectBase& rParent, const BinaryInputStreamRef& rxStrm );
+ void construct( const InputObjectBase& rParent );
+
+ virtual bool implIsValid() const;
+
+ // ------------------------------------------------------------------------
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
+ getXInputStream() const;
+
+ // ------------------------------------------------------------------------
+
+ void skipBlock( sal_Int64 nBytes, bool bShowSize = true );
+ void dumpRawBinary( sal_Int64 nBytes, bool bShowOffset = true, bool bStream = false );
+
+ void dumpBinary( const String& rName, sal_Int64 nBytes, bool bShowOffset = true );
+ void dumpRemaining( sal_Int64 nBytes );
+ void dumpRemainingTo( sal_Int64 nPos );
+ void dumpRemainingStream();
+
+ void dumpArray( const String& rName, sal_Int32 nBytes, sal_Unicode cSep = OOX_DUMP_LISTSEP );
+ inline void dumpUnused( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNUSED, nBytes ); }
+ inline void dumpUnknown( sal_Int32 nBytes ) { dumpArray( OOX_DUMP_UNKNOWN, nBytes ); }
+
+ sal_Unicode dumpUnicode( const String& rName );
+
+ OUString dumpCharArray( const String& rName, sal_Int32 nLen, rtl_TextEncoding eTextEnc, bool bHideTrailingNul = false );
+ OUString dumpUnicodeArray( const String& rName, sal_Int32 nLen, bool bHideTrailingNul = false );
+
+ ::com::sun::star::util::DateTime dumpFileTime( const String& rName = EMPTY_STRING );
+ OUString dumpGuid( const String& rName = EMPTY_STRING );
+
+ void dumpItem( const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ Type dumpName( const String& rName, const NameListWrapper& rListWrp );
+ template< typename Type >
+ Type dumpDec( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHex( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBin( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpFix( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpBool( const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpValue( const ItemFormat& rItemFmt );
+
+ template< typename Type1, typename Type2 >
+ Type1 dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type1, typename Type2 >
+ Type1 dumpValue( bool bType1, const ItemFormat& rItemFmt );
+
+ template< typename Type >
+ void dumpDecPair( const String& rName, sal_Unicode cSep = ',' );
+ template< typename Type >
+ void dumpHexPair( const String& rName, sal_Unicode cSep = ',' );
+
+protected:
+ BinaryInputStreamRef mxStrm;
+};
+
+typedef ::boost::shared_ptr< InputObjectBase > InputObjectRef;
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+Type InputObjectBase::dumpName( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeNameItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpDec( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeDecItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpHex( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeHexItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBin( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeBinItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpFix( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeFixItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpBool( const String& rName, const NameListWrapper& rListWrp )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeDecBoolItem( rName, nData, rListWrp );
+ return nData;
+}
+
+template< typename Type >
+Type InputObjectBase::dumpValue( const ItemFormat& rItemFmt )
+{
+ Type nData;
+ *mxStrm >> nData;
+ writeValueItem( rItemFmt, nData );
+ return nData;
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpName( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpName< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpName< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpDec( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpDec< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpDec< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpHex( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpHex< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpHex< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBin( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBin< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBin< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpFix( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpFix< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpFix< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpBool( bool bType1, const String& rName, const NameListWrapper& rListWrp )
+{
+ return bType1 ? dumpBool< Type1 >( rName, rListWrp ) : static_cast< Type1 >( dumpBool< Type2 >( rName, rListWrp ) );
+}
+
+template< typename Type1, typename Type2 >
+Type1 InputObjectBase::dumpValue( bool bType1, const ItemFormat& rItemFmt )
+{
+ return bType1 ? dumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( dumpValue< Type2 >( rItemFmt ) );
+}
+
+template< typename Type >
+void InputObjectBase::dumpDecPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeDecPairItem( rName, nData1, nData2, cSep );
+}
+
+template< typename Type >
+void InputObjectBase::dumpHexPair( const String& rName, sal_Unicode cSep )
+{
+ Type nData1, nData2;
+ *mxStrm >> nData1 >> nData2;
+ writeHexPairItem( rName, nData1, nData2, cSep );
+}
+
+// ============================================================================
+// ============================================================================
+
+class BinaryStreamObject : public InputObjectBase
+{
+public:
+ explicit BinaryStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ void dumpBinaryStream( bool bShowOffset = true );
+
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class TextStreamObjectBase : public InputObjectBase
+{
+protected:
+ inline TextStreamObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+ void construct(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpText( TextInputStream& rTextStrm ) = 0;
+
+private:
+ void constructTextStrmObj( rtl_TextEncoding eTextEnc );
+
+protected:
+ ::boost::shared_ptr< TextInputStream > mxTextStrm;
+};
+
+// ============================================================================
+
+class TextLineStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit TextLineStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc,
+ const OUString& rSysFileName );
+
+ explicit TextLineStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ rtl_TextEncoding eTextEnc );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
+ virtual void implDumpLine( const OUString& rLine, sal_uInt32 nLine );
+};
+
+// ============================================================================
+
+class XmlStreamObject : public TextStreamObjectBase
+{
+public:
+ explicit XmlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDumpText( TextInputStream& rTextStrm );
+};
+
+// ============================================================================
+// ============================================================================
+
+class RecordObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit RecordObjectBase() {}
+
+ using InputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const BinaryInputStreamRef& rxRecStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs = EMPTY_STRING );
+
+ inline sal_Int64 getRecPos() const { return mnRecPos; }
+ inline sal_Int64 getRecId() const { return mnRecId; }
+ inline sal_Int64 getRecSize() const { return mnRecSize; }
+ inline NameListRef getRecNames() const { return maRecNames.getNameList( cfg() ); }
+
+ inline void setBinaryOnlyMode( bool bBinaryOnly ) { mbBinaryOnly = bBinaryOnly; }
+ inline bool isBinaryOnlyMode() const { return mbBinaryOnly; }
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+ virtual void implWriteExtHeader();
+ virtual void implDumpRecordBody();
+
+private:
+ void constructRecObjBase(
+ const BinaryInputStreamRef& rxBaseStrm,
+ const String& rRecNames,
+ const String& rSimpleRecs );
+
+ void writeHeader();
+
+private:
+ BinaryInputStreamRef mxBaseStrm;
+ NameListWrapper maRecNames;
+ NameListWrapper maSimpleRecs;
+ sal_Int64 mnRecPos;
+ sal_Int64 mnRecId;
+ sal_Int64 mnRecSize;
+ bool mbShowRecPos;
+ bool mbBinaryOnly;
+};
+
+// ============================================================================
+
+class SequenceRecordObjectBase : public RecordObjectBase
+{
+protected:
+ inline explicit SequenceRecordObjectBase() : mxRecData( new StreamDataSequence ) {}
+
+ inline StreamDataSequence& getRecordDataSequence() { return *mxRecData; }
+
+ using RecordObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxBaseStrm,
+ const OUString& rSysFileName,
+ const String& rRecNames,
+ const String& rSimpleRecs = EMPTY_STRING );
+
+ virtual bool implStartRecord( BinaryInputStream& rBaseStrm, sal_Int64& ornRecPos, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize ) = 0;
+
+private:
+ typedef ::boost::shared_ptr< StreamDataSequence > StreamDataSeqRef;
+ StreamDataSeqRef mxRecData;
+};
+
+// ============================================================================
+// ============================================================================
+
+/** Base class for a file dumper. Derived classes implement the implDump()
+ function to add functionality.
+ */
+class DumperBase : public ObjectBase
+{
+public:
+ virtual ~DumperBase();
+
+ bool isImportEnabled() const;
+ bool isImportCancelled() const;
+
+protected:
+ inline explicit DumperBase() {}
+
+ using ObjectBase::construct;
+ void construct( const ConfigRef& rxConfig );
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#define OOX_DUMP_FILE( DumperClassName ) \
+do { \
+ DumperClassName aDumper( *this ); \
+ aDumper.dump(); \
+ bool bCancelled = aDumper.isImportCancelled(); \
+ if( !aDumper.isImportEnabled() || bCancelled ) \
+ return aDumper.isValid() && !bCancelled; \
+} while( false )
+
+#else // OOX_INCLUDE_DUMPER
+
+#define OOX_DUMP_FILE( DumperClassName ) (void)0
+
+#endif // OOX_INCLUDE_DUMPER
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/oledumper.hxx b/include/oox/dump/oledumper.hxx
new file mode 100644
index 000000000000..b58500ef8f3c
--- /dev/null
+++ b/include/oox/dump/oledumper.hxx
@@ -0,0 +1,905 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_OLEDUMPER_HXX
+#define OOX_DUMP_OLEDUMPER_HXX
+
+#include "oox/helper/storagebase.hxx"
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+namespace dump {
+
+// ============================================================================
+// ============================================================================
+
+class OleInputObjectBase : public InputObjectBase
+{
+protected:
+ inline explicit OleInputObjectBase() {}
+
+ OUString dumpAnsiString32( const String& rName );
+ OUString dumpUniString32( const String& rName );
+
+ sal_Int32 dumpStdClipboardFormat( const String& rName = EMPTY_STRING );
+ OUString dumpAnsiString32OrStdClip( const String& rName );
+ OUString dumpUniString32OrStdClip( const String& rName );
+
+ void writeOleColorItem( const String& rName, sal_uInt32 nColor );
+ sal_uInt32 dumpOleColor( const String& rName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class StdFontObject : public OleInputObjectBase
+{
+public:
+ explicit StdFontObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+class StdPicObject : public OleInputObjectBase
+{
+public:
+ explicit StdPicObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OleStreamObject : public OleInputObjectBase
+{
+public:
+ explicit OleStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class OleCompObjObject : public OleStreamObject
+{
+public:
+ explicit OleCompObjObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+// ============================================================================
+
+class OlePropertyStreamObject : public InputObjectBase
+{
+public:
+ explicit OlePropertyStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+
+private:
+ void dumpSection( const OUString& rGuid, sal_uInt32 nStartPos );
+
+ void dumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
+ void dumpCodePageProperty( sal_uInt32 nStartPos );
+ void dumpDictionaryProperty( sal_uInt32 nStartPos );
+
+ sal_uInt16 dumpPropertyContents( sal_Int32 nPropId );
+ void dumpPropertyValue( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyVector( sal_Int32 nPropId, sal_uInt16 nBaseType );
+ void dumpPropertyArray( sal_Int32 nPropId, sal_uInt16 nBaseType );
+
+ sal_uInt16 dumpPropertyType();
+ void dumpBlob( sal_Int32 nPropId, const String& rName );
+ OUString dumpString8( const String& rName );
+ OUString dumpCharArray8( const String& rName, sal_Int32 nLen );
+ OUString dumpString16( const String& rName );
+ OUString dumpCharArray16( const String& rName, sal_Int32 nLen );
+ bool dumpTypedProperty( const String& rName, sal_uInt16 nExpectedType );
+ void dumpHlinks( sal_Int32 nSize );
+
+ bool startElement( sal_uInt32 nStartPos );
+ void writeSectionHeader( const OUString& rGuid, sal_uInt32 nStartPos );
+ void writePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
+
+private:
+ NameListRef mxPropIds;
+ rtl_TextEncoding meTextEnc;
+ bool mbIsUnicode;
+};
+
+// ============================================================================
+
+class OleStorageObject : public StorageObjectBase
+{
+public:
+ explicit OleStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ inline explicit OleStorageObject() {}
+
+ using StorageObjectBase::construct;
+ void construct( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+class ComCtlObjectBase : public OleInputObjectBase
+{
+protected:
+ explicit ComCtlObjectBase(
+ const InputObjectBase& rParent,
+ sal_uInt32 nDataId5, sal_uInt32 nDataId6, sal_uInt16 nVersion,
+ bool bCommonPart, bool bComplexPart );
+
+ virtual void implDump();
+ virtual void implDumpProperties() = 0;
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+
+private:
+ bool dumpComCtlHeader( sal_uInt32 nExpId, sal_uInt16 nExpMajor = SAL_MAX_UINT16, sal_uInt16 nExpMinor = SAL_MAX_UINT16 );
+ bool dumpComCtlSize();
+ bool dumpComCtlData( sal_uInt32& ornCommonPartSize );
+ bool dumpComCtlCommon( sal_uInt32 nPartSize );
+ bool dumpComCtlComplex();
+
+protected:
+ sal_uInt32 mnDataId5;
+ sal_uInt32 mnDataId6;
+ sal_uInt16 mnVersion;
+ bool mbCommonPart;
+ bool mbComplexPart;
+};
+
+// ============================================================================
+
+class ComCtlScrollBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlScrollBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlProgressBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlProgressBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlSliderObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlSliderObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlUpDownObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlUpDownObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+};
+
+// ============================================================================
+
+class ComCtlImageListObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlImageListObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+
+class ComCtlTabStripObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTabStripObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+};
+
+// ============================================================================
+
+class ComCtlTreeViewObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlTreeViewObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+
+private:
+ sal_uInt32 mnStringFlags;
+};
+
+// ============================================================================
+
+class ComCtlStatusBarObject : public ComCtlObjectBase
+{
+public:
+ explicit ComCtlStatusBarObject( const InputObjectBase& rParent, sal_uInt16 nVersion );
+
+protected:
+ virtual void implDumpProperties();
+ virtual void implDumpCommonExtra( sal_Int64 nEndPos );
+ virtual void implDumpCommonTrailing();
+};
+
+// ============================================================================
+// ============================================================================
+
+class AxPropertyObjectBase : public OleInputObjectBase
+{
+protected:
+ inline explicit AxPropertyObjectBase() {}
+
+ using OleInputObjectBase::construct;
+ void construct(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+ void construct(
+ const InputObjectBase& rParent,
+ const String& rPropNameList,
+ bool b64BitPropFlags = false );
+
+ virtual bool implIsValid() const;
+ virtual void implDump();
+
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+ bool ensureValid( bool bCondition = true );
+
+ template< typename Type >
+ void alignInput();
+
+ void setAlignAnchor();
+ bool startNextProperty();
+ OUString getPropertyName() const;
+
+ template< typename Type >
+ Type dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+ template< typename Type >
+ Type dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp = NO_LIST );
+
+ inline bool dumpBoolProperty() { return startNextProperty(); }
+ inline sal_Int32 dumpHmmProperty() { return dumpDecProperty< sal_Int32 >( 0, "CONV-HMM-TO-CM" ); }
+ inline sal_uInt8 dumpMousePtrProperty() { return dumpDecProperty< sal_uInt8 >( 0, "OLE-MOUSEPTR" ); }
+ template< typename Type >
+ inline Type dumpBorderStyleProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-BORDERSTYLE" ); }
+ template< typename Type >
+ inline Type dumpSpecialEffectProperty( Type nDefault ) { return dumpDecProperty< Type >( nDefault, "AX-SPECIALEFFECT" ); }
+ inline sal_uInt32 dumpEnabledProperty() { return dumpDecProperty< sal_uInt32 >( 1, "AX-ENABLED" ); }
+ inline sal_Int32 dumpOrientationProperty() { return dumpDecProperty< sal_Int32 >( -1, "AX-ORIENTATION" ); }
+ inline sal_Int32 dumpDelayProperty() { return dumpDecProperty< sal_Int32 >( 50, "AX-CONV-MS" ); }
+ inline sal_uInt32 dumpImagePosProperty() { return dumpHexProperty< sal_uInt32 >( 0x00070001, "AX-IMAGEPOS" ); }
+ inline sal_uInt8 dumpImageSizeModeProperty() { return dumpDecProperty< sal_uInt8 >( 0, "AX-IMAGESIZEMODE" ); }
+ inline sal_uInt8 dumpImageAlignProperty() { return dumpDecProperty< sal_uInt8 >( 2, "AX-IMAGEALIGN" ); }
+
+ sal_uInt32 dumpFlagsProperty( sal_uInt32 nDefault, const sal_Char* pcNameList = "AX-FLAGS" );
+ sal_uInt32 dumpColorProperty( sal_uInt32 nDefault );
+ sal_Unicode dumpUnicodeProperty();
+ void dumpUnknownProperty();
+
+ void dumpPosProperty();
+ void dumpSizeProperty();
+ void dumpGuidProperty( OUString* pValue = 0 );
+ void dumpStringProperty( OUString* pValue = 0 );
+ void dumpStringArrayProperty();
+ void dumpStreamProperty();
+
+ void dumpEmbeddedFont();
+ void dumpToPosition( sal_Int64 nPos );
+
+private:
+ void constructAxPropObj( const String& rPropNameList, bool b64BitPropFlags );
+
+ void dumpVersion();
+ OUString dumpString( const String& rName, sal_uInt32 nSize, bool bArray );
+ void dumpShortProperties();
+ void dumpLargeProperties();
+
+private:
+ struct LargeProperty
+ {
+ enum LargePropertyType { PROPTYPE_POS, PROPTYPE_SIZE, PROPTYPE_GUID, PROPTYPE_STRING, PROPTYPE_STRINGARRAY };
+
+ LargePropertyType mePropType;
+ OUString maItemName;
+ sal_uInt32 mnDataSize;
+ OUString* mpItemValue;
+ inline explicit LargeProperty( LargePropertyType ePropType, const String& rItemName, sal_uInt32 nDataSize, OUString* pItemValue = 0 ) :
+ mePropType( ePropType ), maItemName( rItemName ), mnDataSize( nDataSize ), mpItemValue( pItemValue ) {}
+ };
+ typedef ::std::vector< LargeProperty > LargePropertyVector;
+
+ struct StreamProperty
+ {
+ OUString maItemName;
+ sal_uInt16 mnData;
+ inline explicit StreamProperty( const String& rItemName, sal_uInt16 nData ) :
+ maItemName( rItemName ), mnData( nData ) {}
+ };
+ typedef ::std::vector< StreamProperty > StreamPropertyVector;
+
+ LargePropertyVector maLargeProps;
+ StreamPropertyVector maStreamProps;
+ NameListRef mxPropNames;
+ sal_Int64 mnPropertiesStart;
+ sal_Int64 mnPropertiesEnd;
+ sal_Int64 mnPropFlags;
+ sal_Int64 mnCurrProp;
+ bool mb64BitPropFlags;
+ bool mbValid;
+};
+
+// ----------------------------------------------------------------------------
+
+template< typename Type >
+void AxPropertyObjectBase::alignInput()
+{
+ mxStrm->skip( (sizeof( Type ) - ((mxStrm->tell() - mnPropertiesStart) % sizeof( Type ))) % sizeof( Type ) );
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpDecProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpDec< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+template< typename Type >
+Type AxPropertyObjectBase::dumpHexProperty( Type nDefault, const NameListWrapper& rListWrp )
+{
+ if( startNextProperty() )
+ {
+ alignInput< Type >();
+ return dumpHex< Type >( getPropertyName(), rListWrp );
+ }
+ return nDefault;
+}
+
+// ============================================================================
+
+class AxCFontNewObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCFontNewObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxColumnInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxColumnInfoObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxCommandButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxCommandButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+};
+
+// ============================================================================
+
+class AxMorphControlObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxMorphControlObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpColumnInfos();
+
+private:
+ sal_uInt16 mnColInfoCount;
+ sal_uInt8 mnCtrlType;
+};
+
+// ============================================================================
+
+class AxLabelObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxLabelObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+};
+
+// ============================================================================
+
+class AxImageObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxImageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxScrollBarObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxScrollBarObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxSpinButtonObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxSpinButtonObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class AxTabStripObject : public AxPropertyObjectBase
+{
+public:
+ explicit AxTabStripObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnTabFlagCount;
+};
+
+// ============================================================================
+// ============================================================================
+
+class FormControlStreamObject : public OleInputObjectBase
+{
+public:
+ explicit FormControlStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ const OUString* pProgId = 0 );
+ explicit FormControlStreamObject(
+ const OutputObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString* pProgId = 0 );
+
+protected:
+ virtual void implDump();
+
+private:
+ void constructFormCtrlStrmObj( const OUString* pProgId );
+
+private:
+ OUString maProgId;
+ bool mbReadGuid;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaFormSiteInfo
+{
+ OUString maProgId;
+ sal_Int32 mnId;
+ sal_uInt32 mnLength;
+ bool mbInStream;
+
+ inline explicit VbaFormSiteInfo() : mnId( 0 ), mnLength( 0 ), mbInStream( false ) {}
+};
+
+typedef ::std::vector< VbaFormSiteInfo > VbaFormSiteInfoVector;
+
+// ============================================================================
+
+struct VbaFormSharedData
+{
+ OUStringVector maClassInfoProgIds;
+ VbaFormSiteInfoVector maSiteInfos;
+};
+
+// ============================================================================
+
+class VbaFormClassInfoObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormClassInfoObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaFormSiteObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormSiteObject( const InputObjectBase& rParent, VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaFormDesignExtObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFormDesignExtObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class VbaFStreamObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaFStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ void dumpClassInfos();
+ void dumpFormSites( sal_uInt32 nCount );
+ void dumpSiteData();
+ void dumpDesignExtender();
+
+private:
+ VbaFormSharedData& mrFormData;
+ sal_uInt32 mnFlags;
+};
+
+// ============================================================================
+
+class VbaOStreamObject : public OleInputObjectBase
+{
+public:
+ explicit VbaOStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+};
+
+// ============================================================================
+
+class VbaMultiPageObject : public AxPropertyObjectBase
+{
+public:
+ explicit VbaMultiPageObject( const InputObjectBase& rParent );
+
+protected:
+ virtual void implDumpShortProperties();
+ virtual void implDumpExtended();
+
+private:
+ sal_Int32 mnPageCount;
+};
+
+// ============================================================================
+
+class VbaXStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaXStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaFormSharedData& rFormData );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaFormSharedData& mrFormData;
+};
+
+// ============================================================================
+
+class VbaContainerStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaContainerStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+private:
+ bool isFormStorage( const OUString& rStrgPath ) const;
+
+private:
+ VbaFormSharedData maFormData;
+};
+
+// ============================================================================
+// ============================================================================
+
+struct VbaSharedData
+{
+ typedef ::std::map< OUString, sal_Int32 > StreamOffsetMap;
+
+ StreamOffsetMap maStrmOffsets;
+ rtl_TextEncoding meTextEnc;
+
+ explicit VbaSharedData();
+
+ bool isModuleStream( const OUString& rStrmName ) const;
+ sal_Int32 getStreamOffset( const OUString& rStrmName ) const;
+};
+
+// ============================================================================
+
+class VbaDirStreamObject : public SequenceRecordObjectBase
+{
+public:
+ explicit VbaDirStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual bool implIsValid() const;
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+ virtual void implDumpRecordBody();
+
+private:
+ OUString dumpByteString( const String& rName = EMPTY_STRING );
+ OUString dumpUniString( const String& rName = EMPTY_STRING );
+
+ OUString dumpByteStringWithLength( const String& rName = EMPTY_STRING );
+
+private:
+ VbaSharedData& mrVbaData;
+ BinaryInputStreamRef mxInStrm;
+ OUString maCurrStream;
+ sal_Int32 mnCurrOffset;
+};
+
+// ============================================================================
+
+class VbaModuleStreamObject : public InputObjectBase
+{
+public:
+ explicit VbaModuleStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName,
+ VbaSharedData& rVbaData,
+ sal_Int32 nStrmOffset );
+
+protected:
+ virtual void implDump();
+
+private:
+ VbaSharedData& mrVbaData;
+ sal_Int32 mnStrmOffset;
+};
+
+// ============================================================================
+
+class VbaStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+// ============================================================================
+
+class VbaFormStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit VbaFormStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath,
+ VbaSharedData& rVbaData );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+private:
+ VbaSharedData& mrVbaData;
+};
+
+// ============================================================================
+
+class VbaProjectStorageObject : public OleStorageObject
+{
+public:
+ explicit VbaProjectStorageObject( const ObjectBase& rParent, const StorageRef& rxStrg, const OUString& rSysPath );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+
+ virtual void implDumpStorage(
+ const StorageRef& rxStrg,
+ const OUString& rStrgPath,
+ const OUString& rSysPath );
+
+private:
+ VbaSharedData maVbaData;
+};
+
+// ============================================================================
+// ============================================================================
+
+class ActiveXStorageObject : public VbaContainerStorageObject
+{
+public:
+ explicit ActiveXStorageObject(
+ const ObjectBase& rParent,
+ const StorageRef& rxStrg,
+ const OUString& rSysPath );
+
+protected:
+ virtual void implDumpBaseStream(
+ const BinaryInputStreamRef& rxStrm,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+// ============================================================================
+
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/pptxdumper.hxx b/include/oox/dump/pptxdumper.hxx
new file mode 100644
index 000000000000..43f39002059b
--- /dev/null
+++ b/include/oox/dump/pptxdumper.hxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_PPTXDUMPER_HXX
+#define OOX_DUMP_PPTXDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox {
+namespace dump {
+namespace pptx {
+
+// ============================================================================
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+} // namespace pptx
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/dump/xlsbdumper.hxx b/include/oox/dump/xlsbdumper.hxx
new file mode 100644
index 000000000000..ffd24d4de808
--- /dev/null
+++ b/include/oox/dump/xlsbdumper.hxx
@@ -0,0 +1,136 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_DUMP_XLSBDUMPER_HXX
+#define OOX_DUMP_XLSBDUMPER_HXX
+
+#include "oox/dump/dumperbase.hxx"
+
+#if OOX_INCLUDE_DUMPER
+
+namespace oox { namespace xls {
+ class FontPortionModelList;
+ class PhoneticPortionModelList;
+ struct FunctionInfo;
+ class FunctionProvider;
+} }
+
+namespace oox {
+namespace dump {
+namespace xlsb {
+
+// ============================================================================
+
+class RecordObjectBase : public SequenceRecordObjectBase
+{
+protected:
+ explicit RecordObjectBase();
+ virtual ~RecordObjectBase();
+
+ using SequenceRecordObjectBase::construct;
+ void construct( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const OUString& rSysFileName );
+ void construct( const RecordObjectBase& rParent );
+
+ virtual bool implReadRecordHeader( BinaryInputStream& rBaseStrm, sal_Int64& ornRecId, sal_Int64& ornRecSize );
+
+ OUString getErrorName( sal_uInt8 nErrCode ) const;
+
+ // ------------------------------------------------------------------------
+
+ void readAddress( Address& orAddress );
+ void readRange( Range& orRange );
+ void readRangeList( RangeList& orRanges );
+
+ // ------------------------------------------------------------------------
+
+ void writeBooleanItem( const String& rName, sal_uInt8 nBool );
+ void writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
+
+ void writeFontPortions( const ::oox::xls::FontPortionModelList& rPortions );
+ void writePhoneticPortions( const ::oox::xls::PhoneticPortionModelList& rPhonetics );
+
+ // ------------------------------------------------------------------------
+
+ sal_uInt8 dumpBoolean( const String& rName = EMPTY_STRING );
+ sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING );
+ OUString dumpString( const String& rName = EMPTY_STRING, bool bRich = false, bool b32BitLen = true );
+ void dumpColor( const String& rName = EMPTY_STRING );
+ ::com::sun::star::util::DateTime dumpPivotDateTime( const String& rName = EMPTY_STRING );
+
+ sal_Int32 dumpColIndex( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpRowIndex( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpColRange( const String& rName = EMPTY_STRING );
+ sal_Int32 dumpRowRange( const String& rName = EMPTY_STRING );
+
+ Address dumpAddress( const String& rName = EMPTY_STRING );
+ Range dumpRange( const String& rName = EMPTY_STRING );
+ void dumpRangeList( const String& rName = EMPTY_STRING );
+
+ // ------------------------------------------------------------------------
+private:
+ bool readCompressedInt( BinaryInputStream& rStrm, sal_Int32& ornValue );
+
+private:
+ typedef ::boost::shared_ptr< SequenceInputStream > SequenceInputStreamRef;
+
+ SequenceInputStreamRef mxBiffStrm;
+ NameListRef mxErrCodes;
+};
+
+// ============================================================================
+
+class RootStorageObject : public StorageObjectBase
+{
+public:
+ explicit RootStorageObject( const DumperBase& rParent );
+
+protected:
+ virtual void implDumpStream(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxStrm,
+ const OUString& rStrgPath,
+ const OUString& rStrmName,
+ const OUString& rSysFileName );
+};
+
+// ============================================================================
+
+class Dumper : public DumperBase
+{
+public:
+ explicit Dumper( const ::oox::core::FilterBase& rFilter );
+
+ explicit Dumper(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxInStrm,
+ const OUString& rSysFileName );
+
+protected:
+ virtual void implDump();
+};
+
+// ============================================================================
+
+} // namespace xlsb
+} // namespace dump
+} // namespace oox
+
+#endif
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
new file mode 100644
index 000000000000..10fc8922dc4a
--- /dev/null
+++ b/include/oox/export/chartexport.hxx
@@ -0,0 +1,204 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_CHART_HXX_
+#define _OOX_EXPORT_CHART_HXX_
+
+#include <oox/dllapi.h>
+#include <com/sun/star/uno/XReference.hpp>
+#include <oox/export/drawingml.hxx>
+#include <oox/token/tokens.hxx>
+#include <sax/fshelper.hxx>
+#include <vcl/mapmod.hxx>
+#include <boost/unordered_map.hpp>
+#include <map>
+
+namespace com { namespace sun { namespace star {
+ namespace chart {
+ class XDiagram;
+ class XChartDocument;
+ class XChartDataArray;
+ struct ChartSeriesAddress;
+ }
+ namespace chart2 {
+ class XDiagram;
+ class XChartDocument;
+ class XDataSeries;
+ class XChartType;
+ namespace data
+ {
+ class XDataProvider;
+ class XDataSequence;
+ }
+ }
+ namespace drawing {
+ class XShape;
+ class XShapes;
+ }
+ namespace task {
+ class XStatusIndicator;
+ }
+ namespace frame {
+ class XModel;
+ }
+}}}
+
+namespace oox { namespace drawingml {
+
+const sal_Int32 AXIS_PRIMARY_X = 1;
+const sal_Int32 AXIS_PRIMARY_Y = 2;
+const sal_Int32 AXIS_PRIMARY_Z = 3;
+const sal_Int32 AXIS_SECONDARY_X = 4;
+const sal_Int32 AXIS_SECONDARY_Y = 5;
+
+struct AxisIdPair{
+ sal_Int32 nAxisType;
+ sal_Int32 nAxisId;
+ sal_Int32 nCrossAx;
+
+ AxisIdPair( sal_Int32 nType, sal_Int32 nId, sal_Int32 nAx ): nAxisType( nType ),nAxisId( nId ),nCrossAx( nAx ) {}
+};
+
+class OOX_DLLPUBLIC ChartExport : public DrawingML {
+
+public:
+ // first: data sequence for label, second: data sequence for values.
+ typedef ::std::vector< AxisIdPair > AxisVector;
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
+ com::sun::star::uno::Reference< com::sun::star::chart::XDiagram > mxDiagram;
+ com::sun::star::uno::Reference< com::sun::star::chart2::XDiagram > mxNewDiagram;
+
+ OUString msTableName;
+ OUStringBuffer msStringBuffer;
+ OUString msString;
+
+ // members filled by InitRangeSegmentationProperties (retrieved from DataProvider)
+ sal_Bool mbHasSeriesLabels;
+ sal_Bool mbHasCategoryLabels; //if the categories are only automatically generated this will be false
+ sal_Bool mbRowSourceColumns;
+ OUString msChartAddress;
+ OUString msTableNumberList;
+ ::com::sun::star::uno::Sequence< sal_Int32 > maSequenceMapping;
+
+ //::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > mxAdditionalShapes;
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > mxCategoriesValues;
+
+ AxisVector maAxes;
+ sal_Bool mbHasXAxis;
+ sal_Bool mbHasYAxis;
+ sal_Bool mbHasZAxis;
+ sal_Bool mbHasSecondaryXAxis;
+ sal_Bool mbHasSecondaryYAxis;
+ sal_Bool mbIs3DChart;
+
+
+private:
+ sal_Int32 getChartType(
+ );
+
+ OUString parseFormula( const OUString& rRange );
+ void InitPlotArea();
+
+ void _ExportContent();
+ void exportChartSpace( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc,
+ sal_Bool bIncludeTable );
+ void exportChart( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+ void exportLegend( com::sun::star::uno::Reference<
+ com::sun::star::chart::XChartDocument > rChartDoc );
+ void exportTitle( com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > xShape );
+ void exportPlotArea( );
+
+ void exportAreaChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportBarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportBubbleChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportDoughnutChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportLineChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportOfPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportPieChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportRadarChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportScatterChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportStockChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+ void exportSuffaceChart( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType );
+
+ void exportSeries( com::sun::star::uno::Reference< com::sun::star::chart2::XChartType > xChartType, sal_Int32& nAttachedAxis );
+ void exportCandleStickSeries(
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > > & aSeriesSeq,
+ sal_Bool bJapaneseCandleSticks, sal_Int32& nAttachedAxis );
+ void exportSeriesText(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesCategory(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq );
+ void exportSeriesValues(
+ const com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValueSeq, sal_Int32 nValueType = XML_val );
+ void exportShapeProps( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+ void exportDataPoints(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength );
+ void exportDataLabels(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesProperties,
+ sal_Int32 nSeriesLength );
+ void exportGrouping( sal_Bool isBar = sal_False );
+ void exportMarker();
+ void exportSmooth();
+ void exportFirstSliceAng();
+
+ void exportAxes( );
+ void exportAxis( AxisIdPair aAxisIdPair );
+ void _exportAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProp,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xAxisTitle,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMajorGrid,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xMinorGrid,
+ sal_Int32 nAxisType,
+ const char* sAxisPos,
+ AxisIdPair aAxisIdPair );
+ void exportAxesId( sal_Int32 nAttachedAxis );
+ void exportView3D();
+ sal_Bool isDeep3dChart();
+
+public:
+
+ ChartExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ virtual ~ChartExport() {}
+
+ sal_Int32 GetChartID( );
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getModel(){ return mxChartModel; }
+
+ virtual ChartExport& WriteChartObj( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape, sal_Int32 nChartCount );
+
+ void ExportContent();
+ void InitRangeSegmentationProperties(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > & xChartDoc );
+};
+
+}}
+
+#endif /* ndef _OOX_EXPORT_CHART_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
new file mode 100644
index 000000000000..fa13a49ea090
--- /dev/null
+++ b/include/oox/export/drawingml.hxx
@@ -0,0 +1,160 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_DRAWINGML_HXX_
+#define _OOX_EXPORT_DRAWINGML_HXX_
+
+#include <oox/dllapi.h>
+#include <sax/fshelper.hxx>
+#include <rtl/strbuf.hxx>
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/uno/XReference.hpp>
+#include <tools/poly.hxx>
+#include <filter/msfilter/escherex.hxx>
+#ifndef PPTX_EXPORT_ROTATE_CLOCKWISIFY
+#define PPTX_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000)
+#endif
+
+class Graphic;
+class String;
+
+namespace com { namespace sun { namespace star {
+namespace beans {
+ class XPropertySet;
+ class XPropertyState;
+}
+namespace drawing {
+ class XShape;
+}
+namespace style {
+ struct LineSpacing;
+}
+namespace text {
+ class XTextContent;
+ class XTextRange;
+}
+namespace io {
+ class XOutputStream;
+}
+}}}
+
+namespace oox {
+namespace core {
+ class XmlFilterBase;
+}
+
+namespace drawingml {
+
+class OOX_DLLPUBLIC DrawingML {
+public:
+ enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
+
+private:
+ static int mnImageCounter;
+
+ /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
+ DocumentType meDocumentType;
+
+protected:
+ ::com::sun::star::uno::Any mAny;
+ ::sax_fastparser::FSHelperPtr mpFS;
+ ::oox::core::XmlFilterBase* mpFB;
+
+ bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString aName );
+ bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
+ String aName, ::com::sun::star::beans::PropertyState& eState );
+ const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, sal_Bool& bIsField );
+
+ OUString WriteImage( const OUString& rURL );
+
+ const char* GetComponentDir();
+ const char* GetRelationCompPrefix();
+
+public:
+ DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
+ void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
+ ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
+ ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
+ DocumentType GetDocumentType() { return meDocumentType; }
+
+ OUString WriteImage( const Graphic &rGraphic );
+
+ void WriteColor( sal_uInt32 nColor );
+ void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
+ void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, sal_Bool bLineStart );
+ void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
+
+ void WriteSolidFill( sal_uInt32 nColor );
+ void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName, sal_Int32 nXmlNamespace );
+ void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString sURLPropName );
+ void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
+ void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+ void WriteStretch();
+ void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
+
+ OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, OUString& rURL, const Graphic *pGraphic=NULL );
+ void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+
+ void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
+ sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Bool bSuppressRotation = false );
+ void WriteTransformation( const Rectangle& rRectangle,
+ sal_Int32 nXmlNamespace, sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 );
+
+ void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface );
+ void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
+ void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
+ void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
+ sal_Int16 nLevel );
+ void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
+ void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, sal_Bool bIsField );
+
+ void WritePresetShape( const char* pShape );
+ void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
+ void WritePolyPolygon( const PolyPolygon& rPolyPolygon );
+ void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+
+ static void ResetCounters();
+
+ void GetUUID( OStringBuffer& rBuffer );
+
+ static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
+
+ sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
+
+ static const char* GetAlignment( sal_Int32 nAlignment );
+
+ sax_fastparser::FSHelperPtr CreateOutputStream (
+ const OUString& sFullStream,
+ const OUString& sRelativeStream,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
+ const char* sContentType,
+ const char* sRelationshipType,
+ OUString* pRelationshipId = NULL );
+
+};
+
+}
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
new file mode 100644
index 000000000000..39b4c0d9ec72
--- /dev/null
+++ b/include/oox/export/shapes.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_SHAPES_HXX_
+#define _OOX_EXPORT_SHAPES_HXX_
+
+#include <oox/dllapi.h>
+#include <com/sun/star/uno/XReference.hpp>
+#include <oox/export/drawingml.hxx>
+#include <sax/fshelper.hxx>
+#include <vcl/mapmod.hxx>
+#include <boost/unordered_map.hpp>
+
+namespace com { namespace sun { namespace star {
+namespace beans {
+ class XPropertySet;
+}
+namespace drawing {
+ class XShape;
+ class XShapes;
+}
+}}}
+
+namespace oox { namespace drawingml {
+
+class OOX_DLLPUBLIC ShapeExport : public DrawingML {
+
+private:
+ static int mnSpreadsheetCounter;
+ struct ShapeCheck
+ {
+ bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
+ {
+ return s1 == s2;
+ }
+ };
+
+ struct ShapeHash
+ {
+ size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
+ };
+
+public:
+ typedef boost::unordered_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
+
+protected:
+ sal_Int32 mnShapeIdMax, mnPictureIdMax;
+
+ void WriteGraphicObjectShapePart( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const Graphic *pGraphic=NULL );
+
+private:
+ sal_Int32 mnXmlNamespace;
+ Fraction maFraction;
+ MapMode maMapModeSrc, maMapModeDest;
+
+ ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
+
+ ShapeHashMap maShapeMap;
+ ShapeHashMap* mpShapeMap;
+
+public:
+
+ ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ virtual ~ShapeExport() {}
+
+ static sal_Bool NonEmptyText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface );
+
+ virtual ShapeExport&
+ WriteBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, sal_Bool bClosed );
+ virtual ShapeExport&
+ WriteClosedBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteConnectorShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteCustomShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteEllipseShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteGraphicObjectShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteLineShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteNonVisualDrawingProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape, const char* sName );
+ virtual ShapeExport&
+ WriteNonVisualProperties( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteOpenBezierShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteRectangleShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+
+ /**
+ * Write the DrawingML for a particular shape.
+ *
+ * <p>This is the member function you want. It performs the type lookup and
+ * invokes the appropriate corresponding Write*() method for the specific
+ * type.</p>
+ *
+ * <p>To write an XShape, XShape::getShapeType() is called to determine
+ * the shape type, and the corresponding method in this table is
+ * invoked:</p>
+ *
+ * <table>
+ * <tr><th>Shape Type</th><th>Method</th></tr>
+ * <tr><td><tt>com.sun.star.drawing.ClosedBezierShape</tt></td> <td>ShapeExport::WriteClosedBezierShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.CustomShape</tt></td> <td>ShapeExport::WriteCustomShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.EllipseShape</tt></td> <td>ShapeExport::WriteEllipseShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.GraphicObjectShape</tt></td> <td>ShapeExport::WriteGraphicObjectShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.LineShape</tt></td> <td>ShapeExport::WriteLineShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.OpenBezierShape</tt></td> <td>ShapeExport::WriteOpenBezierShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.RectangleShape</tt></td> <td>ShapeExport::WriteRectangleShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TableShape</tt></td> <td>ShapeExport::WriteTableShape</td></tr>
+ * <tr><td><tt>com.sun.star.drawing.TextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.DateTimeShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.FooterShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.HeaderShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.NotesShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.OutlinerShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.SlideNumberShape</tt></td><td>ShapeExport::WriteTextShape</td></tr>
+ * <tr><td><tt>com.sun.star.presentation.TitleTextShape</tt></td> <td>ShapeExport::WriteTextShape</td></tr>
+ * </table>
+ *
+ * <p>If the shape type is not recognized, then
+ * <tt>ShapeExport::WriteUnknownShape</tt> is called.</p>
+ *
+ * @param xShape The shape to export as DrawingML.
+ * @return <tt>*this</tt>
+ */
+ virtual ShapeExport&
+ WriteShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteTextBox( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xIface, sal_Int32 nXmlNamespace );
+ virtual ShapeExport&
+ WriteTextShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteTableShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteOLE2Shape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+ virtual ShapeExport&
+ WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+
+ void WriteTable( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape );
+
+
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
+ sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
+ static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap );
+};
+
+}}
+
+#endif /* ndef _OOX_EXPORT_SHAPES_HXX_ */
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/utils.hxx b/include/oox/export/utils.hxx
new file mode 100644
index 000000000000..04c3b3375742
--- /dev/null
+++ b/include/oox/export/utils.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_UTILS_HXX_
+#define _OOX_EXPORT_UTILS_HXX_
+
+#define I32S(x) OString::valueOf( (sal_Int32) x ).getStr()
+#define I64S(x) OString::valueOf( (sal_Int64) x ).getStr()
+#define IS(x) OString::valueOf( x ).getStr()
+#define USS(x) OUStringToOString( x, RTL_TEXTENCODING_UTF8 ).getStr()
+
+#ifndef DBG
+# if OSL_DEBUG_LEVEL > 0
+# define DBG(x) x
+# else
+# define DBG(x)
+# endif
+#endif
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 PPTtoEMU( sal_Int32 nPPT )
+{
+ return (sal_Int64)( (double)nPPT * 1587.5 );
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 MM100toEMU( sal_Int32 nMM100 )
+{
+ return (sal_Int64)nMM100 * 360;
+}
+
+// ---------------------------------------------------------------------------------------------
+
+static inline sal_Int64 TwipsToEMU( sal_Int32 nTwips )
+{
+ return sal_Int64( nTwips ) * 635;
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
new file mode 100644
index 000000000000..54212a65bccf
--- /dev/null
+++ b/include/oox/export/vmlexport.hxx
@@ -0,0 +1,132 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef _OOX_EXPORT_VMLEXPORT_HXX_
+#define _OOX_EXPORT_VMLEXPORT_HXX_
+
+#include <oox/dllapi.h>
+#include <oox/export/drawingml.hxx>
+#include <sax/fshelper.hxx>
+#include <filter/msfilter/escherex.hxx>
+#include <editeng/outlobj.hxx>
+
+
+namespace oox {
+
+namespace vml {
+
+/// Interface to be implemented by the parent exporter that knows how to handle shape text.
+class OOX_DLLPUBLIC VMLTextExport
+{
+public:
+ virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
+ virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
+protected:
+ VMLTextExport() {}
+ virtual ~VMLTextExport() {}
+};
+
+class OOX_DLLPUBLIC VMLExport : public EscherEx
+{
+ /// Fast serializer to output the data
+ ::sax_fastparser::FSHelperPtr m_pSerializer;
+
+ /// Parent exporter, used for text callback.
+ VMLTextExport* m_pTextExport;
+
+ /// The object we're exporting.
+ const SdrObject* m_pSdrObject;
+
+ /// Fill the shape attributes as they come.
+ ::sax_fastparser::FastAttributeList *m_pShapeAttrList;
+
+ /// Remember the shape type.
+ sal_uInt32 m_nShapeType;
+
+ /// Remember the shape flags.
+ sal_uInt32 m_nShapeFlags;
+
+ /// Remember style, the most important shape attribute ;-)
+ OStringBuffer *m_pShapeStyle;
+
+ /// Remember which shape types we had already written.
+ bool *m_pShapeTypeWritten;
+
+public:
+ VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 );
+ virtual ~VMLExport();
+
+ ::sax_fastparser::FSHelperPtr
+ GetFS() { return m_pSerializer; }
+
+ /// Export the sdr object as VML.
+ ///
+ /// Call this when you need to export the object as VML.
+ sal_uInt32 AddSdrObject( const SdrObject& rObj );
+
+protected:
+ /// Add an attribute to the generated <v:shape/> element.
+ ///
+ /// This should be called from within StartShape() to ensure that the
+ /// added attribute is preserved.
+ void AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue );
+
+ using EscherEx::StartShape;
+ using EscherEx::EndShape;
+
+ /// Start the shape for which we just collected the information.
+ ///
+ /// Returns the element's tag number, -1 means we wrote nothing.
+ virtual sal_Int32 StartShape();
+
+ /// End the shape.
+ ///
+ /// The parameter is just what we got from StartShape().
+ virtual void EndShape( sal_Int32 nShapeElement );
+
+ virtual void Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
+
+private:
+
+ virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
+ virtual void CloseContainer();
+
+ virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
+ virtual void LeaveGroup();
+
+ virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 );
+
+private:
+ /// Create an OString representing the id from a numerical id.
+ static OString ShapeIdString( sal_uInt32 nId );
+
+ /// Add starting and ending point of a line to the m_pShapeAttrList.
+ void AddLineDimensions( const Rectangle& rRectangle );
+
+ /// Add position and size to the OStringBuffer.
+ void AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& rRectangle );
+};
+
+} // namespace vml
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/attributelist.hxx b/include/oox/helper/attributelist.hxx
new file mode 100644
index 000000000000..55f41cf0a3b3
--- /dev/null
+++ b/include/oox/helper/attributelist.hxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_ATTRIBUTELIST_HXX
+#define OOX_HELPER_ATTRIBUTELIST_HXX
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+#include "oox/helper/helper.hxx"
+#include "oox/token/namespaces.hxx"
+#include "oox/token/tokens.hxx"
+#include "oox/dllapi.h"
+
+namespace oox {
+
+// ============================================================================
+
+/** Static helpers for conversion of strings to attribute values of various
+ different data types.
+ */
+class OOX_DLLPUBLIC AttributeConversion
+{
+public:
+ /** Returns the XML token identifier from the passed string. */
+ static sal_Int32 decodeToken( const OUString& rValue );
+
+ /** Returns the decoded string value. All characters in the format
+ '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ static OUString decodeXString( const OUString& rValue );
+
+ /** Returns the double value from the passed string. */
+ static double decodeDouble( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (decimal). */
+ static sal_Int32 decodeInteger( const OUString& rValue );
+
+ /** Returns the 32-bit unsigned integer value from the passed string (decimal). */
+ static sal_uInt32 decodeUnsigned( const OUString& rValue );
+
+ /** Returns the 64-bit signed integer value from the passed string (decimal). */
+ static sal_Int64 decodeHyper( const OUString& rValue );
+
+ /** Returns the 32-bit signed integer value from the passed string (hexadecimal). */
+ static sal_Int32 decodeIntegerHex( const OUString& rValue );
+};
+
+// ============================================================================
+
+/** Provides access to attribute values of an element.
+
+ Wraps a com.sun.star.xml.sax.XFastAttributeList object. Provides
+ convenience functions that convert the string value of an attribute to
+ various other data types.
+ */
+class OOX_DLLPUBLIC AttributeList
+{
+public:
+ explicit AttributeList(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& rxAttribs );
+
+ /** Returns the wrapped com.sun.star.xml.sax.XFastAttributeList object. */
+ inline ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
+ getFastAttributeList() const { return mxAttribs; }
+
+ /** Returns true, if the specified attribute is present. */
+ bool hasAttribute( sal_Int32 nAttrToken ) const;
+
+ // optional return values -------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute. */
+ OptValue< sal_Int32 > getToken( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. */
+ OptValue< OUString > getString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the string value of the specified attribute. All characters in
+ the format '_xHHHH_' (H being a hexadecimal digit), will be decoded. */
+ OptValue< OUString > getXString( sal_Int32 nAttrToken ) const;
+
+ /** Returns the double value of the specified attribute. */
+ OptValue< double > getDouble( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int32 > getInteger( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute (decimal). */
+ OptValue< sal_uInt32 > getUnsigned( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute (decimal). */
+ OptValue< sal_Int64 > getHyper( sal_Int32 nAttrToken ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal). */
+ OptValue< sal_Int32 > getIntegerHex( sal_Int32 nAttrToken ) const;
+
+ /** Returns the boolean value of the specified attribute. */
+ OptValue< bool > getBool( sal_Int32 nAttrToken ) const;
+
+ /** Returns the date/time value of the specified attribute. */
+ OptValue< ::com::sun::star::util::DateTime > getDateTime( sal_Int32 nAttrToken ) const;
+
+ // defaulted return values ------------------------------------------------
+
+ /** Returns the token identifier of the value of the specified attribute,
+ or the passed default identifier if the attribute is missing. */
+ sal_Int32 getToken( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the string value of the specified attribute, or the passed
+ default string if the attribute is missing. */
+ OUString getString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the decoded string value of the specified attribute, or the
+ passed default string if the attribute is missing. */
+ OUString getXString( sal_Int32 nAttrToken, const OUString& rDefault ) const;
+
+ /** Returns the double value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to a double. */
+ double getDouble( sal_Int32 nAttrToken, double fDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int32 getInteger( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the 32-bit unsigned integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to unsigned. */
+ sal_uInt32 getUnsigned( sal_Int32 nAttrToken, sal_uInt32 nDefault ) const;
+
+ /** Returns the 64-bit signed integer value of the specified attribute, or the
+ passed default value if the attribute is missing or not convertible to integer. */
+ sal_Int64 getHyper( sal_Int32 nAttrToken, sal_Int64 nDefault ) const;
+
+ /** Returns the 32-bit signed integer value of the specified attribute (hexadecimal),
+ or the passed default value if the attribute is missing or not convertible. */
+ sal_Int32 getIntegerHex( sal_Int32 nAttrToken, sal_Int32 nDefault ) const;
+
+ /** Returns the boolean value of the specified attribute, or the passed
+ default value if the attribute is missing or not convertible to bool. */
+ bool getBool( sal_Int32 nAttrToken, bool bDefault ) const;
+
+ /** Returns the date/time value of the specified attribute, or the default
+ value if the attribute is missing or not convertible to a date/time value. */
+ ::com::sun::star::util::DateTime getDateTime( sal_Int32 nAttrToken, const ::com::sun::star::util::DateTime& rDefault ) const;
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
+ mxAttribs;
+};
+
+// ============================================================================
+
+} // namespace oox
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/oox/helper/binaryinputstream.hxx b/include/oox/helper/binaryinputstream.hxx
new file mode 100644
index 000000000000..64d85357c2e8
--- /dev/null
+++ b/include/oox/helper/binaryinputstream.hxx
@@ -0,0 +1,438 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef OOX_HELPER_BINARYINPUTSTREAM_HXX
+#define OOX_HELPER_BINARYINPUTSTREAM_HXX
+
+#include <vector>
+#include <com/sun/star/io/XInputStream.hpp>
+#include "oox/helper/binarystreambase.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace io { class XInputStream; }
+} } }
+
+namespace oox {
+
+class BinaryOutputStream;
+
+// ============================================================================
+
+/** Interface for binary input stream classes.
+
+ The binary data in the stream is assumed to be in little-endian format.
+ */
+class OOX_DLLPUBLIC BinaryInputStream : public virtual BinaryStreamBase
+{
+public:
+ /** Derived classes implement reading nBytes bytes to the passed sequence.
+ The sequence will be reallocated internally.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readData( StreamDataSequence& orData, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement reading nBytes bytes to the (preallocated!)
+ memory buffer opMem.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+
+ @return
+ Number of bytes really read.
+ */
+ virtual sal_Int32 readMemory( void* opMem, sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Derived classes implement seeking the stream forward by the passed
+ number of bytes. This should work for non-seekable streams too.
+
+ @param nAtomSize
+ The size of the elements in the memory block, if available. Derived
+ classes may be interested in this information.
+ */
+ virtual void skip( sal_Int32 nBytes, size_t nAtomSize = 1 ) = 0;
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ void readValue( Type& ornValue );
+
+ /** Reads a value from the stream and converts it to platform byte order.
+ All data types supported by the ByteOrderConverter class can be used.
+ */
+ template< typename Type >
+ inline Type readValue() { Type nValue; readValue( nValue ); return nValue; }
+
+ /** Stream operator for all data types supported by the readValue() function. */
+ template< typename Type >
+ inline BinaryInputStream& operator>>( Type& ornValue ) { readValue( ornValue ); return *this; }
+
+ inline sal_Int8 readInt8() { return readValue< sal_Int8 >(); }
+ inline sal_uInt8 readuInt8() { return readValue< sal_uInt8 >(); }
+ inline sal_Int16 readInt16() { return readValue< sal_Int16 >(); }
+ inline sal_uInt16 readuInt16() { return readValue< sal_uInt16 >(); }
+ inline sal_Int32 readInt32() { return readValue< sal_Int32 >(); }
+ inline sal_uInt32 readuInt32() { return readValue< sal_uInt32 >(); }
+ inline sal_Int64 readInt64() { return readValue< sal_Int64 >(); }
+ inline sal_uInt64 readuInt64() { return readValue< sal_uInt64 >(); }
+ inline float readFloat() { return readValue< float >(); }
+ inline double readDouble() { return readValue< double >(); }
+
+ /** Reads a (preallocated!) C array of values from the stream.
+
+ Converts all values in the array to platform byte order. All data types
+ supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to read (NOT byte count).
+
+ @return
+ Number of array elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( Type* opnArray, sal_Int32 nElemCount );
+
+ /** Reads a sequence of values from the stream.
+
+ The sequence will be reallocated internally. Converts all values in the
+ array to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the sequence (NOT byte count).
+
+ @return
+ Number of sequence elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::com::sun::star::uno::Sequence< Type >& orSequence, sal_Int32 nElemCount );
+
+ /** Reads a vector of values from the stream.
+
+ The vector will be resized internally. Converts all values in the
+ vector to platform byte order. All data types supported by the
+ ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of elements to put into the vector (NOT byte count).
+
+ @return
+ Number of vector elements really read (NOT byte count).
+ */
+ template< typename Type >
+ sal_Int32 readArray( ::std::vector< Type >& orVector, sal_Int32 nElemCount );
+
+ /** Skips an array of values of a certain type in the stream.
+
+ All data types supported by the ByteOrderConverter class can be used.
+
+ @param nElemCount
+ Number of array elements to skip (NOT byte count).
+ */
+ template< typename Type >
+ void skipArray( sal_Int32 nElemCount );
+
+ /** Reads a NUL-terminated Unicode character array and returns the string.
+ */
+ OUString readNulUnicodeArray();
+
+ /** Reads a byte character array and returns the string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.
+
+ @param bAllowNulChars
+ True = NUL characters are inserted into the imported string.
+ False = NUL characters are replaced by question marks (default).
+ */
+ OString readCharArray( sal_Int32 nChars, bool bAllowNulChars = false );
+
+ /** Reads a byte character array and returns a Unicode string.
+
+ @param nChars
+ Number of characters (bytes) to read from the stream.