Re: [api-dev] Remove rendered graphics from dialogs
Thomas Krumbein wrote: Hey, I am working on a project, in which I display embedded graphics of a writer-document in a dialog. With some help of this list (spezial thanks to Fernand ;-) ) I can now show the embedded graphics dirct on the dialog. I use for this the following code: REM URL des Bildes auslesen oBild = oDoc.getGraphicObjects().getByName(sName) sBildURL = Mid(oBild.GraphicURL, 28, len(oBild.GraphicURL)) REM Bild aus Datei als Objekt laden for i = 0 to uBound(aBildNamen()) if InStr(1, aBildNamen(i), sBildURL, 0) then oVorschauGrafik = getGraphFromStream(oPictures.getByName(aBildNamen(i)).getInputStream()) exit For end if next REM Porportionfaktor Laden nProp = oVorschauGrafik.sizepixel.width/oVorschauGrafik.sizepixel.height ' < 1 = Hochkant, >1 -Querformat, = 1 Quadrat ' oRenderer = createUnoService("com.sun.star.graphic.GraphicRendererVCL") Dim sRect as new com.sun.star.awt.Rectangle sRect.X = 335 sRect.Y = 40 sRect.Width = 150 sRect.Height = 150 if nProp < 1 then 'Hochkant sRect.Width = 150 * nProp sRect.X = 335 + (150 - sRect.Width)/2 elseif nProp > 1 then 'Querformat sRect.Height = 150 / nProp sRect.Y = 40 + (150 - sRect.Height)/2 end if oPaintListener = CreateUnoListener("MyDialog_", "com.sun.star.awt.XPaintListener") oDlg.Peer.addPaintListener( oPaintListener ) oRenderer.Device = oDlg.Peer.createGraphics.Device oRenderer.DestinationRect = sRect oRenderer.render(oVorschauGrafik) The renderer is defined in a seperat Part of the macro: oRenderer = createUnoService("com.sun.star.graphic.GraphicRendererVCL") The Problem is now, that I use the same part of the dialog to show selected graphics. That is no problem, when all graphics have the same size and do not have transparent Pixels. The renderer will change the used Pixels. But it is a problem, when I read a smaler graphic - or a transparent gif-graphic - then you will see the prior graphic on not used pixels of the rectangular area. So my question: How can I remove the rendered graphic from diolog? Or is there a posbility, to overwirte the whole area with the background-pixelcolour? /i struggeld also long time to solve this problem then a clever gui on the forum who learned us to use a peer dow to render a graphic, found also the solution: "invalidate" the window for "invalidating" there are several way's depending on what part of the window hes to been refresched .OO uses rheir famous constants for it (I uses "2" ) who works fine gives you dialog a unique name as "dialog1" and uses thisi code: oWin =GetWindowOpen("Dialog1") 'the titel of the dialog must be "Dialog1' oWin.invalidate(2) ' 2 works fine but there are other constants ans combinations posibla function GetWindowOpen(sTitle as String) as Object oToolkit = Stardesktop.ActiveFrame.ContainerWindow.Toolkit lCount = oToolkit.TopWindowCount ' xray otoolkit for k=0 to lCount -1 oWin = oToolkit.getTopWindow(k) if HasUnoInterfaces(oWin, "com.sun.star.awt.XDialog") then if left(oWin.Title, len(sTitle)) = sTitle then ' GetWindowOpen = oWin exit function endif endif next k end function hope it helps Fernand / " Thanks or your help Thomas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Remove rendered graphics from dialogs
Hey Fernand, Fernand Vanrie schrieb: [..] > /i struggeld also long time to solve this problem > then a clever gui on the forum who learned us to use a peer dow to > render a graphic, found also the solution: "invalidate" the window > for "invalidating" there are several way's depending on what part of the > window hes to been refresched .OO uses rheir famous constants for it (I > uses "2" ) who works fine > > gives you dialog a unique name as "dialog1" and uses thisi code: > > oWin =GetWindowOpen("Dialog1") 'the titel of the dialog must be > "Dialog1' > oWin.invalidate(2) ' 2 works fine but there are other constants ans > combinations posibla I try this - but nothig happend :-( Then I changed a little bit the constant "2" and when I use "1" it works fine :-) So thank you for this code, now my project works as expected. Now i try to learn, what "invalidate()" means and haw it works. Again - thank you for your help :-) regards Thomas -- ## Marketing deutschsprachiges Projekt ## http://de.openoffice.org - www.openoffice.org ## Vorstand OpenOffice.org Deutschland e.V. ## Mitglieder willkommen: www.OOoDeV.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] DCOM & OpenOffice.org
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] I initially thought that this looked like an UNO thing but the UDK people tell me that they think this is unlikely. So I guess it's something within OOo. I know the documentation for OpenOffice.org says that the identity of the service manager must be set to "Interactive User". However it doesn't explain why. The whole thing is a bit opaque and it's difficult to see exactly what's going wrong. If I knew why things were going wrong then I could probably configure this so that I didn't need the Interactive User. Any thoughts on what's going wrong? Best Wishes Jos -- jos vernon http://www.websupergoo.com/ .NET Image Components & Consultancy --
[api-dev] text table cells with multiple columns?
Hi, I am working with an XTextTable and I'm able to create all the cells individually. But I would like to do is to create cells that multiple column spans. Is this possible? I looked through as many mailings as I could but could not find an answer. Here is my code snippet. //getting the text object XText xText = myDoc.getText(); //create a cursor object XTextCursor xTCursor = xText.createTextCursor(); //getting MSF of the document XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, myDoc); //create instance of a text table XTextTable xTT = null; try { Object oInt = xDocMSF.createInstance("com.sun.star.text.TextTable"); xTT = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oInt); } catch (Exception e) { System.err.println("Couldn't create instance " + e); e.printStackTrace(System.err); } //initialize the text table with 2 rows x 9 columns xTT.initialize(2, 9); XPropertySet xTTRowPS = null; //insert the table try { xText.insertTextContent(xTCursor, xTT, false); // get first Row com.sun.star.container.XIndexAccess xTTRows = xTT.getRows(); xTTRowPS = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTTRows.getByIndex(0)); } catch (Exception e) { System.err.println("Couldn't insert the table " + e); e.printStackTrace(System.err); } // write Text in the Table headers System.out.println("Write text in the table headers"); insertIntoCell("A1", "Org / Reviewer", xTT); insertIntoCell("B1", "Page #", xTT); ** public static void insertIntoCell(String CellName, String theText, XTextTable xTTbl) { XText xTableText = (XText) UnoRuntime.queryInterface(XText.class, xTTbl.getCellByName(CellName)); //create a cursor object com.sun.star.text.XTextCursor xTC = xTableText.createTextCursor(); com.sun.star.beans.XPropertySet xTPS = (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xTC); try { xTPS.setPropertyValue("CharHeight", new Float(8)); } catch (Exception e) { System.err.println(" Exception " + e); e.printStackTrace(System.err); } //inserting some Text xTableText.setString(theText); } ___ Anh-Tuan Le FCI 703.961.1818 x162
Re: [api-dev] text table cells with multiple columns?
Anh-Tuan Le wrote: Hi, I am working with an XTextTable and I'm able to create all the cells individually. But I would like to do is to create cells that multiple column spans. Is this possible? I looked through as many mailings as I could but could not find an answer. Hi, what you need is a com::sun::star::text::XTextTableCursor. see http://api.openoffice.org/docs/common/ref/com/sun/star/text/XTextTableCursor.html Regards, Oliver - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [api-dev] text table cells with multiple columns?
Thanks Oliver, that's EXACTLY what I needed. And my code snippet in case anyone needs to see it. insertIntoCell("A1", "Org / Reviewer", xTT); insertIntoCell("B1", "Page #", xTT); XTextTableCursor xTTC = xTT.createCursorByCellName("B1"); xTTC.gotoCellByName("F1", true); boolean merge = xTTC.mergeRange(); if (merge) { System.out.println("Merge successful"); } else { System.out.println("Merge UNsuccessful"); } ___ Anh-Tuan Le FCI 703.961.1818 x162 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, April 16, 2007 2:14 PM To: dev@api.openoffice.org Subject: Re: [api-dev] text table cells with multiple columns? Anh-Tuan Le wrote: > Hi, I am working with an XTextTable and I'm able to create all the cells > individually. But I would like to do is to create cells that multiple > column spans. Is this possible? I looked through as many mailings as I > could but could not find an answer. > > Hi, what you need is a com::sun::star::text::XTextTableCursor. see http://api.openoffice.org/docs/common/ref/com/sun/star/text/XTextTableCursor .html Regards, Oliver - 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]
[api-dev] Quotes in strings (OpenOffice.org Basic)
Hi! I can't figure out how to sent a quote character (") to a function. '"' doesn't work and things like "\"" doesn't work either, and of course """ also will fail. I know I can do Chr(34), but I don't want to use that option. Is there a way, except Chr(34), to insert a quote to a string? My example looks like this: Sub MySub Dim A As String, B As String A="Hello World" B=MyFunction(A,"/") REM This works, but I don't want to send a "/", I want to send a quote. How can I do that without using Chr(34)? End Sub Function MyFunction(Parameter1 As String, Parameter2 As String) As String REMA lot is going on here, it doesn't matter what End Function I was rather surprised that '"' (single quote+quote+single quote) didn't work, isn't it supposed to? Johnny Andersson
Re: [api-dev] Quotes in strings (OpenOffice.org Basic)
Alle 23:21, lunedì 16 aprile 2007, Johnny Andersson ha scritto: > Hi! > > I can't figure out how to sent a quote character (") to a function. > '"' doesn't work and things like "\"" doesn't work either, and of course > """ also will fail. You can use double quoting inside a string in this way: print "this is ""a"" string" print ciao Paolo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] Quotes in strings (OpenOffice.org Basic)
Thanks! It worked! Well, I guess you already knew it would. Johnny Andersson 2007/4/16, Paolo Mantovani <[EMAIL PROTECTED]>: Alle 23:21, lunedì 16 aprile 2007, Johnny Andersson ha scritto: > Hi! > > I can't figure out how to sent a quote character (") to a function. > '"' doesn't work and things like "\"" doesn't work either, and of course > """ also will fail. You can use double quoting inside a string in this way: print "this is ""a"" string" print ciao Paolo - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[api-dev] Replaceing selected text with Basic Macro
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. 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: "Here is a sentence that will *illustrate* my example." I hope you can see that one word ("illustrate") in the sentence above is underlined. That is supposed to illustrate that it is highlighted. Ok, now I run my macro (this is a fake example, my macro does something else) and now it looks like this: "Here is a sentence that will show my example." As you hopefully can see, nothing is now underlined, however the cursor is placed right after the word "show". What I want, is that the word "shows" in this case should be highlighted after the macro was run: "Here is a sentence that will *show* my example." This would make it possible to run the macro once again and get the following result (still a fake example): "Here is a sentence that will *help you to understand* my example." And so on... Thanks in advance Johnny Andersson
Re: [api-dev] Replaceing selected text with Basic Macro
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 > 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 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] protecting drawpages
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? > > -- Christian Andersson - [EMAIL PROTECTED] Configuration and Collaboration for OpenOffice.org Open Framework Systems AS http://www.ofs.no - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [api-dev] DCOM & OpenOffice.org
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? Ciao, Mathias -- Mathias Bauer (mba) - Project Lead OpenOffice.org Writer OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS Please don't reply to "[EMAIL PROTECTED]". I use it for the OOo lists and only rarely read other mails sent to it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]