Merge branch '3929_office_formats_ext'

* 3929_office_formats_ext:
  mcext/doc: improve open of documents in MS Office formats.
  Ticket #3929: mc.ext: improve recognition of MS Office formats.
This commit is contained in:
Andrew Borodin 2018-08-28 10:49:10 +03:00
commit 5f80acde87
2 changed files with 30 additions and 9 deletions

View File

@ -25,9 +25,13 @@ staroffice_console() {
}
get_ooffice_executable() {
which loffice >/dev/null 2>&1 && \
echo "loffice" || \
if loffice >/dev/null 2>&1; then
echo "loffice"
elif ooffice >/dev/null 2>&1; then
echo "ooffice"
else
echo -n
fi
}
do_view_action() {
@ -116,7 +120,9 @@ do_open_action() {
ooffice)
if [ -n "$DISPLAY" ]; then
OOFFICE=`get_ooffice_executable`
(${OOFFICE} "${MC_EXT_FILENAME}" &)
if [ -n "${OOFFICE}" ]; then
(${OOFFICE} "${MC_EXT_FILENAME}" &)
fi
else
if [ `echo "${MC_EXT_FILENAME}" | grep -c "${STAROFFICE_REGEXP}"` -ne 0 ]; then
staroffice_console "${MC_EXT_FILENAME}"
@ -133,7 +139,12 @@ do_open_action() {
;;
msdoc)
if [ -n "$DISPLAY" ]; then
(abiword "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
OOFFICE=`get_ooffice_executable`
if [ -n "${OOFFICE}" ]; then
(${OOFFICE} "${MC_EXT_FILENAME}" &)
else
(abiword "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
fi
else
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
wvHtml "${MC_EXT_FILENAME}" --targetdir="$tmp" page.html -1
@ -143,7 +154,12 @@ do_open_action() {
;;
msxls)
if [ -n "$DISPLAY" ]; then
(gnumeric "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
OOFFICE=`get_ooffice_executable`
if [ -n "${OOFFICE}" ]; then
(${OOFFICE} "${MC_EXT_FILENAME}" &)
else
(gnumeric "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
fi
else
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
xlhtml -a "${MC_EXT_FILENAME}" > "$tmp/page.html"
@ -154,7 +170,9 @@ do_open_action() {
msppt)
if [ -n "$DISPLAY" ]; then
OOFFICE=`get_ooffice_executable`
(${OOFFICE} "${MC_EXT_FILENAME}" >/dev/null 2>&1 &)
if [ -n "${OOFFICE}" ]; then
(${OOFFICE} "${MC_EXT_FILENAME}" &)
fi
else
tmp=`mktemp -d ${TMPDIR:-/tmp}/%p.XXXXXX`
ppthtml "${MC_EXT_FILENAME}" > "$tmp/page.html"

View File

@ -607,7 +607,7 @@ shell/i/.gnumeric
Open=@EXTHELPERSDIR@/doc.sh open gnumeric
# Microsoft Word Document
regex/i/\.(do[ct]|wri)$
regex/i/\.(do[ct]|wri|docx)$
Open=@EXTHELPERSDIR@/doc.sh open msdoc
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msdoc
type/^Microsoft\ Word
@ -626,13 +626,16 @@ type/^Microsoft\ Excel
Open=@EXTHELPERSDIR@/doc.sh open msxls
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msxls
regex/i/\.(ppt|pps)$
# Microsoft PowerPoint Presentation
regex/i/\.(pp[ts]|pptx)$
Open=@EXTHELPERSDIR@/doc.sh open msppt
View=%view{ascii} @EXTHELPERSDIR@/doc.sh view msppt
# Use OpenOffice.org to open any MS Office documents
# Use OpenOffice.org/LibreOffice to open any MS Office documents
type/^Microsoft\ Office\ Document
Open=@EXTHELPERSDIR@/doc.sh open ooffice
type/^Microsoft\ OOXML
Open=@EXTHELPERSDIR@/doc.sh open ooffice
# Framemaker
type/^FrameMaker