[api-dev] OOoBean in C++

2007-03-14 Thread Harald Weyhing

Hi all,

I wonder if someone has tried or succeeded in implementing an OOoBean in 
C++.


Any comments or suggestions would be greatly appreciated

Thank you
Cheers Harald





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[api-dev] StarBasic - what to recommen and what to avoid?

2007-03-14 Thread Johnny Andersson

I have a question about what is recommended to do and to avoid when writing
macros with StarBasic.

I think that one very convenient thing to do, is to create structs (as
they are called in C/C++), such as this one mentioned in another thread a
while ago:

Type PersonType
FirstName As String
LastName As String
End Type

Let's say that we created a rather complex struct with hundreds of variables
and other structs, like this:

Type PersonType
FirstName As String
LastName As String
Status As MyStruct
.
.
.
End Type

Type MyStruct
Test1 As Integer
Test2 As Double
Blah As MyOtherStruct
.
.
.
End Type

Type MyOtherStruct
.
.
.
End Type

.
.
.

(The dots means and so on…)

So, now we want to do stuff. We will create a function that needs, say two
string variables. The function is only going to be used for this project, so
we don't need to make it general.

So here are two options that I could think of:


1:

Sub Main
Dim A As MyStruct
Sim B As Integer

A.FirstName=Johnny
A.LastName=Andersson
.
.
.
B=MyFunction(A.FirstName, A.LastName)
.
.
.
End Sub

Function MyFunction(A As String, B As String) As Integer
Dim C As Integer
.
.
.
'A and B are used to calculate C in some way, how is not important, it's
just an example.
.
.
.
MyFunction=C
End Function

2:

Sub Main
Dim A As MyStruct
Sim B As Integer

A.FirstName=Johnny
A.LastName=Andersson
.
.
.
B=MyFunction(A)
.
.
.
End Sub

Function MyFunction(A As MyStruct) As Integer
Dim C As Integer
.
.
.
'A.FirstName and A.LastName are used to calculate C in some way. No other
variables of A are used.
.
.
.
MyFunction=C
End Function

One of the advantages with option 2, is that I don't need to include a lot
of parameters when I call the function. In this example it was not that big
difference, but sometimes I need maybe 5 or 10 parameters.

On the other hand, and this is my question: Isn't option 2 more time
consuming? I am not sure how this works, but if the whole structure is
copied every time the function is called, I guess it will run slower. So how
does it work? Are all the variables copied to the function or is that
handled by a reference or something like that?

Should option 2 be avoided for extremely complex structures? Or should
option 1 be avoided?

Can you see more (and better) options for this kind of problem?

A bonus question: Is there anything like the C++ class in StarBasic? I
think VB use classes too… It feels like objects works like classes. They
have their own methods to handle their own variables, just like C++ classes,
but can I create my own?

Johnny Andersson


[api-dev] ImageURL in a UnoControlImageControlModel

2007-03-14 Thread Fernand Vanrie

Need to show Embeded Images in a UnoControlImageControlModel.

Giving a normal URL  to the ImageURL property works  fine,  but 
Internal URL's (from embedded Images) do not works


Is there a workaround ?

Can a internal URL been transformed to a normal URL ?

Tryed to use the Graphic-object of the Imagecontrol, but no luck, btw 
wathts te purpouse of the Graphic-propterty ?


Thanks for any hint


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [api-dev] StarBasic - what to recommen and what to avoid?

2007-03-14 Thread Andrew Douglas Pitonyak
Your structs should pass by reference unless you purposely pass them by 
value.


see http://www.pitonyak.org/oooconf/OOoConf_2004_Macro_Presentation.sxi

so, passing these should not be a performance issue. Much will be 
determined by how many times things are called as to what you should 
really do.


You can create your own services, but I assume that you would want to 
implement these in C++ or Java, not Basic.


Johnny Andersson wrote:
I have a question about what is recommended to do and to avoid when 
writing

macros with StarBasic.

I think that one very convenient thing to do, is to create structs (as
they are called in C/C++), such as this one mentioned in another thread a
while ago:

Type PersonType
FirstName As String
LastName As String
End Type

Let's say that we created a rather complex struct with hundreds of 
variables

and other structs, like this:

Type PersonType
FirstName As String
LastName As String
Status As MyStruct
.
.
.
End Type

Type MyStruct
Test1 As Integer
Test2 As Double
Blah As MyOtherStruct
.
.
.
End Type

Type MyOtherStruct
.
.
.
End Type

.
.
.

(The dots means and so on…)

So, now we want to do stuff. We will create a function that needs, say 
two
string variables. The function is only going to be used for this 
project, so

we don't need to make it general.

So here are two options that I could think of:


1:

Sub Main
Dim A As MyStruct
Sim B As Integer

A.FirstName=Johnny
A.LastName=Andersson
.
.
.
B=MyFunction(A.FirstName, A.LastName)
.
.
.
End Sub

Function MyFunction(A As String, B As String) As Integer
Dim C As Integer
.
.
.
'A and B are used to calculate C in some way, how is not important, it's
just an example.
.
.
.
MyFunction=C
End Function

2:

Sub Main
Dim A As MyStruct
Sim B As Integer

A.FirstName=Johnny
A.LastName=Andersson
.
.
.
B=MyFunction(A)
.
.
.
End Sub

Function MyFunction(A As MyStruct) As Integer
Dim C As Integer
.
.
.
'A.FirstName and A.LastName are used to calculate C in some way. No other
variables of A are used.
.
.
.
MyFunction=C
End Function

One of the advantages with option 2, is that I don't need to include a 
lot
of parameters when I call the function. In this example it was not 
that big

difference, but sometimes I need maybe 5 or 10 parameters.

On the other hand, and this is my question: Isn't option 2 more time
consuming? I am not sure how this works, but if the whole structure is
copied every time the function is called, I guess it will run slower. 
So how

does it work? Are all the variables copied to the function or is that
handled by a reference or something like that?

Should option 2 be avoided for extremely complex structures? Or should
option 1 be avoided?

Can you see more (and better) options for this kind of problem?

A bonus question: Is there anything like the C++ class in StarBasic? I
think VB use classes too… It feels like objects works like classes. They
have their own methods to handle their own variables, just like C++ 
classes,

but can I create my own?

Johnny Andersson


--
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]



Re: [api-dev] ImageURL in a UnoControlImageControlModel

2007-03-14 Thread Andrew Douglas Pitonyak

Fernand Vanrie wrote:

Need to show Embeded Images in a UnoControlImageControlModel.

Giving a normal URL  to the ImageURL property works  fine,  but 
Internal URL's (from embedded Images) do not works


Is there a workaround ?

Can a internal URL been transformed to a normal URL ?

Tryed to use the Graphic-object of the Imagecontrol, but no luck, btw 
wathts te purpouse of the Graphic-propterty ?


Thanks for any hint
i think that internal URLs for graphics start with 


vnd.sun.star.GraphiObject:, which is probably only useful as trivia...


Take a look at section 5.9.1  Convert a linked graphic to an embedded 
graphic. in my free macro document, there is some application that might 
provide a hint using the bitmap.



--
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]