Re: [api-dev] protecting drawpages
On Tue, 17 Apr 2007 00:35:22 -0500, Christian Andersson [EMAIL PROTECTED] wrote: anyone? Christian Andersson skrev: In Calc I can protect sheets In Writer I can protect sections but is it possible to protect pages/slides in draw or impress? I have not found anything regarding this in the gui, but do something exist in the api for this? You can protect layers. Not sure how to do thatprograming wise. To protect go to Insert Layer Protect -- Alexandro Colorado OpenOffice.org Community Contact // Mexico http://www.openoffice.org Twitter: http://www.twitter.com/jza Jabber: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] DCOM OpenOffice.org
Mathias Bauer wrote: JV wrote: Hi I'm trying to get OpenOffice.org to run under COM/DCOM for use on an unattended server. To do this I create a Component Package under COM+. It works fine. However if I change the user from the Interactive User (me) to a named user (also me) then I start getting errors when I try to create an instance of the Service Manager. Retrieving the COM class factory for component with CLSID {82154420-0FBF-11D4-8313-005004526AB4} failed due to the following error: 80080005. [Server execution failed] This looks as if your OOo instance is not able to start at all. Can you try to start OOo directly (with the same user!) with the Windows API to start a process? I am not clear if you use OOo via DCOM from a different machine. Then you would need to have the corresponding registry entries also on your client machine. Joachim Ciao, Mathias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] DCOM OpenOffice.org
Joachim I'm trying to get OpenOffice.org to run under COM/DCOM for use on an unattended server. To do this I create a Component Package under COM+. It works fine. However if I change the user from the Interactive User (me) to a named user (also me) then I start getting errors when I try to create an instance of the Service Manager. Retrieving the COM class factory for component with CLSID {82154420-0FBF-11D4-8313-005004526AB4} failed due to the following error: 80080005. [Server execution failed] This looks as if your OOo instance is not able to start at all. Can you try to start OOo directly (with the same user!) with the Windows API to start a process? I am not clear if you use OOo via DCOM from a different machine. Then you would need to have the corresponding registry entries also on your client machine. This is all on the same machine. The only difference between the working and non-working scenario is... When the package is set to the Interactive User (me) it works. However when it's specified as a named user (me) it doesn't. Best Wishes Jos -- jos vernon http://www.websupergoo.com/ .NET Image Components Consultancy -- - Original Message - From: Joachim Lingner [EMAIL PROTECTED] Newsgroups: openoffice.api.dev To: dev@api.openoffice.org; dev@api.openoffice.org Sent: Tuesday, April 17, 2007 3:34 PM Subject: Re: [api-dev] DCOM OpenOffice.org Mathias Bauer wrote: JV wrote: Hi Joachim Ciao, Mathias - 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] Replaceing selected text with Basic Macro
2007/4/17, Paolo Mantovani [EMAIL PROTECTED]: Alle 00:31, martedì 17 aprile 2007, Johnny Andersson ha scritto: I have a small problem that I just can't figure out at these late hours (00:13 right now): I have written a macro that reads highlighted text and replaces it with something else (which is calculated by the macro). To read the highlighted text I use ThisComponent.getCurrentSelection ().getByIndex(0).getString(). This caused me no problems, however I couldn't figure out the parameter in getByIndex(0). Why 0? What does it mean? 0 what? I tried 1 and 2 but they only caused errors. Because the getCurrentSelection() method in writer normally gets a com.sun.star.text.TextRanges (that is a container) In general it contains at least one TextRange, but in case of multiple selection it contains more elements. Use the getCount() method to discover how many TextRanges are actually selected Oh, I see. I didn't realize that it was possible to have more than one selection in Writer (I knew it's possible in Calc though), but a quick test with the Ctrl key certainly proves to me that it's possible. Yes, maybe I should include that possibility in my macro, so not only the first (or rather 0th...) selection is handled. Ok, I guess I can figure that one out myself with some help from Google, so here is my real question: When I replace the highlighted text, I do that with ThisComponent.getCurrentSelection().getByIndex(0).setString(MyString). The problem is that I want the new inserted string also to be highlighted, so I can perform the macro on it without having to highlight it manually. Any ideas? Is there some better way to do this? Just an example to illustrate what I mean: [] Hoping that I have correctly understood your example, the following code should do (more or less) what you need. Check the Andrew Pitonyak's macro document for better techniques and examples ---8--- REM * BASIC * Sub Main oRange = ThisComponent.currentselection(0) oText = oRange.getText() oCursor = oText.createTextCursorByRange(oRange) bAbsorb = True oText.insertString( oRange, new string, bAbsorb) 'restore selection ThisComponent.CurrentController.select(oRange) End Sub ---8--- ciao Paolo M I haven't tried your suggestion yet, but I will as soon as possible. Just one follow-up-question, if you don't mind: The objects we are talking about here, ThisComponent and its sub objects (or whatever I should call them), contain other objects, variables and methods etc, right? Many years ago when I studied some C++ (which I never used since then, sorry...) I was told that when created classes, it was a good idea to keep variables private and do most things with them through public local methods. To me it felt like the proper thing to do is to always use local methods for everything, when it comes to changing values and contents of things. In your example you go for an object directly: ThisComponent.CurrentSelection(0). In my example I do like this to obtain the same (?) thing: ThisComponent.getCurrentSelection().getByIndex(0) My thought was something like since there is a method, it is probably supposed to be used. On the other hand, if ThisComponent.CurrentSelection(0) is possible to do, that object is obviously not private, so I should feel free to use it. Which is the proper way to do things? Is the rule that if a variable or an object is private, use their methods, otherwise manipulate them directly? Or is it always use the method designed for what you want to do with the variable/object? Or is it something else? Johnny Andersson
Re: [api-dev] Replaceing selected text with Basic Macro
I was playing around a bit with the ThisComponent.CurrentSelection.getCount() function and I found that when I had one selection, ThisComponent.CurrentSelection.getCount() returned 1, but when I had more than one selection (and I am still talking about Writer), ThisComponent.CurrentSelection.getCount() returned the number of selections + 1 for some reason. In the same case, ThisComponent.CurrentSelection(0).getText() returns an empty string. ThisComponent.CurrentSelection(1).getText() and ThisComponent.CurrentSelection(2).getText() contains what's selected, however. Is this what always happens or did I do something wrong? I tried it a few times only. Do I have to check for this or can I just assume that if ThisComponent.CurrentSelection.getCount() 1 then ThisComponent.CurrentSelection(0).getText() is always empty? Johnny Andersson
Re: [api-dev] Replaceing selected text with Basic Macro
I am sorry to bother again. Actually, i made the whole thing to work properly now. However i ran into a new problem: I modified the macro to make it possible to handle several selections. The problem is, that when i restore the selection, ThisComponent.CurrentController.select(oRange) in your example, I can only restore one selection. I have tried for some hours now to make it possible to restore a multi-selection, but I failed constantly. Let's say that I highlight three parts in a text, by clicking and dragging while the Ctrl key is held. Then the macro can handle each one of them, that's no problem. I get my text replaced and everything is OK, until the end of the macro. So what do I want to happen at the end? Well, I want to restore the selections. Not just one of them, ALL of them. Just to make it possible to run the same macro again on the same selections. I use some global variables to record what the macro did last time, and next time I run it I want it to do something else to the same text. Well, if you really want to know, I am trying to make my own Uppercase-Lowercase conversion, to use instead of the built in Change Case function. I am also doing it to learn about macros. So I assigned the macro to Shift+F3. My thought is that first time I hit Shift+F3, all selected characters are converted to Uppercase. Second time the macro is run, it will convert to lowercase (if the selection didn't change since last time). Third time, it will convert to Sentence case (first letter after . (point + space) and after : will be Uppercase, other characters won't change). Fourth time, it's Title Case. Fifth time it toggles from the ORIGINAL case (which therefore has to be remembered the first time the macro runs on a specific selection/multi selection). Sixth time it toggles back again to its original state. Seventh time is the same as first time and so on. So, that's why the multi selection needs to stay there after the macro finished. At the moment I just can not figure out (maybe because I am really stupid) how to do this. Everything else is working and it works as long as I don't do multi selections. Johnny Andersson
[api-dev] sub document insertion bug
Hello, I want to insert (at specific bookmark location) several generated sub documents, into a global document. For the first subdocument, all is ok, but for all others ... it insert the first ! I think the XTransferable is not up to date, so how can I refresh the XTransferable ? I write the following java code : public static final void insertSubDocument(XComponent xComponent_sourceDoc, XComponent xComponent_targetDoc, XNameAccess xNamedBookmarks, String bookmarkName) throws UnsupportedFlavorException { XTextDocument xTextDocument_sourceDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent_sourceDoc); XTextDocument xTextDocument_targetDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent_targetDoc); System.out.println(xTextDocument_sourceDoc.getText().getString()); //all sub doc are ok here // the controllers XController xController_sourceDoc = xTextDocument_sourceDoc.getCurrentController(); XController xController_targetDoc = xTextDocument_targetDoc.getCurrentController(); // the cursor for the source document XTextViewCursorSupplier xViewCursorSupplier_sourceDoc = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController_sourceDoc); // selecting the whole source document XTextViewCursor xTextViewCursor_sourceDoc = xViewCursorSupplier_sourceDoc.getViewCursor(); xTextViewCursor_sourceDoc.gotoEnd(true); // getting the data supplier of our source doc XTransferableSupplier xTransferableSupplier_sourceDoc = (XTransferableSupplier) UnoRuntime.queryInterface(XTransferableSupplier.class, xController_sourceDoc); // saving the selected contents XTransferable xTransferable = xTransferableSupplier_sourceDoc.getTransferable(); // getting the data supplier of our target doc XTransferableSupplier xTransferableSupplier_targetDoc = (XTransferableSupplier) UnoRuntime.queryInterface(XTransferableSupplier.class, xController_targetDoc); // the cursor for the target document XTextViewCursorSupplier xViewCursorSupplier_targetDoc = (XTextViewCursorSupplier) UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController_targetDoc); // going to the end of the source document try { // find the bookmark named bookmarkName Object bookmark = xNamedBookmarks.getByName(bookmarkName); // we need its XTextRange which is available from getAnchor(), // so query for XTextContent XTextContent xBookmarkContent = (XTextContent) UnoRuntime.queryInterface(XTextContent.class, bookmark); // get the anchor of the bookmark (its XTextRange) XTextRange xBookmarkRange = xBookmarkContent.getAnchor(); XTextViewCursor xTextViewCursor_targetDoc = xViewCursorSupplier_targetDoc.getViewCursor(); xTextViewCursor_targetDoc.gotoRange(xBookmarkRange, false); // inserting the source document there xTransferableSupplier_targetDoc.insertTransferable(xTransferable); } catch (NoSuchElementException e) { // nothing } catch (WrappedTargetException e) { // nothing } } -- View this message in context: http://www.nabble.com/sub-document-insertion-bug-tf3591129.html#a10036493 Sent from the openoffice - api dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Replaceing selected text with Basic Macro
Am 17.04.2007 11:45 schrieb Johnny Andersson: Is this what always happens or did I do something wrong? I think no (twice). I filed a issue: http://api.openoffice.org/issues/show_bug.cgi?id=76449 Greetings MRoe -- ·-· cut here ·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-·-8·-· - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Replaceing selected text with Basic Macro
Mathias Röllig wrote: Am 17.04.2007 11:45 schrieb Johnny Andersson: Is this what always happens or did I do something wrong? I think no (twice). I filed a issue: http://api.openoffice.org/issues/show_bug.cgi?id=76449 Greetings MRoe I replied to the issue, but I would have said that it was not a bug. I provided code to demonstrate what is really happening here. It may be a bug, but it has been this way since version 1.0. -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt My Book: http://www.hentzenwerke.com/catalog/oome.htm Info: http://www.pitonyak.org/oo.php See Also: http://documentation.openoffice.org/HOW_TO/index.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] [EMAIL PROTECTED] GUIDE: important things to know about this mailing list
Dear OpenOffice.org community, This is the monthly reminder of important things to know about the dev@api.openoffice.org mailing list. We, the project leads of the OOo API project, would like to give you some general information to help you with your questions. *** *** Contents *** 1. Appropriate Mailing List 2. SDK + Developers Guide 3. Form of your Messages 4. Support Questions 5. Reporting Defects 6. Newsletter *** *** 1. Appropriate Mailing List *** Not all questions are really API issues. Please find the most appropriate mailing list for your question. You can find the mailing lists on the OOo project pages. A list of OOo project you can find on http://projects.openoffice.org. Especially these: http://udk.openoffice.org for questions about UNO bridges and language bindings including StarBASIC/OOoBASIC http://framework.openoffice.org/scripting/ for questions about the upcoming scripting framework http://xml.openoffice.org for questions regarding our XML file formats *** *** 2. SDK + Developers Guide *** Please install the SDK from the OOo download area and read at least the chapters First Steps and the chapter your question is about of the Developers Guide. This is a list of volunteers, not a support forum. We like to help you, but we cannot do the footwork for you. An online version of the Developers Guide can be found here: http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html *** *** 3. Form of your Messages *** Please use an appropriate form for your messages: - quote as much as is necessary to make context understandable, NOT more - do NOT put a full quote below your message - do NOT use HTML mails - do NOT attach documents - do NOT ask NEW questions in reply to existing threads By breaking these rules, do not wonder if your question remains unanswerd, most likely even unseen due to mail filters. If you have additional data, like a document or a longer source code, please provide us a link where we can download these. You might upload such documents to the file area: http://api.openoffice.org/servlets/ProjectDownloadList As far as I know, everybody can do that, you might need an OpenOffice.org account. As the responsible project lead, I just have to approve the files to get published. But keep in mind: the more a volunteer has to read to grab your question, the lesser the chance for an answer. *** *** 4. Support Questions *** Please keep in mind that we developers cannot always answer specific questions or even implement features for your application. This is NOT a support forum in the sense of guaranteed help. If we have a solution in mind, we will help you. But if it costs us too much time, and it is a specific problem, we might not be able to spend the time on your issue. On the other hand, we try to answer all questions. And we need the support of other community members. But even as somebody who has only questions yet, you can already contribute to OOo: If you had a question and it was answered to your satisfaction it would be great if you post a summary in our standardized form: http://api.openoffice.org/SDK/snippets/index.html This avoids using up the time of the volunteers to answer the same questions over and over again. Thanks for your contribution! If your question is related to your application code, please include a minimalistic version of your source code with your question. And please add all important information. This includes mostly the concrete component which you are using, the platform, version of OOo and OOo SDK your programming language. There might be a big difference, if your problem is with a Text object in OOo/Writer or a Text object in a OOo/Draw shape. But keep your information as short as possible. Do not post complete programs! The better you cut it down, to the issue, the higher the chance for an volunteer who picks your question up and answers. IMPORTANT: Please avoid sending mails personally to the project leads, unless you are explicitely asked to do so. We do not offer direct support by personal email. *** *** 5. Reporting Defects *** If you are