[api-dev] Strange thing with formulas in Calc?

2006-06-22 Thread Johnny Andersson
Here are two lines from a macro I wrote to remove ' from cells in cell  
ranges, for example if a cell formula is '20 my macro will convert it to  
20.


Selection=ThisComponent.CurrentSelection
Data=Selection.getFormulaArray

I tested the macro and all seemed to work perfectly until I tried it on a  
spreadsheet with floating points. The points is actually a comma, since  
that is Swedish standard.


So I look at a cell, which contains '0,06253
Of course 0,06253 is shown in the cell. The ' can only be seen in the cell  
formula field.


However, in my macro, getFormulaArray seems to return 0,06253 in this  
example and it seems like as soon there is a comma involved, the ' can not  
be detected with getFormulaArray.


Any suggestions for solutions for this problem?

I am going to experiment with it myself, but I thought that if someone  
already know the answer, I don't have to invent the wheel again.


Thanks!
--
Johnny

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



Re: [api-dev] Current Sheet

2006-06-22 Thread Johnny Andersson

Thanks!

Actually I found another solution, since I noticed that I didn't get any  
messages from this mailing list for at least 24 hours, so I figured that  
some server somewhere was down or something, but only a few hours ago I  
suddenly was able to download all messages.


Maybe your solution is better than mine, at least it was shorter. I did  
like this:


SheetName=ThisComponent.CurrentSelection.Spreadsheet.getSpreadsheet.getName
Sheet=ThisComponent.Sheets.getByName(SheetName)

Somewhat more text, but it worked... =)

But thanks again, your solution is better in many ways, so I just copied  
it into my macro. Hope you don't mind... =)



Johnny



Den 2006-06-22 19:46:59 skrev Oliver Brinzing <[EMAIL PROTECTED]>:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Johnny,

try

ThisComponent.getCurrentController().getActiveSheet()


Oliver

- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEmteTTiyrQM/QSkURAvO7AJ9RYyCjF9QTs+dxjt4FPGwx8uhdSwCfUpwm
hL7v0fKhNnvXI3ZTVFn1EtU=
=JS+4
-END PGP SIGNATURE-


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



Re: [api-dev] Current Sheet

2006-06-22 Thread Oliver Brinzing
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Johnny,

try

ThisComponent.getCurrentController().getActiveSheet()


Oliver

- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C AB40 CFD0 4A45
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEmteTTiyrQM/QSkURAvO7AJ9RYyCjF9QTs+dxjt4FPGwx8uhdSwCfUpwm
hL7v0fKhNnvXI3ZTVFn1EtU=
=JS+4
-END PGP SIGNATURE-

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



[api-dev] How to create/get an object with the XCommandEnvironment interface?

2006-06-22 Thread Rony G. Flatscher

Hi there,

finally, I would like to use the PackageManager from a script from a 
commandline.


Some methods of "com.sun.star.deployment.XPackageManager" require a 
"com.sun.star.ucb.XCommandEnvironment" as an argument. E.g. 
"addPackage(string, string, XAbortChannel, XCommandEnvironment)", 
"removePackage(string, XAbortChannel, XCommandEnvironment)", 
"getDeployedPackages(XAbortChannel, XCommandEnvironment)".


Looking through the docs (dev-guide) and googling on the Internet does 
not reveal, how one would be able to get to an object containing the  
XCommandEnvironment interface. Also, the OOo WWW site is down for two 
days :( so I am not able to research there.


Is there anyone who has an idea/hint or even code (snippets) ?

TIA,

---rony






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



Re: [api-dev] Restarting a frozen OOo

2006-06-22 Thread Tobias Krais
Hi Kay,

> If you are on Linux, and the office deadlocks, just try
> 
>   # to get your process id
>   ps -e | grep soffice.bin
>   # to attach to the deadlocked process
>   gdb -p 
> 
>   # let gdb list you the threads
>   (gdb) info threads
>   6 Thread -1503736912 (LWP 14887)  0xe410 in __kernel_vsyscall ()
>   5 Thread -1538745424 (LWP 14890)  0xe410 in __kernel_vsyscall ()
>   4 Thread -1547273296 (LWP 14891)  0xe410 in __kernel_vsyscall ()
>   3 Thread -1557767248 (LWP 14892)  0xe410 in __kernel_vsyscall ()
>   
> 
>   # switch to every thread and get a stack trace
>   (gdb) t 6
>   [Switching to thread 6 (Thread -1503736912 (LWP 14887)) ...
>   (gdb) bt
>   #0  0xe410 in __kernel_vsyscall ()
>   #1  0xa7030fec in pthread_cond_timedwait@@GLIBC_2.3.2 () ...
>   #2  0xa703145d in [EMAIL PROTECTED] () from ...
>   

just now my OOo had a dealock again. And I followed your advice. Here is
the comandline output:
-%<-
[126] [EMAIL PROTECTED]> soffice
-env:UNO_JAVA_JFW_JREHOME=file:///usr/lib/jvm/java-1.5.0-sun-1.5.0.06/
-env:UNO_JAVA_JFW_CLASSPATH=/usr/lib/openoffice/program/classes/jurt.jar;/usr/lib/openoffice/program/classes/ridl.jar;/usr/lib/openoffice/program/classes/java_uno.jar;/usr/lib/openoffice/program/classes/juh.jar;/usr/lib/openoffice/program/classes/jut.jar;/usr/lib/openoffice/program/classes/unoidl.jar
Xlib: unexpected async reply (sequence 0x1e3a)!
-%<-

and here the gdb output. Do you need more?

Greetings, Tobias
-%<-
(gdb) info threads
  6 Thread -1524790352 (LWP 20208)  0xa7232de2 in
pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
  5 Thread -1533383760 (LWP 20209)  0xa723560e in accept ()
   from /lib/tls/libpthread.so.0
  4 Thread -1546462288 (LWP 20213)  0xa6fdc819 in poll ()
   from /lib/tls/libc.so.6
  3 Thread -1573172304 (LWP 20233)  0xa6fdc819 in poll ()
   from /lib/tls/libc.so.6
  2 Thread -1564783696 (LWP 20246)  0xa7235199 in __lll_mutex_lock_wait ()
   from /lib/tls/libpthread.so.0
  1 Thread -1508009760 (LWP 20207)  0xa6fdc819 in poll ()
   from /lib/tls/libc.so.6
(gdb) t 6
[Switching to thread 6 (Thread -1524790352 (LWP 20208))]#0  0xa7232de2
in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
(gdb) bt
#0  0xa7232de2 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
   from /lib/tls/libpthread.so.0
#1  0xa750b066 in osl_waitCondition ()
   from /usr/lib/openoffice/program/libuno_sal.so.3
#2  0xa77390d1 in vos::OCondition::wait ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#3  0xa773e832 in vos::OTimerManager::run ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#4  0xa773ccf9 in vos::_cpp_OThread_WorkerFunction ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#5  0xa773cd27 in _OThread_WorkerFunction ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#6  0xa750dec0 in osl_yieldThread ()
   from /usr/lib/openoffice/program/libuno_sal.so.3
#7  0xa7230ced in start_thread () from /lib/tls/libpthread.so.0
#8  0xa6fe6dee in clone () from /lib/tls/libc.so.6
(gdb) t 5
[Switching to thread 5 (Thread -1533383760 (LWP 20209))]#0  0xa723560e
in accept () from /lib/tls/libpthread.so.0
(gdb) bt
#0  0xa723560e in accept () from /lib/tls/libpthread.so.0
#1  0xa7514e12 in osl_acceptPipe ()
   from /usr/lib/openoffice/program/libuno_sal.so.3
#2  0xa774153d in vos::OPipe::accept ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#3  0x08071f57 in desktop::OfficeIPCThread::run ()
#4  0xa773ccf9 in vos::_cpp_OThread_WorkerFunction ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#5  0xa773cd27 in _OThread_WorkerFunction ()
   from /usr/lib/openoffice/program/libvos3gcc3.so
#6  0xa750dec0 in osl_yieldThread ()
   from /usr/lib/openoffice/program/libuno_sal.so.3
#7  0xa7230ced in start_thread () from /lib/tls/libpthread.so.0
#8  0xa6fe6dee in clone () from /lib/tls/libc.so.6
(gdb) t 4
[Switching to thread 4 (Thread -1546462288 (LWP 20213))]#0  0xa6fdc819
in poll
() from /lib/tls/libc.so.6
(gdb) bt
#0  0xa6fdc819 in poll () from /lib/tls/libc.so.6
#1  0xa418d9f0 in SessionManagerClient::getSessionID ()
   from /usr/lib/openoffice/program/libvclplug_gen680li.so
#2  0xa3ea5d90 in ?? ()
#3  0x0002 in ?? ()
#4  0x in ?? ()
#5  0xa3ea5d90 in ?? ()
#6  0xa3eaefe0 in ?? ()
#7  0x0010 in ?? ()
#8  0x0010 in ?? ()
#9  0x0001 in ?? ()
#10 0x0001 in ?? ()
#11 0xa750de9d in osl_yieldThread ()
   from /usr/lib/openoffice/program/libuno_sal.so.3
#12 0xa750dec0 in osl_yieldThread ()
   from /usr/lib/openoffice/program/libuno_sal.so.3
#13 0xa7230ced in start_thread () from /lib/tls/libpthread.so.0
#14 0xa6fe6dee in clone () from /lib/tls/libc.so.6
(gdb) t 3
[Switching to thread 3 (Thread -1573172304 (LWP 20233))]#0  0xa6fdc819
in poll
() from /lib/tls/libc.so.6
(gdb) bt
#0  0xa6fdc819 in poll () from /lib/tls/libc.so.6
#1  0xa18af89e in ?? () from
/usr/lib/openoffice/program/libdtransX11680li.so
#2  0xa18af965 in ?? () from
/usr/lib/openoffice/program/libdtransX116

[api-dev] Current Sheet

2006-06-22 Thread Johnny Andersson
I am writing a macro that is supposed to work on any spreadsheet. It will,  
when I'm done, be able to work on the current selection OR on the whole  
spreadsheet. The user can select that in a small dialog with two  
radiobuttons.


I understand that ThisComponent.CurrentSelection is relevant for the first  
case, and I already finished that part of the macro, but I can't find a  
way that will work in the second case, that is on the currently selected  
spreadsheet.


ThisComponent.Sheets.getByName("Sheet1") is useless, since the name of the  
spreadsheet could be anything.
ThisComponent.Sheets.getByIndex(0) is also useless, since the macro can  
not be sure that the user want to work with that spreadsheet.


I hoped to find something like ThisComponent.Sheets.getCurrentSheet, but  
that one does not exist, does it? I couldn't find it anyway.


So obviously I am not on the right track here. Can someone point me to the  
right direction here?


I just want the macro to work on the currently selected spreadsheet, no  
matter what the user highlighted or not.


Anyone? Please?

Best regards
--
Johnny

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



Re: [api-dev] Mapping of the UNO type "hyper" in StarBasic

2006-06-22 Thread Andrew Douglas Pitonyak

Paolo Mantovani wrote:


Hi Christian,

sorry for my previous message.

Alle 09:20, martedì 20 giugno 2006, Christian Junker ha scritto:
 


Hi Paolo,
I have the same problems as you have here.
I guess there is no other way than using CreateUnoValue.
   


[...]
 


2) using CreateUnoValue might be too difficult for some to see or use
at first sight, thus making hyper a real type as single, double etc.
would make things more comfortable for the programmer. Would be good
to hear what Andreas Bregas thinks about that.
   



I only want to add that using CreateUnoValue is a workaround if you have to 
pass an hyper to an API method, but does not helps when you must get an 
hyper.


I've also tried with the css.script.Converter but without any result, so any 
suggestions are welcome


thank you
Paolo
 

Are you saying that you do not know how to convert the returned value to 
something that is usable when it is returned?


I noticed that some other types could not be created using any other 
method... I think that Byte was one of them...


--
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] BorderDistance or Spacing to Contents in a Frame

2006-06-22 Thread Kent Gibson
If you do not have a border in a frame you are not
allowed to set what is referred to in the UI as
Spacing to Contents. I observe that without a border
LeftBorderDistance, RightBorderDistance, etc are
ignored.

Is there no way to get around this? The only success I
have had is with transparent colors, but then you can
sometimes see them in pdf outputs. I just want a frame
with an internal margin and no borders.

I am thinking of submitting a feature request. The
code below creates a frame with a border and a large
spacing to contents. If you leave out the borders it
puts them in. Zero for the line widths doesn't work
either.

regards

###

Creates a Frame with Borders and 5cm Space to Contents

Sub Main

 oFrame = ThisComponent.createInstance(
"com.sun.star.text.TextFrame" )
 oFrame.Width = 16000
 
 topBorder = createUnoStruct(
"com.sun.star.table.BorderLine" ) 
 bottomBorder = createUnoStruct(
"com.sun.star.table.BorderLine" ) 
 leftBorder = createUnoStruct(
"com.sun.star.table.BorderLine" ) 
 rightBorder = createUnoStruct(
"com.sun.star.table.BorderLine" ) 

 'transparent colors work ie 2139095020
 topBorder.Color = 10
 bottomBorder.Color = 10 
 leftBorder.Color = 10 
 rightBorder.Color = 10 
 
 ' negative numbers or zero will not work
 topBorder.InnerLineWidth = 1
 bottomBorder.InnerLineWidth = 1
 leftBorder.InnerLineWidth = 1
 rightBorder.InnerLineWidth = 1

 topBorder.LineDistance  = 0
 bottomBorder.LineDistance  = 0
 leftBorder.LineDistance  = 0
 rightBorder.LineDistance  = 0

 topBorder.OuterLineWidth   = 0
 bottomBorder.OuterLineWidth   = 0
 leftBorder.OuterLineWidth   = 0
 rightBorder.OuterLineWidth   = 0

 'Null or Empty will not work
 ' 
 oFrame.TopBorder = topBorder
 oFrame.BottomBorder = bottomBorder
 oFrame.LeftBorder = leftBorder
 oFrame.RightBorder = rightBorder

 oFrame.LeftBorderDistance = 5000
 oFrame.RightBorderDistance = 5000
 oFrame.TopBorderDistance = 5000
 oFrame.BottomBorderDistance = 5000

 ThisComponent.Text.insertTextContent(
ThisComponent.Text.Start, oFrame, false )
 oFrame.Text.String = "Hello, this text is within the
frame."

End Sub

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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