Files
libreoffice/shell/source/unix/misc/senddoc.sh

409 lines
11 KiB
Bash
Raw Normal View History

#!/bin/sh
URI_ENCODE="`dirname $0`/uri-encode"
FOPTS=""
2010-10-13 15:10:27 +01:00
sd_platform=`uname -s`
# linux file utility needs -L option to resolve symlinks
2010-10-13 15:10:27 +01:00
if [ "$sd_platform" = "Linux" ] ; then
FOPTS="-L"
fi
CWS-TOOLING: integrate CWS vcl101 2009-04-30 16:05:34 +0200 pl r271420 : #i95591# need a poll timer so XtTimers work properly 2009-04-30 11:25:52 +0200 hdu r271406 : #i100929# avoid unneeded colormap reallocation 2009-04-30 11:21:16 +0200 hdu r271405 : #i100929# use improved SetDrawable() also for salframe updates 2009-04-30 11:12:41 +0200 hdu r271404 : i100929# invalidate cached renderpic also for changed vdev 2009-04-29 14:31:40 +0200 hdu r271375 : i100929# use cached renderpic also for alpha-rect/bitmap drawing 2009-04-29 14:16:51 +0200 hdu r271370 : i100929# notify only GtkSalFrame's valid X11SalFrames 2009-04-29 13:58:10 +0200 hdu r271369 : i100929# notify GtkSalFrame's X11SalGraphics that their drawables will become obsolete 2009-04-29 13:53:48 +0200 hdu r271367 : #i100929# release cached renderpic whenever the corresponding drawable changes 2009-04-28 11:56:07 +0200 pl r271317 : fix a snafu 2009-04-27 16:52:29 +0200 hdu r271293 : #i100000# WAE fix for debug=true compilation 2009-04-27 12:38:11 +0200 hdu r271260 : #i101367# disable vdev mapmode when measuring pixel size 2009-04-27 12:28:37 +0200 hdu r271259 : #i101367# speedup svclcanvas::CanvasBitmapHelper::getSize() 2009-04-23 15:11:25 +0200 hdu r271175 : #i91685# ignore trailing space in last cell 2009-04-23 12:55:14 +0200 pl r271156 : #i101032# check for empty bitmap 2009-04-23 11:04:50 +0200 pl r271144 : #101184# add a paranoia check 2009-04-21 19:12:25 +0200 pl r271055 : #i101184# add: recognize added/removed monitors in xinerama configuration for gtk plugin (thanks cmc) 2009-04-21 17:04:44 +0200 pl r271046 : #i101089# remove unused method (thanks cmc) 2009-04-21 16:41:38 +0200 hdu r271042 : #i99842# set text decoration color 2009-04-20 22:57:37 +0200 pl r271015 : #i101063# fix warnings 2009-04-20 22:55:39 +0200 pl r271014 : #i101063# fix warnings 2009-04-20 11:35:24 +0200 hdu r270968 : #i1001102# remove dependency to psprint module 2009-04-20 11:31:08 +0200 hdu r270967 : #i100929# keep cached render Picture in X11SalGraphics removes 2009-04-20 11:24:57 +0200 hdu r270966 : #i100929# cache render Picture in X11SalGraphics 2009-04-18 14:53:22 +0200 hdu r270959 : CWS-TOOLING: rebase CWS vcl101 to trunk@270723 (milestone: DEV300:m46) 2009-04-17 12:00:50 +0200 hdu r270934 : #i100951# b2d-polygon clipping handles bezier-segments nowadays => performance opt possible 2009-04-17 11:50:49 +0200 hdu r270933 : #i100922# count b2d-polypoly-points to avoid priority-queue reallocations 2009-04-17 11:07:03 +0200 hdu r270930 : #i101145# match dpi-sanity check with gnome-UI (thanks Caolan!) 2009-04-17 10:44:41 +0200 hdu r270929 : #i100603# dingbats-encoded PDF-builtin fonts are symbol fonts too 2009-04-17 10:36:10 +0200 hdu r270928 : #i101145# check sanity of resolution reported by Xft-dpi (thanks CMC!) 2009-04-08 13:53:35 +0200 hdu r270644 : #i100951# avoid expensive calls to basegfx::tools::clipPolygonOnRange() if possible 2009-04-08 13:19:26 +0200 hdu r270637 : #i100922# prevent needless stl::priority_queue reallacations by reserving 2009-04-08 11:14:30 +0200 hdu r270627 : #i100929# use X11SalGraphics::GetXRenderPicture() also for text drawing 2009-04-08 10:00:42 +0200 hdu r270620 : #i100929# add and use X11SalGraphics::GetXRenderPicture() for polygon drawing 2009-04-06 15:52:47 +0200 hdu r270563 : #i100885# add and use AquaSalGraphics::copyResolution() to speed up virdev creation 2009-04-02 14:39:06 +0200 pl r270408 : #i95873# do not set LD_LIBRARY_PATH for external apps 2009-03-31 18:43:19 +0200 pl r270292 : #i99783# transparency of closer image changed to mask in the meantime 2009-03-27 15:42:37 +0100 hdu r270158 : #i100591# fix binary search in dingbats encoding converter 2009-03-27 13:06:34 +0100 hdu r270151 : #i100603# only PDF builtin text fonts use WinAnsiEncoding 2009-03-27 12:05:35 +0100 hdu r270147 : #i100603# use correct encoding for all PDF builtin fonts 2009-03-27 09:04:07 +0100 hdu r270133 : #i100603# use proper encoding for PDF builtin symbol fonts 2009-03-26 17:19:38 +0100 hdu r270090 : #i100591# support RTL_TEXTENCODING_ADOBE_DINGBATS encoding 2009-03-25 09:02:18 +0100 hdu r269995 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading SAGE and extra USER32 symbols 2009-03-25 08:55:49 +0100 hdu r269994 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading LUNA symbols 2009-03-24 16:15:54 +0100 hdu r269965 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading vclplugin symbols 2009-03-24 16:10:29 +0100 hdu r269963 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading USP symbols 2009-03-24 15:54:30 +0100 hdu r269962 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading xrender symbols 2009-03-24 10:46:55 +0100 hdu r269920 : #i100506# fix WAE build breakers on unxsols4 for debug=true 2009-03-23 16:36:43 +0100 hdu r269884 : #159477# fix crash for PDFs with big zlib-chunks 2009-03-20 17:36:56 +0100 pl r269821 : #i96568# add recent files to mac quickstarter 2009-03-20 14:39:41 +0100 pl r269809 : #i35482# no HC mode detection, automatically done in independent part 2009-03-19 20:01:37 +0100 pl r269768 : #i95591# do not reuse UnxPloginComm because of connection loss problems 2009-03-19 18:08:23 +0100 pl r269765 : #i95588# change default visibility that was ignored everywhere but unix anyway
2009-06-03 15:45:09 +00:00
# do not confuse the system mail clients with OOo and Java libraries
2010-10-13 15:10:27 +01:00
case $sd_platform in
AIX)
unset LIBPATH
;;
*)
unset LD_LIBRARY_PATH
;;
esac
CWS-TOOLING: integrate CWS vcl101 2009-04-30 16:05:34 +0200 pl r271420 : #i95591# need a poll timer so XtTimers work properly 2009-04-30 11:25:52 +0200 hdu r271406 : #i100929# avoid unneeded colormap reallocation 2009-04-30 11:21:16 +0200 hdu r271405 : #i100929# use improved SetDrawable() also for salframe updates 2009-04-30 11:12:41 +0200 hdu r271404 : i100929# invalidate cached renderpic also for changed vdev 2009-04-29 14:31:40 +0200 hdu r271375 : i100929# use cached renderpic also for alpha-rect/bitmap drawing 2009-04-29 14:16:51 +0200 hdu r271370 : i100929# notify only GtkSalFrame's valid X11SalFrames 2009-04-29 13:58:10 +0200 hdu r271369 : i100929# notify GtkSalFrame's X11SalGraphics that their drawables will become obsolete 2009-04-29 13:53:48 +0200 hdu r271367 : #i100929# release cached renderpic whenever the corresponding drawable changes 2009-04-28 11:56:07 +0200 pl r271317 : fix a snafu 2009-04-27 16:52:29 +0200 hdu r271293 : #i100000# WAE fix for debug=true compilation 2009-04-27 12:38:11 +0200 hdu r271260 : #i101367# disable vdev mapmode when measuring pixel size 2009-04-27 12:28:37 +0200 hdu r271259 : #i101367# speedup svclcanvas::CanvasBitmapHelper::getSize() 2009-04-23 15:11:25 +0200 hdu r271175 : #i91685# ignore trailing space in last cell 2009-04-23 12:55:14 +0200 pl r271156 : #i101032# check for empty bitmap 2009-04-23 11:04:50 +0200 pl r271144 : #101184# add a paranoia check 2009-04-21 19:12:25 +0200 pl r271055 : #i101184# add: recognize added/removed monitors in xinerama configuration for gtk plugin (thanks cmc) 2009-04-21 17:04:44 +0200 pl r271046 : #i101089# remove unused method (thanks cmc) 2009-04-21 16:41:38 +0200 hdu r271042 : #i99842# set text decoration color 2009-04-20 22:57:37 +0200 pl r271015 : #i101063# fix warnings 2009-04-20 22:55:39 +0200 pl r271014 : #i101063# fix warnings 2009-04-20 11:35:24 +0200 hdu r270968 : #i1001102# remove dependency to psprint module 2009-04-20 11:31:08 +0200 hdu r270967 : #i100929# keep cached render Picture in X11SalGraphics removes 2009-04-20 11:24:57 +0200 hdu r270966 : #i100929# cache render Picture in X11SalGraphics 2009-04-18 14:53:22 +0200 hdu r270959 : CWS-TOOLING: rebase CWS vcl101 to trunk@270723 (milestone: DEV300:m46) 2009-04-17 12:00:50 +0200 hdu r270934 : #i100951# b2d-polygon clipping handles bezier-segments nowadays => performance opt possible 2009-04-17 11:50:49 +0200 hdu r270933 : #i100922# count b2d-polypoly-points to avoid priority-queue reallocations 2009-04-17 11:07:03 +0200 hdu r270930 : #i101145# match dpi-sanity check with gnome-UI (thanks Caolan!) 2009-04-17 10:44:41 +0200 hdu r270929 : #i100603# dingbats-encoded PDF-builtin fonts are symbol fonts too 2009-04-17 10:36:10 +0200 hdu r270928 : #i101145# check sanity of resolution reported by Xft-dpi (thanks CMC!) 2009-04-08 13:53:35 +0200 hdu r270644 : #i100951# avoid expensive calls to basegfx::tools::clipPolygonOnRange() if possible 2009-04-08 13:19:26 +0200 hdu r270637 : #i100922# prevent needless stl::priority_queue reallacations by reserving 2009-04-08 11:14:30 +0200 hdu r270627 : #i100929# use X11SalGraphics::GetXRenderPicture() also for text drawing 2009-04-08 10:00:42 +0200 hdu r270620 : #i100929# add and use X11SalGraphics::GetXRenderPicture() for polygon drawing 2009-04-06 15:52:47 +0200 hdu r270563 : #i100885# add and use AquaSalGraphics::copyResolution() to speed up virdev creation 2009-04-02 14:39:06 +0200 pl r270408 : #i95873# do not set LD_LIBRARY_PATH for external apps 2009-03-31 18:43:19 +0200 pl r270292 : #i99783# transparency of closer image changed to mask in the meantime 2009-03-27 15:42:37 +0100 hdu r270158 : #i100591# fix binary search in dingbats encoding converter 2009-03-27 13:06:34 +0100 hdu r270151 : #i100603# only PDF builtin text fonts use WinAnsiEncoding 2009-03-27 12:05:35 +0100 hdu r270147 : #i100603# use correct encoding for all PDF builtin fonts 2009-03-27 09:04:07 +0100 hdu r270133 : #i100603# use proper encoding for PDF builtin symbol fonts 2009-03-26 17:19:38 +0100 hdu r270090 : #i100591# support RTL_TEXTENCODING_ADOBE_DINGBATS encoding 2009-03-25 09:02:18 +0100 hdu r269995 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading SAGE and extra USER32 symbols 2009-03-25 08:55:49 +0100 hdu r269994 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading LUNA symbols 2009-03-24 16:15:54 +0100 hdu r269965 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading vclplugin symbols 2009-03-24 16:10:29 +0100 hdu r269963 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading USP symbols 2009-03-24 15:54:30 +0100 hdu r269962 : #i100521# prefer osl_getAsciiFunctionSymbol() when dynloading xrender symbols 2009-03-24 10:46:55 +0100 hdu r269920 : #i100506# fix WAE build breakers on unxsols4 for debug=true 2009-03-23 16:36:43 +0100 hdu r269884 : #159477# fix crash for PDFs with big zlib-chunks 2009-03-20 17:36:56 +0100 pl r269821 : #i96568# add recent files to mac quickstarter 2009-03-20 14:39:41 +0100 pl r269809 : #i35482# no HC mode detection, automatically done in independent part 2009-03-19 20:01:37 +0100 pl r269768 : #i95591# do not reuse UnxPloginComm because of connection loss problems 2009-03-19 18:08:23 +0100 pl r269765 : #i95588# change default visibility that was ignored everywhere but unix anyway
2009-06-03 15:45:09 +00:00
# tries to locate the executable specified
# as first parameter in the user's path.
which() {
if [ ! -z "$1" ]; then
for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do
if [ -x "$i/$1" -a ! -d "$i/$1" ]; then
echo "$i/$1"
break;
fi
done
fi
}
# checks for the original mozilla start script(s)
# and restrict the "-remote" semantics to those.
run_mozilla() {
# find mozilla script in PATH if necessary
if [ "`basename $1`" = "$1" ]; then
moz=`which $1`
else
moz=$1
fi
if file $FOPTS "$moz" | grep "script" > /dev/null && grep "[NM]PL" "$moz" > /dev/null; then
"$moz" -remote 'ping()' 2>/dev/null >/dev/null
if [ $? -eq 2 ]; then
"$1" -compose "$2" &
else
"$1" -remote "xfeDoCommand(composeMessage,$2)" &
fi
else
"$1" -compose "$2" &
fi
}
if [ "$1" = "--mailclient" ]; then
shift
MAILER=$1
shift
fi
# autodetect mail client from executable name
case `basename "$MAILER" | sed 's/-.*$//'` in
iceape | mozilla | netscape | seamonkey | icedove | thunderbird)
while [ "$1" != "" ]; do
case $1 in
--to)
TO=${TO:-}${TO:+,}$2
shift
;;
--cc)
CC=${CC:-}${CC:+,}$2
shift
;;
--bcc)
BCC=${BCC:-}${BCC:+,}$2
shift
;;
--subject)
SUBJECT=$2
shift
;;
--body)
BODY=$2
shift
;;
--attach)
ATTACH=${ATTACH:-}${ATTACH:+,}`echo "file://$2" | ${URI_ENCODE}`
shift
;;
*)
;;
esac
shift;
done
if [ "$TO" != "" ]; then
COMMAND=${COMMAND:-}${COMMAND:+,}to=${TO}
fi
if [ "$CC" != "" ]; then
COMMAND=${COMMAND:-}${COMMAND:+,}cc=${CC}
fi
if [ "$BCC" != "" ]; then
COMMAND=${COMMAND:-}${COMMAND:+,}bcc=${BCC}
fi
if [ "$SUBJECT" != "" ]; then
COMMAND=${COMMAND:-}${COMMAND:+,}subject=${SUBJECT}
fi
if [ "$BODY" != "" ]; then
COMMAND=${COMMAND:-}${COMMAND:+,}body=${BODY}
fi
if [ "$ATTACH" != "" ]; then
COMMAND=${COMMAND:-}${COMMAND:+,}attachment=${ATTACH}
fi
run_mozilla "$MAILER" "$COMMAND"
;;
kmail)
while [ "$1" != "" ]; do
case $1 in
--to)
TO="${TO:-}${TO:+,}$2"
shift
;;
--cc)
CC="${CC:-}${CC:+,}$2"
shift
;;
--bcc)
BCC="${BCC:-}${BCC:+,}$2"
shift
;;
--subject)
SUBJECT="$2"
shift
;;
--body)
BODY="$2"
shift
;;
--attach)
ATTACH="$2"
shift
;;
*)
;;
esac
shift;
done
${MAILER} --composer ${CC:+--cc} ${CC:+"${CC}"} ${BCC:+--bcc} ${BCC:+"${BCC}"} \
${SUBJECT:+--subject} ${SUBJECT:+"${SUBJECT}"} ${BODY:+--body} ${BODY:+"${BODY}"} \
${ATTACH:+--attach} ${ATTACH:+"${ATTACH}"} ${TO:+"${TO}"}
;;
mutt)
while [ "$1" != "" ]; do
case $1 in
--from)
FROM="$2"
shift
;;
--to)
TO="${TO:-}${TO:+,}$2"
shift
;;
--cc)
CC="${CC:-}${CC:+,}$2"
shift
;;
--bcc)
BCC="${BCC:-}${BCC:+,}$2"
shift
;;
--subject)
SUBJECT="$2"
shift
;;
--body)
TEMPLATE="`basename $0`.mutt.XXXXXXXX"
BODY=`mktemp -q -t ${TEMPLATE}`
echo "$2" > $BODY
shift
;;
--attach)
ATTACH="$2"
shift
;;
*)
;;
esac
shift;
done
x-terminal-emulator -e ${MAILER} \
${FROM:+-e} ${FROM:+"set from=\"${FROM}\""} \
${CC:+-c} ${CC:+"${CC}"} \
${BCC:+-b} ${BCC:+"${BCC}"} \
${SUBJECT:+-s} ${SUBJECT:+"${SUBJECT}"} \
${BODY:+-i} ${BODY:+"${BODY}"} \
${ATTACH:+-a} ${ATTACH:+"${ATTACH}"} \
${TO:+"${TO}"} &
rm -f $BODY
;;
evolution)
while [ "$1" != "" ]; do
case $1 in
--to)
if [ "${TO}" != "" ]; then
MAILTO="${MAILTO:-}${MAILTO:+&}to=$2"
else
TO="$2"
fi
shift
;;
--cc)
MAILTO="${MAILTO:-}${MAILTO:+&}cc="`echo "$2" | ${URI_ENCODE}`
shift
;;
--bcc)
MAILTO="${MAILTO:-}${MAILTO:+&}bcc="`echo "$2" | ${URI_ENCODE}`
shift
;;
--subject)
MAILTO="${MAILTO:-}${MAILTO:+&}subject"=`echo "$2" | ${URI_ENCODE}`
shift
;;
--body)
MAILTO="${MAILTO:-}${MAILTO:+&}body="`echo "$2" | ${URI_ENCODE}`
shift
;;
--attach)
MAILTO="${MAILTO:-}${MAILTO:+&}attach="`echo "file://$2" | ${URI_ENCODE}`
shift
;;
*)
;;
esac
shift;
done
MAILTO="mailto:${TO}?${MAILTO}"
${MAILER} "${MAILTO}" &
;;
groupwise)
while [ "$1" != "" ]; do
case $1 in
--to)
if [ "${TO}" != "" ]; then
MAILTO="${MAILTO:-}${MAILTO:+&}to=$2"
else
TO="$2"
fi
shift
;;
--cc)
MAILTO="${MAILTO:-}${MAILTO:+&}cc="`echo "$2" | ${URI_ENCODE}`
shift
;;
--bcc)
MAILTO="${MAILTO:-}${MAILTO:+&}bcc="`echo "$2" | ${URI_ENCODE}`
shift
;;
--subject)
MAILTO="${MAILTO:-}${MAILTO:+&}subject"=`echo "$2" | ${URI_ENCODE}`
shift
;;
--body)
MAILTO="${MAILTO:-}${MAILTO:+&}body="`echo "$2" | ${URI_ENCODE}`
shift
;;
--attach)
MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "file://$2" | ${URI_ENCODE}`
shift
;;
*)
;;
esac
shift;
done
MAILTO="mailto:${TO}?${MAILTO}"
${MAILER} "${MAILTO}" &
;;
dtmail)
while [ "$1" != "" ]; do
case $1 in
--to)
TO=${TO:-}${TO:+,}$2
shift
;;
--attach)
ATTACH="$2"
shift
;;
*)
;;
esac
shift;
done
${MAILER} ${TO:+-T} ${TO:-} ${ATTACH:+-a} ${ATTACH:+"${ATTACH}"}
;;
sylpheed | claws)
while [ "$1" != "" ]; do
case $1 in
--to)
TO=${TO:-}${TO:+,}$2
shift
;;
--attach)
ATTACH="${ATTACH:-}${ATTACH:+ }$2"
shift
;;
*)
;;
esac
shift;
done
${MAILER} ${TO:+--compose} "${TO:-}" ${ATTACH:+--attach} "${ATTACH:-}"
;;
Mail | Thunderbird | *.app )
while [ "$1" != "" ]; do
case $1 in
--attach)
#i95688# fix filenames containing accented chars, whatever alien
ATTACH="${ATTACH:-}${ATTACH:+ }"`echo "file://$2" | ${URI_ENCODE}`
shift
;;
*)
;;
esac
shift;
done
/usr/bin/open -a "${MAILER}" ${ATTACH}
;;
"")
# DESKTOP_LAUNCH, see http://freedesktop.org/pipermail/xdg/2004-August/004489.html
if [ -n "$DESKTOP_LAUNCH" ]; then
while [ "$1" != "" ]; do
case $1 in
--to)
if [ "${TO}" != "" ]; then
MAILTO="${MAILTO:-}${MAILTO:+&}to=$2"
else
TO="$2"
fi
shift
;;
--cc)
MAILTO="${MAILTO:-}${MAILTO:+&}cc="`echo "$2" | ${URI_ENCODE}`
shift
;;
--bcc)
MAILTO="${MAILTO:-}${MAILTO:+&}bcc="`echo "$2" | ${URI_ENCODE}`
shift
;;
--subject)
MAILTO="${MAILTO:-}${MAILTO:+&}subject="`echo "$2" | ${URI_ENCODE}`
shift
;;
--body)
MAILTO="${MAILTO:-}${MAILTO:+&}body="`echo "$2" | ${URI_ENCODE}`
shift
;;
--attach)
MAILTO="${MAILTO:-}${MAILTO:+&}attachment="`echo "$2" | ${URI_ENCODE}`
shift
;;
*)
;;
esac
shift;
done
MAILTO="mailto:${TO}?${MAILTO}"
${DESKTOP_LAUNCH} "${MAILTO}" &
else
echo "Could not determine a mail client to use."
exit 2
fi
;;
*)
echo "Unsupported mail client: `basename $MAILER | sed 's/-.*^//'`"
exit 2
;;
esac
exit 0