diff options
author | nobody <nobody@gnome.org> | 2006-01-09 11:13:38 +0000 |
---|---|---|
committer | nobody <nobody@gnome.org> | 2006-01-09 11:13:38 +0000 |
commit | 5c06a6d9e9f431c90fa6f5047af495670b2e13a8 (patch) | |
tree | a73e355efa61d4fb6c56db7bcf1192868449cffe | |
parent | ffd7f48a5a6eeaf6580177bb2eff4276ddf8cf38 (diff) |
This commit was manufactured by cvs2svn to create tagKOHEI_IMPORT_BASE
'KOHEI_IMPORT_BASE'.
95 files changed, 0 insertions, 10859 deletions
diff --git a/HACKING b/HACKING deleted file mode 100644 index 722266980..000000000 --- a/HACKING +++ /dev/null @@ -1,8 +0,0 @@ -Please do not commit patches here, unless you have signed the JCA: - - http://www.openoffice.org/FAQs/faq-licensing.html#usinglicenses - -and intend to contribute the code to the OO.o mainline. - -These patches are merely in a holding / re-factoring pattern -before they can be merged into OO.o. diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index 7393b7d84..000000000 --- a/MAINTAINERS +++ /dev/null @@ -1,2 +0,0 @@ -michael.meeks@novell.com -halls@debian.org diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 3af46a378..000000000 --- a/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# if BONOBO -# MAYBE_BONOBO = bonobo -# endif - -SUBDIRS = po desktop distro-configs bin patches man doc fonts stamp src www # $(MAYBE_BONOBO) - -include $(top_srcdir)/Makefile.shared - -EXTRA_DIST = \ - emacs.el \ - MAINTAINERS \ - HACKING \ - download.in \ - Makefile.shared \ - intltool-merge.in \ - intltool-update.in \ - intltool-extract.in \ - ChangeLog-to-1.3.0 \ - ChangeLog-to-1.9.0 \ - ChangeLog-to-2.0.0 - -ACLOCAL_AMFLAGS = -I m4 - -clean-local: - test -z "$(OOBUILDDIR)" || rm -rf $(OOBUILDDIR) - for icons in $(OOO_ICONS_VERS) ; do \ - test "$(BUILDDIR)/$$icons" = "/" || rm -rf "$(BUILDDIR)/$$icons" ; \ - done - -maintainer-clean-local: - test -z "$(BUILDDIR)" || rm -rf $(BUILDDIR) @@ -1,161 +0,0 @@ -+ Tooling issues - + - - -+ Startup performance - + OO.o icon cache: 5Mb small - + open("/home/michael/.OpenOffice.org1.9.milestone/user/config/imagecache_gnome/res_commandimagelist_lc_114", O_RDONLY) = 27 - + should be able to work out of the .zip file - + font cache trawling / build - highly slow -+ Misc. - + Win32 - + ODMA/Win32 bits - re-work & make them fly. - + Win32 file-bug toolbar icon - + should point at internal bugzilla. - [ is there a canonical way to refer to bug - filing etc. for internal & external ] - --------- older things -------- - - - -** Misc. tasks that need doing ** - -Michael's bits - + Countif help claims it works with string regexps - but it just doesn't. - + shrink-selection ergonomics in spreadsheet. - + hit 'bullet' - not the right font size - IZ 30960 - + Mine / integrate creative commons clipart.freedesktop.org - + Workable / usable SDK install - + Grab the gsi->po translation tool from l10n, - and get more translations done / a language % - completion page setup on ooo.x.c. - + autocorrection bug #25174 - + test multi-screen bits again - pwrt. raise - + gui-symbol-replace - poke it. - + http://bugzilla.ximian.com/show_bug.cgi?id=52657 - + make something of sd-export-html-thumbnails.diff - + HTML export - + beef up the new patch ... - + fix +/- issue with frame navigation. - + work out the story with 'frames' / image links - + slide designs - store image/link types right ? - + binary registry cache doesn't do lstats. - + Documentation - + png import / render inside xmlhelp - + mapping / clobbering the icons in pictures.jar - + more layout research ... - + respond to feedback - + UDK installation + pkgconfig file - + need a 'post-setup-install' shell-script that - Debian can use as well ... - + Gnome - + finish bonoboui/samples/thread-demo - -Spare tasks: - Minor tasks (for idle cycles) - + MS compatible keyboard shortcuts - + some work already in patches/..../gui-keybindings.diff - + needs extending to all common 'standard' shortcuts - + eg. F3 -> Open File [ everywhere ] - + people doing work on this in HEAD (apparently) - query the Sun team about this / chase up the - check-button .src markup Issue. - Minor tasks (for idle cycles) - + impress - + open existing presentation name presentation - + http://bugzilla.ximian.com/show_bug.cgi?id=52613 - - Major task: - + fixing LXR et. al as per action plan - Minor tasks (for idle cycles) - + AutoCapitalization ... - Tools->AutoCorrect->Correct TWo initial Capitals - this option is useful for writer, but useless for calc - need to be able to disable it for oocalc but not write - currently setting is shared; ie. enter HEllo in writer - should result in 'Hello' and you should be able to enter - HEllo into an oocalc cell. - -+ Bug fixage - + Peter Bowen's (internal) spreadsheets need fixing. - + disable-crash-dialog.diff doesn't: somehow the - signal setup is really strange / broken in here, needs - cleanup / comprehensibility. - + not using autofmt.tbl (according to Jody (?)) - + gccinstlib.pl - + remove it - unused in HEAD ? - -+ New features - + openoffice-gallery-extra - + turn all the dia diagram shapes into clipart. - + re-write i18n stuff - + using a different configuration key - + implement a new backend - + UI loving - + mail merge window shows (only) ~4 records. - + scaling issues: - as we increase font point size: - + 'font style' much too large / bloated - + 'size' - excessively bloated - + changing font size: - + screws up drop-down item count for combos. - + The 'raise' issue - re-instate gui-appear.diff - + re-arrange default toolbars X#39088 - + menu shortcut text should be 'Ctrl'+A (not 'Control') - + changing font size doesn't scale all widgets - eg. toolbar combo boxes & labels, file selector fields. - + mark-up all option menus correctly so they don't - show icons erroneously - + bin LHS padding on menus with no icons or - check-boxes, bin RHS padding with no K/B shortuts. - + use gnome-print dialogs for printer selection - + toolbar icons move on mouse-over; shouldn't. - + right click on image -> 'save as' - + Investigate full fontconfig speedups - + are we still loading stuff from the OO.o font cache? - + if so can we bin that; grok ascent/descent stuff. - + Check our pspfontcache isn't growing [ #9969 ? ] - - pwrt. PDF printing & fontconfig bits ... - + session management - + Automatic font obliquing from Xft2 [?] - + no in-page search in help - + automatic gconf HTTP proxy fetch - + regexp searches in Writer. - + writer - + mouse in margins, should trigger new cursor and row - selection mode - + mouse above/over table header, should allow col - selection + cursor - + encryption: sw/source/core/sw3io/sw3misc.cxx, line 689 - + impress - + PPT load/save doesn't save slide names [!] - + grouped PPT presentation transitions are munged - into many individual interactions on import. - + sd/source/ui/dlg/*.cxx: improve time handling, for - sub-1 second durations. - + drawing view needs LHS panel with scrollable - slides-view for navigation - + calc - + sheet tab font ugly & cramped - + insert a row group in oocalc - + 2nd from bottom toolbar icon on LHS - + expand / collapse button doesn't theme - + XL encryption: sc/source/filter/excel/impop.cxx (SC_XCL_USEDECR) - + make -quickstart useful - + get X session lifecycle right - + gtk+ mainloop integration possibilities: - + bonobo integration ? ... - + mozilla/bonobo integration ? ... - + native at-spi bridge avoiding java cf. doc/accessibility.txt - + Mono integration - + http://udk.openoffice.org/cli/cli-uno.html - + pwrt. macro implementation. - -+ Testing - + do we need inst-destdir.diff in 1.1 - -+ Study - + do we need vcl/source/window/window.cxx (maPaintTimer) - (30ms)? before re-painting the UI ? can we do it - cumulatively for instant response 1st time ? diff --git a/bonobo/.cvsignore b/bonobo/.cvsignore deleted file mode 100644 index 84c2eea9c..000000000 --- a/bonobo/.cvsignore +++ /dev/null @@ -1,25 +0,0 @@ -INSTALL -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.guess -config.log -config.status -config.sub -configure -cscope.files -cscope.out -depcomp -install-sh -intltool-extract -intltool-extract.in -intltool-merge -intltool-merge.in -intltool-update -intltool-update.in -libtool -ltmain.sh -missing -mkinstalldirs -ooo-bonobo*.tar.* diff --git a/bonobo/AUTHORS b/bonobo/AUTHORS deleted file mode 100644 index f409edffb..000000000 --- a/bonobo/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Martin Kretzschmar <martink@ximian.com> diff --git a/bonobo/COPYING b/bonobo/COPYING deleted file mode 100644 index 6a6e7f226..000000000 --- a/bonobo/COPYING +++ /dev/null @@ -1,8 +0,0 @@ -You may only copy and distribute this program consistent with the -requirements and distribute this Program consistent with the -requirements of either the GNU General Public License (GPL) and GNU -Lesser General Public License (LGPL) or the Sun Industry Standards -Source License (SISSL), respectively, depending on whether you elected -to obtain access to this program via the GPL/LGPL Option or the SISSL -Option. Copies of the GPL, LGPL and SISSL licenses can be found -http://www.openoffice.org/project/www/license.html diff --git a/bonobo/Makefile.am b/bonobo/Makefile.am deleted file mode 100644 index db93e4147..000000000 --- a/bonobo/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -SUBDIRS=src data po - -intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in - -EXTRA_DIST= $(intltool_extra) - -DISTCLEANFILES = \ - intltool-extract \ - intltool-merge \ - intltool-update diff --git a/bonobo/NEWS b/bonobo/NEWS deleted file mode 100644 index e69de29bb..000000000 --- a/bonobo/NEWS +++ /dev/null diff --git a/bonobo/README b/bonobo/README deleted file mode 100644 index a0133f7c6..000000000 --- a/bonobo/README +++ /dev/null @@ -1,17 +0,0 @@ -0) Don't read the code and expect anything beautiful. - -1) in src/main.cxx change /demo/schmidt.sxw, (any format that OOo can read goes) - -2) ./configure --with-ooo-solver-dir=/home/martin/Build/ooo/openoffice.org-1.0.99+1.1rc4/solver/645/unxlngi4.pro --with-ooo-install-dir=/usr/lib/openoffice - -3) export LD_LIBRARY_PATH=/usr/lib/ooo-1.1.0/program:$LD_LIBRARY_PATH - -4) make; make install; restart bonobo-activation-server - -5) (removed) - -6) start the bonobo server (we need LD_LIBRARY_PATH): src/ooo-bonobo - -7) in nautilus, open your document file with the OpenOffice.org Document viewer - -8) (removed) diff --git a/bonobo/autogen.sh b/bonobo/autogen.sh deleted file mode 100755 index 63fab0c38..000000000 --- a/bonobo/autogen.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh -# Run this to generate all the initial makefiles, etc. - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -ORIGDIR=`pwd` -cd $srcdir -PROJECT=ooo-bonobo -TEST_TYPE=-d -FILE=src - -DIE=0 - -if glib-gettextize --version < /dev/null > /dev/null 2>&1 ; then - gettextize_version=`glib-gettextize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'` - case $gettextize_version in - 2.*) - have_gettextize=true - ;; - esac -fi -if $have_gettextize ; then : ; else - echo - echo "You must have glib 2.0 or later installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnome.org/pub/GNOME/" - DIE=1 -fi - -have_intltoolize=false -if intltoolize --version < /dev/null > /dev/null 2>&1 ; then - intltool_version=`intltoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'` - case $intltool_version in - 0.2[56789]*|0.[3456789]*) - have_intltoolize=true - ;; - esac -fi -if $have_intltoolize ; then : ; else - echo - echo "You must have intltool 0.25 installed to compile $PROJECT." - echo "Install the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -fi - -have_autoconf=false -if autoconf --version < /dev/null > /dev/null 2>&1 ; then - autoconf_version=`autoconf --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'` - case $autoconf_version in - 2.5*) - have_autoconf=true - ;; - esac -fi -if $have_autoconf ; then : ; else - echo - echo "You must have autoconf installed to compile $PROJECT." - echo "libtool the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -fi - -if automake-1.6 --version < /dev/null > /dev/null 2>&1; then - AUTOMAKE=automake-1.6 - ACLOCAL=aclocal-1.6 -else - echo - echo "You must have automake >= 1.6 installed to compile $PROJECT." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.6.0.tar.gz" - echo "(or a newer version if it is available)" - AUTOMAKE=automake - ACLOCAL=aclocal -fi - -if test "$DIE" -eq 1; then - exit 1 -fi - -test $TEST_TYPE $FILE || { - echo "You must run this script in the top-level $PROJECT directory" - exit 1 -} - -if test -z "$AUTOGEN_SUBDIR_MODE"; then - if test -z "$*"; then - echo "I am going to run ./configure with no arguments - if you wish " - echo "to pass any to it, please specify them on the $0 command line." - fi -fi - -if test -z "$ACLOCAL_FLAGS"; then - - acdir=`$ACLOCAL --print-ac-dir` - m4list="glib-2.0.m4 glib-gettext.m4 gtk-2.0.m4" - - for file in $m4list - do - if [ ! -f "$acdir/$file" ]; then - echo "WARNING: aclocal's directory is $acdir, but..." - echo " no file $acdir/$file" - echo " You may see fatal macro warnings below." - echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS " - echo " environment variable to \"-I /some/dir\", or install" - echo " $acdir/$file." - echo "" - fi - done -fi - -$ACLOCAL $ACLOCAL_FLAGS - -glib-gettextize --copy --force -# intltoolize --copy --force --automake -libtoolize --copy --automake - -$AUTOMAKE --add-missing --copy -autoconf - -# optional feature autoheader -#autoheader - -cd $ORIGDIR - -if test -z "$AUTOGEN_SUBDIR_MODE"; then - echo "Running configure..." - ($srcdir/configure --enable-maintainer-mode "$@" \ - && echo -e "\nNow type 'make' to compile $PROJECT.") -fi diff --git a/bonobo/configure.ac b/bonobo/configure.ac deleted file mode 100644 index dfb2288ca..000000000 --- a/bonobo/configure.ac +++ /dev/null @@ -1,137 +0,0 @@ -AC_PREREQ(2.53) -AC_INIT(src/main.cxx) - -AM_INIT_AUTOMAKE(ooo-bonobo, 0.0.1) - -AM_MAINTAINER_MODE - -AC_ISC_POSIX -AC_PROG_CC -AC_PROG_CXX -AC_STDC_HEADERS -AM_PROG_LIBTOOL - -GETTEXT_PACKAGE=ooo-bonobo -AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE") -AC_SUBST(GETTEXT_PACKAGE) - -ALL_LINGUAS="de" -AM_GLIB_GNU_GETTEXT -AC_PROG_INTLTOOL - -AC_ARG_ENABLE( - [strict-tests], - AC_HELP_STRING([--enable-strict-tests], - [check for the presence of headers, binaries, etc.]),, - [enable_strict_tests="no"]) - -dnl FIXME -TAG=`$srcdir/../bin/latest-patchset $srcdir/../patches`; -BASEDIR=`pwd`/.. - -AC_ARG_WITH( - [ooo-builddir], - AC_HELP_STRING([--with-ooo-builddir], - [define the directory where openoffice.org will be compiled, e.g. the root of an ooo cvs checkout.]), - [OOBUILDDIR="${withval}"], - [if test "z$with_src" = "z"; then - OOBUILDDIR=$BASEDIR/build/$TAG - else - OOBUILDDIR=$with_src/$TAG - fi]) - -ac_solver_dir="$OOBUILDDIR/solver/645/unxlngi4.pro" - -AC_ARG_WITH( - [ooo-solver-dir], - AC_HELP_STRING([--with-ooo-solver-dir=DIR], - [path to your OpenOffice.org solver]), - [ac_solver_dir="${withval}"],) - -ac_ooodev_bindir="${ac_solver_dir}/bin" -ac_ooodev_includes="${ac_solver_dir}/inc" -ac_ooodev_libdir="${ac_solver_dir}/lib" - -AC_ARG_WITH( - [ooo-install-dir], - AC_HELP_STRING([--with-ooo-install-dir=DIR], - [path to your OpenOffice.org installation]), - [OOO_INSTALLDIR=${withval}], - [OOO_INSTALLDIR=${libdir}/ooo-1.1]) -AC_SUBST(OOO_INSTALLDIR) - -PKG_CHECK_MODULES(OOO_BONOBO, gtk+-2.0 libgnome-2.0 libbonoboui-2.0) - -ac_cppflags_safe="$CPPFLAGS" -CPPFLAGS="-I$ac_ooodev_includes" -AC_CHECK_HEADERS([sal/config.h], - [], - test "z$enable_strict_tests" = "zno" || AC_MSG_ERROR([[OpenOffice.org include files not found, try '--with-ooo-solver-dir=/path/to/solver']])) -OOO_BONOBO_CFLAGS="$OOO_BONOBO_CFLAGS -I$ac_ooodev_includes" -CPPFLAGS="$ac_cppflags_safe" - -AC_PATH_PROG([REGMERGE], [regmerge], [], [$ac_ooodev_bindir:$PATH]) -if test -z "$REGMERGE" ; then - if test "z$enable_strict_tests" = "zno"; then - REGMERGE="$ac_ooodev_bindir/regmerge" - else - AC_MSG_ERROR([regmerge not found, try '--with-ooo-solver-dir=location_of_ODK'.]) - fi -fi -dnl FIXME -REGMERGE="LD_LIBRARY_PATH=$ac_ooodev_libdir:\$\$LD_LIBRARY_PATH $REGMERGE" -AC_SUBST(REGMERGE) - -AC_PATH_PROG([REGCOMP], [regcomp], [], [$ac_ooodev_bindir:$PATH]) -if test -z "$REGCOMP" ; then - if test "z$enable_strict_tests" = "zno"; then - REGCOMP="$ac_ooodev_bindir/regcomp" - else - AC_MSG_ERROR([regcomp not found, try '--with-ooo-solver-dir=location_of_ODK'.]) - fi -fi -dnl FIXME -REGCOMP="LD_LIBRARY_PATH=$ac_ooodev_libdir:\$\$LD_LIBRARY_PATH $REGCOMP" -AC_SUBST(REGCOMP) - -if test ! -d "$ac_ooodev_libdir" && test "z$enable_strict_tests" != "zno" ; then - AC_MSG_ERROR([[OpenOffice.org libraries not found. Please use --with-ooo-solver-dir=/path/to/solver]]) -fi -OOO_BONOBO_LIBS="$OOO_BONOBO_LIBS -L$ac_ooodev_libdir" -OOODEV_LIBDIR="$ac_ooodev_libdir" -AC_SUBST(OOODEV_LIBDIR) - -dnl Type Registry (types.rdb = offapi + udkapi) -AC_CHECK_FILE([$ac_ooodev_bindir/types.rdb], - [], - test "z$enable_strict_tests" = "zno" || AC_MSG_ERROR([[udkapi.rdb not found. Please use --with-ooo-install-dir=/path/to/ooo-installation]])) - -DKREGISTRYNAME="$ac_ooodev_bindir/types.rdb" -AC_SUBST(DKREGISTRYNAME) - -dnl FIXME -GUI=UNX -COM=GCC -OS=LINUX -CPPU_ENV=gcc3 - -OOO_BONOBO_CFLAGS="$OOO_BONOBO_CFLAGS -D$GUI -D$COM -D$OS -DCPPU_ENV=$CPPU_ENV" - -dnl FIXME -CPPUHELPERLIB=-lcppuhelpergcc3 -CPPULIB=-lcppu -SALHELPERLIB=-lsalhelpergcc3 -SALLIB=-lsal -STLPORTLIB=-lstlport_gcc - -OOO_BONOBO_LIBS="$OOO_BONOBO_LIBS $CPPUHELPERLIB $CPPULIB $SALHELPERLIB $SALLIB $STLPORTLIB" - -AC_SUBST(OOO_BONOBO_CFLAGS) -AC_SUBST(OOO_BONOBO_LIBS) - -AC_OUTPUT([ -Makefile -data/Makefile -src/Makefile -po/Makefile.in -]) diff --git a/bonobo/data/.cvsignore b/bonobo/data/.cvsignore deleted file mode 100644 index ee971a29a..000000000 --- a/bonobo/data/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -GNOME_OpenOfficeOrg.server -GNOME_OpenOfficeOrg.server.in -Makefile -Makefile.in -ooo-bonobo -ooo-bonobo-uno-bootstrap.ini -ooo-bonobo-uno-bootstraprc -ooo-bonobo.rdb diff --git a/bonobo/data/GNOME_OpenOfficeOrg.server.in.in b/bonobo/data/GNOME_OpenOfficeOrg.server.in.in deleted file mode 100644 index 89e011e6a..000000000 --- a/bonobo/data/GNOME_OpenOfficeOrg.server.in.in +++ /dev/null @@ -1,62 +0,0 @@ -<oaf_info> - - <oaf_server iid="OAFIID:GNOME_OpenOfficeOrg_Factory" - type="exe" - location="@LIBEXECDIR@/ooo-bonobo"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - _value="OpenOffice.org viewer factory"/> - - </oaf_server> - - <oaf_server iid="OAFIID:GNOME_OpenOfficeOrg_Control" - type="factory" - location="OAFIID:GNOME_OpenOfficeOrg_Factory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PersistFile:1.0"/> - <item value="IDL:Bonobo/Persist:1.0"/> - <item value="IDL:Bonobo/Unknown:1.0"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" _value="OpenOffice.org Viewer"/> - <oaf_attribute name="bonobo:editable" type="boolean" value="false"/> - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="application/vnd.sun.xml.writer"/> - <item value="application/vnd.sun.xml.calc"/> - <item value="application/vnd.sun.xml.calc.template"/> - <item value="application/vnd.sun.xml.draw"/> - <item value="application/vnd.sun.xml.draw.template"/> - <item value="application/vnd.sun.xml.impress"/> - <item value="application/vnd.sun.xml.impress.template"/> - <item value="application/vnd.sun.xml.math"/> - <item value="application/vnd.sun.xml.writer"/> - <item value="application/vnd.sun.xml.writer.global"/> - <item value="application/vnd.sun.xml.writer.template"/> - <item value="application/vnd.stardivision.calc"/> - <item value="application/vnd.stardivision.chart"/> - <item value="application/vnd.stardivision.draw"/> - <item value="application/vnd.stardivision.impress"/> - <item value="application/vnd.stardivision.mail"/> - <item value="application/vnd.stardivision.math"/> - <item value="application/vnd.stardivision.writer"/> - <item value="application/msword"/> - <item value="application/excel"/> - <item value="application/powerpoint"/> - <item value="application/rtf"/> - <item value="application/vnd.ms-excel"/> - <item value="application/vnd.lotus-1-2-3"/> - <item value="application/vnd.ms-powerpoint"/> - </oaf_attribute> - - <oaf_attribute name="nautilus:view_as_name" type="string" - _value="OpenOffice.org Document"/> - - </oaf_server> - -</oaf_info> diff --git a/bonobo/data/Makefile.am b/bonobo/data/Makefile.am deleted file mode 100644 index 3a6f16025..000000000 --- a/bonobo/data/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -server_in_files = GNOME_OpenOfficeOrg.server.in.in - -serverdir = $(libdir)/bonobo/servers -server_DATA = $(server_in_files:.server.in.in=.server) - -%.server.in: %.server.in.in - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@ - -@INTLTOOL_SERVER_RULE@ - -rdbdir = $(libdir)/ooo-bonobo -rdb_DATA = ooo-bonobo.rdb - -ooo-bonobo.rdb: - $(REGMERGE) $@.tmp / $(DKREGISTRYNAME) - $(REGCOMP) -register -r $@.tmp -c $(OOODEV_LIBDIR)/connector.uno$(SHAREDLIBEXT) - $(REGCOMP) -register -r $@.tmp -c $(OOODEV_LIBDIR)/remotebridge.uno$(SHAREDLIBEXT) - $(REGCOMP) -register -r $@.tmp -c $(OOODEV_LIBDIR)/bridgefac.uno$(SHAREDLIBEXT) - $(REGCOMP) -register -r $@.tmp -c $(OOODEV_LIBDIR)/uuresolver.uno$(SHARELIBEXT) - mv $@.tmp $@ - -ini_in_files = ooo-bonobo-uno-bootstraprc.in -inidir = $(datadir)/ooo-bonobo -ini_DATA = $(ini_in_files:rc.in=rc) - -%rc: %rc.in - sed -e "s|\@RDBDIR\@|$(rdbdir)|" $< > $@ - -uidir = $(datadir)/gnome-2.0/ui -ui_DATA = ooo-bonobo-control-ui.xml - -libexec_SCRIPTS = ooo-bonobo - -ooo-bonobo: ooo-bonobo.in - sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ - -e "s|\@OOO_LIBDIR\@|$(OOO_INSTALLDIR)/program|" $< > $@ - -BUILT_SOURCES=$(ini_DATA) $(rdb_DATA) $(server_DATA) $(libexec_SCRIPTS) -CLEANFILES=$(BUILT_SOURCES) - -EXTRA_DIST=$(server_in_files) $(ini_in_files) $(ui_DATA) ooo-bonobo.in diff --git a/bonobo/data/ooo-bonobo-control-ui.xml b/bonobo/data/ooo-bonobo-control-ui.xml deleted file mode 100644 index dd1daf567..000000000 --- a/bonobo/data/ooo-bonobo-control-ui.xml +++ /dev/null @@ -1,72 +0,0 @@ -<Root> - <commands> - <cmd name="FileSaveAs" _label="Save as" - _tip="Save the current file with a different name" - accel="*Control**Shift*s" - pixtype="stock" pixname="Save As"/> - - <cmd name="FileExport" _label="Export" - _tip="Save the current file in a different format"/> - - <cmd name="FileExportPDF" _label="Export as PDF" - _tip="Export the current file as PDF file"/> - - <cmd name="FilePrint" _label="Print" - _tip="Print the current file" accel="*Control*P" - pixtype="stock" pixname="Print"/> - - <cmd name="FileProperties" _label="Properties" - _tip="View properties of the displayed document" - pixtype="stock" pixname="Properties"/> - - <cmd name="EditCopy" _label="Copy" - _tip="Copy the selection" pixtype="stock" pixname="Copy" - accel="*Control*c"/> - - <cmd name="ZoomIn" _label="Zoom In" - _tip="Expand to a larger size" accel="*Control*plus" - pixtype="stock" pixname="Zoom-In"/> - - <cmd name="ZoomOut" _label="Zoom Out" - _tip="Shrink to a smaller size" accel="*Control*minus" - pixtype="stock" pixname="Zoom-Out"/> - - <cmd name="ZoomNormal" _label="Normal Size" - _tip="Show the contents at the normal size" - pixtype="stock" pixname="Zoom-100"/> - - <cmd name="ZoomFit" _label="Best Fit" - _tip="Size to fit the page" - pixtype="stock" pixname="Zoom-Fit"/> - </commands> - - <menu> - - <submenu name="File" _label="_File"> - <placeholder name="Open Placeholder"> - <menuitem name="FileSaveAs" _label="Save _as..." verb=""/> - <menuitem name="FileExport" _label="E_xport..." verb=""/> - <menuitem name="FileExportPDF" _label="Export as _PDF..." verb=""/> - </placeholder> - - <placeholder name="File Items Placeholder"> - <menuitem name="FilePrint" _label="_Print..." verb=""/> - <menuitem name="FileProperties" _label="Proper_ties" verb=""/> - </placeholder> - </submenu> - - <submenu name="Edit" _label="_Edit"> - <menuitem name="Copy" _label="_Copy" verb="EditCopy"/> - </submenu> - - <submenu name="View" _label="_View"> - <placeholder name="Zoom Items Placeholder"> - <menuitem name="Zoom In" _label="Zoom _In" verb="ZoomIn"/> - <menuitem name="Zoom Out" _label="Zoom _Out" verb="ZoomOut"/> - <menuitem name="Zoom Normal" _label="Normal Si_ze" verb="ZoomNormal"/> - <menuitem name="Zoom Fit" _label="Best _Fit" verb="ZoomFit"/> - </placeholder> - </submenu> - - </menu> -</Root> diff --git a/bonobo/data/ooo-bonobo-uno-bootstraprc.in b/bonobo/data/ooo-bonobo-uno-bootstraprc.in deleted file mode 100644 index 1a36c386f..000000000 --- a/bonobo/data/ooo-bonobo-uno-bootstraprc.in +++ /dev/null @@ -1,2 +0,0 @@ -UNO_TYPES=@RDBDIR@/ooo-bonobo.rdb -UNO_SERVICES=@RDBDIR@/ooo-bonobo.rdb diff --git a/bonobo/data/ooo-bonobo.in b/bonobo/data/ooo-bonobo.in deleted file mode 100644 index 0d145c899..000000000 --- a/bonobo/data/ooo-bonobo.in +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -LD_LIBRARY_PATH=@OOO_LIBDIR@:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -exec @LIBEXECDIR@/ooo-bonobo.bin "$@" diff --git a/bonobo/intltool-extract.in b/bonobo/intltool-extract.in deleted file mode 100644 index d98b2bf29..000000000 --- a/bonobo/intltool-extract.in +++ /dev/null @@ -1,389 +0,0 @@ -#!@INTLTOOL_PERL@ -w -# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- - -# -# The Intltool Message Extractor -# -# Copyright (C) 2000-2001 Free Software Foundation. -# -# Intltool 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. -# -# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, 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. -# -# Authors: Kenneth Christiansen <kenneth@gnu.org> -# Darin Adler <darin@bentspoon.com> -# - -## Release information -my $PROGRAM = "intltool-extract"; -my $PACKAGE = "intltool"; -my $VERSION = "0.25"; - -## Loaded modules -use strict; -use File::Basename; -use Getopt::Long; - -## Scalars used by the option stuff -my $TYPE_ARG = "0"; -my $LOCAL_ARG = "0"; -my $HELP_ARG = "0"; -my $VERSION_ARG = "0"; -my $UPDATE_ARG = "0"; -my $QUIET_ARG = "0"; - -my $FILE; -my $OUTFILE; - -my $gettext_type = ""; -my $input; -my %messages = (); - -## Use this instead of \w for XML files to handle more possible characters. -my $w = "[-A-Za-z0-9._:]"; - -## Always print first -$| = 1; - -## Handle options -GetOptions ( - "type=s" => \$TYPE_ARG, - "local|l" => \$LOCAL_ARG, - "help|h" => \$HELP_ARG, - "version|v" => \$VERSION_ARG, - "update" => \$UPDATE_ARG, - "quiet|q" => \$QUIET_ARG, - ) or &error; - -&split_on_argument; - - -## Check for options. -## This section will check for the different options. - -sub split_on_argument { - - if ($VERSION_ARG) { - &version; - - } elsif ($HELP_ARG) { - &help; - - } elsif ($LOCAL_ARG) { - &place_local; - &extract; - - } elsif ($UPDATE_ARG) { - &place_normal; - &extract; - - } elsif (@ARGV > 0) { - &place_normal; - &message; - &extract; - - } else { - &help; - - } -} - -sub place_normal { - $FILE = $ARGV[0]; - $OUTFILE = "$FILE.h"; -} - -sub place_local { - $OUTFILE = fileparse($FILE, ()); - if (!-e "tmp/") { - system("mkdir tmp/"); - } - $OUTFILE = "./tmp/$OUTFILE.h" -} - -sub determine_type { - if ($TYPE_ARG =~ /^gettext\/(.*)/) { - $gettext_type=$1 - } -} - -## Sub for printing release information -sub version{ - print "${PROGRAM} (${PACKAGE}) $VERSION\n"; - print "Copyright (C) 2000 Free Software Foundation, Inc.\n"; - print "Written by Kenneth Christiansen, 2000.\n\n"; - print "This is free software; see the source for copying conditions. There is NO\n"; - print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; - exit; -} - -## Sub for printing usage information -sub help{ - print "Usage: ${PROGRAM} [FILENAME] [OPTIONS] ...\n"; - print "Generates a header file from an xml source file.\n\nGrabs all strings "; - print "between <_translatable_node> and it's end tag,\nwhere tag are all allowed "; - print "xml tags. Read the docs for more info.\n\n"; - print " -v, --version shows the version\n"; - print " -h, --help shows this help page\n"; - print " -q, --quiet quiet mode\n"; - print "\nReport bugs to <kenneth\@gnu.org>.\n"; - exit; -} - -## Sub for printing error messages -sub error{ - print "Try `${PROGRAM} --help' for more information.\n"; - exit; -} - -sub message { - print "Generating C format header file for translation.\n"; -} - -sub extract { - &determine_type; - - &convert ($FILE); - - open OUT, ">$OUTFILE"; - &msg_write; - close OUT; - - print "Wrote $OUTFILE\n" unless $QUIET_ARG; -} - -sub convert($) { - - ## Reading the file - { - local (*IN); - local $/; #slurp mode - open (IN, "<$FILE") || die "can't open $FILE: $!"; - $input = <IN>; - } - - &type_ini if $gettext_type eq "ini"; - &type_keys if $gettext_type eq "keys"; - &type_xml if $gettext_type eq "xml"; - &type_glade if $gettext_type eq "glade"; - &type_scheme if $gettext_type eq "scheme"; - &type_schemas if $gettext_type eq "schemas"; - &type_rfc822deb if $gettext_type eq "rfc822deb"; -} - -sub entity_decode_minimal -{ - local ($_) = @_; - - s/'/'/g; # ' - s/"/"/g; # " - s/&/&/g; - - return $_; -} - -sub entity_decode -{ - local ($_) = @_; - - s/'/'/g; # ' - s/"/"/g; # " - s/&/&/g; - s/</</g; - s/>/>/g; - - return $_; -} - -sub escape_char -{ - return '\"' if $_ eq '"'; - return '\n' if $_ eq "\n"; - return '\\' if $_ eq '\\'; - - return $_; -} - -sub escape -{ - my ($string) = @_; - return join "", map &escape_char, split //, $string; -} - -sub type_ini { - ### For generic translatable desktop files ### - while ($input =~ /^_.*=(.*)$/mg) { - $messages{$1} = []; - } -} - -sub type_keys { - ### For generic translatable mime/keys files ### - while ($input =~ /^\s*_\w+=(.*)$/mg) { - $messages{$1} = []; - } -} - -sub type_xml { - ### For generic translatable XML files ### - - while ($input =~ /\s_$w+=\"([^"]+)\"/sg) { # " - $messages{entity_decode_minimal($1)} = []; - } - - while ($input =~ /<_($w+)(?: xml:space="($w+)")?>(.+?)<\/_\1>/sg) { - $_ = $3; - if (!defined($2) || $2 ne "preserve") { - s/\s+/ /g; - s/^ //; - s/ $//; - } - $messages{entity_decode_minimal($_)} = []; - } -} - -sub type_schemas { - ### For schemas XML files ### - - # FIXME: We should handle escaped < (less than) - while ($input =~ / - <locale\ name="C">\s* - (<default>\s*(.*?)\s*<\/default>\s*)? - (<short>\s*(.*?)\s*<\/short>\s*)? - (<long>\s*(.*?)\s*<\/long>\s*)? - <\/locale> - /sgx) { - my @totranslate = ($2,$4,$6); - foreach (@totranslate) { - next if !$_; - s/\s+/ /g; - $messages{entity_decode_minimal($_)} = []; - } - } -} - -sub type_rfc822deb { - ### For rfc822-style Debian configuration files ### - - while ($input =~ /(?:^|\n)_[^:]+:\s*(.*?)(?=\n\S|$)/sg) { - my @str_list = rfc822deb_split($1); - for my $str (@str_list) { - # As rfc822deb is for configuration files, duplicates - # should never happen. Developers must use the - # [] construct to make msgid unique, see also intltool-merge - print STDERR "Warning: msgid multiply defined:\n $str\n" - if defined($messages{$str}); - $messages{$str} = []; - } - } -} - -sub rfc822deb_split { - # Debian defines a special way to deal with rfc822-style files: - # when a value contain newlines, it consists of - # 1. a short form (first line) - # 2. a long description, all lines begin with a space, - # and paragraphs are separated by a single dot on a line - # This routine returns an array of all paragraphs, and reformat - # them. - my $text = shift; - $text =~ s/^ //mg; - return ($text) if $text !~ /\n/; - - $text =~ s/([^\n]*)\n//; - my @list = ($1); - my $str = ''; - for my $line (split (/\n/, $text)) { - chomp $line; - $line =~ /\s+$/; - if ($line =~ /^\.$/) { - # New paragraph - $str =~ s/\s*$//; - push(@list, $str); - $str = ''; - } elsif ($line =~ /^\s/) { - # Line which must not be reformatted - $str .= "\n" if length ($str) && $str !~ /\n$/; - $str .= $line."\n"; - } else { - # Continuation line, remove newline - $str .= " " if length ($str) && $str !~ /[\n ]$/; - $str .= $line; - } - } - $str =~ s/\s*$//; - push(@list, $str) if length ($str); - return @list; -} - -sub type_glade { - ### For translatable Glade XML files ### - - my $tags = "label|title|text|format|copyright|comments|preview_text|tooltip|message"; - - while ($input =~ /<($tags)>([^<]+)<\/($tags)>/sg) { - # Glade sometimes uses tags that normally mark translatable things for - # little bits of non-translatable content. We work around this by not - # translating strings that only includes something like label4 or window1. - $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label)[0-9]+$/; - } - - while ($input =~ /<items>(..[^<]*)<\/items>/sg) { - for my $item (split (/\n/, $1)) { - $messages{entity_decode($item)} = []; - } - } - - ## handle new glade files - while ($input =~ /<(property|atkproperty)\s+[^>]*translatable\s*=\s*"yes"[^>]*>([^<]+)<\/\1>/sg) { - $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label)[0-9]+$/; - } - while ($input =~ /<atkaction\s+action_name="([^>]*)"\s+description="([^>]+)"\/>/sg) { - $messages{entity_decode_minimal($2)} = []; - } -} - -sub type_scheme { - while ($input =~ /_\(?"((?:[^"\\]+|\\.)*)"\)?/sg) { - $messages{$1} = []; - } -} - -sub msg_write { - for my $message (sort keys %messages) { - print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/; - - my @lines = split (/\n/, $message, -1); - for (my $n = 0; $n < @lines; $n++) { - if ($n == 0) { - print OUT "char *s = N_(\""; - } else { - print OUT " \""; - } - - print OUT escape($lines[$n]); - - if ($n < @lines - 1) { - print OUT "\\n\"\n"; - } else { - print OUT "\");\n"; - } - } - } -} - diff --git a/bonobo/intltool-merge.in b/bonobo/intltool-merge.in deleted file mode 100644 index f1d53b114..000000000 --- a/bonobo/intltool-merge.in +++ /dev/null @@ -1,908 +0,0 @@ -#!@INTLTOOL_PERL@ -w - -# -# The Intltool Message Merger -# -# Copyright (C) 2000, 2002 Free Software Foundation. -# Copyright (C) 2000, 2001 Eazel, Inc -# -# Intltool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# version 2 published by the Free Software Foundation. -# -# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, 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. -# -# Authors: Maciej Stachowiak <mjs@noisehavoc.org> -# Kenneth Christiansen <kenneth@gnu.org> -# Darin Adler <darin@bentspoon.com> -# -# Proper XML UTF-8'ification written by Cyrille Chepelov <chepelov@calixo.net> -# - -## Release information -my $PROGRAM = "intltool-merge"; -my $PACKAGE = "intltool"; -my $VERSION = "0.25"; - -## Loaded modules -use strict; -use Getopt::Long; -use Text::Wrap; - -## Scalars used by the option stuff -my $HELP_ARG = 0; -my $VERSION_ARG = 0; -my $BA_STYLE_ARG = 0; -my $XML_STYLE_ARG = 0; -my $KEYS_STYLE_ARG = 0; -my $DESKTOP_STYLE_ARG = 0; -my $SCHEMAS_STYLE_ARG = 0; -my $RFC822DEB_STYLE_ARG = 0; -my $QUIET_ARG = 0; -my $PASS_THROUGH_ARG = 0; -my $UTF8_ARG = 0; -my $cache_file; - -## Handle options -GetOptions -( - "help" => \$HELP_ARG, - "version" => \$VERSION_ARG, - "quiet|q" => \$QUIET_ARG, - "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility - "ba-style|b" => \$BA_STYLE_ARG, - "xml-style|x" => \$XML_STYLE_ARG, - "keys-style|k" => \$KEYS_STYLE_ARG, - "desktop-style|d" => \$DESKTOP_STYLE_ARG, - "schemas-style|s" => \$SCHEMAS_STYLE_ARG, - "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, - "pass-through|p" => \$PASS_THROUGH_ARG, - "utf8|u" => \$UTF8_ARG, - "cache|c=s" => \$cache_file - ) or &error; - -my $PO_DIR; -my $FILE; -my $OUTFILE; - -my %po_files_by_lang = (); -my %translations = (); - -# Use this instead of \w for XML files to handle more possible characters. -my $w = "[-A-Za-z0-9._:]"; - -# XML quoted string contents -my $q = "[^\\\"]*"; - -## Check for options. - -if ($VERSION_ARG) -{ - &print_version; -} -elsif ($HELP_ARG) -{ - &print_help; -} -elsif ($BA_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &ba_merge_translations; - &finalize; -} -elsif ($XML_STYLE_ARG && @ARGV > 2) -{ - &utf8_sanity_check; - &preparation; - &print_message; - &xml_merge_translations; - &finalize; -} -elsif ($KEYS_STYLE_ARG && @ARGV > 2) -{ - &utf8_sanity_check; - &preparation; - &print_message; - &keys_merge_translations; - &finalize; -} -elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &desktop_merge_translations; - &finalize; -} -elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &schemas_merge_translations; - &finalize; -} -elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &rfc822deb_merge_translations; - &finalize; -} -else -{ - &print_help; -} - -exit; - -## Sub for printing release information -sub print_version -{ - print "${PROGRAM} (${PACKAGE}) ${VERSION}\n"; - print "Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen.\n\n"; - print "Copyright (C) 2000-2002 Free Software Foundation, Inc.\n"; - print "Copyright (C) 2000-2001 Eazel, Inc.\n"; - print "This is free software; see the source for copying conditions. There is NO\n"; - print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; - exit; -} - -## Sub for printing usage information -sub print_help -{ - print "Usage: ${PROGRAM} [OPTIONS] PO_DIRECTORY FILENAME OUTPUT_FILE\n"; - print "Generates an output file that includes translated versions of some attributes,\n"; - print "from an untranslated source and a po directory that includes translations.\n\n"; - print " -b, --ba-style includes translations in the bonobo-activation style\n"; - print " -d, --desktop-style includes translations in the desktop style\n"; - print " -k, --keys-style includes translations in the keys style\n"; - print " -s, --schemas-style includes translations in the schemas style\n"; - print " -r, --rfc822deb-style includes translations in the RFC822 style\n"; - print " -x, --xml-style includes translations in the standard xml style\n"; - print " -u, --utf8 convert all strings to UTF-8 before merging\n"; - print " -p, --pass-through use strings as found in .po files, without\n"; - print " conversion (STRONGLY unrecommended with -x)\n"; - print " -q, --quiet suppress most messages\n"; - print " --help display this help and exit\n"; - print " --version output version information and exit\n"; - print "\nReport bugs to bugzilla.gnome.org, module intltool, or contact us through \n"; - print "<xml-i18n-tools-list\@gnome.org>.\n"; - exit; -} - - -## Sub for printing error messages -sub print_error -{ - print "Try `${PROGRAM} --help' for more information.\n"; - exit; -} - - -sub print_message -{ - print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; -} - - -sub preparation -{ - $PO_DIR = $ARGV[0]; - $FILE = $ARGV[1]; - $OUTFILE = $ARGV[2]; - - &gather_po_files; - &get_translation_database; -} - -# General-purpose code for looking up translations in .po files - -sub po_file2lang -{ - my ($tmp) = @_; - $tmp =~ s/^.*\/(.*)\.po$/$1/; - return $tmp; -} - -sub gather_po_files -{ - for my $po_file (glob "$PO_DIR/*.po") { - $po_files_by_lang{po_file2lang($po_file)} = $po_file; - } -} - -sub get_local_charset -{ - my ($encoding) = @_; - my $alias_file = $ENV{"G_CHARSET_ALIAS"} || "/usr/lib/charset.alias"; - - # seek character encoding aliases in charset.alias (glib) - - if (open CHARSET_ALIAS, $alias_file) - { - while (<CHARSET_ALIAS>) - { - next if /^\#/; - return $1 if (/^\s*([-._a-zA-Z0-9]+)\s+$encoding\b/i) - } - - close CHARSET_ALIAS; - } - - # if not found, return input string - - return $encoding; -} - -sub get_po_encoding -{ - my ($in_po_file) = @_; - my $encoding = ""; - - open IN_PO_FILE, $in_po_file or die; - while (<IN_PO_FILE>) - { - ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" - if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) - { - $encoding = $1; - last; - } - } - close IN_PO_FILE; - - if (!$encoding) - { - print "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n"; - $encoding = "ISO-8859-1"; - } - - $encoding = get_local_charset($encoding); - - return $encoding -} - -sub utf8_sanity_check -{ - if (!$UTF8_ARG) - { - if (!$PASS_THROUGH_ARG) - { - $PASS_THROUGH_ARG="1"; - } - } -} - -sub get_translation_database -{ - if ($cache_file) { - &get_cached_translation_database; - } else { - &create_translation_database; - } -} - -sub get_newest_po_age -{ - my $newest_age; - - foreach my $file (values %po_files_by_lang) - { - my $file_age = -M $file; - $newest_age = $file_age if !$newest_age || $file_age < $newest_age; - } - - return $newest_age; -} - -sub create_cache -{ - print "Generating and caching the translation database\n" unless $QUIET_ARG; - - &create_translation_database; - - open CACHE, ">$cache_file" || die; - print CACHE join "\x01", %translations; - close CACHE; -} - -sub load_cache -{ - print "Found cached translation database\n" unless $QUIET_ARG; - - my $contents; - open CACHE, "<$cache_file" || die; - { - local $/; - $contents = <CACHE>; - } - close CACHE; - %translations = split "\x01", $contents; -} - -sub get_cached_translation_database -{ - my $cache_file_age = -M $cache_file; - if (defined $cache_file_age) - { - if ($cache_file_age <= &get_newest_po_age) - { - &load_cache; - return; - } - print "Found too-old cached translation database\n" unless $QUIET_ARG; - } - - &create_cache; -} - -sub create_translation_database -{ - for my $lang (keys %po_files_by_lang) - { - my $po_file = $po_files_by_lang{$lang}; - - if ($UTF8_ARG) - { - my $encoding = get_po_encoding ($po_file); - - if (lc $encoding eq "utf-8") - { - open PO_FILE, "<$po_file"; - } - else - { - my $iconv = $ENV{"INTLTOOL_ICONV"} || "iconv"; - open PO_FILE, "$iconv -f $encoding -t UTF-8 $po_file|"; - } - } - else - { - open PO_FILE, "<$po_file"; - } - - my $nextfuzzy = 0; - my $inmsgid = 0; - my $inmsgstr = 0; - my $msgid = ""; - my $msgstr = ""; - - while (<PO_FILE>) - { - $nextfuzzy = 1 if /^#, fuzzy/; - - if (/^msgid "((\\.|[^\\])*)"/ ) - { - $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; - $msgid = ""; - $msgstr = ""; - - if ($nextfuzzy) { - $inmsgid = 0; - } else { - $msgid = unescape_po_string($1); - $inmsgid = 1; - } - $inmsgstr = 0; - $nextfuzzy = 0; - } - - if (/^msgstr "((\\.|[^\\])*)"/) - { - $msgstr = unescape_po_string($1); - $inmsgstr = 1; - $inmsgid = 0; - } - - if (/^"((\\.|[^\\])*)"/) - { - $msgid .= unescape_po_string($1) if $inmsgid; - $msgstr .= unescape_po_string($1) if $inmsgstr; - } - } - $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; - } -} - -sub finalize -{ -} - -sub unescape_one_sequence -{ - my ($sequence) = @_; - - return "\\" if $sequence eq "\\\\"; - return "\"" if $sequence eq "\\\""; - return "\n" if $sequence eq "\\n"; - - # gettext also handles \n, \t, \b, \r, \f, \v, \a, \xxx (octal), - # \xXX (hex) and has a comment saying they want to handle \u and \U. - - return $sequence; -} - -sub unescape_po_string -{ - my ($string) = @_; - - $string =~ s/(\\.)/unescape_one_sequence($1)/eg; - - return $string; -} - -## NOTE: deal with < - < but not > - > because it seems its ok to have -## > in the entity. For further info please look at #84738. -sub entity_decode -{ - local ($_) = @_; - - s/'/'/g; # ' - s/"/"/g; # " - s/&/&/g; - s/</</g; - - return $_; -} - -sub entity_encode -{ - my ($pre_encoded) = @_; - - my @list_of_chars = unpack ('C*', $pre_encoded); - - if ($PASS_THROUGH_ARG) - { - return join ('', map (&entity_encode_int_even_high_bit, @list_of_chars)); - } - else - { - return join ('', map (&entity_encode_int_minimalist, @list_of_chars)); - } -} - -sub entity_encode_int_minimalist -{ - return """ if $_ == 34; - return "&" if $_ == 38; - return "'" if $_ == 39; - return "<" if $_ == 60; - return chr $_; -} - -sub entity_encode_int_even_high_bit -{ - if ($_ > 127 || $_ == 34 || $_ == 38 || $_ == 39 || $_ == 60) - { - # the ($_ > 127) should probably be removed - return "&#" . $_ . ";"; - } - else - { - return chr $_; - } -} - -sub entity_encoded_translation -{ - my ($lang, $string) = @_; - - my $translation = $translations{$lang, $string}; - return $string if !$translation; - return entity_encode ($translation); -} - -## XML (bonobo-activation specific) merge code - -sub ba_merge_translations -{ - my $source; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; - - while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) - { - print OUTPUT $1; - - my $node = $2 . "\n"; - - my @strings = (); - $_ = $node; - while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { - push @strings, entity_decode($3); - } - print OUTPUT; - - my %langs; - for my $string (@strings) - { - for my $lang (keys %po_files_by_lang) - { - $langs{$lang} = 1 if $translations{$lang, $string}; - } - } - - for my $lang (sort keys %langs) - { - $_ = $node; - s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; - s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; - print OUTPUT; - } - } - - print OUTPUT $source; - - close OUTPUT; -} - - -## XML (non-bonobo-activation) merge code - -sub xml_merge_translations -{ - my $source; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">$OUTFILE" or die; - - # FIXME: support attribute translations - - # Empty nodes never need translation, so unmark all of them. - # For example, <_foo/> is just replaced by <foo/>. - $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; - - # Support for <_foo>blah</_foo> style translations. - while ($source =~ s|^(.*?)([ \t]*)<\s*_($w+)\s*>(.*?)<\s*/_\3\s*>([ \t]*\n)?||s) - { - print OUTPUT $1; - - my $spaces = $2; - my $tag = $3; - my $string = $4; - - print OUTPUT "$spaces<$tag>$string</$tag>\n"; - - $string =~ s/\s+/ /g; - $string =~ s/^ //; - $string =~ s/ $//; - $string = entity_decode($string); - - for my $lang (sort keys %po_files_by_lang) - { - my $translation = $translations{$lang, $string}; - next if !$translation; - $translation = entity_encode($translation); - print OUTPUT "$spaces<$tag xml:lang=\"$lang\">$translation</$tag>\n"; - } - } - - print OUTPUT $source; - - close OUTPUT; -} - -sub keys_merge_translations -{ - open INPUT, "<${FILE}" or die; - open OUTPUT, ">${OUTFILE}" or die; - - while (<INPUT>) - { - if (s/^(\s*)_(\w+=(.*))/$1$2/) - { - my $string = $3; - - print OUTPUT; - - my $non_translated_line = $_; - - for my $lang (sort keys %po_files_by_lang) - { - my $translation = $translations{$lang, $string}; - next if !$translation; - - $_ = $non_translated_line; - s/(\w+)=.*/[$lang]$1=$translation/; - print OUTPUT; - } - } - else - { - print OUTPUT; - } - } - - close OUTPUT; - close INPUT; -} - -sub desktop_merge_translations -{ - open INPUT, "<${FILE}" or die; - open OUTPUT, ">${OUTFILE}" or die; - - while (<INPUT>) - { - if (s/^(\s*)_(\w+=(.*))/$1$2/) - { - my $string = $3; - - print OUTPUT; - - my $non_translated_line = $_; - - for my $lang (sort keys %po_files_by_lang) - { - my $translation = $translations{$lang, $string}; - next if !$translation; - - $_ = $non_translated_line; - s/(\w+)=.*/${1}[$lang]=$translation/; - print OUTPUT; - } - } - else - { - print OUTPUT; - } - } - - close OUTPUT; - close INPUT; -} - -sub schemas_merge_translations -{ - my $source; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">$OUTFILE" or die; - - # FIXME: support attribute translations - - # Empty nodes never need translation, so unmark all of them. - # For example, <_foo/> is just replaced by <foo/>. - $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; - - while ($source =~ s/ - (.*?) - (\s+)(<locale\ name="C">(\s*) - (<default>\s*(.*?)\s*<\/default>)?(\s*) - (<short>\s*(.*?)\s*<\/short>)?(\s*) - (<long>\s*(.*?)\s*<\/long>)?(\s*) - <\/locale>) - //sx) - { - print OUTPUT $1; - - my $locale_start_spaces = $2 ? $2 : ''; - my $default_spaces = $4 ? $4 : ''; - my $short_spaces = $7 ? $7 : ''; - my $long_spaces = $10 ? $10 : ''; - my $locale_end_spaces = $13 ? $13 : ''; - my $c_default_block = $3 ? $3 : ''; - my $default_string = $6 ? $6 : ''; - my $short_string = $9 ? $9 : ''; - my $long_string = $12 ? $12 : ''; - - $c_default_block =~ s/default>\[.*?\]/default>/s; - - print OUTPUT "$locale_start_spaces$c_default_block"; - - $default_string =~ s/\s+/ /g; - $default_string = entity_decode($default_string); - $short_string =~ s/\s+/ /g; - $short_string = entity_decode($short_string); - $long_string =~ s/\s+/ /g; - $long_string = entity_decode($long_string); - - for my $lang (sort keys %po_files_by_lang) - { - my $default_translation = $translations{$lang, $default_string}; - my $short_translation = $translations{$lang, $short_string}; - my $long_translation = $translations{$lang, $long_string}; - - next if (!$default_translation && !$short_translation && - !$long_translation); - - print OUTPUT "\n$locale_start_spaces<locale name=\"$lang\">"; - - print OUTPUT "$default_spaces"; - - if ($default_translation) - { - $default_translation = entity_encode($default_translation); - print OUTPUT "<default>$default_translation</default>"; - } - - print OUTPUT "$short_spaces"; - - if ($short_translation) - { - $short_translation = entity_encode($short_translation); - print OUTPUT "<short>$short_translation</short>"; - } - - print OUTPUT "$long_spaces"; - - if ($long_translation) - { - $long_translation = entity_encode($long_translation); - print OUTPUT "<long>$long_translation</long>"; - } - - print OUTPUT "$locale_end_spaces</locale>"; - } - } - - print OUTPUT $source; - - close OUTPUT; -} - -sub rfc822deb_merge_translations -{ - my $source; - - $Text::Wrap::huge = 'overflow'; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">${OUTFILE}" or die; - - while ($source =~ /(^|\n+)(_)?([^:_\n]+)(:\s*)(.*?)(?=\n[\S\n]|$)/sg) - { - my $sep = $1; - my $non_translated_line = $3.$4; - my $string = $5; - my $is_translatable = defined($2); - # Remove [] dummy strings - $string =~ s/\[\s[^\[\]]*\]$//; - $non_translated_line .= $string; - - print OUTPUT $sep.$non_translated_line; - - if ($is_translatable) - { - my @str_list = rfc822deb_split($string); - - for my $lang (sort keys %po_files_by_lang) - { - my $is_translated = 1; - my $str_translated = ''; - my $first = 1; - - for my $str (@str_list) - { - my $translation = $translations{$lang, $str}; - - if (!$translation) - { - $is_translated = 0; - last; - } - - # $translation may also contain [] dummy - # strings, mostly to indicate an empty string - $translation =~ s/\[\s[^\[\]]*\]$//; - - if ($first) - { - $str_translated .= - Text::Tabs::expand($translation) . - "\n"; - } - else - { - $str_translated .= Text::Tabs::expand( - Text::Wrap::wrap(' ', ' ', $translation)) . - "\n .\n"; - } - $first = 0; - - # To fix some problems with Text::Wrap::wrap - $str_translated =~ s/(\n )+\n/\n .\n/g; - } - next unless $is_translated; - - $str_translated =~ s/\n \.\n$//; - $str_translated =~ s/\s+$//; - - $_ = $non_translated_line; - s/^(\w+):\s*.*/$sep${1}-$lang: $str_translated/s; - print OUTPUT; - } - } - } - print OUTPUT "\n"; - - close OUTPUT; - close INPUT; -} - -sub rfc822deb_split -{ - # Debian defines a special way to deal with rfc822-style files: - # when a value contain newlines, it consists of - # 1. a short form (first line) - # 2. a long description, all lines begin with a space, - # and paragraphs are separated by a single dot on a line - # This routine returns an array of all paragraphs, and reformat - # them. - my $text = shift; - $text =~ s/^ //mg; - return ($text) if $text !~ /\n/; - - $text =~ s/([^\n]*)\n//; - my @list = ($1); - my $str = ''; - - for my $line (split (/\n/, $text)) - { - chomp $line; - $line =~ /\s+$/; - - if ($line =~ /^\.$/) - { - # New paragraph - $str =~ s/\s*$//; - push(@list, $str); - $str = ''; - } - elsif ($line =~ /^\s/) - { - # Line which must not be reformatted - $str .= "\n" if length ($str) && $str !~ /\n$/; - $str .= $line."\n"; - } - else - { - # Continuation line, remove newline - $str .= " " if length ($str) && $str !~ /[\n ]$/; - $str .= $line; - } - } - - $str =~ s/\s*$//; - push(@list, $str) if length ($str); - - return @list; -} - diff --git a/bonobo/intltool-update.in b/bonobo/intltool-update.in deleted file mode 100644 index 2004a5985..000000000 --- a/bonobo/intltool-update.in +++ /dev/null @@ -1,642 +0,0 @@ -#!@INTLTOOL_PERL@ -w - -# -# The Intltool Message Updater -# -# Copyright (C) 2000-2002 Free Software Foundation. -# -# Intltool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# version 2 published by the Free Software Foundation. -# -# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, 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. -# -# Authors: Kenneth Christiansen <kenneth@gnu.org> -# Maciej Stachowiak -# Darin Adler <darin@bentspoon.com> - -## Release information -my $PROGRAM = "intltool-update"; -my $VERSION = "0.25"; -my $PACKAGE = "intltool"; - -## Loaded modules -use strict; -use Getopt::Long; -use Cwd; -use File::Copy; -use File::Find; - -## Scalars used by the option stuff -my $HELP_ARG = 0; -my $VERSION_ARG = 0; -my $DIST_ARG = 0; -my $POT_ARG = 0; -my $HEADERS_ARG = 0; -my $MAINTAIN_ARG = 0; -my $REPORT_ARG = 0; -my $VERBOSE = 0; -my $GETTEXT_PACKAGE = ""; - -my @languages; -my %po_files_by_lang = (); - -# Regular expressions to categorize file types. -# FIXME: Please check if the following is correct - -my $xml_extension = -"xml(\.in)*|". # .in is not required -"ui|". -"glade2?(\.in)*|". # .in is not required -"scm(\.in)*|". # .in is not required -"oaf(\.in)+|". -"etspec|". -"sheet(\.in)+|". -"schemas(\.in)+|". -"pong(\.in)+"; - -my $ini_extension = -"desktop(\.in)+|". -"caves(\.in)+|". -"directory(\.in)+|". -"soundlist(\.in)+|". -"keys(\.in)+|". -"theme(\.in)+|". -"server(\.in)+"; - -## Always print as the first thing -$| = 1; - -## Handle options -GetOptions -( - "help" => \$HELP_ARG, - "version" => \$VERSION_ARG, - "dist|d" => \$DIST_ARG, - "pot|p" => \$POT_ARG, - "headers|s" => \$HEADERS_ARG, - "maintain|m" => \$MAINTAIN_ARG, - "report|r" => \$REPORT_ARG, - "verbose|x" => \$VERBOSE, - "gettext-package|g=s" => \$GETTEXT_PACKAGE, - ) or &print_error_invalid_option; - -&print_help if $HELP_ARG; -&print_version if $VERSION_ARG; - -my $arg_count = ($DIST_ARG > 0) - + ($POT_ARG > 0) - + ($HEADERS_ARG > 0) - + ($MAINTAIN_ARG > 0) - + ($REPORT_ARG > 0); -&print_help if $arg_count > 1; - -# --version and --help don't require a module name -my $MODULE = $GETTEXT_PACKAGE || &find_package_name; - -if ($DIST_ARG) { - if ($ARGV[0] =~ /^[a-z]/){ - &update_po_file ($ARGV[0]); - &print_status ($ARGV[0]); - } else { - &print_help; - } -} elsif ($POT_ARG) { - &generate_headers; - &generate_po_template; -} elsif ($HEADERS_ARG) { - &generate_headers; -} elsif ($MAINTAIN_ARG) { - &find_leftout_files; -} elsif ($REPORT_ARG) { - &print_report; -} else { - if ($ARGV[0] =~ /^[a-z]/) { - &main ($ARGV[0]); - } else { - &print_help; - } -} - -exit; - -######### - -sub print_version -{ - ## Print version information - print "${PROGRAM} (${PACKAGE}) $VERSION\n"; - print "Written by Kenneth Christiansen, Maciej Stachowiak, and Darin Adler.\n\n"; - print "Copyright (C) 2000-2002 Free Software Foundation, Inc.\n"; - print "This is free software; see the source for copying conditions. There is NO\n"; - print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; - exit; -} - -sub print_help -{ - ## Print usage information - print "Usage: ${PROGRAM} [OPTIONS] ...LANGCODE\n"; - print "Updates PO template files and merge them with the translations.\n\n"; - print " -p, --pot generate the PO template only\n"; - print " -s, --headers generate the header files in POTFILES.in\n"; - print " -m, --maintain search for left out files from POTFILES.in\n"; - print " -r, --report display a status report for the module.\n"; - print " -x, --verbose display lots of feedback\n"; - print " --help display this help and exit\n"; - print " --version output version information and exit\n"; - print "\nExamples of use:\n"; - print "${PROGRAM} --pot just creates a new PO template from the source\n"; - print "${PROGRAM} da created new PO template and updated the da.po file\n\n"; - print "Report bugs to bugzilla.gnome.org, module 'intltool'.\n"; - exit; -} - -sub main -{ - my ($lang) = @_; - - ## Report error if the language file supplied - ## to the command line is non-existent - &print_error_not_existing("$lang.po") if ! -s "$lang.po"; - - print "Working, please wait..." unless $VERBOSE; - &generate_headers; - &generate_po_template; - &update_po_file ($lang); - &print_status ($lang); -} - -sub determine_type ($) -{ - my $type = $_; - my $gettext_type; - - # FIXME: Use $xml_extentions, and maybe do all this even nicer - my $xml_regex = - "(?:xml(\.in)*|ui|oaf(?:\.in)+|server(?:\.in)+|sheet(?:\.in)+|". - "pong(?:\.in)+|etspec|schemas(?:\.in)+)"; - my $ini_regex = - "(?:desktop(?:\.in)+|theme(?:\.in)+|caves(?:\.in)+|directory(?:\.in)+|". - "soundlist(?:\.in)+)"; - - if ($type =~ /\[type: gettext\/([^\]].*)]/) { - $gettext_type=$1; - } - elsif ($type =~ /schemas(\.in)+$/) { - $gettext_type="schemas"; - } - elsif ($type =~ /$xml_regex$/) { - $gettext_type="xml"; - } - elsif ($type =~ /glade2?(\.in)*$/) { - $gettext_type="glade"; - } - elsif ($type =~ /$ini_regex$/) { - $gettext_type="ini"; - } - elsif ($type =~ /scm(\.in)*$/) { - $gettext_type="scheme"; - } - elsif ($type =~ /keys(\.in)+$/) { - $gettext_type="keys"; - } - else { $gettext_type=""; } - - return "gettext\/$gettext_type"; -} - -sub find_leftout_files -{ - my (@buf_i18n_plain, - @buf_i18n_xml, - @buf_i18n_xml_unmarked, - @buf_i18n_ini, - @buf_potfiles, - @buf_potfiles_ignore, - @buf_allfiles, - @buf_allfiles_sorted, - @buf_potfiles_sorted - ); - - ## Search and find all translatable files - find sub { - push @buf_i18n_plain, "$File::Find::name" if /\.(c|y|cc|cpp|c\+\+|h|gob)$/ - }, ".."; - find sub { - push @buf_i18n_xml, "$File::Find::name" if /\.($xml_extension)$/ - }, ".."; - find sub { - push @buf_i18n_ini, "$File::Find::name" if /\.($ini_extension)$/ - }, ".."; - find sub { - push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/ - }, ".."; - - - open POTFILES, "POTFILES.in" or die "$PROGRAM: there's no POTFILES.in!\n"; - - @buf_potfiles = grep /^[^#]/, <POTFILES>; - foreach (@buf_potfiles) { - s/^\[.*]\s*//; - } - - print "Searching for missing translatable files...\n" if $VERBOSE; - - ## Check if we should ignore some found files, when - ## comparing with POTFILES.in - foreach my $ignore ("POTFILES.skip", "POTFILES.ignore") { - if (-s $ignore) { - open FILE, $ignore; - while (<FILE>) { - if (/^[^#]/){ - push @buf_potfiles_ignore, $_; - } - } - print "Found $ignore: Ignoring files...\n" if $VERBOSE; - @buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles); - } - } - - foreach my $file (@buf_i18n_plain) - { - my $in_comment = 0; - my $in_macro = 0; - - open FILE, "<$file"; - while (<FILE>) - { - # Handle continued multi-line comment. - if ($in_comment) - { - next unless s-.*\*/--; - $in_comment = 0; - } - - # Handle continued macro. - if ($in_macro) - { - $in_macro = 0 unless /\\$/; - next; - } - - # Handle start of macro (or any preprocessor directive). - if (/^\s*\#/) - { - $in_macro = 1 if /^([^\\]|\\.)*\\$/; - next; - } - - # Handle comments and quoted text. - while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy - { - my $match = $1; - if ($match eq "/*") - { - if (!s-/\*.*?\*/--) - { - s-/\*.*--; - $in_comment = 1; - } - } - elsif ($match eq "//") - { - s-//.*--; - } - else # ' or " - { - if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) - { - warn "mismatched quotes at line $. in $file\n"; - s-$match.*--; - } - } - } - - - if (/_\(QUOTEDTEXT/) - { - ## Remove the first 3 chars and add newline - push @buf_allfiles, unpack("x3 A*", $file) . "\n"; - last; - } - } - close FILE; - } - - foreach my $file (@buf_i18n_xml) { - open FILE, "<$file"; - while (<FILE>) { - if (/\s_(.*)=\"/ || /translatable=\"yes\"/){ - push @buf_allfiles, unpack("x3 A*", $file) . "\n"; - last; - } - } - } - - foreach my $file (@buf_i18n_ini){ - open FILE, "<$file"; - while (<FILE>) { - if (/_(.*)=/){ - push @buf_allfiles, unpack("x3 A*", $file) . "\n"; - last; - } - } - } - - foreach my $file (@buf_i18n_xml_unmarked){ - push @buf_allfiles, unpack("x3 A*", $file) . "\n"; - } - - - @buf_allfiles_sorted = sort (@buf_allfiles); - @buf_potfiles_sorted = sort (@buf_potfiles); - - my %in2; - foreach (@buf_potfiles_sorted) { - $in2{$_} = 1; - } - - my @result; - - foreach (@buf_allfiles_sorted){ - if (!exists($in2{$_})){ - push @result, $_ - } - } - - ## Save file with information about the files missing - ## if any, and give information about this procedure. - if (@result) { - print "\n" if $VERBOSE; - open OUT, ">missing"; - print OUT @result; - print "The following files contain translations and are currently not in use. Please\n"; - print "consider adding these to the POTFILES.in file, located in the po/ directory.\n\n"; - print @result, "\n"; - print "If some of these files are left out on purpose then please add them to\n"; - print "POTFILES.skip instead of POTFILES.in. A file 'missing' containing this list\n"; - print "of left out files has been written in the current directory.\n"; - } - - ## If there is nothing to complain about, notify the user - else { - print "\nAll files containing translations are present in POTFILES.in.\n"; - } -} - -sub print_error_invalid_option -{ - ## Handle invalid arguments - print "Try `${PROGRAM} --help' for more information.\n"; - exit 1; -} - -sub generate_headers -{ - my $EXTRACT = `which intltool-extract 2>/dev/null`; - chomp $EXTRACT; - - $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"}; - - ## Generate the .h header files, so we can allow glade and - ## xml translation support - if (! -s $EXTRACT) - { - print "\n *** The intltool-extract script wasn't found!" - ."\n *** Without it, intltool-update can not generate files.\n"; - exit; - } - else - { - open FILE, "<POTFILES.in"; - while (<FILE>) { - chomp; - - ## Find xml files in POTFILES.in and generate the - ## files with help from the extract script - - my $gettext_type= &determine_type ($1); - - if (/\.($xml_extension|$ini_extension)$/ || /^\[/){ - $_ =~ s/^\[[^\[].*]\s*//; - my $filename = "../$_"; - - if ($VERBOSE){ - system($EXTRACT, "--update", "--type=$gettext_type", $filename); - } else { - system($EXTRACT, "--update", "--type=$gettext_type", "--quiet", $filename); - } - } - } - close FILE; - } -} - -sub generate_po_template -{ - ## Generate the potfiles from the POTFILES.in file - - print "Building the $MODULE.pot...\n" if $VERBOSE; - - move ("POTFILES.in", "POTFILES.in.old"); - - open INFILE, "<POTFILES.in.old"; - open OUTFILE, ">POTFILES.in"; - while (<INFILE>) { - chomp; - if (/\.($xml_extension|$ini_extension)$/ || /^\[/) { - s/^\[.*]\s*//; - print OUTFILE "$_.h\n"; - } else { - print OUTFILE "$_\n"; - } - } - close OUTFILE; - close INFILE; - - system ("xgettext", "--default-domain\=$MODULE", - "--directory\=\.\.", - "--add-comments", - "--keyword\=\_", - "--keyword\=N\_", - "--keyword\=U\_", - "--files-from\=\.\/POTFILES\.in"); - - move ("POTFILES.in.old", "POTFILES.in"); - - print "Removing generated header (.h) files..." if $VERBOSE; - - open FILE, "<POTFILES.in"; - - while (<FILE>) - { - chomp; - unlink "../$_.h" if /\.($xml_extension|$ini_extension)$/; - } - - close FILE; - print "done\n" if $VERBOSE; - - if (!-e "$MODULE.po") { - print "WARNING: It seems that none of the files in POTFILES.in ". - "contain marked strings\n"; - exit (1); - } - - system ("rm", "-f", "$MODULE.pot"); - move ("$MODULE.po", "$MODULE.pot") or die "$PROGRAM: couldn't move $MODULE.po to $MODULE.pot.\n"; - - print "Wrote $MODULE.pot\n" if $VERBOSE; -} - -sub update_po_file -{ - my ($lang) = @_; - - print "Merging $lang.po with $MODULE.pot..." if $VERBOSE; - - copy ("$lang.po", "$lang.po.old") || die "copy failed: $!"; - - # Perform merge, remove backup file and the "messages" trash file - # generated by gettext - system ("msgmerge", "$lang.po.old", "$MODULE.pot", "-o", "$lang.po"); - unlink "$lang.po.old"; - unlink "messages"; -} - -sub print_error_not_existing -{ - my ($file) = @_; - - ## Report error if supplied language file is non-existing - print "$PROGRAM: $file does not exist!\n"; - print "Try '$PROGRAM --help' for more information.\n"; - exit; -} - -sub gather_po_files -{ - my @po_files = glob ("./*.po"); - - @languages = map (&po_file2lang, @po_files); - - foreach my $lang (@languages) { - $po_files_by_lang{$lang} = shift (@po_files); - } -} - -sub po_file2lang ($) -{ - my $tmp = $_; - $tmp =~ s/^.*\/(.*)\.po$/$1/; - return $tmp; -} - -sub print_status -{ - my ($lang) = @_; - - system ("msgfmt", "--statistics", "$lang.po"); - print "\n"; -} - -sub print_report -{ - &generate_headers; - &generate_po_template; - &gather_po_files; - - foreach my $lang (@languages) { - print "$lang: "; - &update_po_file ($lang); - } - - print "\n\n * Current translation support in $MODULE \n\n"; - - foreach my $lang (@languages){ - print "$lang: "; - system ("msgfmt", "--statistics", "$lang.po"); - } -} - -sub find_package_name -{ - my $base_dirname = getcwd(); - $base_dirname =~ s@.*/@@; - - my ($conf_in, $src_dir); - - if ($base_dirname =~ /^po(-.+)?$/) { - if (-f "../configure.in") { - $conf_in = "../configure.in"; - } elsif (-f "../configure.ac") { - $conf_in = "../configure.ac"; - } else { - my $makefile_source; - local (*IN); - open IN, "<Makefile" || die "can't open Makefile: $!"; - - while (<IN>) { - if (/^top_srcdir[ \t]*=/) { - $src_dir = $_; - # print "${src_dir}\n"; - - $src_dir =~ s/^top_srcdir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; - # print "${src_dir}\n"; - chomp $src_dir; - $conf_in = "$src_dir" . "/configure.in" . "\n"; - last; - } - } - $conf_in || die "Cannot find top_srcdir in Makefile." - } - - my %varhash = (); - my $conf_source; { - local (*IN); - open (IN, "<$conf_in") || die "can't open $conf_in: $!"; - while (<IN>) { - if (/^(\w+)=(\S+)/) { $varhash{$1} = $2 }; - } - seek (IN, 0, 0); - local $/; # slurp mode - $conf_source = <IN>; - } - - my $name = ""; - $name = $1 if $conf_source =~ /^AM_INIT_AUTOMAKE\([\s\[]*([^,\)\s\]]+)/m; - if ($conf_source =~ /^AC_INIT\([\s\[]*([^,\)\s\]]+)\]?\s*,/m) { - $name = $1; - $varhash{"AC_PACKAGE_NAME"} = $1; - } - $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=\[?([^\s\]]+)/m; - - $name = "\$AC_PACKAGE_NAME" if "$name" eq "AC_PACKAGE_NAME"; - - my $oldname = ""; - while (($name =~ /[\$](\S+)/) && ("$oldname" ne "$name")) { - $oldname = $name; - if (exists $varhash{$1}) { - $name =~ s/[\$](\S+)/$varhash{$1}/; - } - } - return $name if $name; - } - - print "$PROGRAM: Unable to determine package name.\n" . - "Make sure to run this script inside the po directory.\n"; - exit; -} diff --git a/bonobo/local-build.sh b/bonobo/local-build.sh deleted file mode 100755 index e40e2b2e3..000000000 --- a/bonobo/local-build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -TAG='OOO_1_1_0' -CWD=`pwd`; -./autogen.sh --with-ooo-solver-dir=$CWD/../build/$TAG/solver/645/unxlngi4.pro --with-ooo-install-dir=/usr/lib/ooo-1.1.0 --prefix=/usr --sysconfdir=/etc -make diff --git a/bonobo/po/.cvsignore b/bonobo/po/.cvsignore deleted file mode 100644 index 86f8fefa2..000000000 --- a/bonobo/po/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -Makefile.in.in -POTFILES -*.gmo -ooo-bonobo.pot diff --git a/bonobo/po/POTFILES.in b/bonobo/po/POTFILES.in deleted file mode 100644 index ac7b48fe9..000000000 --- a/bonobo/po/POTFILES.in +++ /dev/null @@ -1,3 +0,0 @@ -src/main.cxx -data/GNOME_OpenOfficeOrg.server.in.in -data/ooo-bonobo-control-ui.xml diff --git a/bonobo/po/de.po b/bonobo/po/de.po deleted file mode 100644 index 3f51d9def..000000000 --- a/bonobo/po/de.po +++ /dev/null @@ -1,162 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-10-28 18:08+0000\n" -"PO-Revision-Date: 2003-10-06 13:12+0200\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Report-Msgid-Bugs-To: \n" - -#. extern "C" -#: data/GNOME_OpenOfficeOrg.server.in.in.h:1 -msgid "OpenOffice.org Document" -msgstr "OpenOffice.org-Dokument" - -#: data/GNOME_OpenOfficeOrg.server.in.in.h:2 -msgid "OpenOffice.org Viewer" -msgstr "OpenOffice.org-Ansicht" - -#: data/GNOME_OpenOfficeOrg.server.in.in.h:3 -msgid "OpenOffice.org viewer factory" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:1 -msgid "Best Fit" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:2 -msgid "Best _Fit" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:3 -msgid "Copy" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:4 -msgid "Copy the selection" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:5 -msgid "E_xport..." -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:6 -msgid "Expand to a larger size" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:7 -msgid "Export" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:8 -msgid "Export as PDF" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:9 -msgid "Export as _PDF..." -msgstr "Als _PDF exportieren..." - -#: data/ooo-bonobo-control-ui.xml.h:10 -msgid "Export the current file as PDF file" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:11 -msgid "Normal Si_ze" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:12 -msgid "Normal Size" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:13 -msgid "Print" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:14 -msgid "Print the current file" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:15 -msgid "Proper_ties" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:16 -msgid "Properties" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:17 -msgid "Save _as..." -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:18 -msgid "Save as" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:19 -msgid "Save the current file in a different format" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:20 -msgid "Save the current file with a different name" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:21 -msgid "Show the contents at the normal size" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:22 -msgid "Shrink to a smaller size" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:23 -msgid "Size to fit the page" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:24 -msgid "View properties of the displayed document" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:25 -msgid "Zoom In" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:26 -msgid "Zoom Out" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:27 -msgid "Zoom _In" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:28 -msgid "Zoom _Out" -msgstr "" - -#: data/ooo-bonobo-control-ui.xml.h:29 -msgid "_Copy" -msgstr "_Kopieren" - -#: data/ooo-bonobo-control-ui.xml.h:30 -msgid "_Edit" -msgstr "_Bearbeiten" - -#: data/ooo-bonobo-control-ui.xml.h:31 -msgid "_File" -msgstr "_Datei" - -#: data/ooo-bonobo-control-ui.xml.h:32 -msgid "_Print..." -msgstr "_Drucken..." - -#: data/ooo-bonobo-control-ui.xml.h:33 -msgid "_View" -msgstr "_Ansicht" diff --git a/bonobo/src/.cvsignore b/bonobo/src/.cvsignore deleted file mode 100644 index d9e292d10..000000000 --- a/bonobo/src/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -Makefile.in -ooo-bonobo -ooo-bonobo.bin -test diff --git a/bonobo/src/Makefile.am b/bonobo/src/Makefile.am deleted file mode 100644 index 418a9a611..000000000 --- a/bonobo/src/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -INCLUDES = \ - -DINIFILE=\"$(datadir)/ooo-bonobo/ooo-bonobo-uno-bootstraprc\" \ - -DDATADIR=\""$(datadir)"\" \ - -DRDBFILE=\""$(libdir)/ooo-bonobo/ooo-bonobo.rdb"\" \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(OOO_BONOBO_CFLAGS) - -LDADD = \ - $(OOO_BONOBO_LIBS) - -libexec_PROGRAMS = ooo-bonobo.bin - -noinst_PROGRAMS = test - -test_SOURCES = \ - remote-uno-helper.cxx \ - remote-uno-helper.h \ - star-frame-widget.cxx \ - star-frame-widget.h \ - test.cxx - -ooo_bonobo_bin_SOURCES = \ - ooo-bonobo-control.cxx \ - ooo-bonobo-control.h \ - remote-uno-helper.cxx \ - remote-uno-helper.h \ - services.h \ - star-frame-widget.cxx \ - star-frame-widget.h \ - string-macros.h \ - main.cxx diff --git a/bonobo/src/main.cxx b/bonobo/src/main.cxx deleted file mode 100644 index 4bd25ea63..000000000 --- a/bonobo/src/main.cxx +++ /dev/null @@ -1,62 +0,0 @@ -#include <string.h> -#include <gtk/gtk.h> -#include <libbonoboui.h> - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> -#include <com/sun/star/document/XTypeDetection.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> - -#include "ooo-bonobo-control.h" -#include "remote-uno-helper.h" -#include "services.h" -#include "string-macros.h" -#include "star-frame-widget.h" - -#define OAFIID "OAFIID:GNOME_OpenOfficeOrg_Control" - -using namespace com::sun::star; -using namespace com::sun::star::beans; - -using rtl::OUString; -using com::sun::star::uno::Reference; - -extern "C" { - -static BonoboObject * -factory( BonoboGenericFactory *factory, - const char *component_id, - gpointer data ) -{ - if( !strcmp( component_id, OAFIID ) ) - { - Reference< uno::XComponentContext > xRemoteContext = getComponentContext(); - g_assert( xRemoteContext.is() ); - - BonoboControl *pControl = - ooo_bonobo_control_new( xRemoteContext ); - - return BONOBO_OBJECT( pControl ); - } - return NULL; -} - -int -main( int argc, char *argv[] ) -{ - bindtextdomain( GETTEXT_PACKAGE, GNOMELOCALEDIR ); - bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" ); - textdomain( GETTEXT_PACKAGE ); - - BONOBO_FACTORY_INIT( "ooo-bonobo", VERSION, &argc, argv ); - return bonobo_generic_factory_main( "OAFIID:GNOME_OpenOfficeOrg_Factory", factory, NULL ); -} - -} // extern "C" diff --git a/bonobo/src/ooo-bonobo-control.cxx b/bonobo/src/ooo-bonobo-control.cxx deleted file mode 100644 index 04040dffb..000000000 --- a/bonobo/src/ooo-bonobo-control.cxx +++ /dev/null @@ -1,498 +0,0 @@ -#include "ooo-bonobo-control.h" - -#include <libbonoboui.h> - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> -#include <com/sun/star/document/XTypeDetection.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/view/DocumentZoomType.hpp> - -#include "services.h" -#include "star-frame-widget.h" - -#define OAFIID "OAFIID:GNOME_OpenOfficeOrg_Control" -// 16% is the minimum for sc, sw crashes at <5%, sd can go down to 4% -#define MIN_ZOOM 16 -// 500% is the maximum for sc, sw crashes at 1000%+, sd can go to 3600% -#define MAX_ZOOM 500 -#define CLAMP_ZOOM(x) CLAMP(x, MIN_ZOOM, MAX_ZOOM) - -using namespace com::sun::star; -using namespace com::sun::star::beans; - -using rtl::OUString; -using com::sun::star::uno::Reference; - -struct _OOoBonoboControlPrivate { - GtkWidget *hbox; - StarFrameWidget *sfw; - BonoboZoomable *zoomable; - - rtl::OUString uri; - gboolean pending_load; -}; - -BONOBO_CLASS_BOILERPLATE( OOoBonoboControl, ooo_bonobo_control, - BonoboControl, BONOBO_TYPE_CONTROL); - -#define URL_SAVEASDOC DECLARE_ASCII( "slot:5502" ) -#define URL_EXPORTDOC DECLARE_ASCII( "slot:5829" ) -#define URL_EXPORTDOCASPDF DECLARE_ASCII( "slot:6673" ) -#define URL_PRINTDOC DECLARE_ASCII( "slot:5504" ) -#define URL_DOCINFO DECLARE_ASCII( "slot:5535" ) -#define URL_COPY DECLARE_ASCII( "slot:5711" ) - -static void -zoomable_report_zoom_level_changed( BonoboZoomable *zoomable, - Reference< XPropertySet > view_properties ) -{ - sal_Int16 zoom; - uno::Any a = view_properties->getPropertyValue( DECLARE_ASCII( "ZoomValue" ) ); - a >>= zoom; - - CORBA_float zoom_level = zoom / 100.0; - bonobo_zoomable_report_zoom_level_changed( zoomable, zoom_level, NULL ); -} - -static void -zoomable_set_zoom_level_cb (BonoboZoomable *zoomable, - CORBA_float new_zoom_level, - OOoBonoboControl *user_data) -{ - g_return_if_fail (IS_OOO_BONOBO_CONTROL (user_data)); - - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - Reference< XPropertySet > view_properties( - star_frame_widget_get_view_properties( control->priv->sfw ) ); - - if( !view_properties.is() ) - return; - - view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomType" ), - uno::makeAny( (sal_Int16) view::DocumentZoomType::BY_VALUE )); - view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomValue" ), - uno::makeAny( (sal_Int16) ( CLAMP_ZOOM( new_zoom_level * 100 ) ) ) ); - - zoomable_report_zoom_level_changed( zoomable, view_properties ); -} - -static void -zoom_in_cb (GtkObject *source, gpointer user_data) -{ - g_return_if_fail (IS_OOO_BONOBO_CONTROL (user_data)); - - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - Reference< XPropertySet > view_properties( - star_frame_widget_get_view_properties( control->priv->sfw ) ); - - if( !view_properties.is() ) - return; - - uno::Any a = view_properties->getPropertyValue( DECLARE_ASCII( "ZoomValue" ) ); - sal_Int16 view_zoom; - a >>= view_zoom; - - view_zoom = ( sal_Int16 )( view_zoom * 1.2 ); - view_zoom = CLAMP_ZOOM( view_zoom ); - - view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomType" ), - uno::makeAny( (sal_Int16) view::DocumentZoomType::BY_VALUE )); - view_properties->setPropertyValue( DECLARE_ASCII( "ZoomValue" ), - uno::makeAny( view_zoom ) ); - - zoomable_report_zoom_level_changed( control->priv->zoomable, - view_properties ); -} - -static void -zoom_out_cb (GtkObject *source, gpointer user_data) -{ - g_return_if_fail (IS_OOO_BONOBO_CONTROL (user_data)); - - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - Reference< XPropertySet > view_properties( - star_frame_widget_get_view_properties( control->priv->sfw ) ); - - if( !view_properties.is() ) - return; - - uno::Any a = view_properties->getPropertyValue( DECLARE_ASCII( "ZoomValue" ) ); - sal_Int16 view_zoom; - a >>= view_zoom; - - view_zoom = ( sal_Int16 )( view_zoom / 1.2 ); - view_zoom = CLAMP_ZOOM( view_zoom ); - - view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomType" ), - uno::makeAny( (sal_Int16) view::DocumentZoomType::BY_VALUE )); - view_properties->setPropertyValue( DECLARE_ASCII( "ZoomValue" ), - uno::makeAny( view_zoom ) ); - - zoomable_report_zoom_level_changed( control->priv->zoomable, - view_properties ); -} - -static void -zoom_to_fit_cb (GtkObject *source, gpointer user_data) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - star_frame_widget_zoom_page_width( control->priv->sfw ); - - zoomable_report_zoom_level_changed( - control->priv->zoomable, - star_frame_widget_get_view_properties( control->priv->sfw ) ); -} - -static void -zoom_to_default_cb (GtkObject *source, gpointer user_data) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - star_frame_widget_zoom_100( control->priv->sfw ); - - zoomable_report_zoom_level_changed( - control->priv->zoomable, - star_frame_widget_get_view_properties( control->priv->sfw ) ); -} - -static void -verb_FileSaveAs_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - util::URL url; - url.Complete = URL_SAVEASDOC; - - star_frame_widget_dispatch_slot_url( control->priv->sfw, url, - uno::Sequence< PropertyValue >(0) ); -} - -static void -verb_FileExport_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - util::URL url; - url.Complete = URL_EXPORTDOC; - - star_frame_widget_dispatch_slot_url( control->priv->sfw, url, - uno::Sequence< PropertyValue >(0) ); -} - -static void -verb_FileExportPDF_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - util::URL url; - url.Complete = URL_EXPORTDOCASPDF; - - star_frame_widget_dispatch_slot_url( control->priv->sfw, url, - uno::Sequence< PropertyValue >(0) ); -} - -static void -verb_FilePrint_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - util::URL url; - url.Complete = URL_PRINTDOC; - - star_frame_widget_dispatch_slot_url( control->priv->sfw, url, - uno::Sequence< PropertyValue >(0) ); -} - -static void -verb_FileProperties_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - util::URL url; - url.Complete = URL_DOCINFO; - - star_frame_widget_dispatch_slot_url( control->priv->sfw, url, - uno::Sequence< PropertyValue >(0) ); -} - - -// FIXME make insensitive when selection is empty -static void -verb_EditCopy_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - util::URL url; - url.Complete = URL_COPY; - - star_frame_widget_dispatch_slot_url( control->priv->sfw, url, - uno::Sequence< PropertyValue >(0) ); -} - -static void -verb_ZoomIn_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - zoom_in_cb( NULL, user_data ); -} - -static void -verb_ZoomOut_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - zoom_out_cb( NULL, user_data ); -} - -static void -verb_ZoomNormal_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - zoom_to_default_cb( NULL, user_data ); -} - -static void -verb_ZoomFit_cb( BonoboUIComponent *uic, gpointer user_data, const char *cname) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - star_frame_widget_zoom_page_width( control->priv->sfw ); -} - -static void -FrameLoadFileFromUrl( Reference< frame::XFrame > xFrame, - Reference< lang::XMultiServiceFactory > xSMgr, - OUString sUrl ) -{ - Reference< document::XTypeDetection > xTypeDetection( - xSMgr->createInstance( SERVICENAME_TYPEDETECTION ), uno::UNO_QUERY ); - g_assert( xTypeDetection.is() ); - - OUString sTypeName( xTypeDetection->queryTypeByURL( sUrl ) ); - - Reference< lang::XMultiServiceFactory > xFrameLoaderFactory( - xSMgr->createInstance( SERVICENAME_FRAMELOADERFACTORY ), - uno::UNO_QUERY ); - - Reference< frame::XSynchronousFrameLoader > xFrameLoader( - xFrameLoaderFactory->createInstance( sTypeName ), - uno::UNO_QUERY ); - g_assert( xFrameLoader.is() ); - - uno::Sequence< PropertyValue > aProperties( 3 ); - - aProperties[ 0 ] = PropertyValue( DECLARE_ASCII( "FileName" ), - 0, - uno::makeAny( sUrl ), - PropertyState_DIRECT_VALUE ); - - aProperties[ 1 ] = PropertyValue( DECLARE_ASCII( "TypeName" ), - 0, - uno::makeAny( sTypeName ), - PropertyState_DIRECT_VALUE ); - - aProperties[ 2 ] = PropertyValue( DECLARE_ASCII( "ReadOnly" ), - 0, - uno::makeAny( sal_True ), - PropertyState_DIRECT_VALUE ); - - xFrameLoader->load( aProperties, xFrame ); -} - -static int -load_uri( BonoboPersistFile *pf, const CORBA_char *text_uri, - CORBA_Environment *ev, gpointer user_data ) -{ - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - control->priv->uri = - DECLARE_ASCII( "file://" ) + B2U( rtl::OString( text_uri ) ); - if( GTK_WIDGET_REALIZED( control->priv->sfw ) ) { - // FIXME implement - FrameLoadFileFromUrl( - star_frame_widget_get_frame( control->priv->sfw ), - control->priv->sfw->service_manager, - control->priv->uri ); - control->priv->pending_load = FALSE; - } else { - control->priv->pending_load = TRUE; - } -} - -static void -frame_widget_realize( GtkWidget *widget, gpointer user_data ) -{ - StarFrameWidget *pSocket = STAR_FRAME_WIDGET( widget ); - OOoBonoboControl *control = OOO_BONOBO_CONTROL( user_data ); - - Reference< frame::XFrame > xFrame( - star_frame_widget_get_frame( STAR_FRAME_WIDGET( pSocket ) ) ); - g_assert( xFrame.is() ); - - if( control->priv->pending_load ) { - FrameLoadFileFromUrl( xFrame, pSocket->service_manager, control->priv->uri ); - - // change to full screen mode (the frame) - star_frame_widget_set_fullscreen( pSocket, sal_True ); - control->priv->pending_load = FALSE; - } -} - -static BonoboUIVerb verbs[] = { - BONOBO_UI_VERB( "FileSaveAs", verb_FileSaveAs_cb ), - BONOBO_UI_VERB( "FileExport", verb_FileExport_cb ), - BONOBO_UI_VERB( "FileExportPDF", verb_FileExportPDF_cb ), - BONOBO_UI_VERB( "FilePrint", verb_FilePrint_cb ), - BONOBO_UI_VERB( "FileProperties", verb_FileProperties_cb ), - - BONOBO_UI_VERB( "EditCopy", verb_EditCopy_cb ), - - BONOBO_UI_VERB( "ZoomIn", verb_ZoomIn_cb ), - BONOBO_UI_VERB( "ZoomOut", verb_ZoomOut_cb ), - BONOBO_UI_VERB( "ZoomNormal", verb_ZoomNormal_cb ), - BONOBO_UI_VERB( "ZoomFit", verb_ZoomFit_cb ), - - BONOBO_UI_VERB_END -}; - -static void -ooo_bonobo_control_activate( BonoboControl *control, gboolean activate ) -{ - gtk_widget_show( GTK_WIDGET( OOO_BONOBO_CONTROL( control )->priv->sfw ) ); - - BonoboUIComponent *ui_component = bonobo_control_get_ui_component( control ); - if( activate ) { - Bonobo_UIContainer ui_container = - bonobo_control_get_remote_ui_container( control, NULL ); - - if( ui_container != CORBA_OBJECT_NIL ) { - bonobo_ui_component_set_container( ui_component, ui_container, NULL ); - bonobo_ui_component_add_verb_list_with_data( - ui_component, verbs, control ); - bonobo_ui_util_set_ui( ui_component, DATADIR, - "ooo-bonobo-control-ui.xml", - "ooo-bonobo", NULL ); - } - } else { - bonobo_ui_component_unset_container( ui_component, NULL ); - } - - BONOBO_CALL_PARENT( BONOBO_CONTROL_CLASS, activate, ( control, activate ) ); -} - -static void -ooo_bonobo_control_finalize( GObject *object ) -{ - delete OOO_BONOBO_CONTROL( object )->priv; - BONOBO_CALL_PARENT( G_OBJECT_CLASS, finalize, ( object ) ); -} - -static void -ooo_bonobo_control_instance_init( OOoBonoboControl *control ) -{ - control->priv = new OOoBonoboControlPrivate; -} - -static void -ooo_bonobo_control_class_init( OOoBonoboControlClass *klass ) -{ - GObjectClass *object_class = G_OBJECT_CLASS( klass ); - - object_class->finalize = ooo_bonobo_control_finalize; - - BonoboControlClass *control_class = BONOBO_CONTROL_CLASS( klass ); - - control_class->activate = ooo_bonobo_control_activate; -} - -#define MAGSTEP 1.2 -#define MAGSTEP2 MAGSTEP * MAGSTEP -#define MAGSTEP4 MAGSTEP2 * MAGSTEP2 -#define IMAGSTEP 0.8333333333 -#define IMAGSTEP2 IMAGSTEP * IMAGSTEP -#define IMAGSTEP4 IMAGSTEP2 * IMAGSTEP2 - -static float preferred_zoom_levels [] = { - IMAGSTEP4 * IMAGSTEP4, IMAGSTEP4 * IMAGSTEP2 * IMAGSTEP, - IMAGSTEP4 * IMAGSTEP2, IMAGSTEP4 * IMAGSTEP, IMAGSTEP4, - IMAGSTEP2 * IMAGSTEP, IMAGSTEP2, IMAGSTEP, - 1.0, - MAGSTEP, MAGSTEP2, MAGSTEP2 * MAGSTEP, MAGSTEP4, - MAGSTEP4 * MAGSTEP, MAGSTEP4 * MAGSTEP2, MAGSTEP4 * MAGSTEP2 * MAGSTEP, - MAGSTEP4 * MAGSTEP4 -}; - -static const int n_zoom_levels = G_N_ELEMENTS( preferred_zoom_levels ); - -BonoboControl * -ooo_bonobo_control_new( Reference< XComponentContext > component_context ) -{ - g_return_val_if_fail( component_context.is(), NULL ); - - OOoBonoboControl *control = - OOO_BONOBO_CONTROL( g_object_new( TYPE_OOO_BONOBO_CONTROL, NULL ) ); - - control->priv->hbox = gtk_hbox_new( FALSE, 0 ); - control->priv->sfw = - STAR_FRAME_WIDGET( star_frame_widget_new( component_context ) ); - g_signal_connect( control->priv->sfw, "realize", - G_CALLBACK( frame_widget_realize ), control ); - - gtk_box_pack_start( GTK_BOX( control->priv->hbox ), - GTK_WIDGET( control->priv->sfw ), TRUE, TRUE, 0 ); - - gtk_widget_show( control->priv->hbox ); - - BonoboPersistFile *persist_file = - bonobo_persist_file_new( load_uri, NULL, OAFIID, control ); - - BonoboZoomable *zoomable = bonobo_zoomable_new(); - control->priv->zoomable = zoomable; - - g_signal_connect (G_OBJECT (zoomable), "set_zoom_level", - G_CALLBACK (zoomable_set_zoom_level_cb), - control); - g_signal_connect (G_OBJECT (zoomable), "zoom_in", - G_CALLBACK (zoom_in_cb), - control); - g_signal_connect (G_OBJECT (zoomable), "zoom_out", - G_CALLBACK (zoom_out_cb), - control); - g_signal_connect (G_OBJECT (zoomable), "zoom_to_fit", - G_CALLBACK (zoom_to_fit_cb), - control); - g_signal_connect (G_OBJECT (zoomable), "zoom_to_default", - G_CALLBACK (zoom_to_default_cb), - control); - - bonobo_zoomable_set_parameters_full ( - control->priv->zoomable, - 1.0, - preferred_zoom_levels [0], - preferred_zoom_levels [n_zoom_levels - 1], - TRUE, TRUE, TRUE, - preferred_zoom_levels, - NULL, - n_zoom_levels); - - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (zoomable)); - - bonobo_object_add_interface( BONOBO_OBJECT( control ), - BONOBO_OBJECT( persist_file ) ); - - return bonobo_control_construct( BONOBO_CONTROL( control ), - control->priv->hbox ); -} diff --git a/bonobo/src/ooo-bonobo-control.h b/bonobo/src/ooo-bonobo-control.h deleted file mode 100644 index ad9f513a4..000000000 --- a/bonobo/src/ooo-bonobo-control.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef OOO_BONOBO_CONTROL_H -#define OOO_BONOBO_CONTROL_H - -#include <bonobo/bonobo-control.h> - -#include <rtl/ustring.hxx> - -#include <com/sun/star/uno/XComponentContext.hpp> - -#define TYPE_OOO_BONOBO_CONTROL (ooo_bonobo_control_get_type ()) -#define OOO_BONOBO_CONTROL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_OOO_BONOBO_CONTROL, OOoBonoboControl)) -#define OOO_BONOBO_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_OOO_BONOBO_CONTROL, OOoBonoboControlClass)) -#define IS_OOO_BONOBO_CONTROL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_OOO_BONOBO_CONTROL)) -#define IS_OOO_BONOBO_CONTROL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_OOO_BONOBO_CONTROL)) - -typedef struct _OOoBonoboControl OOoBonoboControl; -typedef struct _OOoBonoboControlClass OOoBonoboControlClass; -typedef struct _OOoBonoboControlPrivate OOoBonoboControlPrivate; - -struct _OOoBonoboControl { - BonoboControl parent; - - OOoBonoboControlPrivate *priv; -}; - -struct _OOoBonoboControlClass { - BonoboControlClass parent_class; -}; - -GType ooo_bonobo_control_get_type (); -BonoboControl *ooo_bonobo_control_new ( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > component_context ); - -#endif // OOO_BONOBO_CONTROL_H diff --git a/bonobo/src/remote-uno-helper.cxx b/bonobo/src/remote-uno-helper.cxx deleted file mode 100644 index 39b62873f..000000000 --- a/bonobo/src/remote-uno-helper.cxx +++ /dev/null @@ -1,126 +0,0 @@ -#include "remote-uno-helper.h" - -#include <unistd.h> - -#include <glib.h> - -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/bridge/XUnoUrlResolver.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> - -#include "services.h" - -#define UNO_BOOTSTRAP_INI DECLARE_ASCII( "file://" INIFILE ) - -using namespace com::sun::star; -using namespace com::sun::star::bridge; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; - -using rtl::OUString; - -static OUString -getPipeName() -{ - return - OUString::createFromAscii( g_get_user_name() ) + - DECLARE_ASCII( "_ooo_bonobo" ); -} - -static Reference< XComponentContext > -getRemoteComponentContext( const Reference< XComponentContext >& xComponentContext ) -{ - Reference< XMultiComponentFactory > xLocalSMgr( - xComponentContext->getServiceManager() ); - - Reference< XUnoUrlResolver > xUnoUrlResolver( - xLocalSMgr->createInstanceWithContext( SERVICENAME_UNOURLRESOLVER, - xComponentContext ), - UNO_QUERY ); - - Reference< XInterface > xInterface; - OUString sConnect( DECLARE_ASCII( "uno:pipe,name=" ) + - getPipeName() + - DECLARE_ASCII( ";urp;StarOffice.ComponentContext" ) ); - try { - xInterface = xUnoUrlResolver->resolve( sConnect ); - } catch( uno::Exception ) { - g_message( "Trying to start OOo" ); - - gchar *pArgv[5]; - - pArgv[ 0 ] = "ooffice"; - pArgv[ 1 ] = g_strconcat( "-accept=pipe,name=", - U2B( getPipeName() ).pData->buffer, - ";urp;StarOffice.ComponentContext", - NULL ); - pArgv[ 2 ] = "-bean"; - pArgv[ 3 ] = "-norestore"; - pArgv[ 4 ] = NULL; - - gboolean result = g_spawn_async( NULL, // Working directory - pArgv, // Child's argv - NULL, // Child's envp - G_SPAWN_SEARCH_PATH, - NULL, // Child setup function - NULL, // User data for child_setup - NULL, // &child_pid - NULL); // GError ** FIXME - - g_free( pArgv[ 1 ] ); - - if( !result ) { - g_warning( "Unable to start OpenOffice.org" ); - exit(1); - } - - for( int counter = 0; counter < 30; ++counter ) { - try { - g_message( "Trying to connect to OOo (%d)", counter + 2 ); - xInterface = xUnoUrlResolver->resolve( sConnect ); - break; - } catch( uno::Exception ) { - sleep( 1 ); - } - } - } - - if( !xInterface.is() ) { - g_warning( "Unable to connect to OpenOffice.org" ); - exit( 2 ); - } - - Reference< XComponentContext > xRemoteComponentContext( - xInterface, UNO_QUERY ); - - return xRemoteComponentContext; -} - -::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > -getComponentContext() -{ - if( !g_file_test( INIFILE, G_FILE_TEST_EXISTS ) ) - g_error( "Without '%s' installed nothing will work", INIFILE ); - - if( !g_file_test( RDBFILE, G_FILE_TEST_EXISTS ) ) - g_error( "Without '%s' installed nothing will work", RDBFILE ); - - Reference< uno::XComponentContext > xComponentContext; - try { - xComponentContext = - ::cppu::defaultBootstrap_InitialComponentContext( UNO_BOOTSTRAP_INI ); - } catch( registry::InvalidRegistryException &ire ) { - g_error( "InvalidRegistryException." - " %s is invalid or %s doesn't contain the correct path.", - RDBFILE, INIFILE ); - } - - g_assert( xComponentContext.is() ); - - - Reference< lang::XMultiComponentFactory > xMultiComponentFactoryClient( - xComponentContext->getServiceManager() ); - g_assert( xMultiComponentFactoryClient.is() ); - - return getRemoteComponentContext( xComponentContext ); -} diff --git a/bonobo/src/remote-uno-helper.h b/bonobo/src/remote-uno-helper.h deleted file mode 100644 index 28ac4367a..000000000 --- a/bonobo/src/remote-uno-helper.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef REMOTE_UNO_HELPER_H -#define REMOTE_UNO_HELPER_H - -#include <com/sun/star/uno/XComponentContext.hpp> - -::com::sun::star::uno::Reference< - ::com::sun::star::uno::XComponentContext > getComponentContext(); - -#endif diff --git a/bonobo/src/services.h b/bonobo/src/services.h deleted file mode 100644 index bad677a23..000000000 --- a/bonobo/src/services.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef SERVICES_H -#define SERVICES_H - -#include "string-macros.h" - -#define SERVICENAME_FRAME \ - DECLARE_ASCII("com.sun.star.frame.Frame" ) -#define SERVICENAME_DESKTOP \ - DECLARE_ASCII("com.sun.star.frame.Desktop" ) -#define SERVICENAME_FRAMELOADERFACTORY \ - DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" ) -#define SERVICENAME_TYPEDETECTION \ - DECLARE_ASCII("com.sun.star.document.TypeDetection" ) -#define SERVICENAME_UNOURLRESOLVER \ - DECLARE_ASCII("com.sun.star.bridge.UnoUrlResolver" ) -#define SERVICENAME_URLTRANSFORMER \ - DECLARE_ASCII("com.sun.star.util.URLTransformer" ) -#define SERVICENAME_VCLTOOLKIT \ - DECLARE_ASCII("com.sun.star.awt.Toolkit" ) - -#endif /* SERVICES_H */ diff --git a/bonobo/src/star-frame-widget.cxx b/bonobo/src/star-frame-widget.cxx deleted file mode 100644 index 4f33897a8..000000000 --- a/bonobo/src/star-frame-widget.cxx +++ /dev/null @@ -1,256 +0,0 @@ -#include <stdio.h> -#include "star-frame-widget.h" - -#include <libgnome/gnome-macros.h> - -#include <com/sun/star/awt/XToolkit.hpp> -#include <com/sun/star/awt/XSystemChildFactory.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/lang/SystemDependent.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/view/DocumentZoomType.hpp> -#include <com/sun/star/view/XViewSettingsSupplier.hpp> - -#include "services.h" - -using rtl::OUString; -using namespace com::sun::star::awt; -using namespace com::sun::star::beans; -using namespace com::sun::star::frame; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; -using namespace com::sun::star::util; -using namespace com::sun::star::view; - -#define CLASS_BOILERPLATE(type, type_as_function, \ - parent_type, parent_type_macro) \ - BONOBO_BOILERPLATE(type, type_as_function, type, \ - parent_type, parent_type_macro, \ - REGISTER_TYPE) - -#define REGISTER_TYPE(type, type_as_function, corba_type, \ - parent_type, parent_type_macro) \ - g_type_register_static (parent_type_macro, #type, &object_info, \ - (GTypeFlags)0) - - -CLASS_BOILERPLATE( StarFrameWidget, star_frame_widget, - GtkSocket, GTK_TYPE_SOCKET ); - -struct _StarFrameWidgetPrivate { - Reference< XWindowPeer > x_window_peer; - Reference< XFrame > x_frame; - Reference< XPropertySet > view_properties; -}; - -static void -star_frame_widget_create_view_properties( StarFrameWidget *sfw ) -{ - if( !sfw->priv->x_frame.is() ) - return; - - Reference< XViewSettingsSupplier > xViewSettingsSupplier( - sfw->priv->x_frame->getController(), UNO_QUERY ); - if( xViewSettingsSupplier.is() ) - sfw->priv->view_properties = xViewSettingsSupplier->getViewSettings(); - else - sfw->priv->view_properties.set( sfw->priv->x_frame->getController(), - UNO_QUERY ); -} - -Reference< XPropertySet > -star_frame_widget_get_view_properties( StarFrameWidget *sfw ) -{ - if( !sfw->priv->view_properties.is() ) - star_frame_widget_create_view_properties( sfw ); - - return sfw->priv->view_properties; -} - -void -star_frame_widget_zoom_100( StarFrameWidget *sfw ) -{ - if( !sfw->priv->view_properties.is() ) - star_frame_widget_create_view_properties( sfw ); - g_assert( sfw->priv->view_properties.is() ); - - sfw->priv->view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomType" ), - makeAny( ( sal_Int16 ) DocumentZoomType::BY_VALUE ) ); - sfw->priv->view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomValue" ), - makeAny( ( sal_Int16 ) 100 ) ); -} - -void -star_frame_widget_zoom_page_width( StarFrameWidget *sfw ) -{ - if( !sfw->priv->view_properties.is() ) - star_frame_widget_create_view_properties( sfw ); - g_assert( sfw->priv->view_properties.is() ); - - sfw->priv->view_properties->setPropertyValue( - DECLARE_ASCII( "ZoomType" ), - makeAny( ( sal_Int16 ) DocumentZoomType::PAGE_WIDTH ) ); -} - -static void -star_frame_widget_create_window_peer( StarFrameWidget *sfw ) -{ - g_assert( sfw->service_manager.is() ); - - Reference< XSystemChildFactory > xChildFactory( - sfw->service_manager->createInstance( SERVICENAME_VCLTOOLKIT ), - UNO_QUERY ); - g_assert( xChildFactory.is() ); - - sfw->priv->x_window_peer.set( - xChildFactory->createSystemChild( - makeAny( (const sal_Int32) gtk_socket_get_id( GTK_SOCKET( sfw ) ) ), - Sequence< sal_Int8 >(), - SystemDependent::SYSTEM_XWINDOW ) ); - g_assert( sfw->priv->x_window_peer.is() ); -} - -Reference< XFrame > -star_frame_widget_get_frame( StarFrameWidget *sfw ) -{ - return sfw->priv->x_frame; -} - -void -star_frame_widget_dispatch_slot_url( StarFrameWidget *sfw, URL url, - const Sequence< PropertyValue > &properties ) -{ - if( !sfw->priv->x_frame.is() ) - return; - - Reference< XURLTransformer > xURLTransformer( - sfw->service_manager->createInstance( SERVICENAME_URLTRANSFORMER ), - UNO_QUERY ); - - xURLTransformer->parseSmart( url, DECLARE_ASCII( "slot" ) ); - - Reference< XDispatchProvider > xDispProv( sfw->priv->x_frame, UNO_QUERY ); - Reference< XDispatch > xDispatch = - xDispProv->queryDispatch( url, OUString(), 0); - - xDispatch->dispatch( url, properties ); -} - -void -star_frame_widget_set_fullscreen( StarFrameWidget *sfw, sal_Bool fullscreen ) -{ - URL url; - - url.Complete = DECLARE_ASCII( "slot:5627" ); - - Sequence< PropertyValue > properties( 1 ); - properties[ 0 ] = PropertyValue( DECLARE_ASCII( "FullScreen" ), - 0, - makeAny( fullscreen ), - PropertyState_DIRECT_VALUE ); - star_frame_widget_dispatch_slot_url( sfw, url, properties ); -} - -static void -star_frame_widget_create_frame( StarFrameWidget *sfw ) -{ - g_assert( sfw->priv->x_window_peer.is() ); - g_assert( sfw->service_manager.is() ); - - sfw->priv->x_frame.set( - sfw->service_manager->createInstance( SERVICENAME_FRAME ), - UNO_QUERY ); - - sfw->priv->x_frame->setName( OUString::createFromAscii( "A Frame in GTK+" ) ); - - Reference< XWindow > xWindow( sfw->priv->x_window_peer, UNO_QUERY ); - sfw->priv->x_frame->initialize( xWindow ); - - Reference< XFramesSupplier > xTreeRoot( - sfw->service_manager->createInstance( SERVICENAME_DESKTOP ), - UNO_QUERY ); - g_assert( xTreeRoot.is() ); - - Reference< XFrames > xChildContainer = xTreeRoot->getFrames(); - xChildContainer->append( sfw->priv->x_frame ); - - xWindow->setVisible( sal_True ); -} - -static void -star_frame_widget_realize( GtkWidget *widget ) -{ - BONOBO_CALL_PARENT( GTK_WIDGET_CLASS, realize, ( widget ) ); - - StarFrameWidget *sfw = STAR_FRAME_WIDGET( widget ); - - star_frame_widget_create_window_peer( sfw ); - star_frame_widget_create_frame( sfw ); -} - -static void -star_frame_widget_unrealize( GtkWidget *widget ) -{ - star_frame_widget_set_fullscreen( STAR_FRAME_WIDGET( widget ), sal_False ); - - BONOBO_CALL_PARENT( GTK_WIDGET_CLASS, unrealize, ( widget ) ); -} - -static void -star_frame_widget_dispose( GObject *object ) -{ - StarFrameWidget *sfw = STAR_FRAME_WIDGET( object ); - - if( sfw->priv->view_properties.is() ) - sfw->priv->view_properties.clear(); - - if( sfw->priv->x_frame.is() ) - sfw->priv->x_frame.clear(); - - if( sfw->priv->x_window_peer.is() ) - sfw->priv->x_window_peer.clear(); - - if( sfw->service_manager.is() ) - sfw->service_manager.clear(); - - BONOBO_CALL_PARENT( G_OBJECT_CLASS, dispose, ( object ) ); -} - -static void -star_frame_widget_finalize( GObject *object ) -{ - delete STAR_FRAME_WIDGET( object )->priv; - BONOBO_CALL_PARENT( G_OBJECT_CLASS, finalize, ( object ) ); -} - -static void -star_frame_widget_class_init( StarFrameWidgetClass *klass ) -{ - GObjectClass *object_class = G_OBJECT_CLASS( klass ); - - object_class->dispose = star_frame_widget_dispose; - object_class->finalize = star_frame_widget_finalize; - - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS( klass ); - - widget_class->realize = star_frame_widget_realize; - widget_class->unrealize = star_frame_widget_unrealize; -} - -static void -star_frame_widget_instance_init( StarFrameWidget *sfw ) -{ - sfw->priv = new StarFrameWidgetPrivate; -} - -GtkWidget * -star_frame_widget_new ( Reference< XComponentContext > component_context ) -{ - StarFrameWidget *swf = (StarFrameWidget *)g_object_new( TYPE_STAR_FRAME_WIDGET, NULL ); - swf->service_manager = Reference< XMultiServiceFactory >::query( component_context->getServiceManager() ); - return GTK_WIDGET( swf ); -} diff --git a/bonobo/src/star-frame-widget.h b/bonobo/src/star-frame-widget.h deleted file mode 100644 index 58d3aa709..000000000 --- a/bonobo/src/star-frame-widget.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef STAR_FRAME_WIDGET_H -#define STAR_FRAME_WIDGET_H - -#include <gtk/gtksocket.h> - -#define TYPE_STAR_FRAME_WIDGET (star_frame_widget_get_type ()) -#define STAR_FRAME_WIDGET(obj) (GTK_CHECK_CAST ((obj), TYPE_STAR_FRAME_WIDGET, StarFrameWidget)) -#define STAR_FRAME_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_STAR_FRAME_WIDGET, StarFrameWidgetClass)) -#define IS_STAR_FRAME_WIDGET(obj) (GTK_CHECK_TYPE ((obj), TYPE_STAR_FRAME_WIDGET)) -#define IS_STAR_FRAME_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_STAR_FRAME_WIDGET)) - -typedef struct _StarFrameWidget StarFrameWidget; -typedef struct _StarFrameWidgetClass StarFrameWidgetClass; -typedef struct _StarFrameWidgetPrivate StarFrameWidgetPrivate; - -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/XWindowPeer.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - -using com::sun::star::uno::Reference; -using com::sun::star::frame::XFrame; -using com::sun::star::lang::XMultiServiceFactory; -using com::sun::star::uno::XComponentContext; - -struct _StarFrameWidget { - GtkSocket parent; - StarFrameWidgetPrivate *priv; - - /* Temporary */ - Reference< XMultiServiceFactory > service_manager; -}; - -struct _StarFrameWidgetClass { - GtkSocketClass parent_class; -}; - -GType star_frame_widget_get_type ( void ); -GtkWidget *star_frame_widget_new ( Reference< XComponentContext > component_context ); - -Reference< XFrame > star_frame_widget_get_frame( StarFrameWidget *sfw ); -void star_frame_widget_dispatch_slot_url( StarFrameWidget *sfw, ::com::sun::star::util::URL url, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > &properties ); -void star_frame_widget_set_fullscreen( StarFrameWidget *sfw, sal_Bool fullscreen ); -void star_frame_widget_zoom_100( StarFrameWidget *sfw ); -void star_frame_widget_zoom_page_width( StarFrameWidget *sfw ); -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > star_frame_widget_get_view_properties( StarFrameWidget *sfw ); -#endif /* STAR_FRAME_WIDGET_H */ diff --git a/bonobo/src/string-macros.h b/bonobo/src/string-macros.h deleted file mode 100644 index 60a38500e..000000000 --- a/bonobo/src/string-macros.h +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************* - * - * $RCSfile: generic.hxx,v $ - * - * $Revision: 1.4 $ - * - * last change: $Author: as $ $Date: 2001/05/15 05:41:31 $ - * - * The Contents of this file are made available subject to the terms of - * either of the following licenses - * - * - GNU Lesser General Public License Version 2.1 - * - Sun Industry Standards Source License Version 1.1 - * - * Sun Microsystems Inc., October, 2000 - * - * GNU Lesser General Public License Version 2.1 - * ============================================= - * Copyright 2000 by Sun Microsystems, Inc. - * 901 San Antonio Road, Palo Alto, CA 94303, USA - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License version 2.1, as published by the Free Software Foundation. - * - * This library 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 for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * - * Sun Industry Standards Source License Version 1.1 - * ================================================= - * The contents of this file are subject to the Sun Industry Standards - * Source License Version 1.1 (the "License"); You may not use this file - * except in compliance with the License. You may obtain a copy of the - * License at http://www.openoffice.org/license.html. - * - * Software provided under this License is provided on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, - * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. - * See the License for the specific provisions governing your rights and - * obligations concerning the Software. - * - * The Initial Developer of the Original Code is: Sun Microsystems, Inc. - * - * Copyright: 2000 by Sun Microsystems, Inc. - * - * All Rights Reserved. - * - * Contributor(s): _______________________________________ - * - * - ************************************************************************/ - -#ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ -#define __FRAMEWORK_MACROS_GENERIC_HXX_ - -//_________________________________________________________________________________________________________________ -// includes -//_________________________________________________________________________________________________________________ - -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring.hxx> -#endif - -#ifndef _RTL_TEXTENC_H -#include <rtl/textenc.h> -#endif - -//***************************************************************************************************************** -// generic macros -//***************************************************************************************************************** - -/*_________________________________________________________________________________________________________________ - DECLARE_ASCII( SASCIIVALUE ) - - Use it to declare a constant ascii value at compile time in code. - zB. OUSting sTest = DECLARE_ASCII( "Test" ) -_________________________________________________________________________________________________________________*/ - -#define DECLARE_ASCII( SASCIIVALUE ) \ - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) - -/*_________________________________________________________________________________________________________________ - U2B( SUNICODEVALUE ) - B2U( SASCIIVALUE ) - U2B_ENC( SUNICODEVALUE, AENCODING ) - B2U_ENC( SASCIIVALUE, AENCODING ) - - Use it to convert unicode strings to ascii values and reverse ... - We use UTF8 as default textencoding. If you will change this use U2B_ENC and B2U_ENC! -_________________________________________________________________________________________________________________*/ - -#define U2B( SUNICODEVALUE ) \ - ::rtl::OUStringToOString( SUNICODEVALUE, RTL_TEXTENCODING_UTF8 ) - -#define B2U( SASCIIVALUE ) \ - ::rtl::OStringToOUString( SASCIIVALUE, RTL_TEXTENCODING_UTF8 ) - -#define U2B_ENC( SUNICODEVALUE, AENCODING ) \ - ::rtl::OUStringToOString( SUNICODEVALUE, AENCODING ) - -#define B2U_ENC( SASCIIVALUE, AENCODING ) \ - ::rtl::OStringToOUString( SASCIIVALUE, AENCODING ) - -//***************************************************************************************************************** -// end of file -//***************************************************************************************************************** - -#endif // #ifndef __FRAMEWORK_MACROS_GENERIC_HXX_ diff --git a/bonobo/src/test.cxx b/bonobo/src/test.cxx deleted file mode 100644 index 1687a3662..000000000 --- a/bonobo/src/test.cxx +++ /dev/null @@ -1,137 +0,0 @@ -#include <stdio.h> -#include <unistd.h> -#include <string.h> - -#include <gdk/gdkx.h> -#include <gtk/gtk.h> - -#include <com/sun/star/document/XTypeDetection.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XSynchronousFrameLoader.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - -#include "remote-uno-helper.h" -#include "string-macros.h" -#include "services.h" -#include "star-frame-widget.h" - -using namespace com::sun::star; -using namespace com::sun::star::beans; -using namespace com::sun::star::lang; -using namespace com::sun::star::uno; - -using rtl::OUString; - -static void -destroy( GtkWidget *widget, gpointer data ) -{ - gtk_main_quit(); -} - -static void -FrameLoaderLoadFileFromUrl( Reference< frame::XSynchronousFrameLoader > xFrameLoader, - Reference< frame::XFrame > xFrame, - OUString sUrl, - OUString sTypeName) -{ - uno::Sequence< beans::PropertyValue > aProperties( 3 ); - - aProperties[ 0 ] = PropertyValue( DECLARE_ASCII( "FileName" ), - 0, - uno::makeAny( sUrl ), - PropertyState_DIRECT_VALUE ); - - aProperties[ 1 ] = PropertyValue( DECLARE_ASCII( "TypeName" ), - 0, - uno::makeAny( sTypeName ), - PropertyState_DIRECT_VALUE ); - - aProperties[ 2 ] = PropertyValue( DECLARE_ASCII( "ReadOnly" ), - 0, - uno::makeAny( sal_True ), - PropertyState_DIRECT_VALUE ); - - xFrameLoader->load( aProperties, xFrame ); -} - -int -main( int argc, char *argv[] ) -{ - if( argc < 2 || !strcmp( argv [1], "--help" ) ) - { - fprintf( stderr, "Syntax:\n" ); - fprintf( stderr, " test <document-name>\n" ); - exit( 1 ); - } - const char *pFileName = argv[ argc - 1 ]; - if( strncmp( pFileName, "file:", 5 ) ) - { - fprintf( stderr, "test prefers URIs\n" ); - pFileName = g_strconcat( "file://", pFileName, NULL ); - } - OUString aFileName = OUString( pFileName, strlen( pFileName ), - RTL_TEXTENCODING_UTF8 ); - - gtk_init( &argc, &argv ); - - Reference< uno::XComponentContext > xRemoteContext = getComponentContext(); - g_assert( xRemoteContext.is() ); - - GtkWidget *pWindow = gtk_window_new( GTK_WINDOW_TOPLEVEL ); - g_signal_connect (G_OBJECT (pWindow), "destroy", - G_CALLBACK (destroy), NULL); - - GtkWidget *pVBox = gtk_vbox_new( FALSE, 0 ); - gtk_container_add( GTK_CONTAINER( pWindow ), pVBox ); - - GtkWidget *pText = gtk_entry_new(); - gtk_box_pack_start( GTK_BOX( pVBox ), pText, FALSE, FALSE, 5 ); - - GtkWidget *pText2 = gtk_entry_new(); - gtk_box_pack_start( GTK_BOX( pVBox ), pText2, FALSE, FALSE, 5 ); - - GtkWidget *pSocket = star_frame_widget_new( xRemoteContext ); - gtk_box_pack_start( GTK_BOX( pVBox ), pSocket, TRUE, TRUE, 5 ); - - gtk_widget_realize( pSocket ); - - Reference< frame::XFrame > xFrame( - star_frame_widget_get_frame( STAR_FRAME_WIDGET( pSocket ) ) ); - g_assert( xFrame.is() ); - - // Loading - Reference< lang::XMultiServiceFactory > xMultiServiceFactory( - xRemoteContext->getServiceManager(), uno::UNO_QUERY ); - g_assert (xMultiServiceFactory.is() ); - - Reference< document::XTypeDetection > xTypeDetection( - xMultiServiceFactory->createInstance( SERVICENAME_TYPEDETECTION ), - uno::UNO_QUERY ); - g_assert( xTypeDetection.is() ); - - Reference< XMultiServiceFactory > xFrameLoaderFactory( - xMultiServiceFactory->createInstance( SERVICENAME_FRAMELOADERFACTORY ), - uno::UNO_QUERY ); - g_assert( xFrameLoaderFactory.is() ); - - OUString sTypeName( xTypeDetection->queryTypeByURL( aFileName ) ); - - Reference< frame::XSynchronousFrameLoader > xFrameLoader( - xFrameLoaderFactory->createInstance(sTypeName), - uno::UNO_QUERY ); - g_assert( xFrameLoader.is() ); - - FrameLoaderLoadFileFromUrl( xFrameLoader, xFrame, aFileName, sTypeName ); - - gtk_widget_grab_focus( pSocket ); - gtk_widget_show( pSocket ); - gtk_widget_show( pText ); - gtk_widget_show( pText2 ); - gtk_widget_show( pVBox ); - gtk_widget_show( pWindow ); - - gtk_main(); - return 0; -} diff --git a/download.in b/download.in deleted file mode 100755 index 1c11c6154..000000000 --- a/download.in +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/perl -w - -sub webget($$) -{ - my ($src, $dest) = @_; - - print "Get $src -> $dest\n"; - system ("cd $dest ; $WGET $src") != 0 && die "Failed fetch"; -} - -sub usage { - print STDERR "\ndownload\n"; - print STDERR "Syntax: download [--help] \n\n"; - print STDERR " download's behavior is coded by your configure options eg.\n"; - print STDERR " if you configure with --with-system-gcc it will not download\n"; - print STDERR " gcc & binutils\n"; -}; - - -%SRC_URLS = ( - 'binutils-.*' => '@MIRROR@/support', - 'gcc-.*' => '@MIRROR@/support', - 'src680-m.*' => '@MIRROR@/SRC680', - 'ooo680-m.*' => '@MIRROR@/OOO680', - 'libwpd-snap-.*' => '@MIRROR@', - 'libwpd-0.*' => '@MIRROR@/libwpd', - 'images_gnome-.*' => '@MIRROR@/SRC680', - 'images_kde-.*' => '@MIRROR@/SRC680', - 'extras-.*' => '@MIRROR@/SRC680', - 'ooo_custom_images.*' => '@MIRROR@/SRC680', - 'ooo_crystal_images.*' => '@MIRROR@/SRC680', - 'cli_types*' => '@MIRROR@/SRC680', - 'mdbtools*' => '@MIRROR@/SRC680', - 'libpixman-*' => '@MIRROR@/SRC680', - 'cairo-*' => '@MIRROR@/SRC680', - 'glitz-*' => '@MIRROR@/SRC680', - 'hunspell*' => '@MIRROR@/SRC680', -# Graphite rendering bits - 'silgraphite-*' => '@MIRROR@/SRC680', -# Win32 bits: - 'unicows\.exe' => 'http://download.microsoft.com/download/b/7/5/b75eace3-00e2-4aa0-9a6f-0b6882c71642', - # from http://www.microsoft.com/downloads/release.asp?releaseid=30682' - 'dbghinst\.EXE' => 'http://download.microsoft.com/download/platformsdk/Redist/5.0.2195.1/W9XNT4/EN-US', - '5_11_98Odma20\.zip' => '@MIRROR@/support', - 'openclipart-*' => 'http://www.openclipart.org/downloads/@OPENCLIPART_VER@', - 'dejavu-ttf-*' => 'http://heanet.dl.sf.net/sourceforge/dejavu/', -# Win32 ant binaries ... - 'apache-ant-*' => 'http://apache.mirror.positive-internet.com/ant/binaries', -# Mozilla source and libraries - 'mozilla-source-1.7.5*' => 'http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.5/source/', - 'glib-*' => 'http://ftp.gtk.org/pub/gtk/v1.2/', - 'libIDL-*' => 'http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/source/', - 'wintools.zip' => 'http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/' -); - -$WGET='/usr/bin/wget'; - -sub download_files($$$) -{ - my ($files, $locations, $dest) = @_; - - for my $file ( @{$files} ) { - if ( $file ne '' ) { - if (-f "$dest/$file") { - print "Skipping $file\n"; - } else { - print "No file $dest/$file\n"; - my $location = ''; - for $regexp (keys %{$locations}) { - if ($file =~ m/^$regexp/) { - $location = $locations->{$regexp}; - last; - } - } - $location eq '' && die "Can't find '$file' to download"; - webget( $location."/$file", $dest ); - } - } - } -} - -if (!-d "@SRCDIR@") { - `mkdir -p @SRCDIR@`; -} - -# Files to download -@files = (); - -while ($arg = shift @ARGV) { - if ( $arg eq '--help' ) { - &usage and exit(0); - } -} - -# Defaults -$tag = '@CVSTAG@'; -print "Downloading files for $tag\n"; - --x $WGET || die "Can't find wget - install it and try again\n"; - -if ('@SYSTEM_GCC@' eq '') { - push @files, ( 'gcc-3.4.1.tar.bz2', 'gcc-3.4.1-Enums.diff', 'gcc-3.4.1-VisibilityPatch2.diff' ); -} - -# Misc. bits for Win32 -if ('@BUILD_WIN32@' ne '') -{ - push @files, ( 'unicows.exe', 'dbghinst.EXE' ); - push @files, ( "$tag-system.tar.bz2" ); -# push @files, ( '5_11_98Odma20.zip' ); # - ODMA - for when it works. - push @files, ( "apache-ant-1.6.5-bin.tar.gz" ); - push @files, ( '@BUILD_MOZILLA_SOURCE@' ); - push @files, ( 'glib-1.2.10.tar.gz' ); - push @files, ( 'libIDL-0.6.8.tar.gz' ); -# this contains binaries and source, we just use the source - push @files, ( 'wintools.zip' ); -} -else -{ - if ('@ENABLE_MONO@' ne 'FALSE') { - push @files, ( 'cli_types.dll' ); - push @files, ( 'cli_types_bridgetest.dll' ); - } -} -if ('@CAIRO_ENABLED@' eq 'TRUE' && '@SYSTEM_CAIRO@' ne 'TRUE') { - push @files, ( 'cairo-@CAIRO_VER@.tar.gz' ); - push @files, ( 'glitz-@GLITZ_VER@.tar.gz' ); -} - -if ('@OPENCLIPART_VER@' ne '') { - push @files, ( 'openclipart-@OPENCLIPART_VER@.tar.bz2' ); -} - -if ('@DEJAVU_FONTS_VER@' ne '') { - push @files, ( 'dejavu-ttf-@DEJAVU_FONTS_VER@.tar.gz' ); -} - -if ('@MDBTOOLS_SRC@' ne '') { - push @files, ( '@MDBTOOLS_SRC@' ); -} - -push @files, ( "libwpd-0.8.3.tar.gz" ); -push @files, ( "$tag-core.tar.bz2" ); -push @files, ( '@OOO_CUSTOM_IMAGES@', '@OOO_CRYSTAL_IMAGES@', '@OOO_EXTRA_ARTWORK@' ); - -if ('@OOO_LANGS@' ne 'en-US' || '@BUILD_WIN32@' ne '' ) { - push @files, ( "$tag-lang.tar.bz2" ); -} - -if ('@HUNSPELL_UNO_SRC@' ne '') { - push @files, ( '@HUNSPELL_UNO_SRC@' ); -} - -if ('@HUNSPELL_LIB_SRC@' ne '') { - push @files, ( '@HUNSPELL_LIB_SRC@' ); -} - -if ('@GRAPHITE_SRC@' ne '') { - push @files, ( '@GRAPHITE_SRC@' ); -} - -my $distro = '@DISTRO@'; -if ($distro eq 'NLD') { - push @files, ( "$tag-system.tar.bz2" ); -} - -if ($distro =~ m/Debian/ || - $distro =~ m/Ubuntu/ || - '@BUILD_WIN32@' ne '') { - push @files, ( "$tag-sdk_oo.tar.bz2" ); -} - -download_files (\@files, \%SRC_URLS, '@SRCDIR@'); - -print "Done\n"; diff --git a/etc/.cvsignore b/etc/.cvsignore deleted file mode 100644 index 282522db0..000000000 --- a/etc/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -Makefile -Makefile.in diff --git a/intltool-merge.in b/intltool-merge.in deleted file mode 100755 index 9554a1c2a..000000000 --- a/intltool-merge.in +++ /dev/null @@ -1,933 +0,0 @@ -#!@INTLTOOL_PERL@ -w - -# -# The Intltool Message Merger -# -# Copyright (C) 2000, 2003 Free Software Foundation. -# Copyright (C) 2000, 2001 Eazel, Inc -# -# Intltool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# version 2 published by the Free Software Foundation. -# -# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, 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. -# -# Authors: Maciej Stachowiak <mjs@noisehavoc.org> -# Kenneth Christiansen <kenneth@gnu.org> -# Darin Adler <darin@bentspoon.com> -# -# Proper XML UTF-8'ification written by Cyrille Chepelov <chepelov@calixo.net> -# - -## Release information -my $PROGRAM = "intltool-merge"; -my $PACKAGE = "intltool"; -my $VERSION = "0.27.2"; - -## Loaded modules -use strict; -use Getopt::Long; -use Text::Wrap; - -## Scalars used by the option stuff -my $HELP_ARG = 0; -my $VERSION_ARG = 0; -my $BA_STYLE_ARG = 0; -my $XML_STYLE_ARG = 0; -my $KEYS_STYLE_ARG = 0; -my $DESKTOP_STYLE_ARG = 0; -my $SCHEMAS_STYLE_ARG = 0; -my $RFC822DEB_STYLE_ARG = 0; -my $QUIET_ARG = 0; -my $PASS_THROUGH_ARG = 0; -my $UTF8_ARG = 0; -my $cache_file; - -## Handle options -GetOptions -( - "help" => \$HELP_ARG, - "version" => \$VERSION_ARG, - "quiet|q" => \$QUIET_ARG, - "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility - "ba-style|b" => \$BA_STYLE_ARG, - "xml-style|x" => \$XML_STYLE_ARG, - "keys-style|k" => \$KEYS_STYLE_ARG, - "desktop-style|d" => \$DESKTOP_STYLE_ARG, - "schemas-style|s" => \$SCHEMAS_STYLE_ARG, - "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, - "pass-through|p" => \$PASS_THROUGH_ARG, - "utf8|u" => \$UTF8_ARG, - "cache|c=s" => \$cache_file - ) or &error; - -my $PO_DIR; -my $FILE; -my $OUTFILE; - -my %po_files_by_lang = (); -my %translations = (); -my $iconv = $ENV{"INTLTOOL_ICONV"} || "iconv"; - -# Use this instead of \w for XML files to handle more possible characters. -my $w = "[-A-Za-z0-9._:]"; - -# XML quoted string contents -my $q = "[^\\\"]*"; - -## Check for options. - -if ($VERSION_ARG) -{ - &print_version; -} -elsif ($HELP_ARG) -{ - &print_help; -} -elsif ($BA_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &ba_merge_translations; - &finalize; -} -elsif ($XML_STYLE_ARG && @ARGV > 2) -{ - &utf8_sanity_check; - &preparation; - &print_message; - &xml_merge_translations; - &finalize; -} -elsif ($KEYS_STYLE_ARG && @ARGV > 2) -{ - &utf8_sanity_check; - &preparation; - &print_message; - &keys_merge_translations; - &finalize; -} -elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &desktop_merge_translations; - &finalize; -} -elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &schemas_merge_translations; - &finalize; -} -elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) -{ - &preparation; - &print_message; - &rfc822deb_merge_translations; - &finalize; -} -else -{ - &print_help; -} - -exit; - -## Sub for printing release information -sub print_version -{ - print <<_EOF_; -${PROGRAM} (${PACKAGE}) ${VERSION} -Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen. - -Copyright (C) 2000-2003 Free Software Foundation, Inc. -Copyright (C) 2000-2001 Eazel, 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. -_EOF_ - exit; -} - -## Sub for printing usage information -sub print_help -{ - print <<_EOF_; -Usage: ${PROGRAM} [OPTION]... PO_DIRECTORY FILENAME OUTPUT_FILE -Generates an output file that includes some localized attributes from an -untranslated source file. - -Mandatory options: (exactly one must be specified) - -b, --ba-style includes translations in the bonobo-activation style - -d, --desktop-style includes translations in the desktop style - -k, --keys-style includes translations in the keys style - -s, --schemas-style includes translations in the schemas style - -r, --rfc822deb-style includes translations in the RFC822 style - -x, --xml-style includes translations in the standard xml style - -Other options: - -u, --utf8 convert all strings to UTF-8 before merging - -p, --pass-through use strings as found in .po files, without - conversion (STRONGLY unrecommended with -x) - -c, --cache=FILE specify cache file name - (usually \$top_builddir/po/.intltool-merge-cache) - -q, --quiet suppress most messages - --help display this help and exit - --version output version information and exit - -Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") -or send email to <xml-i18n-tools\@gnome.org>. -_EOF_ - exit; -} - - -## Sub for printing error messages -sub print_error -{ - print STDERR "Try `${PROGRAM} --help' for more information.\n"; - exit; -} - - -sub print_message -{ - print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; -} - - -sub preparation -{ - $PO_DIR = $ARGV[0]; - $FILE = $ARGV[1]; - $OUTFILE = $ARGV[2]; - - &gather_po_files; - &get_translation_database; -} - -# General-purpose code for looking up translations in .po files - -sub po_file2lang -{ - my ($tmp) = @_; - $tmp =~ s/^.*\/(.*)\.po$/$1/; - return $tmp; -} - -sub gather_po_files -{ - for my $po_file (glob "$PO_DIR/*.po") { - $po_files_by_lang{po_file2lang($po_file)} = $po_file; - } -} - -sub get_local_charset -{ - my ($encoding) = @_; - my $alias_file = $ENV{"G_CHARSET_ALIAS"} || "/usr/lib/charset.alias"; - - # seek character encoding aliases in charset.alias (glib) - - if (open CHARSET_ALIAS, $alias_file) - { - while (<CHARSET_ALIAS>) - { - next if /^\#/; - return $1 if (/^\s*([-._a-zA-Z0-9]+)\s+$encoding\b/i) - } - - close CHARSET_ALIAS; - } - - # if not found, return input string - - return $encoding; -} - -sub get_po_encoding -{ - my ($in_po_file) = @_; - my $encoding = ""; - - open IN_PO_FILE, $in_po_file or die; - while (<IN_PO_FILE>) - { - ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" - if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) - { - $encoding = $1; - last; - } - } - close IN_PO_FILE; - - if (!$encoding) - { - print STDERR "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG; - $encoding = "ISO-8859-1"; - } - - system ("$iconv -f $encoding -t UTF-8 </dev/null 2>/dev/null"); - if ($?) { - $encoding = get_local_charset($encoding); - } - - return $encoding -} - -sub utf8_sanity_check -{ - if (!$UTF8_ARG) - { - if (!$PASS_THROUGH_ARG) - { - $PASS_THROUGH_ARG="1"; - } - } -} - -sub get_translation_database -{ - if ($cache_file) { - &get_cached_translation_database; - } else { - &create_translation_database; - } -} - -sub get_newest_po_age -{ - my $newest_age; - - foreach my $file (values %po_files_by_lang) - { - my $file_age = -M $file; - $newest_age = $file_age if !$newest_age || $file_age < $newest_age; - } - - $newest_age = 0 if !$newest_age; - - return $newest_age; -} - -sub create_cache -{ - print "Generating and caching the translation database\n" unless $QUIET_ARG; - - &create_translation_database; - - open CACHE, ">$cache_file" || die; - print CACHE join "\x01", %translations; - close CACHE; -} - -sub load_cache -{ - print "Found cached translation database\n" unless $QUIET_ARG; - - my $contents; - open CACHE, "<$cache_file" || die; - { - local $/; - $contents = <CACHE>; - } - close CACHE; - %translations = split "\x01", $contents; -} - -sub get_cached_translation_database -{ - my $cache_file_age = -M $cache_file; - if (defined $cache_file_age) - { - if ($cache_file_age <= &get_newest_po_age) - { - &load_cache; - return; - } - print "Found too-old cached translation database\n" unless $QUIET_ARG; - } - - &create_cache; -} - -sub create_translation_database -{ - for my $lang (keys %po_files_by_lang) - { - my $po_file = $po_files_by_lang{$lang}; - - if ($UTF8_ARG) - { - my $encoding = get_po_encoding ($po_file); - - if (lc $encoding eq "utf-8") - { - open PO_FILE, "<$po_file"; - } - else - { - print STDERR "WARNING: $po_file is not in UTF-8 but $encoding, converting...\n" unless $QUIET_ARG;; - - open PO_FILE, "$iconv -f $encoding -t UTF-8 $po_file|"; - } - } - else - { - open PO_FILE, "<$po_file"; - } - - my $nextfuzzy = 0; - my $inmsgid = 0; - my $inmsgstr = 0; - my $msgid = ""; - my $msgstr = ""; - - while (<PO_FILE>) - { - $nextfuzzy = 1 if /^#, fuzzy/; - - if (/^msgid "((\\.|[^\\])*)"/ ) - { - $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; - $msgid = ""; - $msgstr = ""; - - if ($nextfuzzy) { - $inmsgid = 0; - } else { - $msgid = unescape_po_string($1); - $inmsgid = 1; - } - $inmsgstr = 0; - $nextfuzzy = 0; - } - - if (/^msgstr "((\\.|[^\\])*)"/) - { - $msgstr = unescape_po_string($1); - $inmsgstr = 1; - $inmsgid = 0; - } - - if (/^"((\\.|[^\\])*)"/) - { - $msgid .= unescape_po_string($1) if $inmsgid; - $msgstr .= unescape_po_string($1) if $inmsgstr; - } - } - $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; - } -} - -sub finalize -{ -} - -sub unescape_one_sequence -{ - my ($sequence) = @_; - - return "\\" if $sequence eq "\\\\"; - return "\"" if $sequence eq "\\\""; - return "\n" if $sequence eq "\\n"; - - # gettext also handles \n, \t, \b, \r, \f, \v, \a, \xxx (octal), - # \xXX (hex) and has a comment saying they want to handle \u and \U. - - return $sequence; -} - -sub unescape_po_string -{ - my ($string) = @_; - - $string =~ s/(\\.)/unescape_one_sequence($1)/eg; - - return $string; -} - -## NOTE: deal with < - < but not > - > because it seems its ok to have -## > in the entity. For further info please look at #84738. -sub entity_decode -{ - local ($_) = @_; - - s/'/'/g; # ' - s/"/"/g; # " - s/&/&/g; - s/</</g; - - return $_; -} - -# entity_encode: (string) -# -# Encode the given string to XML format (encode '<' etc). It also -# encodes high bit if not in UTF-8 mode. - -sub entity_encode -{ - my ($pre_encoded) = @_; - - my @list_of_chars = unpack ('C*', $pre_encoded); - - if ($PASS_THROUGH_ARG) - { - return join ('', map (&entity_encode_int_even_high_bit, @list_of_chars)); - } - else - { - # with UTF-8 we only encode minimalistic - return join ('', map (&entity_encode_int_minimalist, @list_of_chars)); - } -} - -sub entity_encode_int_minimalist -{ - return """ if $_ == 34; - return "&" if $_ == 38; - return "'" if $_ == 39; - return "<" if $_ == 60; - return chr $_; -} - -sub entity_encode_int_even_high_bit -{ - if ($_ > 127 || $_ == 34 || $_ == 38 || $_ == 39 || $_ == 60) - { - # the ($_ > 127) should probably be removed - return "&#" . $_ . ";"; - } - else - { - return chr $_; - } -} - -sub entity_encoded_translation -{ - my ($lang, $string) = @_; - - my $translation = $translations{$lang, $string}; - return $string if !$translation; - return entity_encode ($translation); -} - -## XML (bonobo-activation specific) merge code - -sub ba_merge_translations -{ - my $source; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; - - while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) - { - print OUTPUT $1; - - my $node = $2 . "\n"; - - my @strings = (); - $_ = $node; - while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { - push @strings, entity_decode($3); - } - print OUTPUT; - - my %langs; - for my $string (@strings) - { - for my $lang (keys %po_files_by_lang) - { - $langs{$lang} = 1 if $translations{$lang, $string}; - } - } - - for my $lang (sort keys %langs) - { - $_ = $node; - s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; - s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; - print OUTPUT; - } - } - - print OUTPUT $source; - - close OUTPUT; -} - - -## XML (non-bonobo-activation) merge code - -sub xml_merge_translations -{ - my $source; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">$OUTFILE" or die; - - # FIXME: support attribute translations - - # Empty nodes never need translation, so unmark all of them. - # For example, <_foo/> is just replaced by <foo/>. - $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; - - # Support for <_foo>blah</_foo> style translations. - while ($source =~ s|^(.*?)([ \t]*)<\s*_($w+)\s*>(.*?)<\s*/_\3\s*>([ \t]*\n)?||s) - { - print OUTPUT $1; - - my $spaces = $2; - my $tag = $3; - my $string = $4; - - print OUTPUT "$spaces<$tag>$string</$tag>\n"; - - $string =~ s/\s+/ /g; - $string =~ s/^ //; - $string =~ s/ $//; - $string = entity_decode($string); - - for my $lang (sort keys %po_files_by_lang) - { - my $translation = $translations{$lang, $string}; - next if !$translation; - $translation = entity_encode($translation); - print OUTPUT "$spaces<$tag xml:lang=\"$lang\">$translation</$tag>\n"; - } - } - - print OUTPUT $source; - - close OUTPUT; -} - -sub keys_merge_translations -{ - open INPUT, "<${FILE}" or die; - open OUTPUT, ">${OUTFILE}" or die; - - while (<INPUT>) - { - if (s/^(\s*)_(\w+=(.*))/$1$2/) - { - my $string = $3; - - print OUTPUT; - - my $non_translated_line = $_; - - for my $lang (sort keys %po_files_by_lang) - { - my $translation = $translations{$lang, $string}; - next if !$translation; - - $_ = $non_translated_line; - s/(\w+)=.*/[$lang]$1=$translation/; - print OUTPUT; - } - } - else - { - print OUTPUT; - } - } - - close OUTPUT; - close INPUT; -} - -sub desktop_merge_translations -{ - open INPUT, "<${FILE}" or die; - open OUTPUT, ">${OUTFILE}" or die; - - while (<INPUT>) - { - if (s/^(\s*)_(\w+=(.*))/$1$2/) - { - my $string = $3; - - print OUTPUT; - - my $non_translated_line = $_; - - for my $lang (sort keys %po_files_by_lang) - { - my $translation = $translations{$lang, $string}; - next if !$translation; - - $_ = $non_translated_line; - s/(\w+)=.*/${1}[$lang]=$translation/; - print OUTPUT; - } - } - else - { - print OUTPUT; - } - } - - close OUTPUT; - close INPUT; -} - -sub schemas_merge_translations -{ - my $source; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">$OUTFILE" or die; - - # FIXME: support attribute translations - - # Empty nodes never need translation, so unmark all of them. - # For example, <_foo/> is just replaced by <foo/>. - $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; - - while ($source =~ s/ - (.*?) - (\s+)(<locale\ name="C">(\s*) - (<default>\s*(.*?)\s*<\/default>)?(\s*) - (<short>\s*(.*?)\s*<\/short>)?(\s*) - (<long>\s*(.*?)\s*<\/long>)?(\s*) - <\/locale>) - //sx) - { - print OUTPUT $1; - - my $locale_start_spaces = $2 ? $2 : ''; - my $default_spaces = $4 ? $4 : ''; - my $short_spaces = $7 ? $7 : ''; - my $long_spaces = $10 ? $10 : ''; - my $locale_end_spaces = $13 ? $13 : ''; - my $c_default_block = $3 ? $3 : ''; - my $default_string = $6 ? $6 : ''; - my $short_string = $9 ? $9 : ''; - my $long_string = $12 ? $12 : ''; - - $c_default_block =~ s/default>\[.*?\]/default>/s; - - print OUTPUT "$locale_start_spaces$c_default_block"; - - $default_string =~ s/\s+/ /g; - $default_string = entity_decode($default_string); - $short_string =~ s/\s+/ /g; - $short_string = entity_decode($short_string); - $long_string =~ s/\s+/ /g; - $long_string = entity_decode($long_string); - - for my $lang (sort keys %po_files_by_lang) - { - my $default_translation = $translations{$lang, $default_string}; - my $short_translation = $translations{$lang, $short_string}; - my $long_translation = $translations{$lang, $long_string}; - - next if (!$default_translation && !$short_translation && - !$long_translation); - - print OUTPUT "\n$locale_start_spaces<locale name=\"$lang\">"; - - print OUTPUT "$default_spaces"; - - if ($default_translation) - { - $default_translation = entity_encode($default_translation); - print OUTPUT "<default>$default_translation</default>"; - } - - print OUTPUT "$short_spaces"; - - if ($short_translation) - { - $short_translation = entity_encode($short_translation); - print OUTPUT "<short>$short_translation</short>"; - } - - print OUTPUT "$long_spaces"; - - if ($long_translation) - { - $long_translation = entity_encode($long_translation); - print OUTPUT "<long>$long_translation</long>"; - } - - print OUTPUT "$locale_end_spaces</locale>"; - } - } - - print OUTPUT $source; - - close OUTPUT; -} - -sub rfc822deb_merge_translations -{ - my $source; - - $Text::Wrap::huge = 'overflow'; - - { - local $/; # slurp mode - open INPUT, "<$FILE" or die "can't open $FILE: $!"; - $source = <INPUT>; - close INPUT; - } - - open OUTPUT, ">${OUTFILE}" or die; - - while ($source =~ /(^|\n+)(_)?([^:_\n]+)(:\s*)(.*?)(?=\n[\S\n]|$)/sg) - { - my $sep = $1; - my $non_translated_line = $3.$4; - my $string = $5; - my $is_translatable = defined($2); - # Remove [] dummy strings - $string =~ s/\[\s[^\[\]]*\]$//; - $non_translated_line .= $string; - - print OUTPUT $sep.$non_translated_line; - - if ($is_translatable) - { - my @str_list = rfc822deb_split($string); - - for my $lang (sort keys %po_files_by_lang) - { - my $is_translated = 1; - my $str_translated = ''; - my $first = 1; - - for my $str (@str_list) - { - my $translation = $translations{$lang, $str}; - - if (!$translation) - { - $is_translated = 0; - last; - } - - # $translation may also contain [] dummy - # strings, mostly to indicate an empty string - $translation =~ s/\[\s[^\[\]]*\]$//; - - if ($first) - { - $str_translated .= - Text::Tabs::expand($translation) . - "\n"; - } - else - { - $str_translated .= Text::Tabs::expand( - Text::Wrap::wrap(' ', ' ', $translation)) . - "\n .\n"; - } - $first = 0; - - # To fix some problems with Text::Wrap::wrap - $str_translated =~ s/(\n )+\n/\n .\n/g; - } - next unless $is_translated; - - $str_translated =~ s/\n \.\n$//; - $str_translated =~ s/\s+$//; - - $_ = $non_translated_line; - s/^(\w+):\s*.*/$sep${1}-$lang: $str_translated/s; - print OUTPUT; - } - } - } - print OUTPUT "\n"; - - close OUTPUT; - close INPUT; -} - -sub rfc822deb_split -{ - # Debian defines a special way to deal with rfc822-style files: - # when a value contain newlines, it consists of - # 1. a short form (first line) - # 2. a long description, all lines begin with a space, - # and paragraphs are separated by a single dot on a line - # This routine returns an array of all paragraphs, and reformat - # them. - my $text = shift; - $text =~ s/^ //mg; - return ($text) if $text !~ /\n/; - - $text =~ s/([^\n]*)\n//; - my @list = ($1); - my $str = ''; - - for my $line (split (/\n/, $text)) - { - chomp $line; - $line =~ /\s+$/; - - if ($line =~ /^\.$/) - { - # New paragraph - $str =~ s/\s*$//; - push(@list, $str); - $str = ''; - } - elsif ($line =~ /^\s/) - { - # Line which must not be reformatted - $str .= "\n" if length ($str) && $str !~ /\n$/; - $str .= $line."\n"; - } - else - { - # Continuation line, remove newline - $str .= " " if length ($str) && $str !~ /[\n ]$/; - $str .= $line; - } - } - - $str =~ s/\s*$//; - push(@list, $str) if length ($str); - - return @list; -} - diff --git a/ooo1.1.spec.in b/ooo1.1.spec.in deleted file mode 100644 index b73165cd2..000000000 --- a/ooo1.1.spec.in +++ /dev/null @@ -1,193 +0,0 @@ -# RPM specfile for ooo1.1 module -# Generated Fri Aug 8 11:32:32 2003 GMT by Ximian build system -# $Id: ooo1.1.spec.in,v 1.5 2005/02/06 20:03:46 brosenk Exp $ -# from $Id: ooo1.1.spec.in,v 1.5 2005/02/06 20:03:46 brosenk Exp $ - -%define _topdir @BASEDIR@ -%define _sourcedir @BASEDIR@/src -%define _builddir @BASEDIR@/build -%define buildroot @BASEDIR@/dest -%define _rpmdir /tmp/michael/built-packages -%define _srcrpmdir /tmp/michael/built-packages -%define _install_script_path /usr/bin:/usr/X11R6/bin:/usr/bin:/bin -%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm -%define _noPayloadPrefix 1 -%define __check_files /usr/share/ximian-build-system/packsys/rpm/check-files /home/michael/openoffice/bb-snaps/dest -%define __find_requires @BASEDIR@/bin/nothing -%define __find_provides @BASEDIR@/bin/nothing -%define _use_internal_dependency_generator 0 - -%define nam ooo1.1 -%define ver 1.1 -%define licensedir %{_datadir}/licenses/%{nam}-%{ver} -%define ximrev 7.@SNAPSHOT_TAG@ - -Name: ooo1.1 -Version: 1.1 -Release: 0.ximian.6.7.@SNAPSHOT_TAG@ -Vendor: Ximian, Inc. -Distribution: Ximian GNOME for Red Hat Linux 9 / i386 -License: LGPL -BuildRoot: /var/tmp/%{nam}-%{ver}-root -Docdir: /usr/share/doc - -URL: http://ooo.ximian.com -Summary: OpenOffice.org Office Suite -Group: Applications/Office -Requires: fontconfig -Requires: perl-XML-Twig -Requires: gnome-cups-manager -Requires: gnome-vfs2 -Requires: ooo-fonts -Requires: unzip -Requires: libart_lgpl >= 2.3.13 -Provides: ximian-ooo1.1 = %{?epoch:%{epoch}:}%{version}-%{?ximrev:%{ximrev}}%{!?ximrev:%{release}} -Obsoletes: openoffice -Obsoletes: openoffice-skel -Obsoletes: openoffice-libs -Obsoletes: ooo-sys - -%description -OpenOffice.org is a Free software, Microsoft Office compatible, -productivity suite. It is the most powerful office suite -available on Free platforms. - -Usage: Use 'ooffice' to run the suite. - -%files -%defattr(-, root, root) -/etc/openoffice -/usr/lib/ooo-1.1/help/en -/usr/lib/ooo-1.1/help/main_transform.xsl -/usr/lib/ooo-1.1/LICENSE* -/usr/lib/ooo-1.1/README* -/usr/lib/ooo-1.1/install-dict -/usr/lib/ooo-1.1/program/a* -/usr/lib/ooo-1.1/program/b* -/usr/lib/ooo-1.1/program/c* -/usr/lib/ooo-1.1/program/f* -/usr/lib/ooo-1.1/program/g* -/usr/lib/ooo-1.1/program/i* -/usr/lib/ooo-1.1/program/j* -/usr/lib/ooo-1.1/program/l* -/usr/lib/ooo-1.1/program/m* -/usr/lib/ooo-1.1/program/n* -/usr/lib/ooo-1.1/program/o* -/usr/lib/ooo-1.1/program/p* -/usr/lib/ooo-1.1/program/reg* -/usr/lib/ooo-1.1/program/rem* -/usr/lib/ooo-1.1/program/s* -/usr/lib/ooo-1.1/program/t* -/usr/lib/ooo-1.1/program/u* -/usr/lib/ooo-1.1/program/resource/*01.res -/usr/bin/oo* -/usr/share/gnome/ximian/applications/*1.1.desktop -/usr/share/pixmaps/ximian-openoffice* -/usr/lib/ooo-1.1/user/autocorr -/usr/lib/ooo-1.1/user/autotext/english -/usr/lib/ooo-1.1/user/basic -/usr/lib/ooo-1.1/user/config -/usr/lib/ooo-1.1/user/database -/usr/lib/ooo-1.1/user/gallery -/usr/lib/ooo-1.1/user/plugin -/usr/lib/ooo-1.1/user/psprint -/usr/lib/ooo-1.1/user/store -/usr/lib/ooo-1.1/user/temp -/usr/lib/ooo-1.1/user/template -/usr/lib/ooo-1.1/user/uno_packages -/usr/lib/ooo-1.1/user/wordbook -/usr/lib/ooo-1.1/share/autocorr -/usr/lib/ooo-1.1/share/autotext/english -/usr/lib/ooo-1.1/share/basic -/usr/lib/ooo-1.1/share/config -/usr/lib/ooo-1.1/share/dtd -/usr/lib/ooo-1.1/share/dict -/usr/lib/ooo-1.1/share/gallery -/usr/lib/ooo-1.1/share/fonts -/usr/lib/ooo-1.1/share/psprint -/usr/lib/ooo-1.1/share/readme -/usr/lib/ooo-1.1/share/registry -/usr/lib/ooo-1.1/share/samples -/usr/lib/ooo-1.1/share/uno_packages -/usr/lib/ooo-1.1/share/template/english -/usr/lib/ooo-1.1/share/wordbook/english -/usr/lib/ooo-1.1/share/xslt - - -# $RPM_COMMAND is an environment variable used by the Ximian build -# system to control the build process with finer granularity than RPM -# normally allows. This specfile will function as expected by RPM if -# $RPM_COMMAND is unset. If you are not the Ximian build system, -# feel free to ignore it. - -%prep -case "${RPM_COMMAND:-all}" in -dist) - ;; -all) - ;; -esac -case "${RPM_COMMAND:-all}" in -dist|all) - ;; -esac - -%build -MAKE=${MAKE:-make} -RPM_COMMAND=${RPM_COMMAND:-all} -DESTDIR=${DESTDIR:-"$RPM_BUILD_ROOT"} -ARCH=%{_target_platform} -export MAKE RPM_COMMAND DESTDIR ARCH -case "$RPM_COMMAND" in -prepare|all) - (./configure --prefix=/usr --sysconfdir=/etc) - ;; -esac -case "$RPM_COMMAND" in -clean|all) - if [ "/" != "$DESTDIR" ]; then - rm -rf "$DESTDIR" - fi - ;; -esac -case "$RPM_COMMAND" in -build|all) - (make) - ;; -esac - -%install -MAKE=${MAKE:-make} -DESTDIR=${DESTDIR:-"$RPM_BUILD_ROOT"} -# export DESTDIR -case "${RPM_COMMAND:-all}" in -install|all) - (make DESTDIR=${DESTDIR} install) - ;; -esac - -%clean -DESTDIR=${DESTDIR:-"$RPM_BUILD_ROOT"} -export DESTDIR -case "${RPM_COMMAND:-all}" in -clean|all) - if [ "/" != "$DESTDIR" ]; then - rm -rf "$DESTDIR" - fi - ;; -esac - - -%changelog -* Fri Aug 8 2003 Ximian, Inc. - -- Version: 1.1-0.ximian.6.6.RC3_030729.35 -- Summary: New build. -- New automated build. - -* Wed Jun 11 2003 Ximian, Inc. - -- Version: [[ooversion]]-0.ximian.6.1 -- Summary: New build. -- New automated build. - diff --git a/scratch/sc-vba/POSITION b/scratch/sc-vba/POSITION deleted file mode 100644 index 66240cbb0..000000000 --- a/scratch/sc-vba/POSITION +++ /dev/null @@ -1 +0,0 @@ -sc/source/ui/vba diff --git a/scratch/sc-vba/ReadMe b/scratch/sc-vba/ReadMe deleted file mode 100644 index 28874d32c..000000000 --- a/scratch/sc-vba/ReadMe +++ /dev/null @@ -1,16 +0,0 @@ -This directory contains the sources for the scratch implementation of the -vba api. - -Instructions: -* Copy all files to the directory indicated by POSITION file in this directory -* run dmake in the directory specified by POSITION -* register the component library using regcomp - -example -======= - -regcomp -register -r file:///opt/ooo-build/InstallDir/program/services.rdb -c file:///opt/ooo-build//build/src680-m110/sc/unxlngi6.pro/lib/vbaobj680li.uno.so - - -Note: It is NECESSARY to specify "file://" urls for both the serivces.rdb file -& the component diff --git a/scratch/sc-vba/makefile.mk b/scratch/sc-vba/makefile.mk deleted file mode 100644 index 44c2b1f77..000000000 --- a/scratch/sc-vba/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -PRJ=../..$/.. - -PRJNAME= -TARGET=vbaobj -.IF "$(ENABLE_VBA)"!="YES" -dummy: - @echo "not building vba..." -.ENDIF - -NO_BSYMBOLIC= TRUE -ENABLE_EXCEPTIONS=TRUE -COMP1TYPELIST=$(TARGET) -COMPRDB=$(SOLARBINDIR)$/types.rdb - -# --- Settings ----------------------------------------------------- - -#.INCLUDE : svpre.mk -.INCLUDE : settings.mk -.INCLUDE : sv.mk -DLLPRE = - -# ------------------------------------------------------------------ - -#.INCLUDE : ..$/cppumaker.mk - -SLOFILES= \ - $(SLO)$/service.obj \ - $(SLO)$/vbaglobals.obj \ - $(SLO)$/vbaworkbook.obj \ - $(SLO)$/vbaworksheets.obj \ - $(SLO)$/vbaapplication.obj \ - $(SLO)$/vbarange.obj \ - $(SLO)$/vbaworkbooks.obj \ - $(SLO)$/vbaworksheet.obj \ - $(SLO)$/vbaoutline.obj \ - $(SLO)$/vbafont.obj\ - $(SLO)$/vbahelper.obj\ - $(SLO)$/vbainterior.obj\ - $(SLO)$/vbawsfunction.obj\ - $(SLO)$/vbawindow.obj\ - $(SLO)$/vbachart.obj\ - $(SLO)$/vbachartobject.obj\ - $(SLO)$/vbachartobjects.obj\ - $(SLO)$/vbaseriescollection.obj\ - $(SLO)$/vbacollectionimpl.obj\ - $(SLO)$/vbaarraywrapper.obj\ - $(SLO)$/vbadialogs.obj \ - $(SLO)$/vbadialog.obj \ - $(SLO)$/vbapivottable.obj \ - $(SLO)$/vbapivotcache.obj \ - $(SLO)$/vbapivottables.obj - - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/scratch/sc-vba/service.cxx b/scratch/sc-vba/service.cxx deleted file mode 100644 index 849ffe1a3..000000000 --- a/scratch/sc-vba/service.cxx +++ /dev/null @@ -1,88 +0,0 @@ -#include "cppuhelper/implementationentry.hxx" -#include "com/sun/star/lang/XMultiServiceFactory.hpp" -#include "com/sun/star/registry/XRegistryKey.hpp" - -// ============================================================================= -// component exports -// ============================================================================= -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; - -namespace vbaobj -{ - // ============================================================================= - // component operations - // ============================================================================= - - uno::Reference< XInterface > SAL_CALL create( - Reference< XComponentContext > const & xContext ) - SAL_THROW( () ); - - // ----------------------------------------------------------------------------- - - ::rtl::OUString SAL_CALL getImplementationName(); - - Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(); - - Reference<XInterface> SAL_CALL create( - Sequence<Any> const &, Reference<XComponentContext> const & ); -} // end namespace vbaobj - - - // ============================================================================= - - const ::cppu::ImplementationEntry s_component_entries [] = - { - { - ::vbaobj::create, ::vbaobj::getImplementationName, - ::vbaobj::getSupportedServiceNames, - ::cppu::createSingleComponentFactory, - 0, 0 - }, - { 0, 0, 0, 0, 0, 0 } - }; - -extern "C" -{ - void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) - { - OSL_TRACE("In component_getImplementationEnv"); - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; - } - - sal_Bool SAL_CALL component_writeInfo( - lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey ) - { - OSL_TRACE("In component_writeInfo"); - if ( ::cppu::component_writeInfoHelper( - pServiceManager, pRegistryKey, s_component_entries ) ) - { - try - { - registry::XRegistryKey * pKey = - reinterpret_cast< registry::XRegistryKey * >(pRegistryKey); - - Reference< registry::XRegistryKey >xKey = pKey->createKey( - rtl::OUString::createFromAscii( ("org.openoffice.vba.Globals/UNO/SINGLETONS/org.openoffice.vba.theGlobals") ) ); - xKey->setStringValue( ::rtl::OUString::createFromAscii( - ("org.openoffice.vba.Globals") ) ); - return sal_True; - } - catch( uno::Exception& e ) - { - //recomp & friends will detect false returned and fail - } - } - return sal_False; - } - - void * SAL_CALL component_getFactory( - const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager, - registry::XRegistryKey * pRegistryKey ) - { - OSL_TRACE("In component_getFactory"); - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, s_component_entries ); - } -} diff --git a/scratch/sc-vba/vbaapplication.cxx b/scratch/sc-vba/vbaapplication.cxx deleted file mode 100644 index 2b8cd23cd..000000000 --- a/scratch/sc-vba/vbaapplication.cxx +++ /dev/null @@ -1,185 +0,0 @@ - - -#include<com/sun/star/sheet/XSpreadsheetView.hpp> -#include<com/sun/star/view/XSelectionSupplier.hpp> -#include<org/openoffice/vba/Excel/XlCalculation.hpp> - -#include "vbaapplication.hxx" -#include "vbaworkbooks.hxx" -#include "vbaworkbook.hxx" -#include "vbaworksheets.hxx" -#include "vbarange.hxx" -#include "vbawsfunction.hxx" -#include "vbadialogs.hxx" -#include "vbawindow.hxx" - -#include "tabvwsh.hxx" - - - - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - -class ActiveWorkbook : public ScVbaWorkbook -{ -protected: - virtual uno::Reference< frame::XModel > getModel() - { - return getCurrentDocument(); - } -public: - ActiveWorkbook( uno::Reference< uno::XComponentContext >& xContext) : ScVbaWorkbook( xContext ){} -}; - -ScVbaApplication::ScVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): m_xContext( xContext ), m_xCalculation( vba::Excel::XlCalculation::xlCalculationAutomatic ) -{ -} - -ScVbaApplication::~ScVbaApplication() -{ -} - - -uno::Reference< vba::XWorkbook > -ScVbaApplication::getActiveWorkbook() throw (uno::RuntimeException) -{ - return new ActiveWorkbook( m_xContext ); -} -uno::Reference< oo::vba::XWorkbook > SAL_CALL -ScVbaApplication::getThisWorkbook() throw (uno::RuntimeException) -{ - return getActiveWorkbook(); -} - -uno::Reference< vba::XRange > -ScVbaApplication::getSelection() throw (uno::RuntimeException) -{ - uno::Reference< table::XCellRange > xRange( getCurrentDocument()->getCurrentSelection(), ::uno::UNO_QUERY); - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xRange ) ); -} - -uno::Reference< vba::XRange > -ScVbaApplication::getActiveCell() throw (uno::RuntimeException ) -{ - uno::Reference< sheet::XSpreadsheetView > xView( getCurrentDocument()->getCurrentController(), uno::UNO_QUERY_THROW ); - uno::Reference< table::XCellRange > xRange( xView->getActiveSheet(), ::uno::UNO_QUERY_THROW); - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( !pViewShell ) - throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewShell available"), uno::Reference< uno::XInterface >() ); - ScViewData* pTabView = pViewShell->GetViewData(); - if ( !pTabView ) - throw uno::RuntimeException( rtl::OUString::createFromAscii("No ViewData available"), uno::Reference< uno::XInterface >() ); - - sal_Int32 nCursorX = pTabView->GetCurX(); - sal_Int32 nCursorY = pTabView->GetCurY(); - - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xRange->getCellRangeByPosition( nCursorX, nCursorY, - nCursorX, nCursorY ) ) ); -} - -sal_Bool -ScVbaApplication::getScreenUpdating() throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - return !xModel->hasControllersLocked(); -} - -void -ScVbaApplication::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - if (bUpdate) - xModel->unlockControllers(); - else - xModel->lockControllers(); -} - -uno::Any SAL_CALL -ScVbaApplication::Workbooks( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - uno::Reference< vba::XCollection > xWorkBooks( new ScVbaWorkbooks( m_xContext ) ); - if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) - { - // void then somebody did Workbooks.something in vba - return uno::Any( xWorkBooks ); - } - - return uno::Any ( xWorkBooks->Item( aIndex ) ); -} - -uno::Reference< vba::XWorksheetFunction > SAL_CALL -ScVbaApplication::WorksheetFunction( ) throw (::com::sun::star::uno::RuntimeException) -{ - return new ScVbaWSFunction(m_xContext); -} - -uno::Any SAL_CALL -ScVbaApplication::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeException) -{ - // #TODO Evaluate allows other things to be evaluated, e.g. functions - // I think ( like SIN(3) etc. ) need to investigate that - // named Ranges also? e.g. [MyRange] if so need a list of named ranges - if ( isRangeShortCut( Name ) ) - return uno::Any( getActiveWorkbook()->getActiveSheet()->Range( uno::Any( Name ) ) ); - return uno::Any(); -} - -uno::Any -ScVbaApplication::Dialogs( const uno::Any &aIndex ) throw (uno::RuntimeException) -{ - uno::Reference< vba::XDialogs > xDialogs( new ScVbaDialogs( m_xContext ) ); - if( !aIndex.hasValue() ) - return uno::Any( xDialogs ); - return uno::Any( xDialogs->Item( aIndex ) ); -} - -uno::Reference< vba::XWindow > SAL_CALL -ScVbaApplication::getActiveWindow() throw (uno::RuntimeException) -{ - return new ScVbaWindow( m_xContext ); -} - -uno::Any SAL_CALL -ScVbaApplication::getCutCopyMode() throw (uno::RuntimeException) -{ - //# FIXME TODO, implementation - uno::Any result; - result <<= sal_False; - return result; -} -void SAL_CALL -ScVbaApplication::setCutCopyMode( const uno::Any& _cutcopymode ) throw (uno::RuntimeException) -{ - //# FIXME TODO, implementation -} -double SAL_CALL -ScVbaApplication::CountA( const uno::Any& arg1 ) throw (uno::RuntimeException) -{ - double result; - uno::Reference< vba::XWorksheetFunction > xWksFn = WorksheetFunction(); - uno::Reference< script::XInvocation > xInvoc( xWksFn, uno::UNO_QUERY_THROW ); - if ( xInvoc.is() ) - { - static rtl::OUString FunctionName( RTL_CONSTASCII_USTRINGPARAM("CountA" ) ); - uno::Sequence< uno::Any > Params(1); - Params[0] = arg1; - uno::Sequence< sal_Int16 > OutParamIndex; - uno::Sequence< uno::Any > OutParam; - xInvoc->invoke( FunctionName, Params, OutParamIndex, OutParam ) >>= result; - } - return result; -} - -::sal_Int32 SAL_CALL -ScVbaApplication::getCalculation() throw (css::uno::RuntimeException) -{ - return m_xCalculation; -} - -void SAL_CALL -ScVbaApplication::setCalculation( ::sal_Int32 _calculation ) throw (css::uno::RuntimeException) -{ - m_xCalculation = _calculation; -} - diff --git a/scratch/sc-vba/vbaapplication.hxx b/scratch/sc-vba/vbaapplication.hxx deleted file mode 100644 index 08caf2165..000000000 --- a/scratch/sc-vba/vbaapplication.hxx +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef SC_VBA_APPLICATION_HXX -#define SC_VBA_APPLICATION_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <org/openoffice/vba/XWorksheetFunction.hpp> -#include <org/openoffice/vba/XApplication.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1< oo::vba::XApplication > ScVbaApplication_BASE; - -class ScVbaApplication : public ScVbaApplication_BASE -{ -private: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - sal_Int32 m_xCalculation; -public: - ScVbaApplication( css::uno::Reference< css::uno::XComponentContext >& m_xContext ); - virtual ~ScVbaApplication(); - - // XApplication - virtual ::sal_Int32 SAL_CALL getCalculation() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCalculation( ::sal_Int32 _calculation ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > getSelection() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorkbook > getActiveWorkbook() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > getActiveCell() throw ( css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWindow > SAL_CALL getActiveWindow() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool getScreenUpdating() throw (css::uno::RuntimeException); - virtual void setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorkbook > SAL_CALL getThisWorkbook() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Workbooks( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorksheetFunction > SAL_CALL WorksheetFunction( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Dialogs( const css::uno::Any& DialogIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getCutCopyMode() throw (css::uno::RuntimeException); - virtual void SAL_CALL setCutCopyMode( const css::uno::Any& _cutcopymode ) throw (css::uno::RuntimeException); - - virtual double SAL_CALL CountA( const css::uno::Any& arg1 ) throw (css::uno::RuntimeException) ; - -}; -#endif /* SC_VBA_APPLICATION_HXX */ diff --git a/scratch/sc-vba/vbaarraywrapper.cxx b/scratch/sc-vba/vbaarraywrapper.cxx deleted file mode 100644 index 1c6dc36a4..000000000 --- a/scratch/sc-vba/vbaarraywrapper.cxx +++ /dev/null @@ -1,22 +0,0 @@ -#include "vbaarraywrapper.hxx" -using namespace ::org::openoffice; -using namespace ::com::sun::star; - -ScArrayWrapper::ScArrayWrapper( const uno::Any& aArray, sal_Bool bZeroBased ) : maArray( aArray ), mbZeroBased( bZeroBased ) -{ -} - - -sal_Bool SAL_CALL -ScArrayWrapper::getIsZeroIndex() throw (css::uno::RuntimeException) -{ - return mbZeroBased; -} - - -css::uno::Any SAL_CALL -ScArrayWrapper::getArray() throw (css::uno::RuntimeException) -{ - return maArray; -} - diff --git a/scratch/sc-vba/vbaarraywrapper.hxx b/scratch/sc-vba/vbaarraywrapper.hxx deleted file mode 100644 index 02e505ce0..000000000 --- a/scratch/sc-vba/vbaarraywrapper.hxx +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SC_VBA_ARRAYWRAPPER_HXX -#define SC_VBA_ARRAYWRAPPER_HXX -#include <cppuhelper/implbase1.hxx> -#include <org/openoffice/vba/XArrayWrapper.hpp> -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1<oo::vba::XArrayWrapper > ArrayWrapperImpl_BASE; - -class ScArrayWrapper : public ArrayWrapperImpl_BASE -{ - css::uno::Any maArray; - sal_Bool mbZeroBased; -public: - ScArrayWrapper( const css::uno::Any& aArray, sal_Bool bZeroBased ); - // Attributes - virtual ::sal_Bool SAL_CALL getIsZeroIndex() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getArray() throw (css::uno::RuntimeException); -}; - -#endif //SC_VBA_WINDOW_HXX diff --git a/scratch/sc-vba/vbachart.cxx b/scratch/sc-vba/vbachart.cxx deleted file mode 100644 index d3d24ad4e..000000000 --- a/scratch/sc-vba/vbachart.cxx +++ /dev/null @@ -1,29 +0,0 @@ -#include "vbachart.hxx" -#include <com/sun/star/beans/XPropertySet.hpp> - - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -const rtl::OUString CHART_NAME( RTL_CONSTASCII_USTRINGPARAM("Name") ); -::rtl::OUString SAL_CALL -ScVbaChart::getName() throw (css::uno::RuntimeException) -{ - rtl::OUString sName; - uno::Reference< beans::XPropertySet > xProps( m_xChartDoc, uno::UNO_QUERY_THROW ); - try - { - xProps->getPropertyValue( CHART_NAME ) >>= sName; - } - catch( uno::Exception e ) // swallow exceptions - { - } - return sName; -} - -uno::Any SAL_CALL -ScVbaChart::SeriesCollection(const uno::Any&) throw (uno::RuntimeException) -{ - return uno::Any(); -} - diff --git a/scratch/sc-vba/vbachart.hxx b/scratch/sc-vba/vbachart.hxx deleted file mode 100644 index 56a1c432b..000000000 --- a/scratch/sc-vba/vbachart.hxx +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef SC_VBA_CHART_HXX -#define SC_VBA_CHART_HXX -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/chart/XChartDocument.hpp> -#include <org/openoffice/vba/XChart.hpp> -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1<oo::vba::XChart > ChartImpl_BASE; - -class ScVbaChart : public ChartImpl_BASE -{ - - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::chart::XChartDocument > m_xChartDoc; -public: - ScVbaChart( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::chart::XChartDocument >& xChartDoc ) : m_xContext(xContext), m_xChartDoc( xChartDoc ) {} - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual css::uno::Any SeriesCollection(const css::uno::Any&) throw (css::uno::RuntimeException); - -}; - -#endif //SC_VBA_WINDOW_HXX diff --git a/scratch/sc-vba/vbachartobject.cxx b/scratch/sc-vba/vbachartobject.cxx deleted file mode 100644 index e88318db1..000000000 --- a/scratch/sc-vba/vbachartobject.cxx +++ /dev/null @@ -1,74 +0,0 @@ -#include "vbachart.hxx" -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> -#include <com/sun/star/container/XNamed.hpp> - -#include "vbachartobject.hxx" - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -const rtl::OUString CHART_NAME( RTL_CONSTASCII_USTRINGPARAM("Name") ); - -::rtl::OUString SAL_CALL -ScVbaChartObject::getName() throw (css::uno::RuntimeException) -{ - rtl::OUString sName; - uno::Reference< container::XNamed > xNamed( m_xTableChart, uno::UNO_QUERY ); - if ( xNamed.is() ) - sName = xNamed->getName(); - return sName; -} - - - -uno::Reference< vba::XChart > SAL_CALL -ScVbaChartObject::getChart() throw (css::uno::RuntimeException) -{ - uno::Reference< document::XEmbeddedObjectSupplier > xEmbed( m_xTableChart, uno::UNO_QUERY_THROW ); - uno::Reference< chart::XChartDocument > xChart( xEmbed->getEmbeddedObject(), uno::UNO_QUERY_THROW ); - - // #TODO check with vba to see whether its valid to return a - // null object for the Chart property. atm, we throw ( i.e. if in - // doubt... throw ) - - return new ScVbaChart( m_xContext, xChart ); -} -/* -#include<cppuhelper/implbase1.hxx> -#include<org/openoffice/vba/XChartObject.hpp> -#include"vbacollectionimpl.hxx" - -typedef ::cppu::ImplInheritanceHelper1< ScVbaCollectionBaseImpl, oo::vba::XChartObject > XSeriesCollectionBase; -class MyCollectionImpl : public XSeriesCollectionBase -{ -public: - //MyCollectionImpl( css::uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaCollectionBaseImpl( xContext ) {} - MyCollectionImpl( css::uno::Reference< css::uno::XComponentContext >& xContext ) : XSeriesCollectionBase( xContext ) {} - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException) - { - OSL_TRACE("**** In Get Name for mangled object"); - rtl::OUString dummy; - return dummy; - } - virtual css::uno::Any test() throw (css::uno::RuntimeException) - { - OSL_TRACE("**** In test for mangled object"); - return uno::Any(); - } - virtual css::uno::Reference< oo::vba::XChart > SAL_CALL getChart() throw (css::uno::RuntimeException) - { - OSL_TRACE("**** In getChart for mangled object"); - return css::uno::Reference< oo::vba::XChart >(); - } - -}; -*/ - -uno::Any SAL_CALL -ScVbaChartObject::test()throw (css::uno::RuntimeException) -{ - return uno::Any(); -} - - diff --git a/scratch/sc-vba/vbachartobject.hxx b/scratch/sc-vba/vbachartobject.hxx deleted file mode 100644 index cee5103f2..000000000 --- a/scratch/sc-vba/vbachartobject.hxx +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SC_VBA_CHARTOBJECT_HXX -#define SC_VBA_CHARTOBJECT_HXX -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/table/XTableChart.hpp> -#include <org/openoffice/vba/XChartObject.hpp> -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1<oo::vba::XChartObject > ChartObjectImpl_BASE; - -class ScVbaChartObject : public ChartObjectImpl_BASE -{ - - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::table::XTableChart > m_xTableChart; -public: - ScVbaChartObject( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XTableChart >& xTableChart ) : m_xContext(xContext), m_xTableChart( xTableChart ) {} - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XChart > SAL_CALL getChart() throw (css::uno::RuntimeException); - - virtual css::uno::Any SAL_CALL test( ) throw (css::uno::RuntimeException); -}; - -#endif //SC_VBA_WINDOW_HXX diff --git a/scratch/sc-vba/vbachartobjects.cxx b/scratch/sc-vba/vbachartobjects.cxx deleted file mode 100644 index 0f7911a12..000000000 --- a/scratch/sc-vba/vbachartobjects.cxx +++ /dev/null @@ -1,52 +0,0 @@ -#include "vbachart.hxx" -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> - - -#include "vbachartobjects.hxx" -#include "vbachartobject.hxx" -#include "vbaglobals.hxx" - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - - -class ChartObjectEnumerationImpl : public EnumerationHelperImpl -{ -public: - - ChartObjectEnumerationImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ) {} - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - uno::Reference< table::XTableChart > xTableChart( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); - return makeAny( uno::Reference< vba::XChartObject > ( new ScVbaChartObject( m_xContext, xTableChart ) ) ); - } -}; - - - -// XEnumerationAccess - -uno::Reference< container::XEnumeration > -ScVbaChartObjects::createEnumeration() throw (uno::RuntimeException) -{ - css::uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xTableCharts, uno::UNO_QUERY_THROW ); - return new ChartObjectEnumerationImpl( m_xContext, xEnumAccess->createEnumeration() ); -} - -// XElementAccess - -uno::Type -ScVbaChartObjects::getElementType() throw (uno::RuntimeException) -{ - return vba::XChartObject::static_type(0); -} - -// ScVbaCollectionBaseImpl -uno::Any -ScVbaChartObjects::createCollectionObject( const css::uno::Any& aSource ) -{ - uno::Reference< table::XTableChart > xTableChart( aSource, uno::UNO_QUERY_THROW ); - return makeAny( uno::Reference< vba::XChartObject > ( new ScVbaChartObject( m_xContext, xTableChart ) ) ); -} - diff --git a/scratch/sc-vba/vbachartobjects.hxx b/scratch/sc-vba/vbachartobjects.hxx deleted file mode 100644 index 0a196ff08..000000000 --- a/scratch/sc-vba/vbachartobjects.hxx +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef SC_VBA_CHARTOBJECTS_HXX -#define SC_VBA_CHARTOBJECTS_HXX -#include <org/openoffice/vba/XChartObjects.hpp> -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/table/XTableCharts.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include"vbacollectionimpl.hxx" -#include "vbahelper.hxx" - - -typedef ::cppu::ImplInheritanceHelper1< ScVbaCollectionBaseImpl, oo::vba::XChartObjects > ChartObjects_BASE; - -class ScVbaChartObjects : public ChartObjects_BASE -{ - - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::table::XTableCharts > m_xTableCharts; -public: - ScVbaChartObjects( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XTableCharts >& xTableCharts ) : ChartObjects_BASE(xContext, css::uno::Reference< css::container::XIndexAccess >( xTableCharts, css::uno::UNO_QUERY ) ), m_xContext(xContext), m_xTableCharts( xTableCharts ) {} - // XEnumerationAccess - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - // XElementAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); -}; - -#endif //SC_VBA_WINDOW_HXX diff --git a/scratch/sc-vba/vbacollectionimpl.cxx b/scratch/sc-vba/vbacollectionimpl.cxx deleted file mode 100644 index 560b91e44..000000000 --- a/scratch/sc-vba/vbacollectionimpl.cxx +++ /dev/null @@ -1,103 +0,0 @@ -#include <vbacollectionimpl.hxx> -#include "vbaglobals.hxx" -using namespace ::com::sun::star; -using namespace ::org::openoffice; - - -ScVbaCollectionBaseImpl::ScVbaCollectionBaseImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ) throw (uno::RuntimeException) : m_xContext( xContext ), m_xIndexAccess( xIndexAccess ) -{ - m_xNameAccess.set( xIndexAccess, uno::UNO_QUERY_THROW ); - if ( !m_xIndexAccess.is() || !m_xNameAccess.is() ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBaseImpl not initialised") ), uno::Reference< uno::XInterface >() ); -} - -uno::Any -ScVbaCollectionBaseImpl::getItemByStringIndex( const rtl::OUString& sIndex ) throw (::uno::RuntimeException) -{ - return createCollectionObject( m_xNameAccess->getByName( sIndex ) ); -} - -uno::Any -ScVbaCollectionBaseImpl::getItemByIntIndex( const sal_Int32 nIndex ) throw (uno::RuntimeException) -{ - if ( nIndex <= 0 ) - { - throw lang::IndexOutOfBoundsException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "index is 0 or negative" ) ), - uno::Reference< uno::XInterface >() ); - } - // need to adjust for vba index ( for which first element is 1 ) - return createCollectionObject( m_xIndexAccess->getByIndex( nIndex - 1 ) ); -} - -::sal_Int32 SAL_CALL -ScVbaCollectionBaseImpl::getCount() throw (uno::RuntimeException) -{ - return m_xIndexAccess->getCount(); -} - -uno::Any SAL_CALL -ScVbaCollectionBaseImpl::getParent() throw (uno::RuntimeException) -{ - // #TODO #FIXME investigate whether this makes sense - uno::Reference< vba::XApplication > xApplication = - ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); - uno::Reference< vba::XWorkbook > xWorkbook; - if ( xApplication.is() ) - { - xWorkbook = xApplication->getActiveWorkbook(); - } - return uno::Any( xWorkbook ); -} - -::sal_Int32 SAL_CALL ScVbaCollectionBaseImpl::getCreator() throw (uno::RuntimeException) -{ - SC_VBA_STUB(); - return 0; -} -uno::Reference< vba::XApplication > SAL_CALL ScVbaCollectionBaseImpl::getApplication() throw (uno::RuntimeException) -{ - // #TODO #FIXME investigate whether this makes sense - uno::Reference< vba::XApplication > xApplication = - ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); - return xApplication; -} - -uno::Any SAL_CALL ScVbaCollectionBaseImpl::Item( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - if ( aIndex.getValueTypeClass() != uno::TypeClass_STRING ) - { - sal_Int32 nIndex = 0; - - if ( ( aIndex >>= nIndex ) != sal_True ) - { - rtl::OUString message; - message = rtl::OUString::createFromAscii( - "Couldn't convert index to Int32"); - throw lang::IndexOutOfBoundsException( message, - uno::Reference< uno::XInterface >() ); - } - return getItemByIntIndex( nIndex ); - } - rtl::OUString aStringSheet; - - aIndex >>= aStringSheet; - return getItemByStringIndex( aStringSheet ); -} - -/* - // XEnumerationAccess -uno::Reference< container::XEnumeration > SAL_CALL ScVbaCollectionBaseImpl::createEnumeration() throw (uno::RuntimeException) -{ - return uno::Reference< container::XEnumeration > (); -} -*/ - // XElementAccess - -::sal_Bool SAL_CALL ScVbaCollectionBaseImpl::hasElements() throw (uno::RuntimeException) -{ - return ( m_xIndexAccess->getCount() > 0 ); -} - - diff --git a/scratch/sc-vba/vbacollectionimpl.hxx b/scratch/sc-vba/vbacollectionimpl.hxx deleted file mode 100644 index 43269eeff..000000000 --- a/scratch/sc-vba/vbacollectionimpl.hxx +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SC_VBA_COLLECTION_IMPL_HXX -#define SC_VBA_COLLECTION_IMPL_HXX - -#include <org/openoffice/vba/XCollection.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/container/XNameAccess.hpp> - -#include <cppuhelper/implbase2.hxx> -#include <cppuhelper/implbase1.hxx> - -#include "vbahelper.hxx" - - -typedef ::cppu::WeakImplHelper1< css::container::XEnumeration > EnumerationHelper_BASE; - -class EnumerationHelperImpl : public EnumerationHelper_BASE -{ -protected: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::container::XEnumeration > m_xEnumeration; -public: - - EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xEnumeration( xEnumeration ), m_xContext( xContext ) { } - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); } - //virtual css::uno::Any SAL_CALL nextElement( ) throw (css::container::NoSuchElementException, css::lang::WrappedTargetException, css::uno::RuntimeException) = 0; -}; - - - -typedef ::cppu::WeakImplHelper2<oo::vba::XCollection, -css::container::XEnumerationAccess > XCollection_BASE; - -class ScVbaCollectionBaseImpl : public XCollection_BASE -{ -protected: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - - css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess; - css::uno::Reference< css::container::XNameAccess > m_xNameAccess; - - virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException); - - virtual css::uno::Any getItemByIntIndex( const sal_Int32 nIndex ) throw (css::uno::RuntimeException); -public: - ScVbaCollectionBaseImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ); - - //XCollection - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getParent() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getCreator() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XApplication > SAL_CALL getApplication() throw (css::uno::RuntimeException); - - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - - // XEnumerationAccess - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException) = 0; - - // XElementAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException) = 0; - - virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException); - - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ) = 0; - -}; -#endif //SC_VBA_COLLECTION_IMPL_HXX diff --git a/scratch/sc-vba/vbadialog.cxx b/scratch/sc-vba/vbadialog.cxx deleted file mode 100644 index fedb5de19..000000000 --- a/scratch/sc-vba/vbadialog.cxx +++ /dev/null @@ -1,104 +0,0 @@ -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <org/openoffice/vba/XApplication.hpp> - -#include <tools/string.hxx> - -#include "vbahelper.hxx" -#include "vbadialog.hxx" -#include "vbaglobals.hxx" - -using namespace ::org::openoffice; -using namespace ::org::openoffice::vba; -using namespace ::com::sun::star; - -// fails silently -void -ScVbaDialog::Show() throw(uno::RuntimeException) -{ - rtl::OUString aURL; - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - if ( xModel.is() ) - { - aURL = mapIndexToName( mnIndex ); - if( aURL.getLength() ) - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ), - uno::Reference< XInterface > () ); - dispatchRequests( xModel, aURL ); - } -} - -uno::Any -ScVbaDialog::getParent() throw (uno::RuntimeException) -{ - uno::Reference< vba::XGlobals > xGlobals = ScVbaGlobals::getGlobalsImpl( m_xContext ); - uno::Reference< vba::XApplication > xApplication = xGlobals->getApplication(); - if ( !xApplication.is() ) - { - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaDialgs::getParent: Couldn't access Application object") ),uno::Reference< XInterface >() ); - } - return uno::Any(xApplication); -} - -::sal_Int32 -ScVbaDialog::getCreator() throw (uno::RuntimeException) -{ - SC_VBA_STUB(); - return 0; -} -uno::Reference< vba::XApplication > -ScVbaDialog::getApplication() throw (uno::RuntimeException) -{ - uno::Reference< vba::XApplication > xApplication = ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); - if ( !xApplication.is() ) - { - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaWorkbooks::getParent: Couldn't access Application object" ) ), - uno::Reference< XInterface >() ); - } - return xApplication; -} - -static const rtl::OUString aStringList[]= -{ - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Open" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FormatCellDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertCell" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Print" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PasteSpecial" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ToolProtectionDocument" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ColumnWidth" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineName" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConfigureDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:HyperlinkDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertGraphic" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:InsertObject" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:PageFormatDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataSort" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:RowHeight" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoCorrectDlg" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:ConditionalFormatDialog" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataConsolidate" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CreateNames" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:FillSeries" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Validation") ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DefineLabelRange" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterAutoFilter" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:DataFilterSpecialFilter" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:AutoFormat" ) ) -}; - -const sal_Int32 nSize = sizeof( aStringList ) / sizeof( aStringList[ 0 ] ); - -rtl::OUString -ScVbaDialog::mapIndexToName( sal_Int32 nIndex ) -{ - if( nIndex < nSize ) - return aStringList[ nIndex ]; - return rtl::OUString(); -} - diff --git a/scratch/sc-vba/vbadialog.hxx b/scratch/sc-vba/vbadialog.hxx deleted file mode 100644 index 9fd8732d5..000000000 --- a/scratch/sc-vba/vbadialog.hxx +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SC_VBA_DIALOG_HXX -#define SC_VBA_DIALOG_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <org/openoffice/vba/XGlobals.hpp> -#include <org/openoffice/vba/XApplication.hpp> -#include <org/openoffice/vba/XDialog.hpp> - -#include "vbahelper.hxx" -#include "vbadialog.hxx" - -typedef ::cppu::WeakImplHelper1< oo::vba::XDialog > ScVbaDialog_BASE; - -class ScVbaDialog : public ScVbaDialog_BASE -{ - sal_Int32 mnIndex; - css::uno::Reference< css::uno::XComponentContext > m_xContext; -public: - ScVbaDialog( sal_Int32 nIndex, css::uno::Reference< css::uno::XComponentContext > xContext ): - mnIndex( nIndex ), - m_xContext( xContext ) {} - virtual ~ScVbaDialog() {} - - // Attributes - virtual css::uno::Reference< oo::vba::XApplication > SAL_CALL getApplication() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getParent() throw (css::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getCreator() throw(css::uno::RuntimeException); - // Methods - virtual void SAL_CALL Show() throw (css::uno::RuntimeException); - rtl::OUString mapIndexToName( sal_Int32 nIndex ); -}; - -#endif /* SC_VBA_DIALOG_HXX */ diff --git a/scratch/sc-vba/vbadialogs.cxx b/scratch/sc-vba/vbadialogs.cxx deleted file mode 100644 index 6157ae939..000000000 --- a/scratch/sc-vba/vbadialogs.cxx +++ /dev/null @@ -1,69 +0,0 @@ -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <org/openoffice/vba/XApplication.hpp> -#include <org/openoffice/vba/XDialog.hpp> - -#include <tools/string.hxx> - -#include "vbahelper.hxx" -#include "vbadialogs.hxx" -#include "vbaglobals.hxx" -#include "vbadialog.hxx" - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - -void -ScVbaDialogs::Dummy() throw (uno::RuntimeException) -{ -} - -uno::Any -ScVbaDialogs::getParent() throw (uno::RuntimeException) -{ - uno::Reference< vba::XGlobals > xGlobals = ScVbaGlobals::getGlobalsImpl( m_xContext ); - uno::Reference< vba::XApplication > xApplication = xGlobals->getApplication(); - if ( !xApplication.is() ) - { - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaWorkbooks::getParent: Couldn't access Application object") ),uno::Reference< XInterface >() ); - } - return uno::Any(xApplication); -} - -::sal_Int32 -ScVbaDialogs::getCreator() throw (uno::RuntimeException) -{ - SC_VBA_STUB(); - return 0; -} -uno::Reference< vba::XApplication > -ScVbaDialogs::getApplication() throw (uno::RuntimeException) -{ - uno::Reference< vba::XApplication > xApplication = ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); - if ( !xApplication.is() ) - { - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ScVbaWorkbooks::getParent: Couldn't access Application object" ) ), - uno::Reference< XInterface >() ); - } - return xApplication; -} - -::sal_Int32 -ScVbaDialogs::getCount() throw (uno::RuntimeException) -{ - SC_VBA_STUB(); - return 0; -} - -uno::Any -ScVbaDialogs::Item( const uno::Any &aItem ) throw (uno::RuntimeException) -{ - sal_Int32 nIndex; - aItem >>= nIndex; - uno::Reference< vba::XDialog > aDialog( new ScVbaDialog( nIndex, m_xContext ) ); - return uno::Any( aDialog ); -} diff --git a/scratch/sc-vba/vbadialogs.hxx b/scratch/sc-vba/vbadialogs.hxx deleted file mode 100644 index 2fbb7e735..000000000 --- a/scratch/sc-vba/vbadialogs.hxx +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef SC_VBA_DIALOGS_HXX -#define SC_VBA_DIALOGS_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/uno/XComponentContext.hpp> -#include <org/openoffice/vba/XDialogs.hpp> -#include <org/openoffice/vba/XCollection.hpp> - -class ScModelObj; - -typedef ::cppu::WeakImplHelper1< oo::vba::XDialogs > ScVbaDialogs_BASE; - -class ScVbaDialogs : public ScVbaDialogs_BASE -{ - css::uno::Reference< css::uno::XComponentContext > & m_xContext; -public: - ScVbaDialogs( css::uno::Reference< css::uno::XComponentContext > &xContext ): - m_xContext( xContext ) {} - virtual ~ScVbaDialogs() {} - - // XCollection - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getParent() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getCreator() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XApplication > SAL_CALL getApplication() - throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - - // XDialogs - virtual void SAL_CALL Dummy() throw (css::uno::RuntimeException); -}; - -#endif /* SC_VBA_DIALOGS_HXX */ diff --git a/scratch/sc-vba/vbafont.cxx b/scratch/sc-vba/vbafont.cxx deleted file mode 100644 index a55030640..000000000 --- a/scratch/sc-vba/vbafont.cxx +++ /dev/null @@ -1,112 +0,0 @@ -#include <com/sun/star/beans/XProperty.hpp> -#include <com/sun/star/awt/FontWeight.hpp> -#include <com/sun/star/awt/FontUnderline.hpp> -#include <com/sun/star/awt/FontStrikeout.hpp> -#include <com/sun/star/awt/FontSlant.hpp> -#include "vbafont.hxx" - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - -void -ScVbaFont::setBold( sal_Bool bValue ) throw( uno::RuntimeException ) -{ - double fBoldValue = awt::FontWeight::NORMAL; - if( bValue ) - fBoldValue = awt::FontWeight::BOLD; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ), ( uno::Any )fBoldValue ); - -} - -sal_Bool -ScVbaFont::getBold() throw ( uno::RuntimeException ) -{ - double fValue; - uno::Any aValue = mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharWeight" ) ) ); - aValue >>= fValue; - return( fValue == awt::FontWeight::BOLD ); -} - -void -ScVbaFont::setUnderline( sal_Bool bValue ) throw ( uno::RuntimeException ) -{ - short nValue = awt::FontUnderline::NONE; - if( bValue ) - nValue = awt::FontUnderline::SINGLE; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ), ( uno::Any )nValue ); -} - -sal_Bool -ScVbaFont::getUnderline() throw ( uno::RuntimeException ) -{ - short nValue = 0; - uno::Any aValue = mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharUnderline" ) ) ); - aValue >>= nValue; - return( nValue == awt::FontUnderline::SINGLE ); -} - -void -ScVbaFont::setStrikethrough( sal_Bool bValue ) throw ( uno::RuntimeException ) -{ - short nValue = awt::FontStrikeout::NONE; - if( bValue ) - nValue = awt::FontStrikeout::SINGLE; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ), ( uno::Any )nValue ); -} - -sal_Bool -ScVbaFont::getStrikethrough() throw ( uno::RuntimeException ) -{ - short nValue = 0; - uno::Any aValue = mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharStrikeout" ) ) ); - aValue >>= nValue; - return( nValue == awt::FontStrikeout::SINGLE ); -} - -void -ScVbaFont::setShadow( sal_Bool bValue ) throw ( uno::RuntimeException ) -{ - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ), ( uno::Any )bValue ); -} - -sal_Bool -ScVbaFont::getShadow() throw (uno::RuntimeException) -{ - sal_Bool bValue = false; - uno::Any aValue = mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharShadowed" ) ) ); - aValue >>= bValue; - return bValue; -} - -void -ScVbaFont::setItalic( sal_Bool bValue ) throw ( uno::RuntimeException ) -{ - short nValue = awt::FontSlant_NONE; - if( bValue ) - nValue = awt::FontSlant_ITALIC; - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ), ( uno::Any )nValue ); -} - -sal_Bool -ScVbaFont::getItalic() throw ( uno::RuntimeException ) -{ - short nValue = 0; - uno::Any aValue = mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharPosture" ) ) ); - aValue >>= nValue; - return( nValue == awt::FontSlant_ITALIC ); -} - -void -ScVbaFont::setName( const ::rtl::OUString &rString ) throw ( uno::RuntimeException ) -{ - mxFont->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ), ( uno::Any )rString ); -} - -::rtl::OUString -ScVbaFont::getName() throw ( uno::RuntimeException ) -{ - ::rtl::OUString rString; - uno::Any aValue = mxFont->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharFontName" ) ) ); - aValue >>= rString; - return rString; -} diff --git a/scratch/sc-vba/vbafont.hxx b/scratch/sc-vba/vbafont.hxx deleted file mode 100644 index 2444908b4..000000000 --- a/scratch/sc-vba/vbafont.hxx +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef SC_VBA_FONT_HXX -#define SC_VBA_FONT_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <org/openoffice/vba/XFont.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include "vbahelper.hxx" - -class ScTableSheetsObj; - -typedef ::cppu::WeakImplHelper1< oo::vba::XFont > ScVbaFont_BASE; - -class ScVbaFont : public ScVbaFont_BASE -{ - css::uno::Reference< css::beans::XPropertySet > mxFont; -public: - ScVbaFont( css::uno::Reference< css::beans::XPropertySet > xPropertySet ) throw ( css::uno::RuntimeException ) : - mxFont( xPropertySet, css::uno::UNO_QUERY_THROW ){} - virtual ~ScVbaFont() {} - - // Attributes - virtual void SAL_CALL setBold( sal_Bool bValue ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getBold() throw (css::uno::RuntimeException); - virtual void SAL_CALL setUnderline( sal_Bool bValue ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getUnderline() throw (css::uno::RuntimeException); - virtual void SAL_CALL setStrikethrough( sal_Bool bValue ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getStrikethrough() throw (css::uno::RuntimeException); - virtual void SAL_CALL setShadow( sal_Bool bValue ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getShadow() throw (css::uno::RuntimeException); - virtual void SAL_CALL setItalic( sal_Bool bValue ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getItalic() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const ::rtl::OUString &rString ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString getName() throw (css::uno::RuntimeException); -}; - -#endif /* SC_VBA_FONT_HXX */ - diff --git a/scratch/sc-vba/vbaglobals.cxx b/scratch/sc-vba/vbaglobals.cxx deleted file mode 100644 index a7a868576..000000000 --- a/scratch/sc-vba/vbaglobals.cxx +++ /dev/null @@ -1,203 +0,0 @@ -#ifndef SC_VBA_GLOBALS -#include "vbaglobals.hxx" -#endif - -#include <com/sun/star/lang/XMultiComponentFactory.hpp> - -#include "vbaapplication.hxx" -#include "vbaworksheet.hxx" - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::org::openoffice; - - - -namespace vbaobj -{ - ::rtl::OUString SAL_CALL getImplementationName() - { - static ::rtl::OUString* pImplName = 0; - if ( !pImplName ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !pImplName ) - { - static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.vba.Globals" ) ); - pImplName = &aImplName; - } - } - return *pImplName; - } - - uno::Reference< XInterface > SAL_CALL create( - Reference< XComponentContext > const & xContext ) - SAL_THROW( () ) - { - OSL_TRACE("In create component for vbaglobals"); - return static_cast< lang::XTypeProvider * >( new ScVbaGlobals( xContext ) ); - } - - Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() - { - const ::rtl::OUString strName( ::vbaobj::getImplementationName() ); - return Sequence< ::rtl::OUString >( &strName, 1 ); - } -} - -// ============================================================================= -// ScVbaGlobals -// ============================================================================= - -ScVbaGlobals::ScVbaGlobals( const Reference< XComponentContext >& rxContext ) - :m_xContext( rxContext ) -{ -// OSL_TRACE("ScVbaGlobals::ScVbaGlobals()"); - mxApplication = uno::Reference< vba::XApplication > ( new ScVbaApplication( m_xContext) ); -} - -ScVbaGlobals::~ScVbaGlobals() -{ -// OSL_TRACE("ScVbaGlobals::~ScVbaGlobals"); -} - -// Will throw if singleton can't be accessed -uno::Reference< vba::XGlobals > -ScVbaGlobals::getGlobalsImpl( uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) -{ - uno::Reference< vba::XGlobals > xGlobals( - xContext->getValueByName( ::rtl::OUString::createFromAscii( - "/singletons/org.openoffice.vba.theGlobals") ), uno::UNO_QUERY); - - if ( !xGlobals.is() ) - { - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Couldn't access Globals" ) ), - uno::Reference< XInterface >() ); - } - return xGlobals; -} - -// ----------------------------------------------------------------------------- -// XServiceInfo -// ----------------------------------------------------------------------------- - -::rtl::OUString ScVbaGlobals::getImplementationName( ) throw (RuntimeException) -{ - return ::vbaobj::getImplementationName(); -} - -sal_Bool ScVbaGlobals::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) -{ - Sequence< ::rtl::OUString > aNames( ::vbaobj::getSupportedServiceNames() ); - const ::rtl::OUString* pNames = aNames.getConstArray(); - const ::rtl::OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; -} - -Sequence< ::rtl::OUString > ScVbaGlobals::getSupportedServiceNames( ) throw (RuntimeException) -{ - return vbaobj::getSupportedServiceNames(); -} - -// ============================================================================= -// XGlobals -// ============================================================================= -uno::Reference<vba::XApplication > -ScVbaGlobals::getApplication() throw (uno::RuntimeException) -{ -// OSL_TRACE("In ScVbaGlobals::getApplication"); - return mxApplication; -} - -uno::Reference< vba::XWorkbook > SAL_CALL -ScVbaGlobals::getActiveWorkbook() throw (uno::RuntimeException) -{ -// OSL_TRACE("In ScVbaGlobals::getActiveWorkbook"); - uno::Reference< vba::XWorkbook > xWorkbook( mxApplication->getActiveWorkbook(), uno::UNO_QUERY); - if ( xWorkbook.is() ) - { - return xWorkbook; - } -// FIXME check if this is correct/desired behavior - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "No activeWorkbook available" ), Reference< uno::XInterface >() ); -} - - -uno::Reference< vba::XWorksheet > SAL_CALL -ScVbaGlobals::getActiveSheet() throw (uno::RuntimeException) -{ -// OSL_TRACE("ScVbaGlobals::getActiveSheet()"); - uno::Reference< vba::XWorksheet > result; - uno::Reference< vba::XWorkbook > xWorkbook( - mxApplication->getActiveWorkbook(), uno::UNO_QUERY ); - if ( xWorkbook.is() ) - { - uno::Reference< vba::XWorksheet > xWorksheet( - xWorkbook->getActiveSheet(), uno::UNO_QUERY ); - if ( xWorksheet.is() ) - { - result = xWorksheet; - } - } - - if ( !result.is() ) - { - // Fixme - check if this is reasonable/desired behavior - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "No activeSheet available" ), Reference< uno::XInterface >() ); - } - return result; -} - -uno::Any SAL_CALL -ScVbaGlobals::WorkBooks( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - return uno::Any( mxApplication->Workbooks(aIndex) ); -} - -uno::Any SAL_CALL -ScVbaGlobals::WorkSheets(const uno::Any& aIndex) throw (uno::RuntimeException) -{ -// OSL_TRACE("ScVbaGlobals::getWorkSheets()"); - uno::Reference< vba::XWorkbook > xWorkbook( mxApplication->getActiveWorkbook(), uno::UNO_QUERY ); - uno::Any result; - if ( xWorkbook.is() ) - result = xWorkbook->Worksheets( aIndex ); - - else - // Fixme - check if this is reasonable/desired behavior - throw uno::RuntimeException( rtl::OUString::createFromAscii( - "No ActiveWorkBook available" ), Reference< uno::XInterface >() ); - - return result; -} -uno::Any SAL_CALL -ScVbaGlobals::Sheets( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - return WorkSheets( aIndex ); -} - -::uno::Sequence< ::uno::Any > SAL_CALL -ScVbaGlobals::getGlobals( ) throw (::uno::RuntimeException) -{ - sal_uInt32 nMax = 0; - uno::Sequence< uno::Any > maGlobals(4); - maGlobals[ nMax++ ] <<= ScVbaGlobals::getGlobalsImpl(m_xContext); - maGlobals[ nMax++ ] <<= mxApplication; - - uno::Reference< vba::XWorkbook > xWorkbook = mxApplication->getActiveWorkbook(); - if( xWorkbook.is() ) - { - maGlobals[ nMax++ ] <<= xWorkbook; - uno::Reference< vba::XWorksheet > xWorksheet = xWorkbook->getActiveSheet(); - if( xWorksheet.is() ) - maGlobals[ nMax++ ] <<= xWorksheet; - } - maGlobals.realloc( nMax ); - return maGlobals; -} diff --git a/scratch/sc-vba/vbaglobals.hxx b/scratch/sc-vba/vbaglobals.hxx deleted file mode 100644 index 94a7cdc44..000000000 --- a/scratch/sc-vba/vbaglobals.hxx +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef SC_VBA_GLOBALS -#define SC_VBA_GLOBALS - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <org/openoffice/vba/XGlobals.hpp> - -#include <cppuhelper/implbase2.hxx> -#include "vbahelper.hxx" - - // ============================================================================= - // class ScVbaGlobals - // ============================================================================= - - typedef ::cppu::WeakImplHelper2< - oo::vba::XGlobals, - css::lang::XServiceInfo > ScVbaGlobals_BASE; - - - class ScVbaGlobals : public ScVbaGlobals_BASE - { - private: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< oo::vba::XApplication > mxApplication; - public: - - ScVbaGlobals( - const css::uno::Reference< css::uno::XComponentContext >& rxContext ); - virtual ~ScVbaGlobals(); - - static css::uno::Reference< oo::vba::XGlobals > getGlobalsImpl(css::uno::Reference< css::uno::XComponentContext >& ) throw (css::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) - throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) - throw (css::uno::RuntimeException); - virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) - throw (css::uno::RuntimeException); - - // XGlobals - virtual css::uno::Reference< - oo::vba::XApplication > SAL_CALL getApplication() - throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorkbook > SAL_CALL getActiveWorkbook() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL WorkSheets(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL WorkBooks(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Sheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Sequence< css::uno::Any > SAL_CALL getGlobals( ) throw (css::uno::RuntimeException); - - - }; -#endif // diff --git a/scratch/sc-vba/vbahelper.cxx b/scratch/sc-vba/vbahelper.cxx deleted file mode 100644 index 0b4377fb4..000000000 --- a/scratch/sc-vba/vbahelper.cxx +++ /dev/null @@ -1,294 +0,0 @@ -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XController.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - -#include <sfx2/objsh.hxx> -#include <sfx2/app.hxx> - -#include <docuno.hxx> - -#include <basic/sbx.hxx> - -#include "vbahelper.hxx" -#include "tabvwsh.hxx" -#include "transobj.hxx" - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -void unoToSbxValue( SbxVariable* pVar, const uno::Any& aValue ); - -uno::Any sbxToUnoValue( SbxVariable* pVar ); - -const ::rtl::OUString REPLACE_CELLS_WARNING( RTL_CONSTASCII_USTRINGPARAM( "ReplaceCellsWarning")); - -class PasteCellsWarningReseter -{ -private: - bool bInitialWarningState; - static uno::Reference< beans::XPropertySet > getGlobalSheetSettings() throw ( uno::RuntimeException ) - { - static uno::Reference<uno::XComponentContext > xContext( ::cppu::defaultBootstrap_InitialComponentContext(), uno::UNO_QUERY_THROW ); - static uno::Reference<lang::XMultiComponentFactory > xServiceManager( - xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - static uno::Reference< beans::XPropertySet > xProps( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sheet.GlobalSheetSettings" ) ) ,xContext ), uno::UNO_QUERY_THROW ); - return xProps; - } - - bool getReplaceCellsWarning() throw ( uno::RuntimeException ) - { - sal_Bool res = sal_False; - getGlobalSheetSettings()->getPropertyValue( REPLACE_CELLS_WARNING ) >>= res; - return ( res == sal_True ); - } - - void setReplaceCellsWarning( bool bState ) throw ( uno::RuntimeException ) - { - getGlobalSheetSettings()->setPropertyValue( REPLACE_CELLS_WARNING, uno::makeAny( bState ) ); - } -public: - PasteCellsWarningReseter() throw ( uno::RuntimeException ) - { - if ( bInitialWarningState = getReplaceCellsWarning() ); - setReplaceCellsWarning( false ); - } - ~PasteCellsWarningReseter() - { - if ( bInitialWarningState ) - { - // don't allow dtor to throw - try - { - setReplaceCellsWarning( true ); - } - catch ( uno::Exception& e ){} - } - } -}; -void -org::openoffice::dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl, uno::Sequence< beans::PropertyValue >& sProps ) -{ - - util::URL url ; - url.Complete = aUrl; - rtl::OUString emptyString = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "" )); - uno::Reference<frame::XController> xController = xModel->getCurrentController(); - uno::Reference<frame::XFrame> xFrame = xController->getFrame(); - uno::Reference<frame::XDispatchProvider> xDispatchProvider (xFrame,uno::UNO_QUERY_THROW); - try - { - uno::Reference<uno::XComponentContext > xContext( ::cppu::defaultBootstrap_InitialComponentContext()); - if ( !xContext.is() ) - { - return ; - } - - uno::Reference<lang::XMultiComponentFactory > xServiceManager( - xContext->getServiceManager() ); - if ( !xServiceManager.is() ) - { - return ; - } - uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) - ,xContext), uno::UNO_QUERY_THROW ); - if (!xParser.is()) - return; - xParser->parseStrict (url); - } - catch ( ::cppu::BootstrapException & e ) - { - return ; - } - catch ( uno::Exception & e ) - { - return ; - } - - uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0); - - uno::Sequence<beans::PropertyValue> dispatchProps(1); - - sal_Int32 nProps = sProps.getLength(); - beans::PropertyValue* pDest = dispatchProps.getArray(); - if ( nProps ) - { - dispatchProps.realloc( nProps + 1 ); - // need to reaccquire pDest after realloc - pDest = dispatchProps.getArray(); - beans::PropertyValue* pSrc = sProps.getArray(); - for ( sal_Int32 index=0; index<nProps; ++index, ++pSrc, ++pDest ) - *pDest = *pSrc; - } - - (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" )); - (*pDest).Value <<= (sal_Bool)sal_True; - - if (xDispatcher.is()) - xDispatcher->dispatch( url, dispatchProps ); -} - -void -org::openoffice::dispatchRequests (uno::Reference< frame::XModel>& xModel,rtl::OUString & aUrl) -{ - uno::Sequence<beans::PropertyValue> dispatchProps; - dispatchRequests( xModel, aUrl, dispatchProps ); -} - - -void -org::openoffice::implnPaste() -{ - PasteCellsWarningReseter resetWarningBox; - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if ( pViewShell ) - { - pViewShell->PasteFromSystem(); - pViewShell->CellContentChanged(); - } -} - - -void -org::openoffice::implnCopy() -{ - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if ( pViewShell ) - pViewShell->CopyToClip(NULL,false,false,true); -} - -void -org::openoffice::implnCut() -{ - ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - if ( pViewShell ) - pViewShell->CutToClip( NULL, TRUE ); -} - -void org::openoffice::implnPasteSpecial(USHORT nFlags,USHORT nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose) -{ - PasteCellsWarningReseter resetWarningBox; - sal_Bool bAsLink(sal_False), bOtherDoc(sal_False); - InsCellCmd eMoveMode = INS_NONE; - - ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell(); - if ( pTabViewShell ) - { - ScViewData* pView = pTabViewShell->GetViewData(); - Window* pWin = NULL; - if ( pView && ( pWin = pView->GetActiveWin() ) ) - { - if ( bAsLink && bOtherDoc ) - pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK - else - { - ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); - ScDocument* pDoc = NULL; - if ( pOwnClip ) - pDoc = pOwnClip->GetDocument(); - pTabViewShell->PasteFromClip( nFlags, pDoc, - nFunction, bSkipEmpty, bTranspose, bAsLink, - eMoveMode, IDF_NONE, TRUE ); - pTabViewShell->CellContentChanged(); - } - } - } - -} - -bool -org::openoffice::isRangeShortCut( const ::rtl::OUString& sParam ) -{ - // for a ShortCutRange param, I'd expect the first letter to be - //[A-Z] and the last letter to be a digit 0-9 e.g A10, [A1:A10] etc. - ::rtl::OString sStr = rtl::OUStringToOString( sParam, - RTL_TEXTENCODING_UTF8 ); - const sal_Char* pFirst = (const sal_Char*)sStr; - const sal_Char* pLast = pFirst + ( sStr.getLength() - 1 ); - if ( (( *pFirst >= 'A' && *pFirst <= 'Z' ) || ( *pFirst >= 'a' && *pFirst <= 'Z' ) ) ) - if ( ( *pLast >= '0' ) && ( *pLast <= '9' ) ) - return true; - - return false; -} - - uno::Reference< frame::XModel > -org::openoffice::getCurrentDocument() throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel; - SbxObject* pBasic = reinterpret_cast< SbxObject* > ( SFX_APP()->GetBasic() ); - SbxObject* basicChosen = pBasic ; - if ( basicChosen == NULL) - { - OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" ); - return xModel; - } - SbxObject* p = pBasic; - SbxObject* pParent = p->GetParent(); - SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL; - - if( pParentParent ) - { - basicChosen = pParentParent; - } - else if( pParent ) - { - basicChosen = pParent; - } - - - uno::Any aModel; - SbxVariable *pCompVar = basicChosen->Find( UniString(RTL_CONSTASCII_USTRINGPARAM("ThisComponent")), SbxCLASS_OBJECT ); - - if ( pCompVar ) - { - aModel = sbxToUnoValue( pCompVar ); - if ( sal_False == ( aModel >>= xModel ) || - !xModel.is() ) - { - OSL_TRACE("Failed to extract model from thisComponent "); - return xModel; - } - else - { - OSL_TRACE("Have model ThisComponent points to url %s", - ::rtl::OUStringToOString( xModel->getURL(), - RTL_TEXTENCODING_ASCII_US ).pData->buffer ); - } - } - else - { - OSL_TRACE("Failed to get ThisComponent"); - } - return xModel; -} - -ScTabViewShell* -org::openoffice::getCurrentBestViewShell() -{ - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - ScModelObj* pModel = static_cast< ScModelObj* >( xModel.get() ); - if ( pModel ) - { - ScDocShell* pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); - if ( pDocShell ) - return pDocShell->GetBestViewShell(); - } - - return NULL; -} - -SfxViewFrame* -org::openoffice::getCurrentViewFrame() -{ - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( pViewShell ) - return pViewShell->GetViewFrame(); - return NULL; -} - diff --git a/scratch/sc-vba/vbahelper.hxx b/scratch/sc-vba/vbahelper.hxx deleted file mode 100644 index 9524af520..000000000 --- a/scratch/sc-vba/vbahelper.hxx +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SC_VBA_HELPER_HXX -#define SC_VBA_HELPER_HXX - -#include <com/sun/star/frame/XModel.hpp> -#include <docsh.hxx> - -#define css com::sun::star -#define oo org::openoffice -namespace org -{ - namespace openoffice - { - void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl) ; - void dispatchRequests (css::uno::Reference< css::frame::XModel>& xModel,rtl::OUString & aUrl, css::uno::Sequence< css::beans::PropertyValue >& sProps ) ; - void implnCopy(); - void implnPaste(); - void implnCut(); - void implnPasteSpecial(sal_uInt16 nFlags,sal_uInt16 nFunction,sal_Bool bSkipEmpty, sal_Bool bTranspose); - bool isRangeShortCut( const ::rtl::OUString& sParam ); - css::uno::Reference< css::frame::XModel > - getCurrentDocument() throw (css::uno::RuntimeException); - ScTabViewShell* getCurrentBestViewShell(); - SfxViewFrame* getCurrentViewFrame(); - } -} - -#ifdef DEBUG -# define SC_VBA_FIXME(a) OSL_TRACE( a ) -# define SC_VBA_STUB() SC_VBA_FIXME(( "%s - stubbed\n", __FUNCTION__ )) -#else -# define SC_VBA_FIXME(a) -# define SC_VBA_STUB() -#endif - -#endif diff --git a/scratch/sc-vba/vbainterior.cxx b/scratch/sc-vba/vbainterior.cxx deleted file mode 100644 index ab0f9a3ff..000000000 --- a/scratch/sc-vba/vbainterior.cxx +++ /dev/null @@ -1,125 +0,0 @@ -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/table/XCell.hpp> -#include <com/sun/star/table/XColumnRowRange.hpp> -#include <com/sun/star/beans/XIntrospection.hpp> -#include <com/sun/star/beans/XIntrospectionAccess.hpp> -#include <com/sun/star/reflection/XIdlMethod.hpp> -#include <com/sun/star/beans/MethodConcept.hpp> -#include <comphelper/processfactory.hxx> -#include <cppuhelper/queryinterface.hxx> - -#include "vbainterior.hxx" -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -ScVbaInterior::ScVbaInterior( uno::Reference< uno::XComponentContext >& xContext, uno::Reference< css::table::XCellRange > range) throw ( lang::IllegalArgumentException) : m_xContext(xContext),mxRange(range) -{ - if ( !xContext.is() ) - throw lang::IllegalArgumentException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "context not set" ) ), uno::Reference< uno::XInterface >(), 1 ); - if ( !mxRange.is() ) - throw lang::IllegalArgumentException( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "range not set") ), uno::Reference< uno::XInterface >(), 2 ); -} - -uno::Any -ScVbaInterior::getColor() throw (uno::RuntimeException) -{ - uno::Any aAny; - uno::Reference< table::XCell > xCell = mxRange->getCellByPosition(0,0 ); - uno::Reference< beans::XPropertySet > xProps(xCell, uno::UNO_QUERY_THROW ); - aAny = xProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) )); - return aAny; -} - -void -ScVbaInterior::setColor( const uno::Any& _color ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps(mxRange, uno::UNO_QUERY_THROW ); - xProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) ), _color); -} - -uno::Reference< beans::XIntrospectionAccess > -ScVbaInterior::getIntrospection(void) throw(uno::RuntimeException) -{ - return uno::Reference<beans::XIntrospectionAccess>(); -} - -uno::Any -ScVbaInterior::invoke(const rtl::OUString& FunctionName, const uno::Sequence< uno::Any >& Params, uno::Sequence< sal_Int16 >& OutParamIndex, uno::Sequence< uno::Any >& OutParam) throw( lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ - uno::Any aAny; - return aAny; -} - -void -ScVbaInterior::setValue(const rtl::OUString& PropertyName, const uno::Any& Value) throw(beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps(mxRange, uno::UNO_QUERY_THROW ); - if (PropertyName.equalsAscii("RotateAngle")) - { - xProps->setPropertyValue(PropertyName,Value); - } - else if (PropertyName.equalsAscii("CellStyle")) - { - xProps->setPropertyValue(PropertyName,Value); - } - else if (PropertyName.equalsAscii("ColorIndex")) - { - //FIXME:Need to add constants as parameter - xProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) ),Value); - } - else if (PropertyName.equalsAscii("Color")) - { - setColor( Value ); - } - else - { - rtl::OUString msg = rtl::OUString::createFromAscii("No property named "); - msg += PropertyName; - throw beans::UnknownPropertyException( msg, uno::Reference< uno::XInterface >() ); - } -} - -uno::Any -ScVbaInterior::getValue(const rtl::OUString& PropertyName) throw(beans::UnknownPropertyException, uno::RuntimeException) -{ - uno::Any aAny; - uno::Reference< beans::XPropertySet > xProps(mxRange, uno::UNO_QUERY_THROW ); - if (PropertyName.equalsAscii("ColorIndex")) - { - aAny = xProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CellBackColor" ) )); - } - else if (PropertyName.equalsAscii("Color")) - { - aAny = getColor(); - } - else - { - rtl::OUString msg = rtl::OUString::createFromAscii("No property named "); - msg += PropertyName; - throw beans::UnknownPropertyException( msg, uno::Reference< uno::XInterface >() ); - - } - return aAny; -} - -sal_Bool -ScVbaInterior::hasMethod(const rtl::OUString& Name) throw(uno::RuntimeException) -{ - return false; -} - -sal_Bool -ScVbaInterior::hasProperty(const rtl::OUString& Name) throw(uno::RuntimeException) -{ - - if (Name.equalsAscii("RotateAngle")) - return true; - if (Name.equalsAscii("CellStyle")) - return true; - if (Name.equalsAscii("ColorIndex")) - return true; - if (Name.equalsAscii("Color")) - return true; - - return false; -} diff --git a/scratch/sc-vba/vbainterior.hxx b/scratch/sc-vba/vbainterior.hxx deleted file mode 100644 index c476c2b2b..000000000 --- a/scratch/sc-vba/vbainterior.hxx +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef SC_VBA_INTERIOR_HXX -#define SC_VBA_INTERIOR_HXX - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <org/openoffice/vba/XInterior.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include "vbarange.hxx" - -#include <com/sun/star/script/XInvocation.hpp> - - -typedef ::cppu::WeakImplHelper2< oo::vba::XInterior,css::script::XInvocation > ScVbaInterior_BASE; - -class ScVbaInterior : public ScVbaInterior_BASE -{ - css::uno::Reference< css::table::XCellRange > mxRange; - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::beans::XIntrospectionAccess> m_xAcc; - -public: - ScVbaInterior( css::uno::Reference< css::uno::XComponentContext >& xContext, - css::uno::Reference< css::table::XCellRange > range) throw ( css::lang::IllegalArgumentException); - - virtual ~ScVbaInterior(){} - - virtual css::uno::Any SAL_CALL getColor() throw (css::uno::RuntimeException) ; - virtual void SAL_CALL setColor( const css::uno::Any& _color ) throw (css::uno::RuntimeException) ; - - virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection(void) throw(css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL invoke(const rtl::OUString& FunctionName, const css::uno::Sequence< css::uno::Any >& Params, css::uno::Sequence< sal_Int16 >& OutParamIndex, css::uno::Sequence< css::uno::Any >& OutParam) throw(css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); - virtual void SAL_CALL setValue(const rtl::OUString& PropertyName, const css::uno::Any& Value) throw(css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue(const rtl::OUString& PropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasMethod(const rtl::OUString& Name) throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasProperty(const rtl::OUString& Name) throw(css::uno::RuntimeException); - -}; -#endif - diff --git a/scratch/sc-vba/vbaobj.map b/scratch/sc-vba/vbaobj.map deleted file mode 100644 index ccafed5e9..000000000 --- a/scratch/sc-vba/vbaobj.map +++ /dev/null @@ -1,10 +0,0 @@ -OOO_1.1 { - global: - component_getDescriptionFunc; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scratch/sc-vba/vbaobj.xml b/scratch/sc-vba/vbaobj.xml deleted file mode 100644 index 31036f9c2..000000000 --- a/scratch/sc-vba/vbaobj.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> -<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> - - <module-name>vbaobj</module-name> - - <component-description> - <author>Noel Power </author> - <name>org.openoffice.vba.Globals</name> - <description>vba object model component</description> - <loader-name>com.sun.star.loader.SharedLibrary</loader-name> - <language>c++</language> - <status value="drafts"/> - <supported-service>org.openoffice.vba.Globals</supported-service> - <type>com.sun.star.uno.XComponentContext</type> - </component-description> - - <project-build-dependency>cppuhelper</project-build-dependency> - <project-build-dependency>cppu</project-build-dependency> - <project-build-dependency>sal</project-build-dependency> - - <runtime-module-dependency>cppuhelper3$(COM)</runtime-module-dependency> - <runtime-module-dependency>cppu3</runtime-module-dependency> - <runtime-module-dependency>sal3</runtime-module-dependency> - -</module-description> diff --git a/scratch/sc-vba/vbaoutline.cxx b/scratch/sc-vba/vbaoutline.cxx deleted file mode 100644 index c8a197fa5..000000000 --- a/scratch/sc-vba/vbaoutline.cxx +++ /dev/null @@ -1,20 +0,0 @@ -#include "vbaoutline.hxx" -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -void -ScVbaOutline::ShowLevels( const uno::Any& RowLevels, const uno::Any& ColumnLevels ) throw (uno::RuntimeException) -{ - sal_Int16 nLevel = 0; - if (mxOutline.is()) - { - if (RowLevels >>= nLevel) - { - mxOutline->showLevel(nLevel, table::TableOrientation_ROWS); - } - if (ColumnLevels >>= nLevel) - { - mxOutline->showLevel(nLevel,table::TableOrientation_COLUMNS); - } - } -} diff --git a/scratch/sc-vba/vbaoutline.hxx b/scratch/sc-vba/vbaoutline.hxx deleted file mode 100644 index df6bc01ff..000000000 --- a/scratch/sc-vba/vbaoutline.hxx +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SC_VBA_OUTLINE_HXX -#define SC_VBA_OUTLINE_HXX - -#include <com/sun/star/sheet/XSheetOutline.hpp> -#include <cppuhelper/implbase1.hxx> -#include <org/openoffice/vba/XOutline.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1< oo::vba::XOutline > ScVbaOutline_BASE; - -class ScVbaOutline : public ScVbaOutline_BASE -{ - css::uno::Reference< css::sheet::XSheetOutline > mxOutline; - css::uno::Reference< css::uno::XComponentContext > m_xContext; -public: - ScVbaOutline( css::uno::Reference< css::uno::XComponentContext >& xContext, - css::uno::Reference<css::sheet::XSheetOutline> outline):m_xContext(xContext),mxOutline(outline) - {} - virtual ~ScVbaOutline(){} - - virtual void SAL_CALL ShowLevels( const css::uno::Any& RowLevels, const css::uno::Any& ColumnLevels ) throw (css::uno::RuntimeException) ; -}; -#endif diff --git a/scratch/sc-vba/vbapivotcache.cxx b/scratch/sc-vba/vbapivotcache.cxx deleted file mode 100644 index 71451b8cf..000000000 --- a/scratch/sc-vba/vbapivotcache.cxx +++ /dev/null @@ -1,16 +0,0 @@ -#include "vbapivotcache.hxx" - - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -ScVbaPivotCache::ScVbaPivotCache( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : m_xContext( xContext ), m_xTable( xTable ) -{ -} - -void SAL_CALL -ScVbaPivotCache::Refresh() throw (css::uno::RuntimeException) -{ - m_xTable->refresh(); -} - diff --git a/scratch/sc-vba/vbapivotcache.hxx b/scratch/sc-vba/vbapivotcache.hxx deleted file mode 100644 index bdbcd7789..000000000 --- a/scratch/sc-vba/vbapivotcache.hxx +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SC_VBA_PIVOTCACHE_HXX -#define SC_VBA_PIVOTCACHE_HXX -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/sheet/XDataPilotTable.hpp> - -#include <org/openoffice/vba/XPivotCache.hpp> -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1<oo::vba::XPivotCache > PivotCacheImpl_BASE; - -class ScVbaPivotCache : public PivotCacheImpl_BASE -{ - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::sheet::XDataPilotTable > m_xTable; - -public: - ScVbaPivotCache( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XDataPilotTable >& xTable ); - virtual void SAL_CALL Refresh() throw (css::uno::RuntimeException); -}; - -#endif //SC_VBA_PIVOTCACHE_HXX diff --git a/scratch/sc-vba/vbapivottable.cxx b/scratch/sc-vba/vbapivottable.cxx deleted file mode 100644 index 08d22a6ab..000000000 --- a/scratch/sc-vba/vbapivottable.cxx +++ /dev/null @@ -1,16 +0,0 @@ -#include "vbapivottable.hxx" -#include "vbapivotcache.hxx" - - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -ScVbaPivotTable::ScVbaPivotTable( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XDataPilotTable >& xTable ) : m_xContext( xContext ), m_xTable( xTable ) -{ -} - -uno::Reference< vba::XPivotCache > -ScVbaPivotTable::PivotCache() throw (uno::RuntimeException) -{ - return new ScVbaPivotCache( m_xContext, m_xTable ); -} diff --git a/scratch/sc-vba/vbapivottable.hxx b/scratch/sc-vba/vbapivottable.hxx deleted file mode 100644 index 3e572eba5..000000000 --- a/scratch/sc-vba/vbapivottable.hxx +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef SC_VBA_PIVOTTABLE_HXX -#define SC_VBA_PIVOTTABLE_HXX -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/sheet/XDataPilotTable.hpp> -#include <org/openoffice/vba/XPivotTable.hpp> -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1<oo::vba::XPivotTable > PivotTableImpl_BASE; - -class ScVbaPivotTable : public PivotTableImpl_BASE -{ - css::uno::Reference< css::sheet::XDataPilotTable > m_xTable; - css::uno::Reference< css::uno::XComponentContext > m_xContext; -public: - ScVbaPivotTable( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XDataPilotTable >& xTable ); - virtual css::uno::Reference< oo::vba::XPivotCache > SAL_CALL PivotCache( ) throw (css::uno::RuntimeException); -}; - -#endif //SC_VBA_PIVOTTABLE_HXX diff --git a/scratch/sc-vba/vbapivottables.cxx b/scratch/sc-vba/vbapivottables.cxx deleted file mode 100644 index 01bf07f47..000000000 --- a/scratch/sc-vba/vbapivottables.cxx +++ /dev/null @@ -1,49 +0,0 @@ -#include "vbapivottables.hxx" -#include "vbapivottable.hxx" -#include <com/sun/star/sheet/XDataPilotTable.hpp> -#include <org/openoffice/vba/XPivotTable.hpp> - - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -uno::Any DataPilotToPivotTable( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext ) -{ - uno::Reference< sheet::XDataPilotTable > xTable( aSource, uno::UNO_QUERY_THROW ); - return makeAny( uno::Reference< vba::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) ); -} - -class PivotTableEnumeration : public EnumerationHelperImpl -{ -public: - PivotTableEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ) {} - - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - return DataPilotToPivotTable( m_xEnumeration->nextElement(), m_xContext ); - } - -}; - -ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xContext, xIndexAccess ) -{ -} - -uno::Reference< container::XEnumeration > -ScVbaPivotTables::createEnumeration() throw (uno::RuntimeException) -{ - uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); - return new PivotTableEnumeration( m_xContext, xEnumAccess->createEnumeration() ); -} - -uno::Any -ScVbaPivotTables::createCollectionObject( const css::uno::Any& aSource ) -{ - return DataPilotToPivotTable( aSource, m_xContext ); -} - -uno::Type -ScVbaPivotTables::getElementType() throw (uno::RuntimeException) -{ - return vba::XPivotTables::static_type(0); -} diff --git a/scratch/sc-vba/vbapivottables.hxx b/scratch/sc-vba/vbapivottables.hxx deleted file mode 100644 index e2a93defd..000000000 --- a/scratch/sc-vba/vbapivottables.hxx +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SC_VBA_PIVOTTABLES_HXX -#define SC_VBA_PIVOTTABLES_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <org/openoffice/vba/XPivotTables.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include "vbahelper.hxx" -#include "vbacollectionimpl.hxx" - - -typedef ::cppu::ImplInheritanceHelper1< ScVbaCollectionBaseImpl, oo::vba::XPivotTables > ScVbaPivotTables_BASE; - -class ScVbaPivotTables : public ScVbaPivotTables_BASE -{ -protected: -public: - ScVbaPivotTables( const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); - virtual ~ScVbaPivotTables() {} - - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - - - // XPivotTables - - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - -}; - -#endif //SC_VBA_PIVOTTABLES diff --git a/scratch/sc-vba/vbarange.cxx b/scratch/sc-vba/vbarange.cxx deleted file mode 100644 index 8c6f080d4..000000000 --- a/scratch/sc-vba/vbarange.cxx +++ /dev/null @@ -1,1028 +0,0 @@ -#include <comphelper/processfactory.hxx> -#include <sfx2/objsh.hxx> - -#include <com/sun/star/sheet/XSheetOperation.hpp> -#include <com/sun/star/sheet/CellFlags.hpp> -#include <com/sun/star/table/XColumnRowRange.hpp> -#include <com/sun/star/sheet/XCellAddressable.hpp> -#include <com/sun/star/table/CellContentType.hpp> -#include <com/sun/star/sheet/XCellSeries.hpp> -#include <com/sun/star/text/XTextRange.hpp> -#include <com/sun/star/sheet/XCellRangeAddressable.hpp> -#include <com/sun/star/table/CellRangeAddress.hpp> -#include <com/sun/star/sheet/XSheetCellRange.hpp> -#include <com/sun/star/sheet/XSpreadsheet.hpp> -#include <com/sun/star/sheet/XSheetCellCursor.hpp> -#include <com/sun/star/sheet/XArrayFormulaRange.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/sheet/XFunctionAccess.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/table/XCellCursor.hpp> -#include <com/sun/star/table/XTableRows.hpp> -#include <com/sun/star/table/XTableColumns.hpp> -#include <com/sun/star/util/XMergeable.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/util/XNumberFormats.hpp> -#include <com/sun/star/util/XNumberFormatTypes.hpp> -#include <com/sun/star/sheet/XCellRangeMovement.hpp> -#include <com/sun/star/sheet/XCellRangeData.hpp> - -#include <org/openoffice/vba/xlPasteSpecialOperation.hpp> -#include <org/openoffice/vba/xlPasteType.hpp> -#include <org/openoffice/vba/Excel/Constants.hpp> -#include <org/openoffice/vba/Excel/XlFindLookIn.hpp> - -#include "vbarange.hxx" -#include "vbafont.hxx" -#include "vbainterior.hxx" -#include "vbaarraywrapper.hxx" - -#include <comphelper/anytostring.hxx> - -#include "global.hxx" - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - -const sal_Int32 RANGE_PROPERTY_ID_DFLT=1; -// name is not defineable in IDL so no chance of a false detection of the -// another property/method of the same name -const ::rtl::OUString RANGE_PROPERTY_DFLT( RTL_CONSTASCII_USTRINGPARAM( "_$DefaultProp" ) ); -const ::rtl::OUString ISVISIBLE( RTL_CONSTASCII_USTRINGPARAM( "IsVisible")); - -class CellValueSetter : public ArrayVisitor -{ -protected: - uno::Any maValue; - uno::TypeClass mTypeClass; - bool processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell ); -public: - CellValueSetter( const uno::Any& aValue ); - virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell ); - -}; - -CellValueSetter::CellValueSetter( const uno::Any& aValue ): maValue( aValue ), mTypeClass( aValue.getValueTypeClass() ) {} - -void -CellValueSetter::visitNode( sal_Int32 i, sal_Int32 j, const uno::Reference< table::XCell >& xCell ) -{ - bool result = processValue( maValue, xCell ); -} - -bool -CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< table::XCell >& xCell ) -{ - bool isExtracted = false; - switch ( mTypeClass ) - { - case uno::TypeClass_BOOLEAN: - { - static ::rtl::OUString sTrue( RTL_CONSTASCII_USTRINGPARAM("=TRUE()")); - static ::rtl::OUString sFalse( RTL_CONSTASCII_USTRINGPARAM("=FALSE()")); - sal_Bool bState; - if ( aValue >>= bState ) - { - if ( bState ) - xCell->setFormula( sTrue ); - else - xCell->setFormula( sFalse ); - } - else - isExtracted = false; - break; - } - case uno::TypeClass_STRING: - { - rtl::OUString aString; - if ( aValue >>= aString ) - { - uno::Reference< text::XTextRange > xTextRange( xCell, uno::UNO_QUERY_THROW ); - xTextRange->setString( aString ); - } - else - isExtracted = false; - break; - } - default: - { - double nDouble; - if ( aValue >>= nDouble ) - xCell->setValue( nDouble ); - else - isExtracted = false; - break; - } - } - return isExtracted; - -} - -class CellValueGetter : public ArrayVisitor -{ -protected: - uno::Any maValue; - uno::TypeClass mTypeClass; - virtual void processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue ); -public: - CellValueGetter() {} - virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell ); - const uno::Any& getValue() const { return maValue; } - -}; - -void -CellValueGetter::processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue ) -{ - maValue = aValue; -} -void CellValueGetter::visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell ) -{ - uno::Any aValue; - table::CellContentType eType = xCell->getType(); - if( eType == table::CellContentType_VALUE || eType == table::CellContentType_FORMULA ) - { - if ( eType == table::CellContentType_FORMULA ) - { - rtl::OUString sFormula = xCell->getFormula(); - if ( sFormula.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("=TRUE()") ) ) ) - aValue <<= sal_True; - else if ( sFormula.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("=FALSE()") ) ) ) - aValue <<= sal_False; - - } - aValue <<= xCell->getValue(); - } - if( eType == table::CellContentType_TEXT ) - { - uno::Reference< text::XTextRange > xTextRange(xCell, ::uno::UNO_QUERY_THROW); - aValue <<= xTextRange->getString(); - } - processValue( x,y,aValue ); -} - -class ArrayValueGetter : public CellValueGetter -{ -protected: - virtual void processValue( sal_Int32 x, sal_Int32 y, const uno::Any& aValue ) - { - uno::Sequence< uno::Sequence< uno::Any > >& aMatrix = *( uno::Sequence< uno::Sequence< uno::Any > >* )( maValue.getValue() ); - aMatrix[x][y] = aValue; - } - -public: - ArrayValueGetter(sal_Int32 nRowCount, sal_Int32 nColCount ):CellValueGetter() - { - uno::Sequence< uno::Sequence< uno::Any > > aMatrix; - aMatrix.realloc( nRowCount ); - for ( sal_Int32 index = 0; index < nRowCount; ++index ) - aMatrix[index].realloc( nColCount ); - maValue <<= aMatrix; - } -}; - -class ArrayValueSetter : public CellValueSetter -{ - uno::Sequence< uno::Sequence< uno::Any > > aMatrix; -public: - ArrayValueSetter( const uno::Any& aValue ) : CellValueSetter( aValue ) - { - aValue >>= aMatrix; - } - virtual void visitNode( sal_Int32 x, sal_Int32 y, const uno::Reference< table::XCell >& xCell ) - { - processValue( aMatrix[ x ][ y ], xCell ); - } -}; - -class RangeHelper -{ - uno::Reference< table::XCellRange > m_xCellRange; - -public: - RangeHelper( const uno::Reference< table::XCellRange >& xCellRange ) throw (uno::RuntimeException) : m_xCellRange( xCellRange ) - { - if ( !m_xCellRange.is() ) - throw uno::RuntimeException(); - } - RangeHelper( const uno::Any aCellRange ) throw (uno::RuntimeException) - { - m_xCellRange.set( aCellRange, uno::UNO_QUERY_THROW ); - } - uno::Reference< sheet::XSheetCellRange > getSheetCellRange() throw (uno::RuntimeException) - { - return uno::Reference< sheet::XSheetCellRange >(m_xCellRange, uno::UNO_QUERY_THROW); - } - uno::Reference< sheet::XSpreadsheet > getSpreadSheet() throw (uno::RuntimeException) - { - return getSheetCellRange()->getSpreadsheet(); - } - - uno::Reference< table::XCellRange > getCellRangeFromSheet() throw (uno::RuntimeException) - { - return uno::Reference< table::XCellRange >(getSpreadSheet(), uno::UNO_QUERY_THROW ); - } - - uno::Reference< sheet::XCellRangeAddressable > getCellRangeAddressable() throw (uno::RuntimeException) - { - return uno::Reference< sheet::XCellRangeAddressable >(m_xCellRange, ::uno::UNO_QUERY_THROW); - - } - - uno::Reference< sheet::XSheetCellCursor > getSheetCellCursor() throw ( uno::RuntimeException ) - { - return uno::Reference< sheet::XSheetCellCursor >( getSpreadSheet()->createCursorByRange( getSheetCellRange() ), uno::UNO_QUERY_THROW ); - } - - static uno::Reference< vba::XRange > createRangeFromRange( const uno::Reference<uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, const uno::Reference< sheet::XCellRangeAddressable >& xCellRangeAddressable, sal_Int32 nStartColOffset = 0, sal_Int32 nStartRowOffset = 0, - sal_Int32 nEndColOffset = 0, sal_Int32 nEndRowOffset = 0 ) - { - return uno::Reference< vba::XRange >( new ScVbaRange( xContext, - xRange->getCellRangeByPosition( - xCellRangeAddressable->getRangeAddress().StartColumn + nStartColOffset, - xCellRangeAddressable->getRangeAddress().StartRow + nStartRowOffset, - xCellRangeAddressable->getRangeAddress().EndColumn + nEndColOffset, - xCellRangeAddressable->getRangeAddress().EndRow + nEndRowOffset ) ) ); - } - -}; - -ScVbaRange::ScVbaRange( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< table::XCellRange >& xRange, sal_Bool bIsRows, sal_Bool bIsColumns ) throw( lang::IllegalArgumentException ) -:OPropertyContainer(GetBroadcastHelper()) -,mxRange( xRange ), - m_xContext(xContext), - mbIsRows( bIsRows ), - mbIsColumns( bIsColumns ) -{ - if ( !xContext.is() ) - throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "context is not set " ) ), uno::Reference< uno::XInterface >() , 1 ); - if ( !xRange.is() ) - throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "range is not set " ) ), uno::Reference< uno::XInterface >() , 1 ); - msDftPropName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Value" ) ); - registerProperty( RANGE_PROPERTY_DFLT, RANGE_PROPERTY_ID_DFLT, -beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::BOUND, &msDftPropName, ::getCppuType( &msDftPropName ) ); - -} - -uno::Reference< script::XTypeConverter > -ScVbaRange::getTypeConverter() throw (uno::RuntimeException) -{ - static uno::Reference< script::XTypeConverter > xTypeConv( m_xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter") ), m_xContext ), uno::UNO_QUERY_THROW ); - return xTypeConv; -} - -void -ScVbaRange::visitArray( ArrayVisitor& visitor ) -{ - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW ); - sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount(); - sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount(); - for ( sal_Int32 i=0; i<nRowCount; ++i ) - { - for ( sal_Int32 j=0; j<nColCount; ++j ) - { - uno::Reference< table::XCell > xCell( mxRange->getCellByPosition( j, i ), uno::UNO_QUERY_THROW ); - - visitor.visitNode( i, j, xCell ); - } - } -} - - - - -uno::Any SAL_CALL -ScVbaRange::getValue() throw (uno::RuntimeException) -{ - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW ); - sal_Int32 nRowCount = xColumnRowRange->getRows()->getCount(); - sal_Int32 nColCount = xColumnRowRange->getColumns()->getCount(); - // single cell range - if ( nRowCount == 1 && nColCount == 1 ) - { - CellValueGetter getter; - visitArray( getter ); - return getter.getValue(); - } - // multi cell range ( return array ) - ArrayValueGetter getter( nRowCount, nColCount ); - visitArray( getter ); - return makeAny( uno::Reference< vba::XArrayWrapper >( new ScArrayWrapper( getter.getValue(), sal_False ) ) ); - -} - -void SAL_CALL -ScVbaRange::setValue( const uno::Any &aValue ) throw (uno::RuntimeException) -{ - uno::TypeClass aClass = aValue.getValueTypeClass(); - if ( aClass == uno::TypeClass_SEQUENCE ) - { - uno::Reference< script::XTypeConverter > xConverter = getTypeConverter(); - uno::Any aConverted; - try - { - aConverted = xConverter->convertTo( aValue, getCppuType((uno::Sequence< uno::Sequence< uno::Any > >*)0) ); - uno::Sequence< uno::Sequence< uno::Any > > aMatrix; - if ( aConverted >>= aMatrix ) - { - ArrayValueSetter setter( aConverted ); - visitArray( setter ); - } - } - catch ( uno::Exception& e ) - { - OSL_TRACE("Bahhh, caught exception %s", - rtl::OUStringToOString( e.Message, - RTL_TEXTENCODING_UTF8 ).getStr() ); - } - } - else - { - CellValueSetter setter( aValue ); - visitArray( setter ); - } -} - -void -ScVbaRange::Clear() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetOperation > xSheetOperation(mxRange, uno::UNO_QUERY_THROW); - xSheetOperation->clearContents(sheet::CellFlags::VALUE | sheet::CellFlags::STRING | - sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR); -} - -void -ScVbaRange::ClearComments() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetOperation > xSheetOperation(mxRange, uno::UNO_QUERY_THROW); - //FIXME: STRING is not the correct type; May require special handling; clearNotes? - xSheetOperation->clearContents(sheet::CellFlags::STRING); -} - -void -ScVbaRange::ClearContents() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetOperation > xSheetOperation(mxRange, uno::UNO_QUERY_THROW); - xSheetOperation->clearContents(sheet::CellFlags::VALUE | sheet::CellFlags::STRING ); -} - -void -ScVbaRange::ClearFormats() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetOperation > xSheetOperation(mxRange, uno::UNO_QUERY_THROW); - //FIXME: need to check if we need to combine sheet::CellFlags::FORMATTED - xSheetOperation->clearContents(sheet::CellFlags::HARDATTR | sheet::CellFlags::FORMATTED | sheet::CellFlags::EDITATTR); -} - -::rtl::OUString -ScVbaRange::getFormula() throw (::com::sun::star::uno::RuntimeException) -{ - uno::Reference< table::XCell > xCell( mxRange->getCellByPosition( 0, 0 ), uno::UNO_QUERY_THROW ); - return xCell->getFormula(); -} - -void -ScVbaRange::setFormula(const ::rtl::OUString &rFormula ) throw (uno::RuntimeException) -{ - setValue( uno::makeAny( rFormula ) ); -} - -double -ScVbaRange::getCount() throw (uno::RuntimeException) -{ - double rowCount, colCount; - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, uno::UNO_QUERY_THROW ); - rowCount = xColumnRowRange->getRows()->getCount(); - colCount = xColumnRowRange->getColumns()->getCount(); - if( IsRows() ) - return rowCount; - if( IsColumns() ) - return colCount; - return rowCount * colCount; -} - -sal_Int32 -ScVbaRange::getRow() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XCellAddressable > xCellAddressable(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW ); - return xCellAddressable->getCellAddress().Row + 1; // Zero value indexing -} - -sal_Int32 -ScVbaRange::getColumn() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XCellAddressable > xCellAddressable(mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW ); - return xCellAddressable->getCellAddress().Column + 1; // Zero value indexing -} - -sal_Bool -ScVbaRange::HasFormula() throw (uno::RuntimeException) -{ - uno::Reference< table::XCell > xCell( mxRange->getCellByPosition(0, 0), uno::UNO_QUERY_THROW ); - return( xCell->getType() == table::CellContentType_FORMULA ); -} -void -ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode, double fStep, double fEndValue ) throw( uno::RuntimeException ) -{ - uno::Reference< sheet::XCellSeries > xCellSeries(mxRange, uno::UNO_QUERY_THROW ); -} - -void -ScVbaRange::FillLeft() throw (uno::RuntimeException) -{ - fillSeries(sheet::FillDirection_TO_LEFT, - sheet::FillMode_LINEAR, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF); -} - -void -ScVbaRange::FillRight() throw (uno::RuntimeException) -{ - fillSeries(sheet::FillDirection_TO_RIGHT, - sheet::FillMode_LINEAR, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF); -} - -void -ScVbaRange::FillUp() throw (uno::RuntimeException) -{ - fillSeries(sheet::FillDirection_TO_TOP, - sheet::FillMode_LINEAR, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF); -} - -void -ScVbaRange::FillDown() throw (uno::RuntimeException) -{ - fillSeries(sheet::FillDirection_TO_BOTTOM, - sheet::FillMode_LINEAR, sheet::FillDateMode_FILL_DATE_DAY, 0, 0x7FFFFFFF); -} - -::rtl::OUString -ScVbaRange::getText() throw (uno::RuntimeException) -{ - uno::Reference< text::XTextRange > xTextRange(mxRange, uno::UNO_QUERY_THROW ); - return xTextRange->getString(); -} - -void -ScVbaRange::setText( const ::rtl::OUString &rString ) throw (uno::RuntimeException) -{ - uno::Reference< text::XTextRange > xTextRange(mxRange, uno::UNO_QUERY_THROW ); - xTextRange->setString( rString ); -} - -uno::Reference< vba::XRange > -ScVbaRange::Offset( const ::uno::Any &nRowOff, const uno::Any &nColOff ) throw (uno::RuntimeException) -{ - sal_Int32 nRowOffset = 0, nColOffset = 0; - sal_Bool bIsRowOffset = ( nRowOff >>= nRowOffset ); - sal_Bool bIsColumnOffset = ( nColOff >>= nColOffset ); - - RangeHelper helper( mxRange ); - - return RangeHelper::createRangeFromRange( m_xContext, helper.getCellRangeFromSheet(), helper.getCellRangeAddressable(), nColOffset, nRowOffset, nColOffset, nRowOffset ); -} - -uno::Reference< vba::XRange > -ScVbaRange::CurrentRegion() throw (uno::RuntimeException) -{ - RangeHelper helper( mxRange ); - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = - helper.getSheetCellCursor(); - xSheetCellCursor->collapseToCurrentRegion(); - uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW); - return RangeHelper::createRangeFromRange( m_xContext, helper.getCellRangeFromSheet(), xCellRangeAddressable ); -} - -uno::Reference< vba::XRange > -ScVbaRange::CurrentArray() throw (uno::RuntimeException) -{ - RangeHelper helper( mxRange ); - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = - helper.getSheetCellCursor(); - xSheetCellCursor->collapseToCurrentArray(); - uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW); - return RangeHelper::createRangeFromRange( m_xContext, helper.getCellRangeFromSheet(), xCellRangeAddressable ); -} - -::rtl::OUString -ScVbaRange::getFormulaArray() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XArrayFormulaRange > xArrayFormulaRange(mxRange, ::uno::UNO_QUERY_THROW ); - return xArrayFormulaRange->getArrayFormula(); -} - -void -ScVbaRange::setFormulaArray(const ::rtl::OUString &rFormula) throw (uno::RuntimeException) -{ - uno::Reference< sheet::XArrayFormulaRange > xArrayFormulaRange(mxRange, ::uno::UNO_QUERY_THROW ); - xArrayFormulaRange->setArrayFormula( rFormula ); -} - -::rtl::OUString -ScVbaRange::Characters(const uno::Any& Start, const uno::Any& Length) throw (uno::RuntimeException) -{ - long nIndex, nCount; - ::rtl::OUString rString; - uno::Reference< text::XTextRange > xTextRange(mxRange, ::uno::UNO_QUERY_THROW ); - rString = xTextRange->getString(); - if( !( Start >>= nIndex ) && !( Length >>= nCount ) ) - return rString; - if(!( Start >>= nIndex ) ) - nIndex = 1; - if(!( Length >>= nCount ) ) - nIndex = rString.getLength(); - return rString.copy( --nIndex, nCount ); // Zero value indexing -} - -::rtl::OUString -ScVbaRange::Address() throw (uno::RuntimeException) -{ - ::rtl::OUString aStart, aEnd; - uno::Sequence< uno::Any > aAddrArray1, aAddrArray2; - - uno::Reference< lang::XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< sheet::XFunctionAccess > xFunctionAccess( - xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.sheet.FunctionAccess"), m_xContext), - ::uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable( mxRange, ::uno::UNO_QUERY_THROW ); - if( aAddrArray1.getLength() == 0 ) - { - aAddrArray1.realloc(2); - uno::Any* aArray = aAddrArray1.getArray(); - aArray[0] = ( uno::Any )( xCellRangeAddressable->getRangeAddress().StartRow + 1 ); - aArray[1] = ( uno::Any )( xCellRangeAddressable->getRangeAddress().StartColumn + 1 ); - } - uno::Any aString1 = xFunctionAccess->callFunction(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ADDRESS")), aAddrArray1); - aString1 >>= aStart; - - if( xCellRangeAddressable->getRangeAddress().StartColumn == xCellRangeAddressable->getRangeAddress().EndColumn && - xCellRangeAddressable->getRangeAddress().StartRow == xCellRangeAddressable->getRangeAddress().EndRow ) - return aStart; - - String aString(aStart); - aStart = rtl::OUString(aString.Append((sal_Unicode)':')); - if( aAddrArray2.getLength() == 0 ) - { - aAddrArray2.realloc(2); - uno::Any* aArray = aAddrArray2.getArray(); - aArray[0] = ( uno::Any )( xCellRangeAddressable->getRangeAddress().EndRow + 1 ); - aArray[1] = ( uno::Any )( xCellRangeAddressable->getRangeAddress().EndColumn + 1 ); - } - uno::Any aString2 = xFunctionAccess->callFunction(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ADDRESS")), aAddrArray2); - aString2 >>= aEnd; - return aStart.concat( aEnd ); -} - -uno::Reference < vba::XFont > -ScVbaRange::Font() throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY ); - return uno::Reference< vba::XFont >( new ScVbaFont( xProps ) ); -} - -uno::Reference< vba::XRange > -ScVbaRange::Cells( const uno::Any &nRowIndex, const uno::Any &nColumnIndex ) throw(uno::RuntimeException) -{ - long nRow = 0, nColumn = 0; - sal_Bool bIsIndex = nRowIndex >>= nRow, bIsColumnIndex = nColumnIndex >>= nColumn; - - uno::Reference< sheet::XSheetCellRange > xSheetCellRange(mxRange, ::uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet(); - uno::Reference< table::XCellRange > xRange(xSheet, uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRange, uno::UNO_QUERY_THROW ); - uno::Reference< table::XCellRange > xRangeReference = xRange->getCellRangeByPosition( - getColumn()-1, getRow()-1, - xAddressable->getRangeAddress().EndColumn, - xAddressable->getRangeAddress().EndRow ); - if( !bIsIndex && !bIsColumnIndex ) // .Cells - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange ) ); - if( !nRow ) - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Invalid RowIndex ") ), - uno::Reference< XInterface >() ); - if( bIsIndex && !bIsColumnIndex ) // .Cells(n) - { - int nIndex = --nRow; - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, ::uno::UNO_QUERY_THROW); - int nColCount = xColumnRowRange->getColumns()->getCount(); - nRow = nIndex / nColCount; - nColumn = nIndex % nColCount; - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xRangeReference->getCellRangeByPosition( - nColumn, nRow, nColumn, nRow ) ) ); - } - if( !nColumn ) - throw uno::RuntimeException( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": Invalid ColumnIndex" ) ), - uno::Reference< XInterface >() ); - --nRow, --nColumn; - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xRangeReference->getCellRangeByPosition( nColumn, nRow, nColumn, nRow ) ) ); -} - -void -ScVbaRange::Select() throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< view::XSelectionSupplier > xSelection( xModel->getCurrentController(), uno::UNO_QUERY_THROW ); - xSelection->select( ( uno::Any )mxRange ); -} - -uno::Reference< vba::XRange > -ScVbaRange::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - sal_Int32 nValue; - if( !aIndex.hasValue() ) - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange, true ) ); - if( aIndex >>= nValue ) - { - uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxRange, uno::UNO_QUERY ); - --nValue; - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange->getCellRangeByPosition( - xAddressable->getRangeAddress().StartColumn, nValue, - xAddressable->getRangeAddress().EndColumn, nValue ), true ) ); - } - // Questionable return, I'm just copying the invalid Any::value path - // above. Would seem to me that this is an internal error and - // warrants an exception thrown - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange, true ) ); -} - -uno::Reference< vba::XRange > -ScVbaRange::Columns( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - sal_Int32 nValue; - if( !aIndex.hasValue() ) - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange, false, true ) ); - if( aIndex >>= nValue ) - { - uno::Reference< sheet::XCellRangeAddressable > xAddressable( mxRange, uno::UNO_QUERY_THROW ); - --nValue; - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange->getCellRangeByPosition( - nValue, xAddressable->getRangeAddress().StartRow, - nValue, xAddressable->getRangeAddress().EndRow ), false, true ) ); - } - // Questionable return, I'm just copying the invalid Any::value path - // above. Would seem to me that this is an internal error and - // warrants an exception thrown - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, mxRange, false, true ) ); -} - -void -ScVbaRange::setMergeCells( sal_Bool bIsMerged ) throw (uno::RuntimeException) -{ - uno::Reference< util::XMergeable > xMerge( mxRange, ::uno::UNO_QUERY_THROW ); - //FIXME need to check whether all the cell contents are retained or lost by popping up a dialog - xMerge->merge( bIsMerged ); -} - -sal_Bool -ScVbaRange::getMergeCells() throw (uno::RuntimeException) -{ - uno::Reference< util::XMergeable > xMerge( mxRange, ::uno::UNO_QUERY_THROW ); - return xMerge->getIsMerged(); -} - -void -ScVbaRange::Copy(const ::uno::Any& Destination) throw (uno::RuntimeException) -{ - if ( Destination.hasValue() ) - { - uno::Reference< vba::XRange > xRange( Destination, uno::UNO_QUERY_THROW ); - uno::Any aRange = xRange->getCellRange(); - uno::Reference< table::XCellRange > xCellRange; - aRange >>= xCellRange; - uno::Reference< sheet::XSheetCellRange > xSheetCellRange(xCellRange, ::uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet(); - uno::Reference< table::XCellRange > xDest( xSheet, uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeMovement > xMover( xSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XCellAddressable > xDestination( xDest->getCellByPosition( - xRange->getColumn()-1,xRange->getRow()-1), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY); - xMover->copyRange( xDestination->getCellAddress(), xSource->getRangeAddress() ); - } - else - { - Select(); - implnCopy(); - } -} - -void -ScVbaRange::Cut(const ::uno::Any& Destination) throw (uno::RuntimeException) -{ - if (Destination.hasValue()) - { - uno::Reference< vba::XRange > xRange( Destination, uno::UNO_QUERY_THROW ); - uno::Reference< table::XCellRange > xCellRange( xRange->getCellRange(), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSheetCellRange > xSheetCellRange(xCellRange, ::uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet(); - uno::Reference< table::XCellRange > xDest( xSheet, uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeMovement > xMover( xSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XCellAddressable > xDestination( xDest->getCellByPosition( - xRange->getColumn()-1,xRange->getRow()-1), uno::UNO_QUERY); - uno::Reference< sheet::XCellRangeAddressable > xSource( mxRange, uno::UNO_QUERY); - xMover->moveRange( xDestination->getCellAddress(), xSource->getRangeAddress() ); - } - { - Select(); - implnCut(); - } -} - -void -ScVbaRange::setNumberFormat( const ::rtl::OUString &rFormat ) throw (uno::RuntimeException) -{ - uno::Reference< util::XNumberFormatsSupplier > xSupplier(getCurrentDocument(), uno::UNO_QUERY_THROW); - uno::Reference< util::XNumberFormats > xFormats( xSupplier->getNumberFormats(), uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xRangeProps( mxRange, uno::UNO_QUERY_THROW ); - //FIXME behaviour with different locales - lang::Locale pLocale = ::com::sun::star::lang::Locale(); - long nIndexKey = xFormats->queryKey( rFormat, pLocale, false ); - if( nIndexKey != -1 ) - xRangeProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberFormat")), (uno::Any) nIndexKey ); -} - -::rtl::OUString -ScVbaRange::getNumberFormat() throw (uno::RuntimeException) -{ - uno::Reference< util::XNumberFormatsSupplier > xSupplier( getCurrentDocument(), uno::UNO_QUERY_THROW ); - uno::Reference< util::XNumberFormats > xFormats = xSupplier->getNumberFormats(); - uno::Reference< beans::XPropertySet > xRangeProps( mxRange, uno::UNO_QUERY); - long nIndexKey; - uno::Any aValue = xRangeProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NumberFormat"))); - aValue >>= nIndexKey; - uno::Reference< beans::XPropertySet > xNumberProps = xFormats->getByKey( nIndexKey ); - ::rtl::OUString aFormatString; - uno::Any aString = xNumberProps->getPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString"))); - aString >>= aFormatString; - return aFormatString; -} - -uno::Reference< vba::XRange > -ScVbaRange::Resize( const uno::Any &RowSize, const uno::Any &ColumnSize ) throw (uno::RuntimeException) -{ - long nRowSize, nColumnSize; - sal_Bool bIsRowChanged = ( RowSize >>= nRowSize ), bIsColumnChanged = ( ColumnSize >>= nColumnSize ); - uno::Reference< table::XColumnRowRange > xColumnRowRange(mxRange, ::uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSheetCellRange > xSheetRange(mxRange, ::uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSheetCellCursor > xCursor( xSheetRange->getSpreadsheet()->createCursorByRange(xSheetRange), ::uno::UNO_QUERY_THROW ); - if( !nRowSize || !nColumnSize ) - throw lang::IndexOutOfBoundsException(); - if( !bIsRowChanged ) - nRowSize = xColumnRowRange->getRows()->getCount(); - if( !bIsColumnChanged ) - nColumnSize = xColumnRowRange->getColumns()->getCount(); - xCursor->collapseToSize( nColumnSize, nRowSize ); - uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xCursor, ::uno::UNO_QUERY_THROW ); - uno::Reference< table::XCellRange > xRange( xSheetRange->getSpreadsheet(), ::uno::UNO_QUERY_THROW ); - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext,xRange->getCellRangeByPosition( - xCellRangeAddressable->getRangeAddress().StartColumn, - xCellRangeAddressable->getRangeAddress().StartRow, - xCellRangeAddressable->getRangeAddress().EndColumn, - xCellRangeAddressable->getRangeAddress().EndRow ) ) ); -} - -void -ScVbaRange::setWrapText( sal_Bool bIsWrapped ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY_THROW ); - xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTextWrapped" ) ), ( uno::Any )bIsWrapped ); -} - -sal_Bool -ScVbaRange::getWrapText() throw (uno::RuntimeException) -{ - sal_Bool bWrapped = false; - uno::Reference< beans::XPropertySet > xProps(mxRange, ::uno::UNO_QUERY_THROW ); - uno::Any aValue = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsTextWrapped" ) ) ); - aValue >>= bWrapped; - return bWrapped; -} - -uno::Reference< vba::XInterior > ScVbaRange::Interior( ) throw (uno::RuntimeException) -{ - return uno::Reference<vba::XInterior> (new ScVbaInterior ( m_xContext, mxRange)); -} -uno::Reference< vba::XRange > -ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2 ) throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetCellRange > xSheetCellRange( mxRange, uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSpreadsheet > xSheet = xSheetCellRange->getSpreadsheet(); - uno::Reference< table::XCellRange > xRanges( xSheet, uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XCellRangeAddressable > xAddressable( xRanges, uno::UNO_QUERY_THROW ); - uno::Reference< table::XCellRange > xReferrer = xRanges->getCellRangeByPosition( - getColumn()-1, getRow()-1, - xAddressable->getRangeAddress().EndColumn, - xAddressable->getRangeAddress().EndRow ); - rtl::OUString rString; - uno::Reference< vba::XRange > aRange1, aRange2; - sal_Bool bIsCell1 = Cell1 >>= aRange1, bIsCell2 = Cell2 >>= aRange2; - - if( !Cell1.hasValue() ) - throw uno::RuntimeException( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Invalid Argument " ) ), - uno::Reference< XInterface >() ); - if( ( Cell1 >>= rString ) && !Cell2.hasValue() ) - { - uno::Reference< table::XCellRange > xRange = xRanges->getCellRangeByName( rString ); - uno::Reference< sheet::XCellRangeAddressable > xRefAddress( xRange, uno::UNO_QUERY_THROW ); - return uno::Reference< vba::XRange > ( new ScVbaRange( m_xContext, xReferrer->getCellRangeByPosition( - xRefAddress->getRangeAddress().StartColumn, - xRefAddress->getRangeAddress().StartRow, - xRefAddress->getRangeAddress().EndColumn, - xRefAddress->getRangeAddress().EndRow ) ) ); - } - if( bIsCell1 && bIsCell2 ) - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xReferrer->getCellRangeByPosition( - aRange1->getColumn() - 1, aRange1->getRow() - 1, - aRange2->getColumn() - 1, aRange2->getRow() - 1 ) ) ); - if( bIsCell1 && !Cell2.hasValue() ) - return uno::Reference< vba::XRange > ( new ScVbaRange( m_xContext, xReferrer->getCellRangeByPosition( - aRange1->getColumn() - 1, aRange1->getRow() - 1, - aRange1->getColumn() - 1, aRange1->getRow() - 1 ) ) ); - return NULL; -} - -::com::sun::star::uno::Any SAL_CALL -ScVbaRange::getCellRange( ) throw (::com::sun::star::uno::RuntimeException) -{ - uno::Any aAny; - aAny <<= mxRange; - return aAny; -} - -static USHORT -getPasteFlags (sal_Int16 Paste) -{ - USHORT nFlags = IDF_NONE; - switch (Paste) { - case vba::xlPasteType::xlPasteComments: - nFlags = IDF_NOTE;break; - case vba::xlPasteType::xlPasteFormats: - nFlags = IDF_ATTRIB;break; - case vba::xlPasteType::xlPasteFormulas: - nFlags = IDF_FORMULA;break; - case vba::xlPasteType::xlPasteFormulasAndNumberFormats : - nFlags = IDF_FORMULA | IDF_VALUE ;break; - case vba::Excel::XlFindLookIn::xlValues: - case vba::xlPasteType::xlPasteValues: - nFlags = IDF_VALUE | IDF_SPECIAL_BOOLEAN ;break; - case vba::xlPasteType::xlPasteValuesAndNumberFormats: - nFlags = IDF_VALUE | IDF_ATTRIB; break; - case vba::xlPasteType::xlPasteColumnWidths: - case vba::xlPasteType::xlPasteValidation: - nFlags = IDF_NONE;break; - case vba::xlPasteType::xlPasteAll: - case vba::xlPasteType::xlPasteAllExceptBorders: - default: - nFlags = IDF_ALL;break; - }; -return nFlags; -} - -static USHORT -getPasteFormulaBits( sal_Int16 Operation) -{ - USHORT nFormulaBits = PASTE_NOFUNC ; - switch (Operation) - { - case vba::xlPasteSpecialOperation::xlPasteSpecialOperationAdd: - nFormulaBits = PASTE_ADD;break; - case vba::xlPasteSpecialOperation::xlPasteSpecialOperationSubtract: - nFormulaBits = PASTE_SUB;break; - case vba::xlPasteSpecialOperation::xlPasteSpecialOperationMultiply: - nFormulaBits = PASTE_MUL;break; - case vba::xlPasteSpecialOperation::xlPasteSpecialOperationDivide: - nFormulaBits = PASTE_DIV;break; - - case vba::xlPasteSpecialOperation::xlPasteSpecialOperationNone: - case vba::Excel::Constants::xlNone: - default: - nFormulaBits = PASTE_NOFUNC; break; - }; - -return nFormulaBits; -} -void SAL_CALL -ScVbaRange::PasteSpecial(sal_Int16 Paste, sal_Int16 Operation, ::sal_Bool SkipBlanks, ::sal_Bool Transpose ) throw (::com::sun::star::uno::RuntimeException) -{ - USHORT nFlags = getPasteFlags(Paste); - USHORT nFormulaBits = getPasteFormulaBits(Operation); - implnPasteSpecial(nFlags,nFormulaBits,SkipBlanks,Transpose); - -} - -uno::Reference< vba::XRange > -ScVbaRange::getEntireColumnOrRow( bool bEntireRow ) throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetCellRange > xSheetCellRange(mxRange, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet( xSheetCellRange->getSpreadsheet(), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor( xSheet->createCursorByRange( xSheetCellRange ), uno::UNO_QUERY_THROW ); - if ( bEntireRow ) - xSheetCellCursor->expandToEntireRows(); - else - xSheetCellCursor->expandToEntireColumns(); - - uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW); - uno::Reference< table::XCellRange > xCellRange( xSheet, uno::UNO_QUERY_THROW); - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xCellRange->getCellRangeByPosition( xCellRangeAddressable->getRangeAddress().StartColumn, xCellRangeAddressable->getRangeAddress().StartRow, xCellRangeAddressable->getRangeAddress().EndColumn, xCellRangeAddressable->getRangeAddress().EndRow ) , bEntireRow, !bEntireRow ) ); -} - -uno::Reference< vba::XRange > SAL_CALL -ScVbaRange::getEntireRow() throw (uno::RuntimeException) -{ - return getEntireColumnOrRow(); -} - -uno::Reference< vba::XRange > SAL_CALL -ScVbaRange::getEntireColumn() throw (uno::RuntimeException) -{ - return getEntireColumnOrRow( false ); -} - -uno::Reference< beans::XPropertySet > -getRowOrColumnProps( const uno::Reference< table::XCellRange >& xCellRange, bool bRows ) throw ( uno::RuntimeException ) -{ - uno::Reference< table::XColumnRowRange > xColRow( xCellRange, uno::UNO_QUERY_THROW ); - uno::Reference< beans::XPropertySet > xProps; - if ( bRows ) - xProps.set( xColRow->getRows(), uno::UNO_QUERY_THROW ); - else - xProps.set( xColRow->getColumns(), uno::UNO_QUERY_THROW ); - return xProps; -} - -uno::Any SAL_CALL -ScVbaRange::getHidden() throw (uno::RuntimeException) -{ - bool bIsVisible = false; - try - { - uno::Reference< beans::XPropertySet > xProps = getRowOrColumnProps( mxRange, mbIsRows ); - if ( !( xProps->getPropertyValue( ISVISIBLE ) >>= bIsVisible ) ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to get IsVisible property")), uno::Reference< uno::XInterface >() ); - } - catch( uno::Exception& e ) - { - throw uno::RuntimeException( e.Message, uno::Reference< uno::XInterface >() ); - } - return uno::makeAny( !bIsVisible ); -} - -void SAL_CALL -ScVbaRange::setHidden( const uno::Any& _hidden ) throw (uno::RuntimeException) -{ - sal_Bool bHidden; - if ( !(_hidden >>= bHidden) ) - throw uno::RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Failed to extract param for Hidden property" ) ), uno::Reference< uno::XInterface >() ); - - try - { - uno::Reference< beans::XPropertySet > xProps = getRowOrColumnProps( mxRange, mbIsRows ); - xProps->setPropertyValue( ISVISIBLE, uno::makeAny( !bHidden ) ); - } - catch( uno::Exception& e ) - { - throw uno::RuntimeException( e.Message, uno::Reference< uno::XInterface >() ); - } -} - -// XInterface - -IMPLEMENT_FORWARD_XINTERFACE2( ScVbaRange, ScVbaRange_BASE, OPropertyContainer ) - -// XTypeProvider - -IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScVbaRange, ScVbaRange_BASE, OPropertyContainer ) - -// OPropertySetHelper - -::cppu::IPropertyArrayHelper& -ScVbaRange::getInfoHelper( ) -{ - static ::cppu::IPropertyArrayHelper* sProps = 0; - if ( !sProps ) - sProps = createArrayHelper(); - return *sProps; -} - - -::cppu::IPropertyArrayHelper* -ScVbaRange::createArrayHelper( ) const -{ - uno::Sequence< beans::Property > aProps; - describeProperties( aProps ); - return new ::cppu::OPropertyArrayHelper( aProps ); -} - -// XPropertySet -uno::Reference< beans::XPropertySetInfo > -ScVbaRange::getPropertySetInfo( ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} diff --git a/scratch/sc-vba/vbarange.hxx b/scratch/sc-vba/vbarange.hxx deleted file mode 100644 index b955b03f5..000000000 --- a/scratch/sc-vba/vbarange.hxx +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef SC_VBA_RANGE_HXX -#define SC_VBA_RANGE_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <org/openoffice/vba/XRange.hpp> -#include <com/sun/star/table/XCellRange.hpp> -#include <org/openoffice/vba/XFont.hpp> -#include <org/openoffice/vba/xlPasteType.hdl> -#include <org/openoffice/vba/xlPasteSpecialOperation.hdl> - -#include <comphelper/proparrhlp.hxx> -#include <comphelper/propertycontainer.hxx> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> -#include <com/sun/star/sheet/FillDateMode.hpp> -#include <com/sun/star/sheet/FillMode.hpp> -#include <com/sun/star/sheet/FillDirection.hpp> - -#include "vbahelper.hxx" - -class ScTableSheetsObj; - -typedef ::cppu::WeakImplHelper1< oo::vba::XRange > ScVbaRange_BASE; -class ArrayVisitor -{ -public: - virtual void visitNode( sal_Int32 x, sal_Int32 y, const css::uno::Reference< css::table::XCell >& xCell ) = 0; -}; -class ScVbaRange : public ScVbaRange_BASE - ,public ::comphelper::OMutexAndBroadcastHelper - ,public ::comphelper::OPropertyContainer - -{ - css::uno::Reference< css::table::XCellRange > mxRange; - css::uno::Reference< css::uno::XComponentContext > m_xContext; - sal_Bool mbIsRows; - sal_Bool mbIsColumns; - rtl::OUString msDftPropName; - void visitArray( ArrayVisitor& vistor ); - css::uno::Reference< css::script::XTypeConverter > getTypeConverter() throw (css::uno::RuntimeException); - - css::uno::Reference< oo::vba::XRange > getEntireColumnOrRow( bool bEntireRow = true ) throw( css::uno::RuntimeException ); - - void fillSeries( css::sheet::FillDirection nFillDirection, css::sheet::FillMode nFillMode, css::sheet::FillDateMode nFillDateMode, double fStep, double fEndValue ) throw( css::uno::RuntimeException ); - -public: - ScVbaRange( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::table::XCellRange >& xRange, sal_Bool bIsRows = false, sal_Bool bIsColumns = false ) throw ( css::lang::IllegalArgumentException ); - - virtual ~ScVbaRange() {} - - // Attributes - virtual css::uno::Any SAL_CALL getValue() throw (css::uno::RuntimeException); - virtual void SAL_CALL setValue( const css::uno::Any& aValue ) throw ( css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getFormula() throw (css::uno::RuntimeException); - virtual void SAL_CALL setFormula( const ::rtl::OUString &rFormula ) throw (css::uno::RuntimeException); - virtual double SAL_CALL getCount() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getRow() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getColumn() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException); - virtual void SAL_CALL setText( const ::rtl::OUString &rString ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getFormulaArray() throw (css::uno::RuntimeException); - virtual void SAL_CALL setFormulaArray(const ::rtl::OUString &rFormula) throw (css::uno::RuntimeException); - virtual void SAL_CALL setNumberFormat( const ::rtl::OUString &rNumberFormat ) throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getNumberFormat() throw (css::uno::RuntimeException); - virtual void SAL_CALL setMergeCells( sal_Bool bMerge ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getMergeCells() throw (css::uno::RuntimeException); - virtual void SAL_CALL setWrapText( sal_Bool bIsWrapped ) throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getWrapText() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL getEntireRow() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL getEntireColumn() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getHidden() throw (css::uno::RuntimeException); - virtual void SAL_CALL setHidden( const css::uno::Any& _hidden ) throw (css::uno::RuntimeException); - // Methods - sal_Bool IsRows() { return mbIsRows; } - sal_Bool IsColumns() { return mbIsColumns; } - virtual void SAL_CALL Clear() throw (css::uno::RuntimeException); - virtual void SAL_CALL ClearComments() throw (css::uno::RuntimeException); - virtual void SAL_CALL ClearContents() throw (css::uno::RuntimeException); - virtual void SAL_CALL ClearFormats() throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL HasFormula() throw (css::uno::RuntimeException); - virtual void SAL_CALL FillLeft() throw (css::uno::RuntimeException); - virtual void SAL_CALL FillRight() throw (css::uno::RuntimeException); - virtual void SAL_CALL FillUp() throw (css::uno::RuntimeException); - virtual void SAL_CALL FillDown() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Offset( const css::uno::Any &nRowOffset, const css::uno::Any &nColOffset ) - throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL CurrentRegion() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL CurrentArray() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL Characters( const css::uno::Any& nIndex, const css::uno::Any& nCount ) - throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL Address() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Cells( const css::uno::Any &nRow, const css::uno::Any &nCol ) - throw (css::uno::RuntimeException); - virtual void SAL_CALL Select() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Rows( const css::uno::Any& nIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Columns( const css::uno::Any &nIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Copy( const css::uno::Any& Destination ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Cut( const css::uno::Any& Destination ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Resize( const css::uno::Any& RowSize, const css::uno::Any& ColumnSize ) - throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XFont > SAL_CALL Font() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XInterior > SAL_CALL Interior( ) throw (css::uno::RuntimeException) ; - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Range( const css::uno::Any &Cell1, const css::uno::Any &Cell2 ) - throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getCellRange( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL PasteSpecial( sal_Int16 Paste, sal_Int16 Operation, ::sal_Bool SkipBlanks, ::sal_Bool Transpose ) throw (css::uno::RuntimeException); - // XPropertySet - - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (css::uno::RuntimeException); - - // XInterface - DECLARE_XINTERFACE() - - // XTypeProvider - DECLARE_XTYPEPROVIDER() -protected: - // OPropertySetHelper - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; - -}; - -#endif /* SC_VBA_RANGE_HXX */ - diff --git a/scratch/sc-vba/vbaseriescollection.cxx b/scratch/sc-vba/vbaseriescollection.cxx deleted file mode 100644 index 0c1824412..000000000 --- a/scratch/sc-vba/vbaseriescollection.cxx +++ /dev/null @@ -1,73 +0,0 @@ -#include "vbaseriescollection.hxx" -#include <org/openoffice/vba/XSeries.hpp> - -#include "vbaglobals.hxx" - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -uno::Reference< oo::vba::XApplication > -ScVbaSeriesCollection::getApplication() throw (uno::RuntimeException) -{ - return ScVbaGlobals::getGlobalsImpl( m_xContext )->getApplication(); -} -::sal_Int32 -ScVbaSeriesCollection::getCount() throw (uno::RuntimeException) -{ - return 0; -} - -uno::Any -ScVbaSeriesCollection::Item( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - return uno::Any(); -} - -// XEnumerationAccess - -uno::Reference< container::XEnumeration > -ScVbaSeriesCollection::createEnumeration() throw (uno::RuntimeException) -{ - uno::Reference< container::XEnumeration > xEnum; - return xEnum; -} - -// XElementAccess - -uno::Type -ScVbaSeriesCollection::getElementType() throw (uno::RuntimeException) -{ - return vba::XSeries::static_type(0); -} -::sal_Bool -ScVbaSeriesCollection::hasElements() throw (uno::RuntimeException) -{ - // #TODO #TOFIX Really?, how can we say that! - // needs to delegate to xIndex - return sal_True; -} - -uno::Any SAL_CALL -ScVbaSeriesCollection::getParent() throw (uno::RuntimeException) -{ - uno::Reference< vba::XApplication > xApplication = - getApplication(); - uno::Reference< vba::XWorkbook > xWorkbook; - if ( xApplication.is() ) - { - xWorkbook = xApplication->getActiveWorkbook(); - } - return uno::Any( xWorkbook ); -} - -sal_Int32 SAL_CALL -ScVbaSeriesCollection::getCreator() throw (uno::RuntimeException) -{ - SC_VBA_STUB(); - return 0; -} - - - - - diff --git a/scratch/sc-vba/vbaseriescollection.hxx b/scratch/sc-vba/vbaseriescollection.hxx deleted file mode 100644 index 631d750cf..000000000 --- a/scratch/sc-vba/vbaseriescollection.hxx +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef SC_VBA_SERIESCOLLECTION_HXX -#define SC_VBA_SERIESCOLLECTION_HXX -#include <org/openoffice/vba/XSeriesCollection.hpp> -#include <cppuhelper/implbase2.hxx> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> - -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper2<oo::vba::XSeriesCollection, -css::container::XEnumerationAccess > SeriesCollectionImpl_BASE; - -class ScVbaSeriesCollection : public SeriesCollectionImpl_BASE -{ - - css::uno::Reference< css::uno::XComponentContext > m_xContext; -public: - ScVbaSeriesCollection( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext(xContext) {} - //XCollection - virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getParent() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getCreator() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XApplication > SAL_CALL getApplication() throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - - // XEnumerationAccess - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - // XElementAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL hasElements() throw (css::uno::RuntimeException); -}; - -#endif //SC_VBA_WINDOW_HXX diff --git a/scratch/sc-vba/vbawindow.cxx b/scratch/sc-vba/vbawindow.cxx deleted file mode 100644 index 1a5c37988..000000000 --- a/scratch/sc-vba/vbawindow.cxx +++ /dev/null @@ -1,238 +0,0 @@ -#include "vbawindow.hxx" -#include "vbaworksheets.hxx" -#include "vbaworksheet.hxx" -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/sheet/XSpreadsheet.hpp> -#include <com/sun/star/container/XNamed.hpp> - -#include <docsh.hxx> -#include <tabvwsh.hxx> -#include <docuno.hxx> -#include <sc.hrc> -#include <hash_map> - -using namespace ::com::sun::star; -using namespace ::org::openoffice; - -typedef std::hash_map< rtl::OUString, -SCTAB, ::rtl::OUStringHash, -::std::equal_to< ::rtl::OUString > > NameIndexHash; - -typedef std::vector < uno::Reference< sheet::XSpreadsheet > > Sheets; - -typedef ::cppu::WeakImplHelper1< container::XEnumeration - -> Enumeration_BASE; - -typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess - , com::sun::star::container::XIndexAccess - , com::sun::star::container::XNameAccess - > SelectedSheets_BASE; - - -class SelectedSheetsEnum : public Enumeration_BASE -{ -public: - uno::Reference< uno::XComponentContext > m_xContext; - uno::Reference< frame::XModel > m_xModel; - Sheets m_sheets; - Sheets::const_iterator m_it; - - SelectedSheetsEnum( const uno::Reference< uno::XComponentContext >& xContext, const Sheets& sheets, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_sheets( sheets ), m_xModel( xModel ) - { - m_it = m_sheets.begin(); - } - // XEnumeration - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) - { - return m_it != m_sheets.end(); - } - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( !hasMoreElements() ) - { - throw container::NoSuchElementException(); - } - return makeAny( uno::Reference< vba::XWorksheet > ( new ScVbaWorksheet( m_xContext, *(m_it++), m_xModel ) ) ); - } - - -}; - -class SelectedSheetsEnumAccess : public SelectedSheets_BASE -{ - uno::Reference< uno::XComponentContext > m_xContext; - NameIndexHash namesToIndices; - Sheets sheets; - uno::Reference< frame::XModel > m_xModel; -public: - SelectedSheetsEnumAccess( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ):m_xContext( xContext ), m_xModel( xModel ) - { - ScModelObj* pModel = static_cast< ScModelObj* >( m_xModel.get() ); - if ( !pModel ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain current document" ) ), uno::Reference< uno::XInterface >() ); - ScDocShell* pDocShell = (ScDocShell*)pModel->GetEmbeddedObject(); - if ( !pDocShell ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain docshell" ) ), uno::Reference< uno::XInterface >() ); - ScTabViewShell* pViewShell = getCurrentBestViewShell(); - if ( !pViewShell ) - throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Cannot obtain view shell" ) ), uno::Reference< uno::XInterface >() ); - - SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); - uno::Sequence<sal_Int32> aSheets( nTabCount ); - sal_Int32 nIndex = 0; - const ScMarkData& rMarkData = pViewShell->GetViewData()->GetMarkData(); - sheets.reserve( nTabCount ); - uno::Reference <sheet::XSpreadsheetDocument> xSpreadSheet( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference <container::XIndexAccess> xIndex( xSpreadSheet->getSheets(), uno::UNO_QUERY_THROW ); - for ( SCTAB nTab=0; nTab<nTabCount; nTab++ ) - { - if ( rMarkData.GetTableSelect(nTab) ) - { - uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex( nTab ), uno::UNO_QUERY_THROW ); - uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW ); - sheets.push_back( xSheet ); - namesToIndices[ xNamed->getName() ] = nIndex++; - } - } - - } - - //XEnumerationAccess - virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) - { - return new SelectedSheetsEnum( m_xContext, sheets, m_xModel ); - } - // XIndexAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) - { - return sheets.size(); - } - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( Index < 0 - || Index >= sheets.size() ) - throw lang::IndexOutOfBoundsException(); - - //return makeAny( uno::Reference< vba::XWorksheet > ( new ScVbaWorksheet( m_xContext, sheets[ Index ], m_xModel ) ) ); - return makeAny( sheets[ Index ] ); - } - - //XElementAccess - virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) - { - return vba::XWorksheet::static_type(0); - } - - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) - { - return (sheets.size() > 0); - } - - //XNameAccess - virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - NameIndexHash::const_iterator it = namesToIndices.find( aName ); - if ( it == namesToIndices.end() ) - throw container::NoSuchElementException(); - //return makeAny( uno::Reference< vba::XWorksheet > ( new ScVbaWorksheet( m_xContext, sheets[ it->second ], m_xModel ) ) ); - return makeAny( sheets[ it->second ] ); - - } - - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) - { - uno::Sequence< ::rtl::OUString > names( namesToIndices.size() ); - ::rtl::OUString* pString = names.getArray(); - NameIndexHash::const_iterator it = namesToIndices.begin(); - NameIndexHash::const_iterator it_end = namesToIndices.end(); - for ( ; it != it_end; ++it, ++pString ) - *pString = it->first; - return names; - } - - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) - { - NameIndexHash::const_iterator it = namesToIndices.find( aName ); - return (it != namesToIndices.end()); - } - - -}; - - -void -ScVbaWindow::Scroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft, bool bLargeScroll ) throw (uno::RuntimeException) -{ - sal_Int16 down = 0; - sal_Int16 up = 0; - sal_Int16 toRight = 0; - sal_Int16 toLeft = 0; - Down >>= down; - Up >>= up; - ToRight >>= toRight; - ToLeft >>= toLeft; - uno::Sequence< beans::PropertyValue > args1(2); - args1[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "By" ) ); - args1[1].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Sel" ) ); - args1[1].Value <<= false; - - sal_Int16 totalUp = up - down; - sal_Int16 totalLeft = toLeft - toRight; - - if ( totalUp != 0 ) - { - args1[0].Value <<= totalUp; - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoUp")); - if ( bLargeScroll ) - url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoUpBlock")); - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - dispatchRequests( xModel, url, args1 ); - } - - if ( totalLeft != 0 ) - { - args1[0].Value <<= totalLeft; - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:GoLeft")); - if ( bLargeScroll ) - url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:")) + rtl::OUString::valueOf( (sal_Int32)SID_CURSORPAGELEFT_ ); - uno::Reference< frame::XModel > xModel = getCurrentDocument(); - dispatchRequests( xModel, url, args1 ); - } - -} -void SAL_CALL -ScVbaWindow::SmallScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException) -{ - Scroll( Down, Up, ToRight, ToLeft ); -} -void SAL_CALL -ScVbaWindow::LargeScroll( const uno::Any& Down, const uno::Any& Up, const uno::Any& ToRight, const uno::Any& ToLeft ) throw (uno::RuntimeException) -{ - Scroll( Down, Up, ToRight, ToLeft, true ); -} - -uno::Any SAL_CALL -ScVbaWindow::SelectedSheets( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - uno::Reference< container::XEnumerationAccess > xEnumAccess( new SelectedSheetsEnumAccess( m_xContext, getCurrentDocument() ) ); - return makeAny( uno::Reference< vba::XWorksheets > ( new ScVbaWorksheets( m_xContext, xEnumAccess, getCurrentDocument() ) ) ); -} - -void SAL_CALL -ScVbaWindow::ScrollWorkbookTabs( const uno::Any& Sheets, const uno::Any& Position ) throw (uno::RuntimeException) -{ - sal_Int32 nSheets = 0; - sal_Int32 nPosition = 0; - sal_Bool bSheets = ( Sheets >>= nSheets ); - sal_Bool bPosition = ( Position >>= nPosition ); -// #TODO #FIXME need some implementation to scroll through the tabs -// but where is this done? - if ( bSheets || bPosition ) // at least one param specified - if ( bSheets ) - ;// use sheets - else if ( bPosition ) - ; //use position - -} - diff --git a/scratch/sc-vba/vbawindow.hxx b/scratch/sc-vba/vbawindow.hxx deleted file mode 100644 index abb5d7f85..000000000 --- a/scratch/sc-vba/vbawindow.hxx +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SC_VBA_WINDOW_HXX -#define SC_VBA_WINDOW_HXX -#include <cppuhelper/implbase1.hxx> -#include <org/openoffice/vba/XWindow.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include "vbahelper.hxx" - -typedef ::cppu::WeakImplHelper1<oo::vba::XWindow > WindowImpl_BASE; - -class ScVbaWindow : public WindowImpl_BASE -{ - css::uno::Reference< css::uno::XComponentContext > m_xContext; - void Scroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft, bool bLargeScroll = false ) throw (css::uno::RuntimeException); -public: - ScVbaWindow( css::uno::Reference< css::uno::XComponentContext >& xContext ) : m_xContext(xContext) {} - //XWindow - virtual void SAL_CALL SmallScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException); - virtual void SAL_CALL LargeScroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL SelectedSheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL ScrollWorkbookTabs( const css::uno::Any& Sheets, const css::uno::Any& Position ) throw (css::uno::RuntimeException); -}; - -#endif //SC_VBA_WINDOW_HXX diff --git a/scratch/sc-vba/vbaworkbook.cxx b/scratch/sc-vba/vbaworkbook.cxx deleted file mode 100644 index 041dbc72f..000000000 --- a/scratch/sc-vba/vbaworkbook.cxx +++ /dev/null @@ -1,188 +0,0 @@ -#include <tools/urlobj.hxx> - -#include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/util/XProtectable.hpp> -#include <com/sun/star/sheet/XSpreadsheetView.hpp> -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/frame/XFrame.hpp> - -#include "vbaworksheet.hxx" -#include "vbaworksheets.hxx" -#include "vbaworkbook.hxx" -#include "vbahelper.hxx" - -#include <stdio.h> - -// Much of the impl. for the equivalend UNO module is -// sc/source/ui/unoobj/docuno.cxx, viewuno.cxx - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - -class ActiveSheet : public ScVbaWorksheet -{ -protected: - virtual uno::Reference< frame::XModel > getModel() - { - return getCurrentDocument(); - } - virtual uno::Reference< sheet::XSpreadsheet > getSheet() - { - uno::Reference< frame::XModel > xModel = getModel(); - uno::Reference< sheet::XSpreadsheet > xSheet; - if ( xModel.is() ) - { - uno::Reference< sheet::XSpreadsheetView > xSpreadsheet( - xModel->getCurrentController(), uno::UNO_QUERY ); - if ( xSpreadsheet.is() ) - xSheet = xSpreadsheet->getActiveSheet(); - } - return xSheet; - } -public: - ActiveSheet( uno::Reference< uno::XComponentContext >& xContext ) : ScVbaWorksheet( xContext ) {} - -}; - - -::rtl::OUString -ScVbaWorkbook::getName() throw (uno::RuntimeException) -{ - INetURLObject aURL( getModel()->getURL() ); - return aURL.GetLastName(); -} -::rtl::OUString -ScVbaWorkbook::getPath() throw (uno::RuntimeException) -{ - INetURLObject aURL( getModel()->getURL() ); - aURL.CutLastName(); - return aURL.GetURLPath(); -} - -::rtl::OUString -ScVbaWorkbook::getFullName() throw (uno::RuntimeException) -{ - INetURLObject aURL( getModel()->getURL() ); - return aURL.GetURLPath(); -} -uno::Reference< vba::XWorksheet > -ScVbaWorkbook::getActiveSheet() throw (uno::RuntimeException) -{ - return new ActiveSheet( m_xContext ); -} -uno::Any SAL_CALL -ScVbaWorkbook::Worksheets( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - uno::Reference< frame::XModel > xModel( getModel() ); - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xModel, uno::UNO_QUERY_THROW ); - uno::Reference<sheet::XSpreadsheets > xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW ); - uno::Reference< vba::XCollection > xWorkSheets( uno::Reference< vba::XWorksheets >( new ScVbaWorksheets(m_xContext, xSheets, xModel ) ), uno::UNO_QUERY_THROW ); - if ( aIndex.getValueTypeClass() == uno::TypeClass_VOID ) - { - return uno::Any( xWorkSheets ); - } - return uno::Any( xWorkSheets->Item( aIndex ) ); -} - -void -ScVbaWorkbook::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, - const uno::Any &rRouteArg ) throw (uno::RuntimeException) -{ - sal_Bool bSaveChanges = sal_False; - rtl::OUString aFileName; - sal_Bool bRouteWorkbook = sal_True; - - rSaveArg >>= bSaveChanges; - sal_Bool bFileName = ( rFileArg >>= aFileName ); - rRouteArg >>= bRouteWorkbook; - uno::Reference< frame::XStorable > xStorable( getModel(), uno::UNO_QUERY_THROW ); - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - - if( bSaveChanges ) - { - if( xStorable->isReadonly() ) - { - throw uno::RuntimeException(::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ), - uno::Reference< XInterface >() ); - } - if( bFileName ) - xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) ); - else - xStorable->store(); - } - else - xModifiable->setModified( false ); - - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc")); - uno::Reference< frame::XModel > xModel = getModel(); - dispatchRequests(xModel,url); -} - -void -ScVbaWorkbook::Protect( const uno::Any &aPassword ) throw (uno::RuntimeException) -{ - rtl::OUString rPassword; - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - SC_VBA_FIXME(("Workbook::Protect stub")); - if( aPassword >>= rPassword ) - xProt->protect( rPassword ); - else - xProt->protect( rtl::OUString() ); -} - -void -ScVbaWorkbook::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException) -{ - rtl::OUString rPassword; - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - if( !getProtectStructure() ) - throw uno::RuntimeException(::rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "File is already unprotected" ) ), - uno::Reference< XInterface >() ); - else - { - if( aPassword >>= rPassword ) - xProt->unprotect( rPassword ); - else - xProt->unprotect( rtl::OUString() ); - } -} - -::sal_Bool -ScVbaWorkbook::getProtectStructure() throw (uno::RuntimeException) -{ - uno::Reference< util::XProtectable > xProt( getModel(), uno::UNO_QUERY_THROW ); - return xProt->isProtected(); -} - -void -ScVbaWorkbook::setSaved( sal_Bool bSave ) throw (uno::RuntimeException) -{ - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - xModifiable->setModified( bSave ); -} - -sal_Bool -ScVbaWorkbook::getSaved() throw (uno::RuntimeException) -{ - uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW ); - return xModifiable->isModified(); -} - -void -ScVbaWorkbook::Save() throw (uno::RuntimeException) -{ - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Save")); - uno::Reference< frame::XModel > xModel = getModel(); - dispatchRequests(xModel,url); -} - -void -ScVbaWorkbook::Activate() throw (uno::RuntimeException) -{ - uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW ); - xFrame->activate(); -} - diff --git a/scratch/sc-vba/vbaworkbook.hxx b/scratch/sc-vba/vbaworkbook.hxx deleted file mode 100644 index bac6c321a..000000000 --- a/scratch/sc-vba/vbaworkbook.hxx +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef SC_VBA_WORKBOOK_HXX -#define SC_VBA_WORKBOOK_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <com/sun/star/frame/XModel.hpp> -#include <org/openoffice/vba/XWorkbook.hpp> -#include "vbahelper.hxx" - -class ScModelObj; - -typedef ::cppu::WeakImplHelper1< oo::vba::XWorkbook > ScVbaWorkbook_BASE; - -class ScVbaWorkbook : public ScVbaWorkbook_BASE -{ - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::frame::XModel > mxModel; -protected: - virtual css::uno::Reference< css::frame::XModel > getModel() { return mxModel; } - ScVbaWorkbook( css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext( xContext ){} -public: - ScVbaWorkbook( css::uno::Reference< css::uno::XComponentContext >& xContext, - css::uno::Reference< css::frame::XModel > xModel ) : - mxModel( xModel ), m_xContext( xContext ){} - virtual ~ScVbaWorkbook() {} - - // Attributes - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getPath() throw (css::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getProtectStructure() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorksheet > SAL_CALL getActiveSheet() throw (css::uno::RuntimeException); - virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException); - virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException); - - // Methods - virtual css::uno::Any Worksheets( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges, - const css::uno::Any &aFileName, - const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Save() throw (css::uno::RuntimeException); - virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); -}; - -#endif /* SC_VBA_WORKBOOK_HXX */ diff --git a/scratch/sc-vba/vbaworkbooks.cxx b/scratch/sc-vba/vbaworkbooks.cxx deleted file mode 100644 index bd13cb032..000000000 --- a/scratch/sc-vba/vbaworkbooks.cxx +++ /dev/null @@ -1,291 +0,0 @@ -#include <comphelper/processfactory.hxx> - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase3.hxx> - -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/lang/XComponent.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/util/XModifiable.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/lang/DisposedException.hpp> -#include <com/sun/star/beans/PropertyVetoException.hpp> -#include <com/sun/star/util/XCloseable.hpp> -#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> - -#include <sfx2/objsh.hxx> -#include <tools/urlobj.hxx> - -#include "vbaglobals.hxx" -#include "vbaworkbook.hxx" -#include "vbaworkbooks.hxx" -#include "vbahelper.hxx" - -#include <hash_map> - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - - -typedef std::hash_map< rtl::OUString, -sal_Int32, ::rtl::OUStringHash, -::std::equal_to< ::rtl::OUString > > NameIndexHash; - -typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > WorkBooks; - -typedef ::cppu::WeakImplHelper1< container::XEnumeration > SpreadSheetDocEnumImpl_BASE; - -static uno::Any -getWorkbook( uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSpreadsheetDocument > &xDoc ) -{ - // FIXME: fine as long as ScVbaWorkbook is stateless ... - uno::Reference< frame::XModel > xModel( xDoc, uno::UNO_QUERY ); - if( !xModel.is() ) - return uno::Any(); - - ScVbaWorkbook *pWb = new ScVbaWorkbook( xContext, xModel ); - return uno::Any( uno::Reference< vba::XWorkbook > (pWb) ); -} - - -// #FIXME clearly this is a candidate for some sort of helper base class as -// this is a copy of SelectedSheetsEnum ( vbawindow.cxx ) - -class SpreadSheetDocEnumImpl : public SpreadSheetDocEnumImpl_BASE -{ - uno::Reference< uno::XComponentContext > m_xContext; - WorkBooks m_books; - WorkBooks::const_iterator m_it; - -public: - SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const WorkBooks& books ) throw ( uno::RuntimeException ) : m_xContext( xContext ), m_books( books ) - { - m_it = m_books.begin(); - } - SpreadSheetDocEnumImpl( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::RuntimeException ) : m_xContext( xContext ) - { - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), m_xContext), uno::UNO_QUERY_THROW ); - uno::Reference< container::XEnumeration > mxComponents = xDesktop->getComponents()->createEnumeration(); - sal_Int32 nIndex=0; - while( mxComponents->hasMoreElements() ) - { - uno::Reference< sheet::XSpreadsheetDocument > xNext( mxComponents->nextElement(), uno::UNO_QUERY ); - if ( xNext.is() ) - m_books.push_back( xNext ); - } - m_it = m_books.begin(); - } - // XEnumeration - virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (uno::RuntimeException) - { - return m_it != m_books.end(); - } - - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( !hasMoreElements() ) - { - throw container::NoSuchElementException(); - } - return makeAny( *(m_it++) ); - } -}; - -class WorkBookEnumImpl : public EnumerationHelperImpl -{ -public: - WorkBookEnumImpl( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ){} - - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - uno::Reference< sheet::XSpreadsheetDocument > xDoc( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); - return getWorkbook( m_xContext, xDoc ); - } - -}; - -// #FIXME clearly this is also a candidate for some sort of helper base class as -// a very similar one is used in vbawindow ( SelectedSheetsEnumAccess ) -// Maybe a template base class that does all of the operations on the hashmap -// and vector only, and the sub-class does everything else -// => ctor, createEnumeration & factory method need be defined ( to be called -// by getByIndex, getByName ) -typedef ::cppu::WeakImplHelper3< container::XEnumerationAccess - , com::sun::star::container::XIndexAccess - , com::sun::star::container::XNameAccess - > WorkBooksAccessImpl_BASE; - -class WorkBooksAccessImpl : public WorkBooksAccessImpl_BASE -{ - uno::Reference< uno::XComponentContext > m_xContext; - WorkBooks m_books; - NameIndexHash namesToIndices; -public: - WorkBooksAccessImpl( const uno::Reference< uno::XComponentContext >& xContext ):m_xContext( xContext ) - { - uno::Reference< container::XEnumeration > xEnum = new SpreadSheetDocEnumImpl( m_xContext ); - sal_Int32 nIndex=0; - while( xEnum->hasMoreElements() ) - { - uno::Reference< sheet::XSpreadsheetDocument > xNext( xEnum->nextElement(), uno::UNO_QUERY ); - if ( xNext.is() ) - { - m_books.push_back( xNext ); - uno::Reference< frame::XModel > xModel( xNext, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given - INetURLObject aURL( xModel->getURL() ); - aURL.CutLastName(); - namesToIndices[ aURL.GetURLPath() ] = nIndex++; - } - } - - } - - //XEnumerationAccess - virtual uno::Reference< container::XEnumeration > SAL_CALL createEnumeration( ) throw (uno::RuntimeException) - { - return new SpreadSheetDocEnumImpl( m_xContext, m_books ); - } - // XIndexAccess - virtual ::sal_Int32 SAL_CALL getCount( ) throw (uno::RuntimeException) - { - return m_books.size(); - } - virtual uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw ( lang::IndexOutOfBoundsException, lang::WrappedTargetException, uno::RuntimeException) - { - if ( Index < 0 - || Index >= m_books.size() ) - throw lang::IndexOutOfBoundsException(); - return makeAny( m_books[ Index ] ); // returns xspreadsheetdoc - } - - //XElementAccess - virtual uno::Type SAL_CALL getElementType( ) throw (uno::RuntimeException) - { - return sheet::XSpreadsheetDocument::static_type(0); - } - - virtual ::sal_Bool SAL_CALL hasElements( ) throw (uno::RuntimeException) - { - return (m_books.size() > 0); - } - - //XNameAccess - virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - NameIndexHash::const_iterator it = namesToIndices.find( aName ); - if ( it == namesToIndices.end() ) - throw container::NoSuchElementException(); - return makeAny( m_books[ it->second ] ); - - } - - virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException) - { - uno::Sequence< ::rtl::OUString > names( namesToIndices.size() ); - ::rtl::OUString* pString = names.getArray(); - NameIndexHash::const_iterator it = namesToIndices.begin(); - NameIndexHash::const_iterator it_end = namesToIndices.end(); - for ( ; it != it_end; ++it, ++pString ) - *pString = it->first; - return names; - } - - virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException) - { - NameIndexHash::const_iterator it = namesToIndices.find( aName ); - return (it != namesToIndices.end()); - } - -}; - -ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xContext, uno::Reference< container::XIndexAccess >( new WorkBooksAccessImpl( xContext ) ) ) -{ -} -// XEnumerationAccess -uno::Type -ScVbaWorkbooks::getElementType() throw (uno::RuntimeException) -{ - return vba::XWorkbook::static_type(0); -} -uno::Reference< container::XEnumeration > -ScVbaWorkbooks::createEnumeration() throw (uno::RuntimeException) -{ - return new WorkBookEnumImpl( m_xContext, uno::Reference< container::XEnumeration >( new SpreadSheetDocEnumImpl(m_xContext) ) ); -} - -uno::Any -ScVbaWorkbooks::createCollectionObject( const css::uno::Any& aSource ) -{ - uno::Reference< sheet::XSpreadsheetDocument > xDoc( aSource, uno::UNO_QUERY ); - return getWorkbook( m_xContext, xDoc ); -} - - -uno::Any SAL_CALL -ScVbaWorkbooks::Add() throw (uno::RuntimeException) -{ - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XComponentLoader > xLoader( - xSMgr->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), - m_xContext), uno::UNO_QUERY_THROW ); - uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc") ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_blank") ), 0, - uno::Sequence< beans::PropertyValue >(0) ); - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); - - if( xSpreadDoc.is() ) - return getWorkbook( m_xContext, xSpreadDoc ); - return uno::Any(); -} - -void -ScVbaWorkbooks::Close() throw (uno::RuntimeException) -{ - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW ); - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc")); - dispatchRequests(xModel,url); -} - -uno::Any -ScVbaWorkbooks::Open( const uno::Any &aFileName ) throw (uno::RuntimeException) -{ - rtl::OUString aURL(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("file://") )); - rtl::OUString aTempName; - aFileName >>= aTempName; - aURL += aTempName; - - uno::Reference< lang::XMultiComponentFactory > xSMgr( - m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - - uno::Reference< frame::XDesktop > xDesktop - (xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop") , m_xContext), - uno::UNO_QUERY_THROW ); - uno::Reference< frame::XComponentLoader > xLoader( - xSMgr->createInstanceWithContext( - ::rtl::OUString::createFromAscii("com.sun.star.frame.Desktop"), - m_xContext), - uno::UNO_QUERY_THROW ); - uno::Reference< lang::XComponent > xComponent = xLoader->loadComponentFromURL( aURL, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_default") ), - frame::FrameSearchFlag::CREATE, - uno::Sequence< beans::PropertyValue >(0)); - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); - return getWorkbook( m_xContext, xSpreadDoc ); -} - - diff --git a/scratch/sc-vba/vbaworkbooks.hxx b/scratch/sc-vba/vbaworkbooks.hxx deleted file mode 100644 index 6612a3efb..000000000 --- a/scratch/sc-vba/vbaworkbooks.hxx +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef SC_VBA_WORKBOOKS_HXX -#define SC_VBA_WORKBOOKS_HXX - - -#include "vbacollectionimpl.hxx" -#include <org/openoffice/vba/XGlobals.hpp> -#include <org/openoffice/vba/XWorkbooks.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include "vbahelper.hxx" - - -class ScModelObj; - -typedef ::cppu::ImplInheritanceHelper1< ScVbaCollectionBaseImpl, oo::vba::XWorkbooks > ScVbaWorkbooks_BASE; - -class ScVbaWorkbooks : public ScVbaWorkbooks_BASE -{ -private: - css::uno::Reference< oo::vba::XGlobals > getGlobals() throw (css::uno::RuntimeException); - -public: - //ScVbaWorkbooks( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ); - ScVbaWorkbooks( const css::uno::Reference< css::uno::XComponentContext >& xContext ); - virtual ~ScVbaWorkbooks() {} - - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - - // XWorkbooks - virtual css::uno::Any SAL_CALL Add() throw (css::uno::RuntimeException); - virtual void SAL_CALL Close( ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Open(const css::uno::Any &aFileName) throw (css::uno::RuntimeException); - -// delete these - //virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException); - //virtual css::uno::Any SAL_CALL getParent() throw (css::uno::RuntimeException); - //virtual ::sal_Int32 SAL_CALL getCreator() throw (css::uno::RuntimeException); - //virtual css::uno::Reference< oo::vba::XApplication > SAL_CALL getApplication() throw (css::uno::RuntimeException); - - //virtual css::uno::Any SAL_CALL Item( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - -}; - -#endif /* SC_VBA_WORKBOOKS_HXX */ diff --git a/scratch/sc-vba/vbaworksheet.cxx b/scratch/sc-vba/vbaworksheet.cxx deleted file mode 100644 index e34593d33..000000000 --- a/scratch/sc-vba/vbaworksheet.cxx +++ /dev/null @@ -1,538 +0,0 @@ -#include <cppuhelper/queryinterface.hxx> - -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/util/XProtectable.hpp> -#include <com/sun/star/table/XCellRange.hpp> -#include <com/sun/star/sheet/XSpreadsheetView.hpp> -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/sheet/XCalculatable.hpp> -#include <com/sun/star/sheet/XCellRangeAddressable.hpp> -#include <com/sun/star/sheet/XSheetCellRange.hpp> -#include <com/sun/star/sheet/XSheetCellCursor.hpp> -#include <com/sun/star/sheet/XUsedAreaCursor.hpp> -#include <com/sun/star/sheet/XSpreadsheets.hpp> -#include <com/sun/star/sheet/XSheetPastable.hpp> -#include <com/sun/star/sheet/XCellAddressable.hpp> -#include <com/sun/star/sheet/XSheetOutline.hpp> -#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp> -#include <cppuhelper/bootstrap.hxx> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/table/XColumnRowRange.hpp> -#include <com/sun/star/table/XTableChartsSupplier.hpp> -#include <tools/string.hxx> - -#include "vbaoutline.hxx" -#include "vbarange.hxx" -#include "vbaworksheet.hxx" -#include "vbachartobjects.hxx" -#include "vbapivottables.hxx" - -#define STANDARDWIDTH 2267 -#define STANDARDHEIGHT 427 -#define DOESNOTEXIST -1 -using namespace com::sun::star; -using namespace org::openoffice; -static sal_Int16 -nameExists( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, ::rtl::OUString & name) throw ( lang::IllegalArgumentException ) -{ - if (!xSpreadDoc.is()) - throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nameExists() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 ); - uno::Reference <sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); - uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); - if ( xIndex.is() ) - { - sal_Int32 nCount = xIndex->getCount(); - for (sal_Int32 i=0; i < nCount; i++) - { - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(i), uno::UNO_QUERY); - uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW ); - if (xNamed->getName() == name) - { - return i; - } - } - } - return DOESNOTEXIST; -} - -static void getNewSpreadsheetName (rtl::OUString &aNewName, rtl::OUString aOldName, uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc ) -{ - if (!xSpreadDoc.is()) - throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "getNewSpreadsheetName() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 ); - static rtl::OUString aUnderScre( RTL_CONSTASCII_USTRINGPARAM( "_" ) ); - int currentNum =2; - aNewName = aOldName + aUnderScre+ - String::CreateFromInt32(currentNum) ; - while ( nameExists(xSpreadDoc,aNewName) != DOESNOTEXIST ) - { - aNewName = aOldName + aUnderScre + - String::CreateFromInt32(++currentNum) ; - } -} - -static void removeAllSheets( uno::Reference <sheet::XSpreadsheetDocument>& xSpreadDoc, rtl::OUString aSheetName) -{ - if (!xSpreadDoc.is()) - throw lang::IllegalArgumentException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "removeAllSheets() xSpreadDoc is null" ) ), uno::Reference< uno::XInterface >(), 1 ); - uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); - uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); - - if ( xIndex.is() ) - { - uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW); - for (sal_Int32 i = xIndex->getCount() -1; i>= 1; i--) - { - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(i), uno::UNO_QUERY); - uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW ); - if (xNamed.is()) - { - xNameContainer->removeByName(xNamed->getName()); - } - } - - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY); uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW ); - if (xNamed.is()) - { - xNamed->setName(aSheetName); - } - } -} - -static uno::Reference<frame::XModel> -openNewDoc(rtl::OUString aSheetName ) -{ - uno::Reference<frame::XModel> xModel; - try - { - uno::Reference<uno::XComponentContext > xContext( ::cppu::defaultBootstrap_InitialComponentContext()); - if ( !xContext.is() ) - { - return xModel; - } - uno::Reference<lang::XMultiComponentFactory > xServiceManager( - xContext->getServiceManager() ); - if ( !xServiceManager.is() ) - { - return xModel; - } - uno::Reference <frame::XComponentLoader > xComponentLoader( - xServiceManager->createInstanceWithContext( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) ), - xContext ), uno::UNO_QUERY_THROW ); - - uno::Reference<lang::XComponent > xComponent( xComponentLoader->loadComponentFromURL( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:factory/scalc" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" ) ), 0, - uno::Sequence < ::com::sun::star::beans::PropertyValue >() ) ); - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( xComponent, uno::UNO_QUERY_THROW ); - if ( xSpreadDoc.is() ) - { - removeAllSheets(xSpreadDoc,aSheetName); - } - uno::Reference<frame::XModel> xModel(xSpreadDoc,uno::UNO_QUERY_THROW); - return xModel; - } - catch ( ::cppu::BootstrapException & e ) - { - return xModel; - } - catch ( uno::Exception & e ) - { - return xModel; - } -} - - -ScVbaWorksheet::ScVbaWorksheet( const uno::Reference< uno::XComponentContext >& xContext ): m_xContext( xContext ) -{ -} -ScVbaWorksheet::ScVbaWorksheet(const uno::Reference< uno::XComponentContext >& xContext, - const uno::Reference< sheet::XSpreadsheet >& xSheet, - const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException) : m_xContext(xContext), mxSheet( xSheet ), mxModel(xModel) -{ -} - -::rtl::OUString -ScVbaWorksheet::getName() throw (uno::RuntimeException) -{ - uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW ); - return xNamed->getName(); -} - -void -ScVbaWorksheet::setName(const ::rtl::OUString &rName ) throw (uno::RuntimeException) -{ - uno::Reference< container::XNamed > xNamed( getSheet(), uno::UNO_QUERY_THROW ); - xNamed->setName( rName ); -} - -sal_Bool -ScVbaWorksheet::getVisible() throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW ); - uno::Any aValue = xProps->getPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ) ); - sal_Bool bRet = false; - aValue >>= bRet; - return bRet; -} - -void -ScVbaWorksheet::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException) -{ - uno::Reference< beans::XPropertySet > xProps( getSheet(), uno::UNO_QUERY_THROW ); - uno::Any aValue( bVisible ); - xProps->setPropertyValue - (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsVisible" ) ), aValue); -} - -uno::Reference< vba::XRange > -ScVbaWorksheet::getUsedRange() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSheetCellRange > xSheetCellRange(getSheet(), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor( getSheet()->createCursorByRange( xSheetCellRange ), uno::UNO_QUERY_THROW ); - uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW); - xUsedCursor->gotoStartOfUsedArea( false ); - xUsedCursor->gotoEndOfUsedArea( true ); - uno::Reference< table::XCellRange > xRange( xSheetCellCursor, uno::UNO_QUERY); - return new ScVbaRange(m_xContext, xRange); -} - -uno::Reference< vba::XOutline > -ScVbaWorksheet::Outline( ) throw (uno::RuntimeException) -{ - uno::Reference<sheet::XSheetOutline> xOutline(getSheet(),uno::UNO_QUERY_THROW); - return uno::Reference<vba::XOutline> (new ScVbaOutline(m_xContext, xOutline)); -} - -sal_Int32 -ScVbaWorksheet::getStandardWidth() throw (uno::RuntimeException) -{ - return STANDARDWIDTH ; -} - -sal_Int32 -ScVbaWorksheet::getStandardHeight() throw (uno::RuntimeException) -{ - return STANDARDHEIGHT; -} - -sal_Bool -ScVbaWorksheet::getProtectionMode() throw (uno::RuntimeException) -{ - return false; -} - -sal_Bool -ScVbaWorksheet::getProtectContents()throw (uno::RuntimeException) -{ - uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW); - return xProtectable->isProtected(); -} - -sal_Bool -ScVbaWorksheet::getProtectDrawingObjects() throw (uno::RuntimeException) -{ - return false; -} - -void -ScVbaWorksheet::Activate() throw (uno::RuntimeException) -{ - uno::Reference< sheet::XSpreadsheetView > xSpreadsheet( - getModel()->getCurrentController(), uno::UNO_QUERY_THROW ); - xSpreadsheet->setActiveSheet(getSheet()); -} - -void -ScVbaWorksheet::Select() throw (uno::RuntimeException) -{ - Activate(); -} - -void -ScVbaWorksheet::Move( const uno::Any& Before, const uno::Any& After ) throw (uno::RuntimeException) -{ - rtl::OUString aSheetName; - uno::Reference<vba::XWorksheet> xSheet; - rtl::OUString aCurrSheetName =getName(); - - if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue())) - { - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( ); - uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW); - uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY); - uno::Reference<vba::XRange> xRange = new ScVbaRange(m_xContext, xRange1); - if (xRange.is()) - xRange->Select(); - implnCopy(); - uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName); - if (xModel.is()) - { - implnPaste(); - Delete(); - } - return ; - } - - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW ); - sal_Int32 nDest = DOESNOTEXIST; - sal_Bool bAfter = false; - if (Before >>= xSheet ) - { - aSheetName = xSheet->getName(); - nDest = nameExists (xSpreadDoc, aSheetName); - } - else if (After >>= xSheet) - { - aSheetName = xSheet->getName(); - nDest = nameExists (xSpreadDoc, aSheetName); - bAfter =true; - } - - if (nDest != DOESNOTEXIST) - { - if (bAfter) nDest++; - uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); - xSheets->moveByName(aCurrSheetName,nDest); - } -} - -void -ScVbaWorksheet::Copy( const uno::Any& Before, const uno::Any& After ) throw (uno::RuntimeException) -{ - rtl::OUString aSheetName; - uno::Reference<vba::XWorksheet> xSheet; - rtl::OUString aCurrSheetName =getName(); - if (!(Before >>= xSheet) && !(After >>=xSheet)&& !(Before.hasValue()) && !(After.hasValue())) - { - uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = getSheet()->createCursor( ); - uno::Reference<sheet::XUsedAreaCursor> xUsedCursor(xSheetCellCursor,uno::UNO_QUERY_THROW); - uno::Reference< table::XCellRange > xRange1( xSheetCellCursor, uno::UNO_QUERY); - uno::Reference<vba::XRange> xRange = new ScVbaRange(m_xContext, xRange1); - if (xRange.is()) - xRange->Select(); - implnCopy(); - uno::Reference<frame::XModel> xModel = openNewDoc(aCurrSheetName); - if (xModel.is()) - { - implnPaste(); - } - return; - } - - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY ); - sal_Int32 nDest = DOESNOTEXIST; - sal_Bool bAfter = false; - if (Before >>= xSheet ) - { - aSheetName = xSheet->getName(); - nDest = nameExists (xSpreadDoc, aSheetName); - } - else if (After >>= xSheet) - { - aSheetName = xSheet->getName(); - nDest = nameExists (xSpreadDoc, aSheetName); - bAfter =true; - } - - if (nDest != DOESNOTEXIST) - { - if(bAfter) nDest++; - uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); - getNewSpreadsheetName(aSheetName,aCurrSheetName,xSpreadDoc); - xSheets->copyByName(aCurrSheetName,aSheetName,nDest); - } -} - -void -ScVbaWorksheet::Paste( const uno::Any& Destination, const uno::Any& Link ) throw (uno::RuntimeException) -{ - uno::Reference<vba::XRange> xRange( Destination, uno::UNO_QUERY ); - if ( xRange.is() ) - xRange->Select(); - implnPaste(); -} - -void -ScVbaWorksheet::Delete() throw (uno::RuntimeException) -{ - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW ); - rtl::OUString aSheetName = getName(); - if ( xSpreadDoc.is() ) - { - if (!nameExists(xSpreadDoc, aSheetName)) - { - return; - } - uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); - uno::Reference<container::XNameContainer> xNameContainer(xSheets,uno::UNO_QUERY_THROW); - xNameContainer->removeByName(aSheetName); - } -} - -uno::Reference< vba::XWorksheet > -ScVbaWorksheet::getSheetAtOffset(int offset) throw (uno::RuntimeException) -{ - uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( getModel(), uno::UNO_QUERY_THROW ); - uno::Reference <sheet::XSpreadsheets> xSheets( xSpreadDoc->getSheets(), uno::UNO_QUERY_THROW ); - uno::Reference <container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY_THROW ); - - rtl::OUString aName = getName(); - sal_Int16 nIdx = nameExists (xSpreadDoc, aName); - if (nIdx >= 0) - nIdx += offset; - - if (nIdx < 0 || nIdx >= xIndex->getCount()) // TESTME - throw ? - return uno::Reference< vba::XWorksheet >(); - else - { - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(nIdx), uno::UNO_QUERY_THROW); - return new ScVbaWorksheet (m_xContext, xSheet, getModel()); - } -} - -uno::Reference< vba::XWorksheet > -ScVbaWorksheet::getNext() throw (uno::RuntimeException) -{ - return getSheetAtOffset(1); -} - -uno::Reference< vba::XWorksheet > -ScVbaWorksheet::getPrevious() throw (uno::RuntimeException) -{ - return getSheetAtOffset(-1); -} - -void -ScVbaWorksheet::Protect( const uno::Any& Password, const uno::Any& DrawingObjects, const uno::Any& Contents, const uno::Any& Scenarios, const uno::Any& UserInterfaceOnly ) throw (uno::RuntimeException) -{ - uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW); - ::rtl::OUString aPasswd; - Password >>= aPasswd; - xProtectable->protect( aPasswd ); -} - -void -ScVbaWorksheet::Unprotect( const uno::Any& Password ) throw (uno::RuntimeException) -{ - uno::Reference<util::XProtectable > xProtectable(getSheet(), uno::UNO_QUERY_THROW); - ::rtl::OUString aPasswd; - Password >>= aPasswd; - xProtectable->unprotect( aPasswd ); -} - -void -ScVbaWorksheet::Calculate() throw (uno::RuntimeException) -{ - uno::Reference <sheet::XCalculatable> xReCalculate(getModel(), uno::UNO_QUERY_THROW); - xReCalculate->calculate(); -} - -uno::Reference< vba::XRange > -ScVbaWorksheet::Range( const ::uno::Any &rRange ) throw (uno::RuntimeException) -{ - rtl::OUString aStringRange; - rRange >>= aStringRange; - uno::Reference< table::XCellRange > xRanges( getSheet(), uno::UNO_QUERY_THROW ); - OSL_TRACE("Trying to cell range by %s", rtl::OUStringToOString( - aStringRange, RTL_TEXTENCODING_UTF8 ).getStr() ); - try - { - uno::Reference< table::XCellRange > xRange = xRanges->getCellRangeByName( aStringRange ); - } - catch ( uno::Exception& e ) - { - OSL_TRACE("** Caught Exception with msg: %s", - rtl::OUStringToOString( e.Message, - RTL_TEXTENCODING_UTF8 ).getStr() ); - } - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xRanges->getCellRangeByName( aStringRange ) ) ); -} - -void -ScVbaWorksheet::CheckSpelling( const uno::Any& CustomDictionary,const uno::Any& IgnoreUppercase,const uno::Any& AlwaysSuggest, const uno::Any& SpellingLang ) throw (uno::RuntimeException) -{ - rtl::OUString url = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:SpellDialog")); - uno::Reference< frame::XModel > xModel( getModel() ); - dispatchRequests(xModel,url); -} - -uno::Reference< vba::XRange > -ScVbaWorksheet::getSheetRange() throw (uno::RuntimeException) -{ - uno::Reference< table::XCellRange > xRange( getSheet(),uno::UNO_QUERY_THROW ); - return uno::Reference< vba::XRange >( new ScVbaRange( m_xContext, xRange ) ); -} - -// These are hacks - we prolly (somehow) need to inherit -// the vbarange functionality here ... -uno::Reference< vba::XRange > -ScVbaWorksheet::Cells( const ::uno::Any &nRow, const ::uno::Any &nCol ) - throw (uno::RuntimeException) -{ - return getSheetRange()->Cells( nRow, nCol ); -} - -uno::Reference< vba::XRange > -ScVbaWorksheet::Rows(const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - return getSheetRange()->Rows( aIndex ); -} - -uno::Reference< vba::XRange > -ScVbaWorksheet::Columns( const uno::Any& aIndex ) throw (uno::RuntimeException) -{ - return getSheetRange()->Columns( aIndex ); -} - -uno::Any SAL_CALL -ScVbaWorksheet::ChartObjects( const uno::Any& Index ) throw (uno::RuntimeException) -{ - if ( !mxCharts.is() ) - { - uno::Reference< table::XTableChartsSupplier > xChartSupplier( getSheet(), uno::UNO_QUERY_THROW ); - uno::Reference< table::XTableCharts > xTableCharts = xChartSupplier->getCharts(); - - mxCharts = new ScVbaChartObjects( m_xContext, xTableCharts ); - } - if ( Index.hasValue() ) - { - uno::Reference< vba::XCollection > xColl( mxCharts, uno::UNO_QUERY_THROW ); - return xColl->Item( Index ); - } - else - return makeAny( mxCharts ); - -} - -uno::Any SAL_CALL -ScVbaWorksheet::PivotTables( const uno::Any& Index ) throw (uno::RuntimeException) -{ - uno::Reference< css::sheet::XSpreadsheet > xSheet = getSheet(); - uno::Reference< sheet::XDataPilotTablesSupplier > xTables(xSheet, uno::UNO_QUERY_THROW ) ; - uno::Reference< container::XIndexAccess > xIndexAccess( xTables->getDataPilotTables(), uno::UNO_QUERY_THROW ); - - uno::Reference< vba::XCollection > xColl( uno::Reference< vba::XPivotTables > ( new ScVbaPivotTables( m_xContext, xIndexAccess ) ), uno::UNO_QUERY_THROW ); - if ( Index.hasValue() ) - return xColl->Item( Index ); - return makeAny( xColl ); - - -} - -uno::Any SAL_CALL -ScVbaWorksheet::Evaluate( const ::rtl::OUString& Name ) throw (uno::RuntimeException) -{ - // #TODO Evaluate allows other things to be evaluated, e.g. functions - // I think ( like SIN(3) etc. ) need to investigate that - // named Ranges also? e.g. [MyRange] if so need a list of named ranges - if ( isRangeShortCut( Name ) ) - return uno::Any( Range( uno::Any( Name ) ) ); - - return uno::Any(); -} - diff --git a/scratch/sc-vba/vbaworksheet.hxx b/scratch/sc-vba/vbaworksheet.hxx deleted file mode 100644 index 7fe219d1f..000000000 --- a/scratch/sc-vba/vbaworksheet.hxx +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef SC_VBA_WORKSHEET_HXX -#define SC_VBA_WORKSHEET_HXX - -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/sheet/XSpreadsheet.hpp> -#include <org/openoffice/vba/XWorksheet.hpp> -#include <org/openoffice/vba/XRange.hpp> -#include <com/sun/star/lang/XEventListener.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <org/openoffice/vba/XOutline.hpp> -#include <org/openoffice/vba/XChartObjects.hpp> - -#include "vbahelper.hxx" - -class ScVbaWorksheet : public ::cppu::WeakImplHelper1<oo::vba::XWorksheet> -{ - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::sheet::XSpreadsheet > mxSheet; - css::uno::Reference< css::frame::XModel > mxModel; - css::uno::Reference< oo::vba::XChartObjects > mxCharts; - - css::uno::Reference< oo::vba::XWorksheet > getSheetAtOffset(int offset) throw (css::uno::RuntimeException); - css::uno::Reference< oo::vba::XRange > getSheetRange() throw (css::uno::RuntimeException); - - -protected: - - virtual css::uno::Reference< css::frame::XModel > getModel() - { return mxModel; } - virtual css::uno::Reference< css::sheet::XSpreadsheet > getSheet() - { return mxSheet; } - ScVbaWorksheet( const css::uno::Reference< css::uno::XComponentContext >& xContext ); -public: - ScVbaWorksheet( - const css::uno::Reference< css::uno::XComponentContext >& xContext, - const css::uno::Reference< css::sheet::XSpreadsheet >& xSheet, - const css::uno::Reference< css::frame::XModel >& xModel )throw (css::uno::RuntimeException) ; - - virtual ~ScVbaWorksheet() {} - - - // Attributes - virtual ::rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException); - virtual void SAL_CALL setName( const ::rtl::OUString &rName ) throw (css::uno::RuntimeException); - virtual sal_Bool getVisible() throw (css::uno::RuntimeException); - virtual void setVisible( sal_Bool bVisible ) throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getStandardWidth() throw (css::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getStandardHeight() throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getProtectionMode() throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getProtectContents() throw (css::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL getProtectDrawingObjects() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL getUsedRange() throw (css::uno::RuntimeException) ; - virtual css::uno::Any SAL_CALL ChartObjects( const css::uno::Any& Index ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XOutline > SAL_CALL Outline( ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorksheet > SAL_CALL getNext() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XWorksheet > SAL_CALL getPrevious() throw (css::uno::RuntimeException); - - // Methods - virtual void SAL_CALL Activate() throw (css::uno::RuntimeException); - virtual void SAL_CALL Select() throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Range( const css::uno::Any &rRange ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Move( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException) ; - virtual void SAL_CALL Copy( const css::uno::Any& Before, const css::uno::Any& After ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Paste( const css::uno::Any& Destination, const css::uno::Any& Link ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Protect( const css::uno::Any& Password, const css::uno::Any& DrawingObjects, const css::uno::Any& Contents, const css::uno::Any& Scenarios, const css::uno::Any& UserInterfaceOnly ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Unprotect( const css::uno::Any& Password ) throw (css::uno::RuntimeException); - - virtual void SAL_CALL Calculate( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL CheckSpelling( const css::uno::Any& CustomDictionary,const css::uno::Any& IgnoreUppercase,const css::uno::Any& AlwaysSuggest, const css::uno::Any& SpellingLang ) throw (css::uno::RuntimeException); - // Hacks (?) - virtual css::uno::Reference< oo::vba::XRange > SAL_CALL Cells( const css::uno::Any &nRow, const css::uno::Any &nCol ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > Rows(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - virtual css::uno::Reference< oo::vba::XRange > Columns(const css::uno::Any& aIndex ) throw (css::uno::RuntimeException); - - virtual css::uno::Any SAL_CALL Evaluate( const ::rtl::OUString& Name ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL PivotTables( const css::uno::Any& Index ) throw (css::uno::RuntimeException); -}; - -#endif /* SC_VBA_WORKSHEET_HXX */ - diff --git a/scratch/sc-vba/vbaworksheets.cxx b/scratch/sc-vba/vbaworksheets.cxx deleted file mode 100644 index 2a460ebbf..000000000 --- a/scratch/sc-vba/vbaworksheets.cxx +++ /dev/null @@ -1,275 +0,0 @@ -#include "vbaworksheets.hxx" - -#include <sfx2/dispatch.hxx> -#include <sfx2/app.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/request.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/itemwrapper.hxx> -#include <svtools/itemset.hxx> -#include <svtools/eitem.hxx> - -#include <comphelper/processfactory.hxx> -#include <cppuhelper/implbase3.hxx> - -#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/sheet/XSpreadsheetView.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - -#include <org/openoffice/vba/XApplication.hpp> -#include <tools/string.hxx> - -#include "vbaglobals.hxx" -#include "vbaworksheet.hxx" -#include "vbaworkbook.hxx" - -using namespace ::org::openoffice; -using namespace ::com::sun::star; - - -class SheetsEnumeration : public EnumerationHelperImpl -{ - uno::Reference< frame::XModel > m_xModel; -public: - SheetsEnumeration( const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration, const uno::Reference< frame::XModel >& xModel ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xContext, xEnumeration ), m_xModel( xModel ) {} - - virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) - { - uno::Reference< sheet::XSpreadsheet > xSheet( m_xEnumeration->nextElement(), uno::UNO_QUERY_THROW ); - return makeAny( uno::Reference< vba::XWorksheet > ( new ScVbaWorksheet( m_xContext, xSheet, m_xModel ) ) ); - } - -}; - -ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< sheet::XSpreadsheets >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xContext, uno::Reference< container::XIndexAccess >( xSheets, uno::UNO_QUERY ) ), mxModel( xModel ), m_xSheets( xSheets ) -{ -} - -ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext, const uno::Reference< container::XEnumerationAccess >& xEnumAccess, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xContext, uno::Reference< container::XIndexAccess >( xEnumAccess, uno::UNO_QUERY ) ), mxModel(xModel) -{ -} - -// XEnumerationAccess -uno::Type -ScVbaWorksheets::getElementType() throw (uno::RuntimeException) -{ - return vba::XWorksheet::static_type(0); -} - -uno::Reference< container::XEnumeration > -ScVbaWorksheets::createEnumeration() throw (uno::RuntimeException) -{ - if ( !m_xSheets.is() ) - { - uno::Reference< container::XEnumerationAccess > xAccess( m_xIndexAccess, uno::UNO_QUERY_THROW ); - return xAccess->createEnumeration(); - } - uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xSheets, uno::UNO_QUERY_THROW ); - return new SheetsEnumeration( m_xContext, xEnumAccess->createEnumeration(), mxModel ); -} - -uno::Any -ScVbaWorksheets::createCollectionObject( const css::uno::Any& aSource ) -{ - uno::Reference< sheet::XSpreadsheet > xSheet( aSource, uno::UNO_QUERY ); - return makeAny( uno::Reference< vba::XWorksheet > ( new ScVbaWorksheet( m_xContext, xSheet, mxModel ) ) ); -} - -// XWorksheets -uno::Any -ScVbaWorksheets::Add( const uno::Any& Before, const uno::Any& After, - const uno::Any& Count, const uno::Any& Type ) throw (uno::RuntimeException) -{ - if ( isSelectedSheets() ) - return uno::Any(); // or should we throw? - - rtl::OUString aStringSheet; - sal_Bool bBefore(sal_True); - sal_Int32 nSheetIndex = 0; - sal_Int32 nNewSheets = 1, nType = 0; - Count >>= nNewSheets; - Type >>= nType; - sal_Int32 nCount = 0; - Before >>= aStringSheet; - if (!aStringSheet.getLength()) - { - After >>= aStringSheet; - bBefore = sal_False; - } - if (!aStringSheet.getLength()) - { - aStringSheet = ScVbaGlobals::getGlobalsImpl( - m_xContext )->getApplication()->getActiveWorkbook()->getActiveSheet()->getName(); - bBefore = sal_True; - } - nCount = m_xIndexAccess->getCount(); - for (sal_Int32 i=0; i < nCount; i++) - { - uno::Reference< sheet::XSpreadsheet > xSheet(m_xIndexAccess->getByIndex(i), uno::UNO_QUERY); - uno::Reference< container::XNamed > xNamed( xSheet, uno::UNO_QUERY_THROW ); - if (xNamed->getName() == aStringSheet) - { - nSheetIndex = i; - break; - } - } - - if(!bBefore) - nSheetIndex++; - - sal_Int32 nSheetName = nCount + 1L; - String aStringBase( RTL_CONSTASCII_USTRINGPARAM("Sheet") ); - uno::Any result; - for (sal_Int32 i=0; i < nNewSheets; i++, nSheetName++) - { - String aStringName = aStringBase; - aStringName += String::CreateFromInt32(nSheetName); - while (m_xNameAccess->hasByName(aStringName)) - { - nSheetName++; - aStringName = aStringBase; - aStringName += String::CreateFromInt32(nSheetName); - } - m_xSheets->insertNewByName(aStringName, nSheetIndex + i); - result = getItemByStringIndex( aStringName ); - } - - return result; -} - -void -ScVbaWorksheets::Delete() throw (uno::RuntimeException) -{ - //SC_VBA_STUB(); -} - -bool -ScVbaWorksheets::isSelectedSheets() -{ - return !m_xSheets.is(); -} - -void SAL_CALL -ScVbaWorksheets::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException) -{ - sal_Int32 nTo = 0; - sal_Int32 nFrom = 0; - sal_Int16 nCopies = 1; - sal_Bool bCollate = sal_False; - sal_Bool bSelection = sal_False; - From >>= nFrom; - To >>= nTo; - Copies >>= nCopies; - if ( nCopies > 1 ) // Collate only useful when more that 1 copy - Collate >>= bCollate; - - rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) ); - rtl::OUString sFileName; - - if (( nFrom || nTo ) ) - { - if ( nFrom ) - sRange = ( ::rtl::OUString::valueOf( nFrom ) + sRange ); - if ( nTo ) - sRange += ::rtl::OUString::valueOf( nTo ); - } - else if ( isSelectedSheets() ) - { - bSelection = sal_True; - } - - if ( PrToFileName.getValue() ) - { - PrToFileName >>= sFileName; - } - - SfxViewFrame* pViewFrame = getCurrentViewFrame(); - if ( pViewFrame ) - { - SfxAllItemSet aArgs( SFX_APP()->GetPool() ); - - SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate ); - aArgs.Put( sfxCollate, sfxCollate.Which() ); - SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies ); - aArgs.Put( sfxCopies, sfxCopies.Which() ); - if ( sFileName.getLength() ) - { - SfxStringItem sfxFileName( SID_FILE_NAME, sFileName); - aArgs.Put( sfxFileName, sfxFileName.Which() ); - - } - if ( sRange.getLength() ) - { - SfxStringItem sfxRange( SID_PRINT_PAGES, sRange ); - aArgs.Put( sfxRange, sfxRange.Which() ); - } - SfxBoolItem sfxSelection( SID_SELECTION, bSelection ); - aArgs.Put( sfxSelection, sfxSelection.Which() ); - SfxBoolItem sfxAsync( SID_ASYNCHRON, sal_False ); - aArgs.Put( sfxAsync, sfxAsync.Which() ); - SfxDispatcher* pDispatcher = pViewFrame->GetDispatcher(); - - if ( pDispatcher ) - { - pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs ); - } - - } - - // #FIXME #TODO - // 1 Preview ( does such a thing in OO.org? ) - // 2 ActivePrinter ( how/can we switch a printer via API? ) - // 3 PrintToFile ( ms behaviour if this option is specified but no - // filename supplied 'PrToFileName' then the user will be prompted ) - // 4 Need to check behaviour of Selected sheets with range ( e.g. From & To - // values ) in oOO these options are mutually exclusive - // 5 There is a pop up to do with transparent objects in the print source - // should be able to disable that via configuration for the duration - // of this method -} -css::uno::Any SAL_CALL -ScVbaWorksheets::getVisible() throw (css::uno::RuntimeException) -{ - sal_Bool bVisible = sal_True; - uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_QUERY_THROW ); - while ( xEnum->hasMoreElements() ) - { - uno::Reference< vba::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW ); - if ( xSheet->getVisible() == sal_False ) - { - bVisible = sal_False; - break; - } - } - return uno::makeAny( bVisible ); -} - -void SAL_CALL -ScVbaWorksheets::setVisible( const css::uno::Any& _visible ) throw (css::uno::RuntimeException) -{ - sal_Bool bState; - if ( _visible >>= bState ) - { - uno::Reference< container::XEnumeration > xEnum( createEnumeration(), uno::UNO_QUERY_THROW ); - while ( xEnum->hasMoreElements() ) - { - uno::Reference< vba::XWorksheet > xSheet( xEnum->nextElement(), uno::UNO_QUERY_THROW ); - xSheet->setVisible( bState ); - } - } - else - throw uno::RuntimeException( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( "Visible property doesn't support non boolean #FIXME" ) ), uno::Reference< uno::XInterface >() ); -} -//ScVbaCollectionBaseImpl -uno::Any -ScVbaWorksheets::getItemByStringIndex( const rtl::OUString& sIndex ) throw (uno::RuntimeException) -{ - String sScIndex = sIndex; - ScDocument::ConvertToValidTabName( sScIndex, '_' ); - return ScVbaCollectionBaseImpl::getItemByStringIndex( sScIndex ); -} - diff --git a/scratch/sc-vba/vbaworksheets.hxx b/scratch/sc-vba/vbaworksheets.hxx deleted file mode 100644 index b63b36fef..000000000 --- a/scratch/sc-vba/vbaworksheets.hxx +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef SC_VBA_WORKSHEETS_HXX -#define SC_VBA_WORKSHEETS_HXX - -#include <cppuhelper/implbase1.hxx> - -#include <org/openoffice/vba/XWorksheets.hpp> -#include <com/sun/star/sheet/XSpreadsheets.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include <org/openoffice/vba/XGlobals.hpp> - -#include "vbahelper.hxx" -#include "vbacollectionimpl.hxx" - -class ScModelObj; - - -typedef ::cppu::ImplInheritanceHelper1< ScVbaCollectionBaseImpl, oo::vba::XWorksheets > ScVbaWorksheets_BASE; - -class ScVbaWorksheets : public ScVbaWorksheets_BASE -{ - css::uno::Reference< css::frame::XModel > mxModel; - css::uno::Reference< css::sheet::XSpreadsheets > m_xSheets; -protected: - //ScVbaCollectionBaseImpl - virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException); - -public: - ScVbaWorksheets( const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::sheet::XSpreadsheets >& xSheets, const css::uno::Reference< css::frame::XModel >& xModel ); - ScVbaWorksheets( const css::uno::Reference< css::uno::XComponentContext > & xContext, const css::uno::Reference< css::container::XEnumerationAccess >& xEnum, const css::uno::Reference< css::frame::XModel >& xModel ); - virtual ~ScVbaWorksheets() {} - - bool isSelectedSheets(); - - // XEnumerationAccess - virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException); - virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException); - - - // XWorksheets - virtual css::uno::Any SAL_CALL getVisible() throw (css::uno::RuntimeException); - virtual void SAL_CALL setVisible( const css::uno::Any& _visible ) throw (css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL Add( const css::uno::Any& Before, const css::uno::Any& After, const css::uno::Any& Count, const css::uno::Any& Type ) throw (css::uno::RuntimeException); - virtual void SAL_CALL Delete( ) throw (css::uno::RuntimeException); - virtual void SAL_CALL PrintOut( const css::uno::Any& From, const css::uno::Any& To, const css::uno::Any& Copies, const css::uno::Any& Preview, const css::uno::Any& ActivePrinter, const css::uno::Any& PrintToFile, const css::uno::Any& Collate, const css::uno::Any& PrToFileName ) throw (css::uno::RuntimeException); - // ScVbaCollectionBaseImpl - virtual css::uno::Any createCollectionObject( const css::uno::Any& aSource ); - -}; - -#endif /* SC_VBA_WORKSHEETS_HXX */ diff --git a/scratch/sc-vba/vbawsfunction.cxx b/scratch/sc-vba/vbawsfunction.cxx deleted file mode 100644 index 860afddd2..000000000 --- a/scratch/sc-vba/vbawsfunction.cxx +++ /dev/null @@ -1,82 +0,0 @@ -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/table/XCell.hpp> -#include <com/sun/star/table/XColumnRowRange.hpp> -#include <com/sun/star/beans/XIntrospection.hpp> -#include <com/sun/star/beans/XIntrospectionAccess.hpp> -#include <com/sun/star/sheet/XCellRangesQuery.hpp> -#include <com/sun/star/sheet/CellFlags.hpp> -#include <com/sun/star/reflection/XIdlMethod.hpp> -#include <com/sun/star/beans/MethodConcept.hpp> -#include <comphelper/processfactory.hxx> -#include <cppuhelper/queryinterface.hxx> -#include <comphelper/anytostring.hxx> - -#include "vbawsfunction.hxx" - -using namespace com::sun::star; -using namespace org::openoffice; - -void SAL_CALL -ScVbaWSFunction::dummy( ) throw (uno::RuntimeException) -{ -} - -uno::Reference< beans::XIntrospectionAccess > -ScVbaWSFunction::getIntrospection(void) throw(uno::RuntimeException) -{ - return uno::Reference<beans::XIntrospectionAccess>(); -} - -uno::Any SAL_CALL -ScVbaWSFunction::invoke(const rtl::OUString& FunctionName, const uno::Sequence< uno::Any >& Params, uno::Sequence< sal_Int16 >& OutParamIndex, uno::Sequence< uno::Any >& OutParam) throw(lang::IllegalArgumentException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ - uno::Reference< lang::XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XFunctionAccess > xFunctionAccess( - xSMgr->createInstanceWithContext(::rtl::OUString::createFromAscii( - "com.sun.star.sheet.FunctionAccess"), m_xContext), - ::uno::UNO_QUERY_THROW); - uno::Sequence< uno::Any > aParamTemp; - sal_Int32 nParamCount = Params.getLength(); - aParamTemp.realloc(nParamCount); - const uno::Any* aArray = Params.getConstArray(); - uno::Any* aArrayTemp = aParamTemp.getArray(); - - for (int i=0; i < Params.getLength();i++) - { - uno::Reference<vba::XRange> myRange( aArray[ i ], uno::UNO_QUERY ); - if ( myRange.is() ) - { - aArrayTemp[i] = myRange->getCellRange(); - continue; - } - aArrayTemp[i]= aArray[i]; - } - - for ( int count=0; count < aParamTemp.getLength(); ++count ) - OSL_TRACE("Param[%d] is %s", - count, rtl::OUStringToOString( comphelper::anyToString( aParamTemp[count] ), RTL_TEXTENCODING_UTF8 ).getStr() ); - return xFunctionAccess->callFunction(FunctionName,aParamTemp); -} - -void SAL_CALL -ScVbaWSFunction::setValue(const rtl::OUString& PropertyName, const uno::Any& Value) throw(beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException) -{ -} - -uno::Any SAL_CALL -ScVbaWSFunction::getValue(const rtl::OUString& PropertyName) throw(beans::UnknownPropertyException, uno::RuntimeException) -{ - return uno::Any(); -} - -sal_Bool SAL_CALL -ScVbaWSFunction::hasMethod(const rtl::OUString& Name) throw(uno::RuntimeException) -{ - return true; -} - -sal_Bool SAL_CALL -ScVbaWSFunction::hasProperty(const rtl::OUString& Name) throw(uno::RuntimeException) -{ - return false; -} diff --git a/scratch/sc-vba/vbawsfunction.hxx b/scratch/sc-vba/vbawsfunction.hxx deleted file mode 100644 index 3fe784fcb..000000000 --- a/scratch/sc-vba/vbawsfunction.hxx +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef SC_VBA_INTERIOR_HXX -#define SC_VBA_INTERIOR_HXX - -#include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> -#include <org/openoffice/vba/XWorksheetFunction.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> -#include "vbarange.hxx" - -#include <com/sun/star/script/XInvocation.hpp> -#include <com/sun/star/sheet/XFunctionAccess.hpp> - -typedef ::cppu::WeakImplHelper2< oo::vba::XWorksheetFunction,css::script::XInvocation > ScVbaWSFunction_BASE; - -class ScVbaWSFunction : public ScVbaWSFunction_BASE -{ - css::uno::Reference< css::uno::XComponentContext > m_xContext; -public: - ScVbaWSFunction( css::uno::Reference< css::uno::XComponentContext >& xContext - ):m_xContext(xContext) - { - } - virtual ~ScVbaWSFunction(){} - - virtual void SAL_CALL dummy( ) throw (css::uno::RuntimeException); - - virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection(void) throw(css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL invoke(const rtl::OUString& FunctionName, const css::uno::Sequence< css::uno::Any >& Params, css::uno::Sequence< sal_Int16 >& OutParamIndex, css::uno::Sequence< css::uno::Any >& OutParam) throw(css::lang::IllegalArgumentException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); - virtual void SAL_CALL setValue(const rtl::OUString& PropertyName, const css::uno::Any& Value) throw(css::beans::UnknownPropertyException, css::script::CannotConvertException, css::reflection::InvocationTargetException, css::uno::RuntimeException); - virtual css::uno::Any SAL_CALL getValue(const rtl::OUString& PropertyName) throw(css::beans::UnknownPropertyException, css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasMethod(const rtl::OUString& Name) throw(css::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasProperty(const rtl::OUString& Name) throw(css::uno::RuntimeException); - -}; -#endif - |