Re: [api-dev] Zooming ti given range in Calc (with macro)

2006-09-21 Thread Niklas Nebel

Bart Aimar wrote:

I need to make full the screen (i.e. OO CAlc window)  with a given range.

In other word, I need to zooming (with macro) in manner that a given 
range fill the OO window.


Select the range in the view, and then set the property ZoomType to 
OPTIMAL:


oView.select(oRange)
oView.ZoomType = com.sun.star.view.DocumentZoomType.OPTIMAL

After that, you can remove the selection again.

Niklas

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



[api-dev] XDispatchProvider implementation

2006-09-21 Thread Jimmy
I already had an XDispatchProvider implementation for my Java component 
which worked.
Now I'm trying to move the DispatchProvider/Dispatch into its own class 
instead of implementing it in the root class Editor (the one with 
WeakBase, XServiceInfo).
So all I did was create a new class and copy everything concerning the 
DispatchProvider to the new class Dispatcher.


public class Dispatcher implements XDispatchProvider, XDispatch,
   XInitialization {
...

Then I changed the ProtocolHandler to point to the new Dispatcher.

oor:component-data oor:name=ProtocolHandler 
oor:package=org.openoffice.Office 
xmlns:oor=http://openoffice.org/2001/registry; 
xmlns:xs=http://www.w3.org/2001/XMLSchema; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;

   node oor:name=HandlerSet
   node oor:name=org.openoffice.addon.Dispatcher oor:op=replace
   prop oor:name=Protocols oor:type=oor:string-list
   valueorg.openoffice.addon.Editor:*/value
   /prop
   /node
   /node
/oor:component-data

When I startup the menu items stay grayed out. Isn't it possible to have 
the Dispatchstuff in a special class? What am I missing here?


thanks for some input
André

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



[api-dev] Disable navigator (OOoBean, OpenOffice 2.0.3)

2006-09-21 Thread Harald Weyhing

Hi all,

I need to disable the navigator what can be done easily for menus, 
toolbars and F5 by modifying the user configuration. Actually double 
click on the page number in the status bar also starts up the navigator.


I tried to intercept .uno:navigator but that does not help in this case. 
The only way I found to prevent the navigator here is to intercept 
.uno:StatePageNumber, but then the current page number in the status bar 
won't get updated any more.


Is there another way to intercept the navigator in this case?


Thanks for your help

Cheers
Harald

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



Re: [api-dev] Zooming ti given range in Calc (with macro)

2006-09-21 Thread Bart Aimar


Niklas Nebel ha scritto:

Bart Aimar wrote:

I need to make full the screen (i.e. OO CAlc window)  with a given range.
In other word, I need to zooming (with macro) in manner that a given 
range fill the OO window.




Select the range in the view, and then set the property ZoomType to 
OPTIMAL:

oView.select(oRange)
oView.ZoomType = com.sun.star.view.DocumentZoomType.OPTIMAL


Thank you Niklas for the excellent solution!

I have replaced 165 rows of tremolous flicker whith 6 rows of efficient 
code!


:-))
thanks ++

Bart

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



[api-dev] problems reading xml file with com.sun.star.xml.dom.DocumentBuilder

2006-09-21 Thread Christian Andersson
I have a small problem, In starbasic I'm using (almost) the following
code (there might be small mistakes sicne I'm writing this from memory)
to read and parse an xml document with starbasic

oSFA = createUNOService (com.sun.star.ucb.SimpleFileAccess)
oInpStream = oSFA.openFileRead(sUrl)
oDB = createUnoService(com.sun.star.xml.dom.DocumentBuilder)
domDoc = oDB.parse(oInpStream)
oInpStream.closeInput

this works for me almost perfectly, and I say almost, since there are
some xml documents that it cannot read.

the problem I am having is that some documents (that are beeing
generated by a third party system which I cannot change)

have not declared that it is an xml document like this
?xml version=1.0 encoding=utf-8 ?

it just starts with the xml tags directly liek this

test
  test2
.
  /test2
/test

this is all fine, I have other xml documents that also look liek this,
and Openoffice can read and parse them.
however within these problematic documents they are using national
characters (åæø) encoded using iso-8859-1 and this is the problem.
if they were encoded with utf-8 openoffice can read the document without
having any ecoding declaration. but with iso-8859-1 the oDB.parse
function just returns null. no errors/exceptions or anything, just null.

if I in that file manually add ?xml version=1.0 encoding=iso-8859-1
? at the start, openoffice can read it perfectly..

so is there some way I can force the dom parser to use iso-8859-1
instead of utf-8 ?
it would be great if I could do
domDoc = oDB.parse(oInpStream, iso-8859-1)
and it would work, but from what I can see there is no function for this
in the DocumentBuilder, not is there anything like this in the
inputstream object or the simplefileaccess object.

I should be able to get around this problem by programmaticly make a
copy of the file, and insert the ?... part first and then use my
modified file for reading the xml file, but this is only a last resort
sollution.

-- 
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] problems reading xml file with com.sun.star.xml.dom.DocumentBuilder

2006-09-21 Thread Christoph Jopp
Kjære Christian,
for meg følgende code virker:

oSFA = createUNOService (com.sun.star.ucb.SimpleFileAccess)
oInpStream = oSFA.openFileRead(sUrl)
oTextInpStream = createUnoService(com.sun.star.io.TextInputStream)
oTextInpStream.setInputStream(oInpStream)
oTextInpStream.setEncoding(iso-8859-1)
oDB = createUnoService(com.sun.star.xml.dom.DocumentBuilder)
domDoc = oDB.parse(oTextInpStream)
oInpStream.closeInput

Sorry for my bad Norvegian but It's long ago, I've been there.
To the code:
You have to use a TextInputStream to be able to set the encoding.

Hope it helps.
Ha det bra,
Christoph


Christian Andersson wrote:
 I have a small problem, In starbasic I'm using (almost) the following
 code (there might be small mistakes sicne I'm writing this from memory)
 to read and parse an xml document with starbasic

   oSFA = createUNOService (com.sun.star.ucb.SimpleFileAccess)
   oInpStream = oSFA.openFileRead(sUrl)
   oDB = createUnoService(com.sun.star.xml.dom.DocumentBuilder)
   domDoc = oDB.parse(oInpStream)
   oInpStream.closeInput

 this works for me almost perfectly, and I say almost, since there are
 some xml documents that it cannot read.

 the problem I am having is that some documents (that are beeing
 generated by a third party system which I cannot change)

 have not declared that it is an xml document like this
 ?xml version=1.0 encoding=utf-8 ?

 it just starts with the xml tags directly liek this

 test
   test2
 .
   /test2
 /test

 this is all fine, I have other xml documents that also look liek this,
 and Openoffice can read and parse them.
 however within these problematic documents they are using national
 characters (åæø) encoded using iso-8859-1 and this is the problem.
 if they were encoded with utf-8 openoffice can read the document without
 having any ecoding declaration. but with iso-8859-1 the oDB.parse
 function just returns null. no errors/exceptions or anything, just null.

 if I in that file manually add ?xml version=1.0 encoding=iso-8859-1
 ? at the start, openoffice can read it perfectly..

 so is there some way I can force the dom parser to use iso-8859-1
 instead of utf-8 ?
 it would be great if I could do
   domDoc = oDB.parse(oInpStream, iso-8859-1)
 and it would work, but from what I can see there is no function for this
 in the DocumentBuilder, not is there anything like this in the
 inputstream object or the simplefileaccess object.

 I should be able to get around this problem by programmaticly make a
 copy of the file, and insert the ?... part first and then use my
 modified file for reading the xml file, but this is only a last resort
 sollution.

   

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



Re: [api-dev] XDispatchProvider implementation

2006-09-21 Thread Mathias Bauer
Jimmy wrote:

 I already had an XDispatchProvider implementation for my Java component 
 which worked.
 Now I'm trying to move the DispatchProvider/Dispatch into its own class 
 instead of implementing it in the root class Editor (the one with 
 WeakBase, XServiceInfo).
 So all I did was create a new class and copy everything concerning the 
 DispatchProvider to the new class Dispatcher.
 
 public class Dispatcher implements XDispatchProvider, XDispatch,
 XInitialization {
 ...
 
 Then I changed the ProtocolHandler to point to the new Dispatcher.
 
 oor:component-data oor:name=ProtocolHandler 
 oor:package=org.openoffice.Office 
 xmlns:oor=http://openoffice.org/2001/registry; 
 xmlns:xs=http://www.w3.org/2001/XMLSchema; 
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 node oor:name=HandlerSet
 node oor:name=org.openoffice.addon.Dispatcher oor:op=replace
 prop oor:name=Protocols oor:type=oor:string-list
 valueorg.openoffice.addon.Editor:*/value
 /prop
 /node
 /node
 /oor:component-data
 
 When I startup the menu items stay grayed out. Isn't it possible to have 
 the Dispatchstuff in a special class? What am I missing here?

You could find out wether your service can be instantiated at all? Just
try (in Basic)

obj = CreateUnoService(org.openoffice.addon.Dispatcher)
print IsNull(obi)

If you don't get an object there might be something wrong with your
service or its registration.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



Re: [api-dev] Disable navigator (OOoBean, OpenOffice 2.0.3)

2006-09-21 Thread Mathias Bauer
Harald Weyhing wrote:

 Hi all,
 
 I need to disable the navigator what can be done easily for menus,
 toolbars and F5 by modifying the user configuration. Actually double
 click on the page number in the status bar also starts up the navigator.
 
 I tried to intercept .uno:navigator but that does not help in this case.
 The only way I found to prevent the navigator here is to intercept
 .uno:StatePageNumber, but then the current page number in the status bar
 won't get updated any more.
 
 Is there another way to intercept the navigator in this case?

I'm afraid not so easily, obviously the code that reacts on the double
click doesn't use the way it should.

By intercepting .uno::StatePageNumber of course you could do it in the
following way:

- forward add/removeStatusListener calls to the SlaveDispatcher object
- don't do anything in case you get a dispatch() call for this command

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



Re: [api-dev] problems reading xml file with c

2006-09-21 Thread Christoph Jopp
One thing I forgot to mention:
Be aware that your code uses the com.sun.star.xml.dom.XDocumentBuilder
Interface
and that is signed 'unpublished' in the IDL reference.
Which means you can't rely on it in future versions.
It might be changed or replaced or something like that.

Christian Andersson wrote:
 I have a small problem, In starbasic I'm using (almost) the following
 code (there might be small mistakes sicne I'm writing this from memory)
 to read and parse an xml document with starbasic

   oSFA = createUNOService (com.sun.star.ucb.SimpleFileAccess)
   oInpStream = oSFA.openFileRead(sUrl)
   oDB = createUnoService(com.sun.star.xml.dom.DocumentBuilder)
   domDoc = oDB.parse(oInpStream)
   oInpStream.closeInput

 this works for me almost perfectly, and I say almost, since there are
 some xml documents that it cannot read.

 the problem I am having is that some documents (that are beeing
 generated by a third party system which I cannot change)

 have not declared that it is an xml document like this
 ?xml version=1.0 encoding=utf-8 ?

 it just starts with the xml tags directly liek this

 test
   test2
 .
   /test2
 /test

 this is all fine, I have other xml documents that also look liek this,
 and Openoffice can read and parse them.
 however within these problematic documents they are using national
 characters (åæø) encoded using iso-8859-1 and this is the problem.
 if they were encoded with utf-8 openoffice can read the document without
 having any ecoding declaration. but with iso-8859-1 the oDB.parse
 function just returns null. no errors/exceptions or anything, just null.

 if I in that file manually add ?xml version=1.0 encoding=iso-8859-1
 ? at the start, openoffice can read it perfectly..

 so is there some way I can force the dom parser to use iso-8859-1
 instead of utf-8 ?
 it would be great if I could do
   domDoc = oDB.parse(oInpStream, iso-8859-1)
 and it would work, but from what I can see there is no function for this
 in the DocumentBuilder, not is there anything like this in the
 inputstream object or the simplefileaccess object.

 I should be able to get around this problem by programmaticly make a
 copy of the file, and insert the ?... part first and then use my
 modified file for reading the xml file, but this is only a last resort
 sollution.

   

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