Re: How to run multiple instances of Writer simultaneously?
On 19 October 2017 at 16:26, Matthew Francis <mjay.fran...@gmail.com> wrote: > Some sample code appended below - this is hacked out from a previous > project, and may or may not represent best practice as to how to do > this, but does work. ... and the same code as a github gist, because I should know better than to paste wide code in an email https://gist.github.com/mjayfrancis/164e8956113b7119b4e71cb8d4bd41ed ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: How to run multiple instances of Writer simultaneously?
On 19 October 2017 at 15:05, Jens Tröger <jens.troe...@light-speed.de> wrote: > The termination of the process p seems to destroy the other running soffice > process. Hence using custom user installations with > -env:UserInstallation=/tmp/random-dir but that just prolongs the process > creation noticeably! One alternative to allowing LO to create a new user installation each time (which will indeed be slow) is to create a fresh user installation once, save it somewhere as a template, then make a new copy of the template directory each time - a file level copy should be considerably faster. You can accomplish this simply in Python using shutil.copytree() Some sample code appended below - this is hacked out from a previous project, and may or may not represent best practice as to how to do this, but does work. Regards Matthew Francis #!/usr/bin/python3 import os import re import shutil import subprocess import tempfile import time import uno import uuid from com.sun.star.connection import NoConnectException sofficePath = '/usr/bin/soffice' tempDir = tempfile.mkdtemp() # Restore cached profile if available userProfile = tempDir + '/profile' cacheDir = os.getenv('XDG_CACHE_DIR', os.environ['HOME'] + '/.cache') + '/lo_profile_cache' if os.path.isdir(cacheDir): shutil.copytree(cacheDir, userProfile) profileCached = True else: os.mkdir(userProfile) profileCached = False # Launch LibreOffice server pipeName = uuid.uuid4().hex args = [ sofficePath, '-env:UserInstallation=file://' + userProfile, '--pidfile=' + tempDir + '/soffice.pid', '--accept=pipe,name=' + pipeName + ';urp;', '--norestore', '--invisible' ] sofficeEnvironment = os.environ sofficeEnvironment['TMPDIR'] = tempDir proc = subprocess.Popen(args, env=sofficeEnvironment, preexec_fn=os.setsid) # Open connection to server for i in range(100): try: localContext = uno.getComponentContext() resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext) context = resolver.resolve("uno:pipe,name=%s;urp;StarOffice.ComponentContext" % pipeName) break except NoConnectException: time.sleep(0.1) if i == 99: raise # Cache profile if required if not profileCached: shutil.copytree(userProfile, cacheDir) desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context) desktop.loadComponentFromURL('private:factory/swriter', 'blank', 0, ()) # ... clean up temporary directory when done (omitted) ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - vcl/osx
vcl/osx/salframe.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit 255884bd221d0521f5c99add4b9af8723668c300 Author: Matthew Francis mjay.fran...@gmail.com Date: Mon Apr 20 12:33:48 2015 +0800 tdf#71278 Fix cursor hiding in presentation mode The original commit was based on a misunderstanding. In fact, the call to GetSalData()-getCursor() at the end of AquaSalFrame::getCurrentCursor() already handles POINTER_NULL correctly, or at least in the same way as on other platforms. The cursor in presentation mode disappears after 10 seconds - if this is to be changed, it should be changed for all platforms. (cherry picked from commit 58a3a99efec9d4bcb4ab61c41bf2feb707c8e1ef and commit b144821188aac238a38d647dff489fc53d9bf3f6) Change-Id: I6d468caa597afa39d17317a60b3dffc190165ac4 Reviewed-on: https://gerrit.libreoffice.org/15395 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 0f266db..4ff33e4 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -825,7 +825,6 @@ NSCursor* AquaSalFrame::getCurrentCursor() const case POINTER_WINDOW_WSIZE: pCursor = [NSCursor resizeLeftRightCursor]; break; case POINTER_REFHAND: pCursor = [NSCursor pointingHandCursor];break; -case POINTER_NULL: [NSCursor hide];break; default: pCursor = GetSalData()-getCursor( mePointerStyle ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/osx
vcl/osx/salframe.cxx | 13 - 1 file changed, 13 deletions(-) New commits: commit b144821188aac238a38d647dff489fc53d9bf3f6 Author: Matthew Francis mjay.fran...@gmail.com Date: Wed Apr 15 13:57:48 2015 +0800 tdf#71278 Revert both the previous cursor commit and the commit it fixed The original commit was based on a misunderstanding. In fact, the call to GetSalData()-getCursor() at the end of AquaSalFrame::getCurrentCursor() already handles POINTER_NULL correctly, or at least in the same way as on other platforms. The cursor in presentation mode disappears after 10 seconds - if this is to be changed, it should be changed for all platforms. Reverts: commit 58a3a99efec9d4bcb4ab61c41bf2feb707c8e1ef Author: Matthew Francis mjay.fran...@gmail.com Date: Sun Apr 12 23:10:58 2015 +0800 tdf#71278 Set an invisible cursor rather than hiding the cursor commit 8d351c59d4393aa37ab38139b3a741f15a49dbfe Author: jorendc joren.libreoff...@telenet.be Date: Sun Apr 14 00:33:19 2013 +0200 fdo#31082 cursor visible during impress presentation Change-Id: Ie40882661dc1a2f4857027ff04393874042e04ec Reviewed-on: https://gerrit.libreoffice.org/15316 Tested-by: Norbert Thiebaud nthieb...@gmail.com Reviewed-by: Norbert Thiebaud nthieb...@gmail.com diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 202c2ee..da85f00 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -802,18 +802,6 @@ void AquaSalFrame::ToTop(sal_uInt16 nFlags) NSCursor* AquaSalFrame::getCurrentCursor() const { -/* Create invisible cursor */ -static NSCursor *invisibleCursor = NULL; -if (!invisibleCursor) { -NSImage *cursorImage = [[[NSImage alloc] initWithSize:NSMakeSize (16, 16)] autorelease]; -[cursorImage lockFocus]; -[[NSColor clearColor] set]; -NSRectFill( NSMakeRect( 0, 0, 16, 16 ) ); -[cursorImage unlockFocus]; -invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage - hotSpot:NSZeroPoint]; -} - NSCursor* pCursor = nil; switch( mePointerStyle ) { @@ -837,7 +825,6 @@ NSCursor* AquaSalFrame::getCurrentCursor() const case POINTER_WINDOW_WSIZE: pCursor = [NSCursor resizeLeftRightCursor]; break; case POINTER_REFHAND: pCursor = [NSCursor pointingHandCursor];break; -case POINTER_NULL: pCursor = invisibleCursor; break; default: pCursor = GetSalData()-getCursor( mePointerStyle ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/osx
vcl/osx/salframe.cxx | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) New commits: commit 58a3a99efec9d4bcb4ab61c41bf2feb707c8e1ef Author: Matthew Francis mjay.fran...@gmail.com Date: Sun Apr 12 23:10:58 2015 +0800 tdf#71278 Set an invisible cursor rather than hiding the cursor Change-Id: I5ecfa01ab444148aa8d13d04f78db1c6c131a4df Reviewed-on: https://gerrit.libreoffice.org/15269 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Norbert Thiebaud nthieb...@gmail.com diff --git a/vcl/osx/salframe.cxx b/vcl/osx/salframe.cxx index 61dd536..202c2ee 100644 --- a/vcl/osx/salframe.cxx +++ b/vcl/osx/salframe.cxx @@ -802,6 +802,18 @@ void AquaSalFrame::ToTop(sal_uInt16 nFlags) NSCursor* AquaSalFrame::getCurrentCursor() const { +/* Create invisible cursor */ +static NSCursor *invisibleCursor = NULL; +if (!invisibleCursor) { +NSImage *cursorImage = [[[NSImage alloc] initWithSize:NSMakeSize (16, 16)] autorelease]; +[cursorImage lockFocus]; +[[NSColor clearColor] set]; +NSRectFill( NSMakeRect( 0, 0, 16, 16 ) ); +[cursorImage unlockFocus]; +invisibleCursor = [[NSCursor alloc] initWithImage:cursorImage + hotSpot:NSZeroPoint]; +} + NSCursor* pCursor = nil; switch( mePointerStyle ) { @@ -825,7 +837,7 @@ NSCursor* AquaSalFrame::getCurrentCursor() const case POINTER_WINDOW_WSIZE: pCursor = [NSCursor resizeLeftRightCursor]; break; case POINTER_REFHAND: pCursor = [NSCursor pointingHandCursor];break; -case POINTER_NULL: [NSCursor hide];break; +case POINTER_NULL: pCursor = invisibleCursor; break; default: pCursor = GetSalData()-getCursor( mePointerStyle ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source
sw/source/ui/index/cnttab.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 33a67ac2c5e6a60b5a99ebf6767f803277b79148 Author: Matthew Francis mjay.fran...@gmail.com Date: Mon Apr 6 01:46:45 2015 +0400 tdf#89630 Remove extra space added when assigning styles for TOC Change-Id: I05deaf5360fb2d64419f2e47ed348edc9e3adefe Reviewed-on: https://gerrit.libreoffice.org/15165 Tested-by: Christian Lohmaier lohmaier+libreoff...@googlemail.com Reviewed-by: Christian Lohmaier lohmaier+libreoff...@googlemail.com diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index c0065b7..a528f65 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3623,7 +3623,7 @@ IMPL_LINK_NOARG(SwTOXStylesTabPage, AssignHdl) nTemplPos != LISTBOX_ENTRY_NOTFOUND) { const OUString aStr(m_pLevelLB-GetEntry(nLevPos).getToken(0, aDeliStart) -+ + OUString(aDeliStart) ++ OUString(aDeliStart) + m_pParaLayLB-GetSelectEntry() + OUString(aDeliEnd)); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: sw/source
sw/source/ui/index/cnttab.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2caa097682e181fe1dfe19d1af1d798ab9af38eb Author: Matthew Francis mjay.fran...@gmail.com Date: Sat Mar 28 18:58:30 2015 +0800 tdf#89630 Remove extra space added when assigning styles for TOC This crept in with commit 367d3c9b53b94c727c4a818141c580b740c0ae56 Change-Id: Ia59d89b6d08b45478ce1c217c7e4004aa52aca06 Reviewed-on: https://gerrit.libreoffice.org/15042 Tested-by: Jenkins c...@libreoffice.org Reviewed-by: Yousuf Philips philip...@hotmail.com diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 6675da9..fd7a35b 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3622,7 +3622,7 @@ IMPL_LINK_NOARG(SwTOXStylesTabPage, AssignHdl) nTemplPos != LISTBOX_ENTRY_NOTFOUND) { const OUString aStr(m_pLevelLB-GetEntry(nLevPos).getToken(0, aDeliStart) -+ + OUStringLiteral1aDeliStart() ++ OUStringLiteral1aDeliStart() + m_pParaLayLB-GetSelectEntry() + OUStringLiteral1aDeliEnd()); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-6' - filter/source
filter/source/flash/swfwriter1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit e1dcf9331eacc308b521609ccbb1eaf6a81f4826 Author: Matthew Francis mjay.fran...@gmail.com Date: Wed Jan 21 23:58:03 2015 +0800 fdo#84336 Fix swf rendering Commit d83dfeb5e59c8f3de12d673b001a44001f644e7d accidentally inverted a test, causing at least the presentation linked on the above bug to render all black Change-Id: I2267ef43023b735587d6921f17aa7207f70dbd7b Reviewed-on: https://gerrit.libreoffice.org/14084 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com (cherry picked from commit eb4c29f4d10ae4be0e6be15a4c7c8c5bfb1edcc3) Reviewed-on: https://gerrit.libreoffice.org/14088 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Reviewed-by: Michael Stahl mst...@redhat.com diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index 89e5e97..82f8d4e 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -181,7 +181,7 @@ void Writer::Impl_addShapeRecordChange( BitStream rBits, sal_Int16 dx, sal_Int1 rBits.writeUB( 0, 1 ); // StateNewStyles rBits.writeUB( sal_uInt32(!bFilled), 1 ); // StateLineStyle rBits.writeUB( 0, 1 ); // StateFillStyle0 -rBits.writeUB( bFilled ? 0 : 1, 1 );// StateFillStyle1 +rBits.writeUB( bFilled ? 1 : 0, 1 );// StateFillStyle1 rBits.writeUB( 1, 1 ); // StateMoveTo sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-0' - filter/source
filter/source/flash/swfwriter1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6da6af3050393db90b6a6f0c3b1db885f9ddbf14 Author: Matthew Francis mjay.fran...@gmail.com Date: Wed Jan 21 23:58:03 2015 +0800 fdo#84336 Fix swf rendering Commit d83dfeb5e59c8f3de12d673b001a44001f644e7d accidentally inverted a test, causing at least the presentation linked on the above bug to render all black Change-Id: I2267ef43023b735587d6921f17aa7207f70dbd7b Reviewed-on: https://gerrit.libreoffice.org/14084 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com (cherry picked from commit eb4c29f4d10ae4be0e6be15a4c7c8c5bfb1edcc3) Reviewed-on: https://gerrit.libreoffice.org/14086 Reviewed-by: Markus Mohrhard markus.mohrh...@googlemail.com Reviewed-by: Michael Stahl mst...@redhat.com diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index e2c34c1..ae9d1a0 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -178,7 +178,7 @@ void Writer::Impl_addShapeRecordChange( BitStream rBits, sal_Int16 dx, sal_Int1 rBits.writeUB( 0, 1 ); // StateNewStyles rBits.writeUB( sal_uInt32(!bFilled), 1 ); // StateLineStyle rBits.writeUB( 0, 1 ); // StateFillStyle0 -rBits.writeUB( bFilled ? 0 : 1, 1 );// StateFillStyle1 +rBits.writeUB( bFilled ? 1 : 0, 1 );// StateFillStyle1 rBits.writeUB( 1, 1 ); // StateMoveTo sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: filter/source
filter/source/flash/swfwriter1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit eb4c29f4d10ae4be0e6be15a4c7c8c5bfb1edcc3 Author: Matthew Francis mjay.fran...@gmail.com Date: Wed Jan 21 23:58:03 2015 +0800 fdo#84336 Fix swf rendering Commit d83dfeb5e59c8f3de12d673b001a44001f644e7d accidentally inverted a test, causing at least the presentation linked on the above bug to render all black Change-Id: I2267ef43023b735587d6921f17aa7207f70dbd7b Reviewed-on: https://gerrit.libreoffice.org/14084 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index ba7c610..fa4fb92 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -178,7 +178,7 @@ void Writer::Impl_addShapeRecordChange( BitStream rBits, sal_Int16 dx, sal_Int1 rBits.writeUB( 0, 1 ); // StateNewStyles rBits.writeUB( sal_uInt32(!bFilled), 1 ); // StateLineStyle rBits.writeUB( 0, 1 ); // StateFillStyle0 -rBits.writeUB( bFilled ? 0 : 1, 1 );// StateFillStyle1 +rBits.writeUB( bFilled ? 1 : 0, 1 );// StateFillStyle1 rBits.writeUB( 1, 1 ); // StateMoveTo sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - filter/source
filter/source/flash/swfwriter1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 09037c9f41799893c42b719aa332730a5e1c4bf7 Author: Matthew Francis mjay.fran...@gmail.com Date: Wed Jan 21 23:58:03 2015 +0800 fdo#84336 Fix swf rendering Commit d83dfeb5e59c8f3de12d673b001a44001f644e7d accidentally inverted a test, causing at least the presentation linked on the above bug to render all black Change-Id: I2267ef43023b735587d6921f17aa7207f70dbd7b Reviewed-on: https://gerrit.libreoffice.org/14084 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com (cherry picked from commit eb4c29f4d10ae4be0e6be15a4c7c8c5bfb1edcc3) Reviewed-on: https://gerrit.libreoffice.org/14087 diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index 89e5e97..82f8d4e 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -181,7 +181,7 @@ void Writer::Impl_addShapeRecordChange( BitStream rBits, sal_Int16 dx, sal_Int1 rBits.writeUB( 0, 1 ); // StateNewStyles rBits.writeUB( sal_uInt32(!bFilled), 1 ); // StateLineStyle rBits.writeUB( 0, 1 ); // StateFillStyle0 -rBits.writeUB( bFilled ? 0 : 1, 1 );// StateFillStyle1 +rBits.writeUB( bFilled ? 1 : 0, 1 );// StateFillStyle1 rBits.writeUB( 1, 1 ); // StateMoveTo sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - filter/source
filter/source/flash/swfwriter1.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 3fdc79f191e629042a8e448c7d643a1cd487e3c8 Author: Matthew Francis mjay.fran...@gmail.com Date: Wed Jan 21 23:58:03 2015 +0800 fdo#84336 Fix swf rendering Commit d83dfeb5e59c8f3de12d673b001a44001f644e7d accidentally inverted a test, causing at least the presentation linked on the above bug to render all black Change-Id: I2267ef43023b735587d6921f17aa7207f70dbd7b Reviewed-on: https://gerrit.libreoffice.org/14084 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com (cherry picked from commit eb4c29f4d10ae4be0e6be15a4c7c8c5bfb1edcc3) Reviewed-on: https://gerrit.libreoffice.org/14085 diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx index e2c34c1..ae9d1a0 100644 --- a/filter/source/flash/swfwriter1.cxx +++ b/filter/source/flash/swfwriter1.cxx @@ -178,7 +178,7 @@ void Writer::Impl_addShapeRecordChange( BitStream rBits, sal_Int16 dx, sal_Int1 rBits.writeUB( 0, 1 ); // StateNewStyles rBits.writeUB( sal_uInt32(!bFilled), 1 ); // StateLineStyle rBits.writeUB( 0, 1 ); // StateFillStyle0 -rBits.writeUB( bFilled ? 0 : 1, 1 );// StateFillStyle1 +rBits.writeUB( bFilled ? 1 : 0, 1 );// StateFillStyle1 rBits.writeUB( 1, 1 ); // StateMoveTo sal_uInt16 nMoveBits = max( getMaxBitsSigned( dx ), getMaxBitsSigned( dy ) ); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits