[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - librelogo/source

László Németh nemeth at numbertext.org
Tue Oct 29 13:05:04 CET 2013


 librelogo/source/LibreLogo/LibreLogo.py |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit c24493db0d4b4d2685ef5b8fcca51f163531394d
Author: László Németh <nemeth at numbertext.org>
Date:   Thu Oct 24 16:11:33 2013 +0200

    librelogo: fix Writer/Draw synchronization in cropped SVG export
    
    Change-Id: Id7dc7a2853a8c56ee56eab55c078650e16c278fd
    (cherry picked from commit d0af3045c3ff850387385599fdcef7f9ecf407cb)
    Reviewed-on: https://gerrit.libreoffice.org/6420
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index c0c6447..913ae6b 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -1255,7 +1255,7 @@ def create_valid_svg_file(filename):
         f.write(s)
 
 def __groupend__(name = ""):
-    global __group__, __grouplefthang__, __groupstack__
+    global __group__, __grouplefthang__, __groupstack__, __halt__
     g = 0
     if __group__.getCount() > 1:
         if __grouplefthang__ < 0:
@@ -1283,19 +1283,26 @@ def __groupend__(name = ""):
       d = ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
       draw = d.loadComponentFromURL("private:factory/sdraw", "_blank", 0, ())
       drawpage = draw.getDrawPages().getByIndex(0)
+      while XSCRIPTCONTEXT.getDocument() != draw:
+        if XSCRIPTCONTEXT.getDocument() not in [draw, _.doc, None]:
+          __halt__ = True
+          return
+        __time__.sleep(0.1)
       __dispatcher__(".uno:Paste", (), draw)
       __dispatcher__(".uno:FormatGroup", (), draw)
       pic = drawpage.getByIndex(0)
       pic.setPosition(__Point__((g.BoundRect.Width - g.Size.Width)//2, (g.BoundRect.Height - g.Size.Height)//2))
       drawpage.Height, drawpage.Width = g.BoundRect.Height, g.BoundRect.Width
-      __time__.sleep(1) # avoid writing problem
       if not os.path.isabs(name):
         name = os.path.expanduser('~') + os.path.sep + name
       __dispatcher__(".uno:ExportTo", (__getprop__("URL", unohelper.systemPathToFileUrl(name)), __getprop__("FilterName", "draw_svg_Export")), draw)
-      __time__.sleep(1)
-      create_valid_svg_file(name)
       draw.close(True)
-
+      while XSCRIPTCONTEXT.getDocument() != _.doc:
+        if XSCRIPTCONTEXT.getDocument() not in [draw, _.doc, None]:
+          __halt__ = True
+          return
+        __time__.sleep(0.1)
+      create_valid_svg_file(name)
     __group__ = __groupstack__.pop()
     if __group__ and g:
         __group__.add(g)


More information about the Libreoffice-commits mailing list