Re: How many degrees of headlessness do we need? [and LibreOffice crash]

2015-04-01 Thread Piet van Oostrum
Michael Stahl wrote:

  actually now i tried it out and the crash was pretty trivially fixed
  with commit d360477d8740f29e2c2bc5f7bbd667df7cd26ee9
  
This is great! It works!

So now I have one more way to process a document headless. And now no weird 
window will be created.

Code for reading a document:

 
textdoc = ServiceManager.createInstance(com.sun.star.text.TextDocument)

loadURL = systemPathToFileUrl(realpath(test.odt))
inProps = (PropertyValue(URL, -1, loadURL, 0), PropertyValue(FilterName, 
-1, writer8, 0))
textdoc.load(inProps)

print(textdoc.Text.String)

textdoc.close(True)



Code for writing a document:

textdoc = ServiceManager.createInstance(com.sun.star.text.TextDocument)

textdoc.initNew()
textdoc.Text.String = Hello World from initNew()

saveURL = systemPathToFileUrl(realpath(test.odt))
outProps = PropertyValue(Overwrite, -1, True, 0), # 1-tuple
textdoc.storeAsURL(saveURL, outProps)

textdoc.close(True)


Even with a non-headless LO start (but with --nologo --nodefault) no window is 
created.
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-31 Thread Stephan Bergmann

On 03/30/2015 09:54 PM, Tor Lillqvist wrote:

OK, so after trying out the --invisible switch, I don't think it is that
super-useful after all, if all it does is make the soffice process wait
invisibly for the first UNO client to connect, but has no effect after that.

When the first client tells LO to open a document, it opens (visibly).
That is as expected. But if I then close the document, the start centre
shows up. I would have expected the soffice process to go back to the
invisible state, with no windows showing, when it has no documents open.


I guess that's a regression, given --invisible is much older than the 
various iterations of when exactly to show or not show the start center 
(which started out as a Mac-specific thing and then spread from there).


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-31 Thread Tor Lillqvist
Is it in fact so that nowadays --quickstart does what --invisible is
supposed to do? (Note that just starting soffice with the --quickstart
option has nothing to do with whether that happens automatically when you
log in or not.) If I start soffice with --quickstart and --accept, nothing
is displayed (like with --invisible). If I connect with a UNO client that
opens a document, closes the window, the process stays running (unlike with
--invisible).

Maybe we should in fact just make --invisible a synonym for --quickstart?

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-31 Thread Stephan Bergmann

On 03/31/2015 12:15 PM, Tor Lillqvist wrote:

Is it in fact so that nowadays --quickstart does what --invisible is
supposed to do? (Note that just starting soffice with the --quickstart
option has nothing to do with whether that happens automatically when
you log in or not.) If I start soffice with --quickstart and --accept,
nothing is displayed (like with --invisible). If I connect with a UNO
client that opens a document, closes the window, the process stays
running (unlike with --invisible).

Maybe we should in fact just make --invisible a synonym for --quickstart?


While --quickstart indeed visually behaves similar to --invisible, it 
also actually starts the quickstart service (where available) and thus 
defeats XDesktop.terminate, unlike --invisible.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-31 Thread Tor Lillqvist
  While --quickstart indeed visually behaves similar to --invisible, it
  also actually starts the quickstart service (where available) and thus
  defeats XDesktop.terminate, unlike --invisible.

 Sounds like --quickstart is more of a persistent server mode then?


Could be;) If you want to run a server LibreOffice, and want to be sure
that no client accidentally shuts it down, is --quickstart (coincidentally)
how you should start it, not --invisible?

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-31 Thread Jens Tröger
On Tue, Mar 31, 2015 at 05:03:38PM +0300, Tor Lillqvist wrote:
  Sounds like --quickstart is more of a persistent server mode then?
 
Could be;) If you want to run a server LibreOffice, and want to be
sure that no client accidentally shuts it down, is --quickstart
(coincidentally) how you should start it, not --invisible?
--tml

Oh how I would like to run a persistent LO server that scales well with
the number of connections...  :)  (Off topic though.)

Jens

-- 
Jens Tröger
http://savage.light-speed.de/
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-31 Thread Jens Tröger
On Tue, Mar 31, 2015 at 02:43:56PM +0200, Stephan Bergmann wrote:
 On 03/31/2015 12:15 PM, Tor Lillqvist wrote:
  Is it in fact so that nowadays --quickstart does what --invisible is
  supposed to do? (Note that just starting soffice with the --quickstart
  option has nothing to do with whether that happens automatically when
  you log in or not.) If I start soffice with --quickstart and --accept,
  nothing is displayed (like with --invisible). If I connect with a UNO
  client that opens a document, closes the window, the process stays
  running (unlike with --invisible).
 
  Maybe we should in fact just make --invisible a synonym for --quickstart?
 
 While --quickstart indeed visually behaves similar to --invisible, it 
 also actually starts the quickstart service (where available) and thus 
 defeats XDesktop.terminate, unlike --invisible.

Sounds like --quickstart is more of a persistent server mode then? 

-- 
Jens Tröger
http://savage.light-speed.de/
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-30 Thread Tor Lillqvist
 I our company, on Windows machines, it is used regularly to convert file
 formats (xls to odf/pdf) without user interaction, without any signs of
 being broken.


Yeah, which is why I said to some degree. It's not the situations and
combinations that work that are interesting, but those that don't.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


RE: How many degrees of headlessness do we need?

2015-03-30 Thread Winfried Donkers
Hi tml,

On Linux (and other X11-using Unixes), --headless is tightly coupled to the 
'vclplug' concept, as there used to be a 'headless' (actually called 'svp') 
vclplug that was used (instead of a generic X11, GTK or KDE one) in headless 
mode. Nowadays the 'svp' code is not technically a vclplug any more, but that 
is just an implementation detail. On Windows and OS X, --headless support is 
presumably broken to some degree.

I our company, on Windows machines, it is used regularly to convert file 
formats (xls to odf/pdf) without user interaction, without any signs of being 
broken.

Winfried
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-30 Thread Jens Tröger
Hi,

Thank you Tor for starting this discussion; very interesting and
necessary.  I've been confused about these different modes for a while,
in particular because I run on both Mac and Linux where the same switch
works differently.

I use LO for document analysis (not conversion), i.e. I need to load a
document and poke its styles and also extract some content.  This
*should* run without any GUI because we don't even have the X libs
installed on Linux; works ok so far.  That exact same approach on Mac
*always* pops open a window, which has irritated me for a while.  Good
you mention that this might be broken.

Another question that arose from these switches is the server mode in
general.  I mean, when I run LO headless with a named pipe or socket
port, then it becomes a server.  However, it seems to scale poorly, and
your mention of dialog/error boxes trying to disrupt the use makes me
nervous.

  https://forum.openoffice.org/en/forum/viewtopic.php?f=5t=74002

I was unable to find good documentation regarding headless mode, server
mode, and interacting with LO in such an environment.  Perhaps, to bring
order into these various switches, it'll help to define use cases and
use scenarios; then adjust and fix the switches accordingly.

Cheers,
Jens

-- 
Jens Tröger
http://savage.light-speed.de/
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-30 Thread Tor Lillqvist
OK, so after trying out the --invisible switch, I don't think it is that
super-useful after all, if all it does is make the soffice process wait
invisibly for the first UNO client to connect, but has no effect after that.

When the first client tells LO to open a document, it opens (visibly). That
is as expected. But if I then close the document, the start centre shows
up. I would have expected the soffice process to go back to the invisible
state, with no windows showing, when it has no documents open.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Popup dialogs (was How many degrees of headlessness do we need?)

2015-03-30 Thread Anthonys Lists

On 30/03/2015 16:50, Jens Tröger wrote:

Hi,

Thank you Tor for starting this discussion; very interesting and
necessary.  I've been confused about these different modes for a while,
in particular because I run on both Mac and Linux where the same switch
works differently.
Just throwing something completely off the wall into the mix ... and 
trained touch-typists the world over (not that there are that many left) 
would probably throw their arms around you and hug and kiss you for this ...


Is there any way we could have a mode that would disable pop-up dialogs, 
auto-corrupt, etc etc. Touch typists are TRAINED NOT to look at the 
screen - a pop-up dialog plays havoc with that workflow. They want to be 
able to dump text from a paper document into a word-processor document. 
Bear in mind that a trained typist can do this accurately such that it 
OCR needs to be better than 95% accurate to do a faster job.


That's what pisses me off about Word - it's aimed at the hunt-n-peck 
brigade - sure that's the majority of the market out there, but so many 
of its features are on-by-default, hard to disable, and a pain in the 
neck for the professional user. It would be nice to have a mode that 
says what you type is what you get!!!


Cheers,
Wol
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-30 Thread Tor Lillqvist
 If you run LO on the Mac as a service with --headless and you open a doc
 from a script with Hidden=True,


Oh. I guess this Hidden=True needs to be counted as one more degree (or
mode) of headlessness;) One that is specific to a document window. What
happens if you haven't started LO with --headless, what effect does
Hidden=True then have?


 no window will pop up. If the document is open long enough (for example if
 you put a sleep in the script) you can see from the doc that there is an
 invisible window. From the Dock you can open that window.


I guess with open you mean un-minimize here?


 It does have the document filename as title, but it doesn't contain the
 document. It is a kind of strange window.


Yeah, sounds odd indeed. The described can hardly be intentional, but must
be seen as a bug.


 Here is a script that extracts the text from a Writer document.


Thanks. I will experiment eventually.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-30 Thread Piet van Oostrum
Jens Tröger wrote:

  I use LO for document analysis (not conversion), i.e. I need to load a
  document and poke its styles and also extract some content.  This
  *should* run without any GUI because we don't even have the X libs
  installed on Linux; works ok so far.  That exact same approach on Mac
  *always* pops open a window, which has irritated me for a while.  Good
  you mention that this might be broken.
 
If you run LO on the Mac as a service with --headless and you open a doc from a 
script with Hidden=True, no window will pop up. If the document is open long 
enough (for example if you put a sleep in the script) you can see from the doc 
that there is an invisible window. From the Dock you can open that window. It 
does have the document filename as title, but it doesn't contain the document. 
It is a kind of strange window. Here is a script that extracts the text from a 
Writer document. Start LO as
/Applications/LibreOffice.app/Contents/MacOS/soffice 
'--accept=socket,host=localhost,port=2002;urp;StarOffice.Servicemanager' 
--headless 

and run the script with LO's Python:

import uno
from unohelper import systemPathToFileUrl
from com.sun.star.beans import PropertyValue
from os.path import realpath

localContext = uno.getComponentContext()
resolver = 
localContext.ServiceManager.createInstanceWithContext(com.sun.star.bridge.UnoUrlResolver,
 localContext)
context = 
resolver.resolve(uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext)
desktop = 
context.ServiceManager.createInstanceWithContext(com.sun.star.frame.Desktop, 
context)

loadURL = systemPathToFileUrl(realpath(test.odt))
inProps = PropertyValue( Hidden , -1 , True, 0 ), # 1-tuple!

textdoc = desktop.loadComponentFromURL(loadURL, _blank, 0, inProps);
print(textdoc.Text.String)

textdoc.close(True)

-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


How many degrees of headlessness do we need?

2015-03-29 Thread Tor Lillqvist
As far as I see, we have the following command-line options or other ways
to avoid display of GUI elements:

- The --quickstart switch. Starts a LO instance that *initially* has no
GUI. But when the user then actually wants to use LO, it is that instance
that wakes up and shows the GUI. When the user quits, the process stays
running but goes back to showing no GUI.

- The --invisible switch. Not much used? Exact semantics unknown. What is
the intended interaction with existing LibreOffice instances, is there the
normal IPC pipe thing going on, so that only one LO instance runs per user
session?

- The --headless switch. Perhaps newer than --invisible? Not sure why a
separate one is needed and what the exact intended semantics are. Again,
how is it supposed to affect the interaction with other LibreOffice
instances?

On Linux (and other X11-using Unixes), --headless is tightly coupled to the
'vclplug' concept, as there used to be a 'headless' (actually called 'svp')
vclplug that was used (instead of a generic X11, GTK or KDE one) in
headless mode. Nowadays the 'svp' code is not technically a vclplug any
more, but that is just an implementation detail. On Windows and OS X,
--headless support is presumably broken to some degree.

Note that Application::EnableHeadlessMode takes a boolean parameter
'dialogsAreFatal', so this mode actually splits into two.

- The Application::EnableConsoleOnly() and IsConsoleOnly() API. No
command-line switch. Very new, from 2013. Used only in one program, gengal,
for OS X. Not sure if actually does what Michael (who doesn't use OS X)
thinks it does. Unclear why the 'headless' thing could not be used instead.
(Yesterday I made EnableConsoleOnly() also call EnableHeadlessMode(true).)

-  LibreOfficeKit use of LO code. At least to me, it should be obvious that
when some arbitrary program, possibly running as a daemon, as a web
service, etc, uses LibreOfficeKit to handle documents, no LO GUI should
ever be displayed. Currently LibreOfficeKit turns on 'headless', and since
yesterday, also 'console-only'.

This is a mess and needs clarification. There are five modes of
headlessness. Do these modes form a hierarchy? Or is it possible, and
meaningful, to have a LibreOffice instance that is headless but not
invisible, for instance? Could we at least finally kill the quick start
concept, which surely is outdated by now?

Then there is also the issue that many (or all?) programs that use
LibreOfficeKit should be able to run totally isolated from other processes
using LO code (LO itself, or other instances of the same or other
LOKit-using processes). There should be no inter-process communication.
Perhaps even no reading or writing of user configuration. But this is a
separate topic.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-29 Thread Tor Lillqvist
 On Mac we have the env variable VCL_HIDE_WINDOWS
 connected to 'PseudoHeadless'


OK, so we have *six* modes of headlessness;)

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-29 Thread Norbert Thiebaud
On Sun, Mar 29, 2015 at 1:21 AM, Tor Lillqvist t...@iki.fi wrote:
 On Windows and OS X,
 --headless support is presumably broken to some degree.

On Mac we have the env variable VCL_HIDE_WINDOWS
connected to 'PseudoHeadless'
the poor man version of headless achieved my preventing any Windows of 'showing'

I added that to avoid the very annoying 'flashing' when the unit test
are running on Mac.

Norbert
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-29 Thread Riccardo Magliocchetti

Il 29/03/2015 08:21, Tor Lillqvist ha scritto:

As far as I see, we have the following command-line options or other ways to
avoid display of GUI elements:

[snip]

- The --invisible switch. Not much used? Exact semantics unknown. What is the
intended interaction with existing LibreOffice instances, is there the normal
IPC pipe thing going on, so that only one LO instance runs per user session?


Looking at the code there's quite a lot of if that avoid calling 
OfficeIPCThread::ExecuteCmdLineRequests when libo is invoked with --invisible

Telepathy has some knowledge of it for some reason.


- The --headless switch. Perhaps newer than --invisible? Not sure why a separate
one is needed and what the exact intended semantics are. Again, how is it
supposed to affect the interaction with other LibreOffice instances?

On Linux (and other X11-using Unixes), --headless is tightly coupled to the
'vclplug' concept, as there used to be a 'headless' (actually called 'svp')
vclplug that was used (instead of a generic X11, GTK or KDE one) in headless
mode. Nowadays the 'svp' code is not technically a vclplug any more, but that is
just an implementation detail. On Windows and OS X, --headless support is
presumably broken to some degree.


[snip]


This is a mess and needs clarification. There are five modes of headlessness. Do
these modes form a hierarchy? Or is it possible, and meaningful, to have a
LibreOffice instance that is headless but not invisible, for instance? Could we
at least finally kill the quick start concept, which surely is outdated by now?


I've googled a bit on libreoffice headless and invisible options usage on forums 
in the context of document conversion. Found just once occurence of invisible 
used alone at stack overflow, most of the time it's headless alone or headless 
and invisible together. So i'd just make it an alias of headless to avoid 
breaking scripts and mark it as deprecated in the help.


thanks

--
Riccardo Magliocchetti
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-29 Thread Tor Lillqvist
 I've googled a bit on libreoffice headless and invisible options usage on
 forums in the context of document conversion. Found just once occurence of
 invisible used alone at stack overflow, most of the time it's headless
 alone or headless and invisible together. So i'd just make it an alias of
 headless to avoid breaking scripts and mark it as deprecated in the help.


Yep, that seems sensible to me, too. Will do that.

Also, I will probably get rid of the ConsoleOnly thing, and instead call
EnableHeadlessMode() in gengal and test IsHeadlessModeEnabled in SVMain().
(This will affect only OS X, as it is only on OS X that ImplSVMainHook()
can return true.)

BTW, despite the ConsoleOnly thing, gengal was still crashing on OS X when
running with no access to the window system. That was because the [NSScreen
screens] call in AquaSalGraphics::initResolution() naturally returned an
empty NSArray, but the code anyway tried to get the 0th object of it. I
fixed that today. Will push together with the other changes mentioned above
once I have done some double-checking.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: How many degrees of headlessness do we need?

2015-03-29 Thread Tor Lillqvist
 Also, I will probably get rid of the ConsoleOnly thing, and instead call
 EnableHeadlessMode() in gengal and test IsHeadlessModeEnabled in SVMain().
 (This will affect only OS X, as it is only on OS X that ImplSVMainHook()
 can return true.)


On the other hand, it *is* documented in svapp.hxx what ConsoleOnly mode
means, and it is in fact orthogonal to headlessness. (Used to disable Mac
specific app init that requires an app bundle.) So using this in gengal
(which indeed is not a program in an app bundle; only soffice is) makes
sense.

On the other hand, the change I did yesterday to check IsConsoleOnly()
in OfficeIPCThread::EnableOfficeIPCThread() and OfficeIPCThread::execute()
probably was wrong. That has nothing to do with whether the code is
executing in an app bundle or not. Probably what I should be checking there
is IsHeadlessModeEnabled().

Also the check for IsConsoleOnly() in OpenGLHelper::isVCLOpenGLEnabled() is
probably not right, because whether OpenGL can be used or not has little do
do with whether running in app bundle or not. Probably
IsHeadlessModeEnabled() is the right thing to call there, too.

--tml
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice