Re: [libreoffice-users] loadComponentFromURL into _top frame at startup crashes LO

2015-05-31 Thread X Roemer

sorry, forgot some code in the listener.m it should be:



class Doc_Event_Listener(unohelper.Base,XDocumentEventListener):

def documentEventOccured(self,ev):

if ev.EventName == 'OnLayoutFinished':
if document.Name == '':
document.Name = 'xxx'

URL=private:factory/swriter
desktop.ActiveFrame.loadComponentFromURL(URL,'_top','',())





Am 31.05.2015 um 12:18 schrieb X Roemer:

Hi,

this post is somehow related to open files automatically, but a bit 
more specific.
http://nabble.documentfoundation.org/open-files-automatically-td4149584.html 




When I load a component in an already loaded LO, following code works 
inside an extension:

URL=private:factory/swriter
desktop.ActiveFrame.loadComponentFromURL(URL,'_top','',())

But when I try to do that on startup of LO, LO crashes.
I used an EventBroadcaster to start the code, like this:

eventb = 
ctx.getByName(/singletons/com.sun.star.frame.theGlobalEventBroadcaster)

eventb.addDocumentEventListener(listener)

and in the listener:

class Doc_Event_Listener(unohelper.Base,XDocumentEventListener):

def documentEventOccured(self,ev):

if document.Name == '':
document.Name = 'xxx'

URL=private:factory/swriter
desktop.ActiveFrame.loadComponentFromURL(URL,'_top','',())


It doesn't matter if I set _self or _top or _parent, LO always 
crashes. Whereas when I use _blank or _default, it works, but the 
document gets opened in another window, what is not, what I want to 
reach.


I tried it on OO also, slightly different with a TopWindowListener, 
and it works.


Does anybody have an idea about what is going on and if it is 
solveable in another way?


Regards,
Xaver




--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


Re: [libreoffice-users] loadComponentfromUrl

2012-10-04 Thread Tom Davies
Hi :)
Hopefully someone more experienced will give a decent answer but until then it 
might be worth acquiring Andrew Pitonyak's Macro Guide
https://wiki.documentfoundation.org/Documentation/Publications#Programmers

There are a few chapters and things in official documentation (and therefore 
free) but i suspect you have already gone through those.  
Regards from
Tom :)  







 From: Walther Koehler w.koeh...@onlinemed.de
To: users@global.libreoffice.org 
Sent: Thursday, 4 October 2012, 17:42
Subject: [libreoffice-users] loadComponentfromUrl
 
Hi,

When I open a document in writer (by menu/open or recently used or new), it 
opens a frame with full window size. bingo.

When I open the same document via a basic makro using
loadComponentfromUrl(sURL, _blank, 0, args())
it opens in a frame maximised vertically but not horizontally.

All further open commands (menu/open AND basic) give the same reduced window 
frame. I assume that somehow an internal variable has been changed by the 
loadComponentfromUrl command.

of course I fiddled around with the parameters/args() of loadComponentfromURL 
and the KDE windows configuration, does _blank start a new (wrong) parent 
frame?, never Problem up to 3.4.

Any idea?

Walther

-- 
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted




-- 
For unsubscribe instructions e-mail to: users+h...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted