Re: [api-dev] Impossible to close a Base document
Hi Bernard, ... dbDoc.close(True) The document usine.odb shows up, but the close instruction receives an exception. what kind of exception? Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Frank I reproduced the problem ... dbDoc.close(True) The document usine.odb shows up, but the close instruction receives an exception. what kind of exception? com.sun.star.util.CloseVetoException Laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org Indesko http://www.indesko.com Nuxeo CPS http://www.nuxeo.com - http://www.cps-project.org Livre Programmation OpenOffice.org, Eyrolles 2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Laurent, com.sun.star.util.CloseVetoException That's okay :), and it was a bug that this exception wasn't thrown before. (Hmm. Thinking about it, do the other document types behave the same way?) The idea is that as long as a view to the document exists, you cannot close the document - the view will veto is. This is because there's no possibility to decide that the view was created (with your 'loadComponentFromURL( ..., _blank, ... )') by the same script which is now trying to close the document - it could also be a view created by the user via File|Open. So, if you want to close the view (I suppose this is what you really want: get rid of the window displaying the document), then obtain the CurrentController of the model, and close the frame this controller lives in. If this was the last frame, the document should be closed automatically (if not, it's a bug). If there are more frames, you can iterate through them (CurrentController will point to the controller in the next frame, after you closed the previous one). However, this is rather unlikely for database documents, which to not have the multiple views per document (Window|New window) feature, at least not in the usual sense. Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Laurent, dbdoc.currentController.Frame.close(false) any reason you used false here? This means that if the close fails, you're still responsible for it ... Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Laurent, hum, the method of the object that created it is called so there is a way to know that we want to close the views dependanding of it are you saying taht views are not attached to their creators ? They're bound to the model, but that's not necessarily the same as creator. For instance, you could load a model without any view, by retrieving the DataSource at the DatabaseContext (getByName( URL ) ), and asking this DataSource for its Document (.getDatabaseDocument). In this case, you'd have a model, but no view at all. Now if the user does a File|Open with the very same file you specified in the URL, the the document is not loaded, again ('cause it already *is*), but only a new view is created. Also, if you (or another script) does a loadComponentFromURL with the URL in question, the document is reused, and only a new view for it is created. So, while the document knows that there exists a view for it, it cannot know who's the owner of this view. Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Frank They're bound to the model, but that's not necessarily the same as creator. yes For instance, you could load a model without any view, by retrieving the DataSource at the DatabaseContext (getByName( URL ) ), and asking this DataSource for its Document (.getDatabaseDocument). In this case, you'd have a model, but no view at all. ok So, while the document knows that there exists a view for it, it cannot know who's the owner of this view. Would it be possible to identify controllers that are loaded by different ways ? Thanks again for your response Frank Laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org Indesko http://www.indesko.com Nuxeo CPS http://www.nuxeo.com - http://www.cps-project.org Livre Programmation OpenOffice.org, Eyrolles 2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Java: Managing keyboard shortcuts - where to start
Hi Carsten, my next task is to remove and add some keyboard shortcuts to an OpenOffice... I looked up the Dev-Guide but it does not tell much about keybord shortcuts. Is it possible to manage the keyboard shortcuts via Java? If yes, where can I start? Can you help me please once more? just have a look at the thread UNO package setting keybindings where I describe how to set keyboard shortcuts via API. There is also another thread Problem adding a keyboard shortcut by API's where this issue were discussed. I found the BASIC examlpe. I want to translate it to Java but have a starting problem. Maybe you can help me. I cite you: -%- REM * BASIC * REM *** Example to set a keyboard shortcut with the new ui REM *** configuration API Sub Main REM *** Initialize constants. See IDL file REM com.sun.star.awt.KeyEvent REM com.sun.star.awt.KeyModifier REM com.sun.star.awt.Key MODIFIER_SHIFT = 1 MODIFIER_MOD1 = 2 MODIFIER_MOD2 = 4 KEY_F10= 777 REM *** Retrieve the global accelerator configuration manager oGlobalAccelCfgMgr = createUnoService(com.sun.star.ui.GlobalAcceleratorConfiguration) REM *** Retrieve the module configuration manager from central REM *** module configuration manager supplier oModuleCfgMgrSupplier = createUnoService( com.sun.star.ui.ModuleUIConfigurationManagerSupplier) -%- How can I get the oGlobalAccelCfgMgr? I tried: -%- // Condition: XComponentContext xRemoteContext Object test = xRemoteServiceManager.createInstanceWithContext( com.sun.star.ui.GlobalAcceleratorConfiguration, xRemoteContext); com.sun.star.uno.XInterface xInterface = (com.sun.star.uno.XInterface) UnoRuntime.queryInterface( GlobalAcceleratorConfiguration.class, test); -%- The createInstance... works out, but how to go on? Would you please give me a hint? Greetings, Tobias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Bonjour Frank Message du 2006-03-14 09:59: Hi Laurent, com.sun.star.util.CloseVetoException That's okay :), and it was a bug that this exception wasn't thrown before. (Hmm. Thinking about it, do the other document types behave the same way?) No. If I load a text document for example, no problem to close it. Dim adrOdb As String Dim OdbOpt() as new com.sun.star.beans.PropertyValue adrOdb = convertToURL(C:\Docs OpenOffice\PrixSuperieur10.odt) dbDoc = StarDesktop.loadComponentFromURL(adrOdb, _blank, 0, OdbOpt()) wait(3000) dbDoc.close(True) The idea is that as long as a view to the document exists, you cannot close the document - the view will veto is. This is not the case for documents other than odb. Bernard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Laurent, Would it be possible to identify controllers that are loaded by different ways ? Hmm, not that I know. Basically, a controller is (almost) always loaded by a loadComponentFromURL, but nobody knows who called this method. Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Bernard, No. If I load a text document for example, no problem to close it. ... The idea is that as long as a view to the document exists, you cannot close the document - the view will veto is. This is not the case for documents other than odb. Hmm. Do you mind submitting an issue for this (and assigning it to me)? Not sure how it could be solved, since database documents are a little bit different (as you can obtain them without loading, via the DatabaseContext.getByName( url ).getDatabaseDocument() way, as described in another mail). But we should try to be consistent here. Thanks Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Laurent, in fact, what about the datasource that seems to load the file without displaying it as frank said We then end with 2 loads of the document one for the datasource ( maSource.DatabaseDocument) one for the loadComponentFromURL Effectively, it's loaded once only, but you have two clients of it: the script which (implicitly) loaded it via maSource.DatabaseDocument, and the user (or script) which (explicitly) loaded it. That's why it's hard to tell who has the ownership of the document. If it were the frame (opened by the user), and the frame would close it, then the script would break. If it were the script, and the script would close the doc, then the frame would silently be closed, too, even if the user doesn't want this. Thus, the idea was that any client obtaining a database document must register as CloseVetoListener. Frames (resp. the Controller for a DBDoc) do this automatically, speaking strictly, your script would need to do this, too, to be on the safe side against closes by foreign parties. However, this interpretation might be too strict (and the scenario too esoteric). Should probably discuss this with the people who implemented the closing mechanism for the other document types, they must have had reasons to do it the way they did :) Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Bonjour Frank Message du 2006-03-14 12:37: Hi Laurent, in fact, what about the datasource that seems to load the file without displaying it as frank said We then end with 2 loads of the document one for the datasource ( maSource.DatabaseDocument) one for the loadComponentFromURL Effectively, it's loaded once only, but you have two clients of it: the script which (implicitly) loaded it via maSource.DatabaseDocument, and the user (or script) which (explicitly) loaded it. That's why it's hard to tell who has the ownership of the document. In the original code, I can understand that, although it is not obvious. But if I directly load the odb file, I still get the same exception Dim dbDoc As Object Dim adrOdb As String Dim OdbOpt() as new com.sun.star.beans.PropertyValue adrOdb = convertToURL(C:\Documents and Settings\Personne\Mes documents\Databases\base2\usine.odb) dbDoc = StarDesktop.loadComponentFromURL(adrOdb, _blank, 0, OdbOpt()) wait(3000) dbDoc.close(True) ' - closeVetoException Your solution works, but it is a workaround. It is not described in Dev' Guide 6.4.5, sub-section Closing a document. See in particular the flowchart Closing a model. I will file an issue. Bernard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Bernard, In the original code, I can understand that, although it is not obvious. But if I directly load the odb file, I still get the same exception the datasource is loaded to be accessed so you end with the same previous case i guess this is the difference with other document types : there is no extra-binding to setup to display the document Your solution works, but it is a workaround. It is not described in Dev' Guide 6.4.5, sub-section Closing a document. See in particular the flowchart Closing a model. I will file an issue. please send me the IZ number thanks Laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org Indesko http://www.indesko.com Nuxeo CPS http://www.nuxeo.com - http://www.cps-project.org Livre Programmation OpenOffice.org, Eyrolles 2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi bernard Bernard Marcelly a écrit : Bonjour Frank Message du 2006-03-14 12:33: Hmm. Do you mind submitting an issue for this (and assigning it to me)? Not sure how it could be solved, since database documents are a little bit different (as you can obtain them without loading, via the DatabaseContext.getByName( url ).getDatabaseDocument() way, as described in another mail). But we should try to be consistent here. Issue filed : http://www.openoffice.org/issues/show_bug.cgi?id=63162 thanks :-) Laurent -- Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org Indesko http://www.indesko.com Nuxeo CPS http://www.nuxeo.com - http://www.cps-project.org Livre Programmation OpenOffice.org, Eyrolles 2004 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] digital signature openoffice
Hi ALL, I have a question for you. Does somebody know if OpenOffice has API for digital signature management? Can somebody give me any links? Thank you. Regards, Vincenzo. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Impossible to close a Base document
Hi Bernard, Issue filed : http://www.openoffice.org/issues/show_bug.cgi?id=63162 Thanks. Ciao Frank -- - Frank Schönheit, Software Engineer [EMAIL PROTECTED] - - Sun Microsystems http://www.sun.com/staroffice - - OpenOffice.org Database http://dba.openoffice.org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [api-dev] Calc addin - Custom toolbar not enabled
The toolbar disables an entry for two reasons: 1. The queryDispatch(...) call on XDispatchProvider doesn't provide a dispatch object. I put in some messageboxes to see when queryDispatch is called (and to see any exceptions thrown). It appears the queryDispatch method doesn't get called until I hit my custom menu (and those items are initialized). I was expecting them to be called on application startup based on the Jobs.xcu I have defined: ?xml version=1.0 encoding=UTF-8? oor:component-data xmlns:oor=http://openoffice.org/2001/registry; xmlns:xs=http://www.w3.org/2001/XMLSchema; oor:name=Jobs oor:package=org.openoffice.Office node oor:name=Jobs node oor:name=startApp oor:op=replace prop oor:name=Service valuecom.appliedolap.objects.essbase.client.grid.staroffice.plugin.ui.Plug inProtocolHandler/value /prop /node /node node oor:name=Events node oor:name=onFirstVisibleTask oor:op=replace node oor:name=JobList node oor:name=startApp oor:op=replace/ /node /node node oor:name=OnNew oor:op=replace node oor:name=JobList node oor:name=startApp oor:op=replace/ /node /node node oor:name=OnLoad oor:op=replace node oor:name=JobList node oor:name=startApp oor:op=replace/ /node /node /node /oor:component-data Based on this jobs.xcu, I would expect the initialization to happen on onFirstVisibleTask, OnNew or OnLoad. Am I wrong in that? BTW, it seemed to work in Ooo 1.1.4 without a problem. Tim Tim Tow Applied OLAP, Inc 256.990.0136 -Original Message- From: Carsten Driesner [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 14, 2006 3:15 AM To: dev@api.openoffice.org Subject: Re: [api-dev] Calc addin - Custom toolbar not enabled Tim Tow wrote: I have a custom toolbar defined in Addons.xcu that is not enabling properly. The icons appear to be found properly but are disabled. The same URL is being used on custom menubar, so it appears as though it is registered properly. Here is a snippet of the Addons.xcu for the toolbar: Two questions: 1. What could be causing the toolbar to be disabled (and what is the best way to debug this issue?); and The toolbar disables an entry for two reasons: 1. The queryDispatch(...) call on XDispatchProvider doesn't provide a dispatch object. 2. The dispatch object sends a statusChanged notification with FeatureStateEvent.IsEnabled = false. This results in a disabled toolbar item. You have to check whether your queryDispatch function is called. If yes, please check your statusChanged notification. 2. Why does the submenu get the same icon as the toolbar when it isn't specified to have an icon in Addons.xcu? OpenOffice.org always associates an image to a command URL. Therefore you see the same image on the toolbar and menu item. Regards, Carsten - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] How to ask a frame if any part of it is outside of the margin or of the printable area
Thanks in the end I wrote up something similiar to your algorithmn. What I did is I created a shape, then I do insertTextContent, and then I do getSize and finally removeTextContent. Then I at least have the size of the object so I can calculate if there is room enough. Then instead of a shape I use a TextFrame because I need the text flow functionality it gives - ie I can put them in tables. Unfortunately leftborderdistance and the other borderdistance properties don't seem to work. Tomorrow I will enter a bug report for these problems. Thanks again for your interest. --- Fernand Vanrie [EMAIL PROTECTED] wrote: Had the same problem and solved it with running a counter for eevry page and keep track off the cursor position on the page where we are inserting a frame. Then you have to place the new frame anywhere on the page, fil the frame with the text and with the frame cursor you can measur the hight of the filled-frame and then just reposition the frame on the page or on a new page if there is not enough place (hight) on the current page. Maybe a peace of OObasic code can help you further Dim oFrame As Object oFrame = oDoc.createInstance(com.sun.star.text.TextFrame) oFrame.SetPropertyValue(AnchorPageNo, iPagenr) oFrame.AnchorType = lAnchor oFrame. BackColorTransparency = 100 oFrame.PositionProtected = True oFrame.SizeProtected = True oFrame.ContentProtected = True oFrame.width = iFotW - AflpL - AflpR oFrame.HoriOrient = NONE oFrame.VertOrient = NONE oFrame.VertOrientRelation = PAGE_PRINT_AREA oFrame.HoriOrientRelation = PAGE_PRINT_AREA aLBorder.OuterLineWidth = 0 aRBorder.OuterLineWidth = 0 aTBorder.OuterLineWidth = 1 aTBorder.Color = rgb(254,254,254) aBBorder.OuterLineWidth = 1 aBBorder.Color = rgb(254,254,254) oFrame.LeftBorder = aLBorder oFrame.RightBorder = aRBorder oFrame.TopBorder = aTBorder oFrame.BottomBorder = aBBorder oframe.TopMargin = 200 'wrap aanzetten, anders wordt het automatisch 2mm oFrame.BottomMargin = 100 oFrame.LeftMargin = 0 oFrame.RightMargin = 0 oFrame.BottomBorderDistance = iif(oDialog.Model.OndBoven.State = 1 , 172, 0) oFrame.TopBorderDistance = iif(oDialog.Model.OndOnder.State = 1 , 172 , 0) 'oFrame.HoriOrient = com.sun.star.text.HoriOrientation.NONE 'oFrame.VertOrient = com.sun.star.text.VertOrientation.LINE_TOP oText.insertTextContent(oCursor(), oFrame, false) sOnderschrift = oTextModel.GetPropertyValue(Text) dim iStringhoogte as long iStringhoogte = Fix((Len(sOnderschrift)/67*9400/(iFotW-AflpR-AflpL))) +1 Dim IFramehoogte_alsboven as integer Dim iFramehoogte_alsonder as integer ' iFramehoogte_alsboven = (IStringhoogte *(-345)) - 172 - ' iFramehoogte_alsonder = iFoth oFrame.HoriOrientPosition = iHCpos + 900 'left Pagemargin Dim oFrameCursor As Object oFrameCursor = oFrame.createTextCursor() oFrameCursor.paraStyleName = 6_ondertitel oViewCursor.gotoRange(oFrameCursor,false) 'FrameCursor.paraAdjust = com.sun.star.style.ParagraphAdjust.CENTER 'Dim frameCPos as integer Dim FrameCpos as integer Dim FrameH as integer FrameCpos = oViewCursor.getPosition().Y 'print FrameCpos oFrameCursor.String = sOnderschrift 'oFrame.SizeType = 2 oViewCursor.gotoEnd(false) FrameH = oViewCursor.getPosition().Y - FrameCpos + 345 + 200 iFramehoogte_alsboven = (FrameH * (-1)) iFramehoogte_alsonder = iFoth oFrame.VertOrientPosition = iVCpos - AflpB + iif(oDialog.Model.OndBoven.State = 1 , iFramehoogte_alsboven , iFramehoogte_alsonder) + iif(oDialog.Model.viaCursor.State = 1 , 1080 , 1100) oFrame.Height = FrameH oFrame.SizeType = 1 ' oFrame.VertOrientPosition = iVCpos - AflpB + iif(oDialog.Model.OndBoven.State = 1 , iFramehoogte_alsboven , iFramehoogte_alsonder ) + iif(oDialog.Model.viaCursor.State = 1 , 1080 , 1100) 'oFrame.Name = Ond + _ + iPagenr + _ + iHCpos +_ + iVCpos + _ + (tot + 1) ' moet telkens uniek zijn oFrame.Name = Ond + _ + iPagenr + _ + oFrame.Zorder oViewCursor.gotoRange(oCursor,false) fernand Kent Gibson schreef: Is there any way I can ask a frame if any part of it is in the non - printable area? If any one has any ideas I would be very appreciative and I will be happy to submit a snippet for it. I am planning on submitting a couple of frame snippets already. Sorry for the deluge of questions. But this frame problem is turning out to be a real project killer. I am having a problem that I cannot get frames to break neatly at the page borders. I have tried frames in paragraph styles, frames in frames, tables in tables, frames in tables and frames in sections. All these ways have their different quirks but they leave something to be desired in the end effect. Furthermore I would like these frames to be inside of some container that shows borders (ie paragraphs or tables). The only way I think I can figure it out is if