Nach der Umstellung von Template.pm in r1330 werden neue Hilfsscripte benoetigt,...
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 24 Nov 2006 10:34:51 +0000 (10:34 +0000)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 24 Nov 2006 10:34:51 +0000 (10:34 +0000)
lx-erp.conf
scripts/oo-uno-convert-pdf.py [new file with mode: 0755]
scripts/oo-uno-test-conn.py [new file with mode: 0755]
scripts/spawn_oo.pl [new file with mode: 0755]
users/.openoffice.org2/user/registry/data/org/openoffice/Office/Linguistic.xcu
xvfb-run [deleted file]

index 1a91c19..515daba 100644 (file)
@@ -53,10 +53,18 @@ $opendocument_templates = 1;
 # Pfad zu OpenOffice.org writer
 $openofficeorg_writer_bin = "/usr/bin/oowriter";
 
-# Pfad zu einem Script, dass einen "X virtual frame buffer" startet
-# und OpenOffice unter ihm laufen laesst. Lx-Office bringt ein
-# solches Script mit.
-$xvfb_run_bin = getcwd() . "/xvfb-run";
+# Soll OpenOffice dauerhaft gestartet bleiben? Die Konvertierung nachfolgender
+# Dokumente geht dann schneller. Allerdings wird auf dem System ein
+# installiertes Python mit den Python-UNO-Bindings benoetigt, die Bestandteil
+# von OpenOffice sind.
+$openofficeorg_daemon = 1;
+$openofficeorg_daemon_port = 2002;
+
+# Pfad zum "X virtual frame buffer", unter dem OpenOffice gestartet wird.
+# Zusaetzlich muessen die Programme "xauth" und "mcookie" gefunden werden
+# koennen, was eine Aenderung an PATH bedeuten kann.
+$ENV{"PATH"} = $ENV{"PATH"} . ":/usr/X11R6/bin:/usr/X11/bin";
+$xvfb_bin = "/usr/bin/Xvfb";
 
 # Das charset, in dem die Daten in der Datenbank abgelegt sind.
 $dbcharset = "ISO-8859-15";
diff --git a/scripts/oo-uno-convert-pdf.py b/scripts/oo-uno-convert-pdf.py
new file mode 100755 (executable)
index 0000000..5a2ab46
--- /dev/null
@@ -0,0 +1,69 @@
+#!/usr/bin/python
+
+import uno, sys
+
+from unohelper import Base, systemPathToFileUrl, absolutize
+from os import getcwd
+from os.path import splitext
+from com.sun.star.beans import PropertyValue
+
+def establish_connection(port):
+  local_ctx = uno.getComponentContext()
+  local_smgr = local_ctx.ServiceManager
+
+  resolver = local_smgr.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local_ctx)
+  ctx = resolver.resolve("uno:socket,host=localhost,port=%s;urp;StarOffice.ComponentContext" % port)
+  smgr = ctx.ServiceManager
+
+  desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
+
+  return desktop
+
+def load_file(desktop, path):
+  cwd = systemPathToFileUrl(getcwd())
+  file_url = absolutize(cwd, systemPathToFileUrl(path))
+  sys.stderr.write(file_url + "\n")
+
+  in_props = (
+    #   PropertyValue("Hidden", 0 , True, 0),
+    )
+  return desktop.loadComponentFromURL(file_url, "_blank", 0, in_props)
+
+
+def write_pdf(doc, path):
+  out_props = (
+    PropertyValue("FilterName", 0, "writer_pdf_Export", 0),
+    PropertyValue("Overwrite", 0, True, 0),
+    )
+
+  (dest, ext) = splitext(path)
+  dest = dest + ".pdf"
+  dest_url = absolutize(systemPathToFileUrl(getcwd()), systemPathToFileUrl(dest))
+  sys.stderr.write(dest_url + "\n")
+  doc.storeToURL(dest_url, out_props)
+  doc.dispose()
+
+def main():
+  if len(sys.argv) <= 2:
+    sys.exit(1)
+
+  try:
+    desktop = establish_connection(sys.argv[1])
+  except:
+    sys.exit(2)
+
+  try:
+    doc = load_file(desktop, sys.argv[2])
+    if not doc:
+      sys.exit(3)
+  except:
+    sys.exit(3)
+
+  try:
+    write_pdf(doc, sys.argv[2])
+  except:
+    sys.exit(4)
+
+  sys.exit(0)
+
+main()
diff --git a/scripts/oo-uno-test-conn.py b/scripts/oo-uno-test-conn.py
new file mode 100755 (executable)
index 0000000..183a290
--- /dev/null
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+
+import uno, sys
+
+from unohelper import Base, systemPathToFileUrl, absolutize
+from os import getcwd
+from os.path import splitext
+from com.sun.star.beans import PropertyValue
+
+def establish_connection(port):
+  local_ctx = uno.getComponentContext()
+  local_smgr = local_ctx.ServiceManager
+
+  resolver = local_smgr.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", local_ctx)
+  ctx = resolver.resolve("uno:socket,host=localhost,port=%s;urp;StarOffice.ComponentContext" % port)
+  smgr = ctx.ServiceManager
+
+  desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
+
+  return desktop
+
+def main():
+  if len(sys.argv) <= 1:
+    sys.exit(1)
+
+  try:
+    desktop = establish_connection(sys.argv[1])
+  except:
+    sys.exit(2)
+  sys.exit(0)
+
+main()
diff --git a/scripts/spawn_oo.pl b/scripts/spawn_oo.pl
new file mode 100755 (executable)
index 0000000..387961e
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+use DBI;
+use Data::Dumper;
+
+use SL::LXDebug;
+
+use SL::Form;
+use SL::Template;
+
+$userspath  = "users";
+$templates  = "templates";
+$memberfile = "users/members";
+$sendmail   = "| /usr/sbin/sendmail -t";
+
+$| = 1;
+
+$lxdebug = LXDebug->new();
+
+require "lx-erp.conf";
+
+$form = new Form;
+$form->{"script"} = "oe.pl";
+$form->{"path"} = "bin/mozilla";
+
+
+$ENV{'HOME'} = getcwd() . "/$userspath";
+
+my $template = OpenDocumentTemplate->new("", $form, \%myconfig, $userspath);
+
+if (@ARGV && ($ARGV[0] eq "-r")) {
+  system("ps auxww | " .
+         "grep -v awk | " .
+         "awk '/^www-data.*(soffice|Xvfb)/ { print \$2 }' | " .
+         "xargs -r kill");
+  sleep(10);
+}
+
+exit(1) unless ($template->spawn_xvfb());
+exit(2) unless ($template->spawn_openoffice());
+exit(0);
index 2fd8654..0dc5b5b 100644 (file)
@@ -5,4 +5,104 @@
    <value>en-US</value>
   </prop>
  </node>
+ <node oor:name="ServiceManager">
+  <prop oor:name="DataFilesChangedCheckValue" oor:type="xs:int">
+   <value>-411764226</value>
+  </prop>
+  <node oor:name="HyphenatorList">
+   <prop oor:name="de-AT" oor:op="replace" oor:type="xs:string">
+    <value>org.openoffice.lingu.LibHnjHyphenator</value>
+   </prop>
+   <prop oor:name="de-CH" oor:op="replace" oor:type="xs:string">
+    <value>org.openoffice.lingu.LibHnjHyphenator</value>
+   </prop>
+   <prop oor:name="de-DE" oor:op="replace" oor:type="xs:string">
+    <value>org.openoffice.lingu.LibHnjHyphenator</value>
+   </prop>
+  </node>
+  <node oor:name="LastFoundHyphenators">
+   <prop oor:name="de-AT" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.LibHnjHyphenator</value>
+   </prop>
+   <prop oor:name="de-CH" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.LibHnjHyphenator</value>
+   </prop>
+   <prop oor:name="de-DE" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.LibHnjHyphenator</value>
+   </prop>
+  </node>
+  <node oor:name="LastFoundSpellCheckers">
+   <prop oor:name="de-AT" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="de-CH" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="de-DE" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="en-GB" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="en-US" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+  </node>
+  <node oor:name="LastFoundThesauri">
+   <prop oor:name="de-AT" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="de-CH" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="de-DE" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="en-GB" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="en-US" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+  </node>
+  <node oor:name="SpellCheckerList">
+   <prop oor:name="de-AT" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="de-CH" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="de-DE" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="en-GB" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+   <prop oor:name="en-US" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.MySpellSpellChecker</value>
+   </prop>
+  </node>
+  <node oor:name="ThesaurusList">
+   <prop oor:name="de-AT" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="de-CH" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="de-DE" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="en-GB" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+   <prop oor:name="en-US" oor:op="replace" oor:type="oor:string-list">
+    <value>org.openoffice.lingu.new.Thesaurus</value>
+   </prop>
+  </node>
+ </node>
+ <node oor:name="TextConversion">
+  <prop oor:name="IsDirectionToSimplified" oor:type="xs:boolean">
+   <value>true</value>
+  </prop>
+ </node>
 </oor:component-data>
\ No newline at end of file
diff --git a/xvfb-run b/xvfb-run
deleted file mode 100755 (executable)
index 7a4251c..0000000
--- a/xvfb-run
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/bin/sh
-
-# This script starts an instance of Xvfb, the "fake" X server, runs a command
-# with that server available, and kills the X server when done.  The return
-# value of the command becomes the return value of this script.
-
-# This is a stripped-down version of the 'xvfb-run' script provided by
-# Debian's 'xvfb' package which itself is licensed under the GPL, just as
-# Lx-Office is. It is unclear who wrote the original script, but the
-# CVS Id tag mentioned 'branden'.
-
-set -e
-
-PROGNAME=xvfb-run
-SERVERNUM=99
-AUTHFILE=
-ERRORFILE=/dev/null
-STARTWAIT=3
-XVFBARGS="-screen 0 640x480x8"
-LISTENTCP="-nolisten tcp"
-XAUTHPROTO=.
-
-# Query the terminal to establish a default number of columns to use for
-# displaying messages to the user.  This is used only as a fallback in the event
-# the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while the
-# script is running, and this cannot, only being calculated once.)
-DEFCOLUMNS=$(stty size 2>/dev/null | awk '{print $2}') || true
-if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" >/dev/null 2>&1; then
-    DEFCOLUMNS=80
-fi
-
-# Display a message, wrapping lines at the terminal width.
-message () {
-    echo "$PROGNAME: $*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS}
-}
-
-# Display an error message.
-error () {
-    message "error: $*" >&2
-}
-
-# Find a free server number by looking at .X*-lock files in /tmp.
-find_free_servernum() {
-    # Sadly, the "local" keyword is not POSIX.  Leave the next line commented in
-    # the hope Debian Policy eventually changes to allow it in /bin/sh scripts
-    # anyway.
-    #local i
-
-    i=$SERVERNUM
-    while [ -f /tmp/.X$i-lock ]; do
-        i=$(($i + 1))
-    done
-    echo $i
-}
-
-SERVERNUM=$(find_free_servernum)
-
-PATH=$PATH:/usr/bin/x11:/usr/X11R6/bin
-
-if ! which xauth >/dev/null; then
-    error "xauth command not found"
-    exit 3
-fi
-
-# If the user did not specify an X authorization file to use, set up a temporary
-# directory to house one.
-XVFB_RUN_TMPDIR="${TMPDIR:-/tmp}/$PROGNAME.$$"
-if ! mkdir -p -m 700 "$XVFB_RUN_TMPDIR"; then
-  error "temporary directory $XVFB_RUN_TMPDIR already exists"
-  exit 4
-fi
-AUTHFILE=$(tempfile -n "$XVFB_RUN_TMPDIR/Xauthority")
-
-# Start Xvfb.
-MCOOKIE=$(mcookie)
-XAUTHORITY=$AUTHFILE xauth add ":$SERVERNUM" "$XAUTHPROTO" "$MCOOKIE" \
-  >"$ERRORFILE" 2>&1
-XAUTHORITY=$AUTHFILE Xvfb ":$SERVERNUM" $XVFBARGS $LISTENTCP >"$ERRORFILE" \
-  2>&1 &
-XVFBPID=$!
-sleep "$STARTWAIT"
-
-# Start the command and save its exit status.
-set +e
-DISPLAY=:$SERVERNUM XAUTHORITY=$AUTHFILE "$@" 2>&1
-RETVAL=$?
-set -e
-
-# Kill Xvfb now that the command has exited.
-kill $XVFBPID
-
-# Clean up.
-XAUTHORITY=$AUTHFILE xauth remove ":$SERVERNUM" >"$ERRORFILE" 2>&1
-if [ -n "$XVFB_RUN_TMPDIR" ]; then
-    if ! rm -r "$XVFB_RUN_TMPDIR"; then
-        error "problem while cleaning up temporary directory"
-        exit 5
-    fi
-fi
-
-# Return the executed command's exit status.
-exit $RETVAL