Re: [api-dev] Styles and Formatting Dialog

2006-03-23 Thread Mathias Bauer
Tuomas Räsänen wrote:

> Hi,
> 
> Can I somehow (programmatically) access Styles and Formatting - dialog 
> and chage it's properties. My goal is to hide those default style 
> categories and propably to chage the name of Custom Styles - category. 
> I'd like to limit users to use only definite styles.

No, the "Styles and Formatting" dialog doesn't have an API.

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] Re: [dev] Integrating external program with OOo on Windows - request for assistance!

2006-03-23 Thread Mathias Bauer
Anders S. Johansen wrote:

> OK. I have a way to get the currently forground window, so that will work
> nicely. I then need a way to check, say:
> 
> bool isOOoWindow(const HWND w);

Yes, as I wrote: this can be implemented in the following way: get all
frames from the Desktop service of OOo, retrieve their ContainerWindow
and check their window handle. Details can be explained when the other
problems are solved.

>> We have an API for cursor travelling, but I don't understand how a
>> single integer value can describe a cursor position. Can you explain?
>> What is the "reference point" for your position?
> 
> OK.
> 
> ^ is cursor
> 
> ^hello <-- pos == 0
> 
> h^ello <-- pos == 1

Yes, sure, but this doesn't help. Consider a complex document with 100
pages of text. Your current view might be on page 17. On this page you
have a text table on the tab, followed by normal text, the text cursor
is in the last paragraph of it.

So which character should be the one with position 0? The first
character of the document? The first character in the table? The
character that the cursor points to?

Another example: there is a text frame surrounded by normal text. The
text frame lies in the middle of the paragraph, below line 1 and above
line 7, some text on its left and right side. How will you describe this
with a linear cursor position? Please consider that the text inside the
frame can have a different number of lines that does not match the lines
outside of it. Here's a picture of what I described:

xxx
 - 
 |   | 
 |   | 
 |   | 
 - 
xxx

I'm sure I could find more "interesting" arrangements like this one. :-)

>>>   void ChangeRange(const HWND w, char *NewString, const int
>>> start, const int length);

I forgot to mention: if you want to use char* to address strings there
is another problem because OOo strings are 16Bit UniCode strings, so a
suitable data type should be used. You could workaround this by
converting all strings received by our API to UTF-8 encoded strings in
the DLL with C-API but then you can't rely on the usual pointer arithmetics.

>> BTW: I thought that the best list would be dev@api.openoffice.org but
>> dev@openoffice.org should be OK here also. One move is enough. :-)
> 
> OK, I have tried a few times, but it has not shown up in the archives. Not I
> experiment with a new method (joining, then mailing to thwe list).

I didn't want to suggest a move to api-dev, but now you arrived here, so
let's go on. :-)

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] XComponentLoader event onload

2006-03-23 Thread Andreas Schlüns

Antoine POURCHEZ wrote:

Hello,
I want to load and next update an ODT in a java program. To do that, i 
write this code :

Object vDesktop = OoBootstrap.createDesktop();
XComponentLoader vCompLoader = (XComponentLoader) 
UnoRuntime.queryInterface(XComponentLoader.class, vDesktop);


String vUrl = "_file://".concat(((File_) 
pSrc).toURL().toExternalForm().substring(5));

PropertyValue vProps[] = new PropertyValue[1];
vProps[0] = new PropertyValue();
vProps[0].Name = "Hidden";
vProps[0].Value = Boolean.TRUE;
Object vDocSrc = vCompLoader.loadComponentFromURL(vUrl, 
"_blank", 0, vProps);

XFrame  vFrameDoc = ((XModel) 
UnoRuntime.queryInterface(XModel.class, 
vDocSrc)).getCurrentController().getFrame();


XDispatchHelper vDipatchHelper = 
(XDispatchHelper)UnoRuntime.queryInterface(XDispatchHelper.class, 
OoBootstrap.createService("com.sun.star.frame.DispatchHelper"));



vDipatchHelper.executeDispatch((XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, 
vFrameDoc), ".uno:UpdateAllIndexes", "", 0, null);


In some big documents, this generate a crash of openOffice : i think 
that the document is not totaly load when "executeDispatch" is execute.


The document is loaded completely after loadComponentFromURL() returned 
the model. But might be there are some asynchronous layout routines.
On the other side such asynchronous layout must deal with the situation 
that it will be disturbed from outside. And further you loaded the 
document with HIDDEN=TRUE so there is no need for such operations after 
loading.


For me it looks like a "simple .-)" bug. If it can be reproduced by you 
with some special documents, please file an issue attaching one or two 
test documents.




Can XComponentLoader generate an event when all the document is load?


There is already such event. But it's not generated by the component 
loader itself. It's generated by the document, which was loaded and will 
be broadcasted by another singleton instance named 
com.sun.star.frame.GlobalEventBroadcaster (which implements the 
interface css.document.XEventBroadcaster.


The callback css.document.XEventListener.notifyEvent() contains a 
reference to the model. For loading (or creating empty) documents exists 
different events.


OnNew  => for creating a new empty (visible) doc
OnLoad => for loading an existing doc (visible) from disc

OnCreate => for creating an empty (hidden) doc
OnLoadFinished => for loading an existing doc (hidden) from disc


Thank you.
Antoine POURCHEZ
[EMAIL PROTECTED]



Regards
Andreas

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



Re: [api-dev] detecting "unrecoverable error" event

2006-03-23 Thread Stephan Wunderlich

Hi John,

1.) Most important: is there any way to suppress the dialog so that OO 
just goes away quietly without user intervention.


you could start the office with the parameters "-nocrashreport" and 
"-norestore" ... e.g.


soffice.exe -accept=... -norestore -nocrashreport

2.) Convenient: Is there any way to observe the ‘unrecoverable error’ 
event within our UNO library, so our driver would know to retry the text 
block.


as soon as the office is gone this way your library should run into a 
"com.sun.star.lang.DisposedException" as soon as the next UNO-call is 
send ... this way you know when the office died prematurely.


Hope that helps

Regards

Stephan

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



[api-dev] detecting "unrecoverable error" event

2006-03-23 Thread John Sisson








Scenario:

We run OpenOffice 1.1.3 as a slave
to a text processor via both a UNO library and the Xinterface
calls; the processes run on XP workstations.

Each station ‘imports’ about 1  text blocks a day; they are sent to the
slave OO instance, composed, recovered and saved by the driver program.

 

About once a day OO crashes with an ‘unrecoverable
error” dialog and the message that ‘all work has been saved’

Now OpenOffice is hung until
someone notices and accepts the dialog; out driver will then start a new OO.

 

Question:

1.) Most important: is there any way to suppress the dialog
so that OO just goes away quietly without user intervention.

 

2.) Convenient: Is there any way to observe the ‘unrecoverable
error’ event within our UNO library, so our driver would know to retry
the text block.

 

thank you

john sisson

 

[EMAIL PROTECTED]








Re: [api-dev] New Component in Java in order to implement XMultiPropertySet Support

2006-03-23 Thread Kent Gibson
thanks for your detailed response.

--- Stephan Bergmann <[EMAIL PROTECTED]> wrote:

> Kent Gibson wrote:
> > Hi-ya
> > 
> > I am rendering 500 page documents with loads of
> > XTextFrames (about 20 per page) and most of the
> > parameters I set are always the same. 
> > 
> > Unfortunately com.sun.star.text.TextFrame does not
> > support XMultiPropertySet or XFastPropertySet. If
> I
> > create my own Component as described in the guide
> "4.5
> > Simple Component in Java", will I be able to
> basically
> > subclass TextFrame and implement my own support
> for
> > XMultiPropertySet, or at least in some way set
> these
> > standard parameters quicker? My aim is to speed
> things
> > up for objects that I use a lot.
> 
> com.sun.star.text.TextFrame is a description of what
> functionality some 
> software artifact must have in order to count as an
> instance of 
> com.sun.star.text.TextFrame in the UNO world.  That
> artifact could be 
> pretty much anything, and UNO does not offer any way
> to "subclass" it.
> 
> Of course, you could create your own artifact that
> adheres to the 
> com.sun.star.text.TextFrame description, and which
> could (in principle) 
> be used as a replacement of some other
> com.sun.star.text.TextFrame 
> aritfact.  However, the notion of what exactly an
> (old-style) UNO 
> services is are left a bit fuzzy ("how do I obtain
> instances of that 
> service?", corrected now with the introduction of
> new-style services), 
> so that you might or might not have a chance of
> successfully injecting 
> your replacement into the OOo system.  At any rate,
> you probably do not 
> want to create a complete replacement for
> com.sun.star.text.TextFrame, 
> anyway.
> 
> If you only want to have XMultiPropertySet as a
> convenience for your own 
> client (and not to improve execution performance),
> you could create a 
> wrapper around an existing TextFrame instance,
> implement 
> XMultiPropertySet at the wrapper, and forward a
> single call to your 
> XMultiPropertySet as N calls to the wrapped
> TextFrame.
> 
> If, however, you think that instances of TextFrame
> should generally 
> support XMultiPropertySet, you could see that the
> existing 
> implementations of TextFrame in the OOo source code
> are extended by this 
> optional interface, and then your client code could
> test for the 
> existence of the optional interface, and use it if
> available.
> 
> -Stephan
> 
> > thanks.
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


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



Re: [api-dev] toolbar glue or adding to standard toolbar groups

2006-03-23 Thread Jorge . Pelizzoni

Thanks, Carsten!

Selon Carsten Driesner <[EMAIL PROTECTED]>:

> Currently I only have a hard way to get this done. If you really need
> it, just tell me and I can give you a description.

So you mean it's possible after all? If so, please just give a brief outline of
the procedure so I can have an idea what burden is involved.

Cheers,

Jorge.

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



[api-dev] XComponentLoader event onload

2006-03-23 Thread Antoine POURCHEZ
Title: XComponentLoader  event onload






Hello,

I want to load and next update an ODT in a java program. To do that, i write this code :

    Object vDesktop = OoBootstrap.createDesktop();

    XComponentLoader vCompLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, vDesktop);

    String vUrl = "file://".concat(((File) pSrc).toURL().toExternalForm().substring(5));

    PropertyValue vProps[] = new PropertyValue[1];

    vProps[0] = new PropertyValue();

    vProps[0].Name = "Hidden";

    vProps[0].Value = Boolean.TRUE;

    Object vDocSrc = vCompLoader.loadComponentFromURL(vUrl, "_blank", 0, vProps);

 

    XFrame  vFrameDoc = ((XModel) UnoRuntime.queryInterface(XModel.class, vDocSrc)).getCurrentController().getFrame();

    XDispatchHelper vDipatchHelper = (XDispatchHelper)UnoRuntime.queryInterface(XDispatchHelper.class, OoBootstrap.createService("com.sun.star.frame.DispatchHelper"));

    vDipatchHelper.executeDispatch((XDispatchProvider)UnoRuntime.queryInterface(XDispatchProvider.class, vFrameDoc), ".uno:UpdateAllIndexes", "", 0, null);

In some big documents, this generate a crash of openOffice : i think that the document is not totaly load when "executeDispatch" is execute.

Can XComponentLoader generate an event when all the document is load?

Thank you.

Antoine POURCHEZ

[EMAIL PROTECTED]





Re: [api-dev] toolbar glue or adding to standard toolbar groups

2006-03-23 Thread Carsten Driesner

Laurent Godard wrote:

Hi Carsten

Again, I don't know what you mean with a toolbar group. There is a set 
of default configuration properties for a toolbar. One of the 
properties controls the docking state, but you can only change the 
default for every toolbar.


i think the question is
- i define an addon containing a toolbar
- when deploying the addon is floating
- user has to drag it to dock it manually

How to deploy an addon containing a toolbar so that it is docked 
automatically ?


Ok, now I understand. That's a good question, but I only have a not so 
good answer. Currently this is not possible as an add-on doesn't know 
its resource identifier (e.g. "private:resource/toolbar/addon_1") on 
package creation time. We know that this is a limitation we have to 
solve. I hope that we will fix it in one of the future versions (may be 
before OOo 3.0).


A future solution would be: The resource identifier of an add-on is 
created from the root node identifier of its "OfficeToolbar" definition. 
That's known on package creation time and you could add the 
WindowState.xcu files to you package. There you would need to 
add a node for your toolbar and set the property "Docked" to "true".


Currently I only have a hard way to get this done. If you really need 
it, just tell me and I can give you a description.


Regards,
Carsten

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



Re: [api-dev] toolbar glue or adding to standard toolbar groups

2006-03-23 Thread Jorge . Pelizzoni
Selon Laurent Godard <[EMAIL PROTECTED]>:

> i think the question is
> - i define an addon containing a toolbar
> - when deploying the addon is floating
> - user has to drag it to dock it manually
>
> How to deploy an addon containing a toolbar so that it is docked
> automatically ?
>

I couldn't put it better (literally), Laurent, thanks! Sorry for not having a
better command of OOo language.

Cheers,

Jorge.

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



Re: [api-dev] toolbar glue or adding to standard toolbar groups

2006-03-23 Thread Laurent Godard

Hi Carsten

Again, I don't know what you mean with a toolbar group. There is a set 
of default configuration properties for a toolbar. One of the properties 
controls the docking state, but you can only change the default for 
every toolbar.


i think the question is
- i define an addon containing a toolbar
- when deploying the addon is floating
- user has to drag it to dock it manually

How to deploy an addon containing a toolbar so that it is docked 
automatically ?


Thanks

Laurent

--
Laurent Godard <[EMAIL PROTECTED]> - Ingénierie OpenOffice.org
Indesko >> http://www.indesko.com
Nuxeo CPS >> http://www.nuxeo.com - http://www.cps-project.org
Livre "Programmation OpenOffice.org", Eyrolles 2004

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



Re: [api-dev] toolbar glue or adding to standard toolbar groups

2006-03-23 Thread Carsten Driesner

[EMAIL PROTECTED] wrote:


Hi, all!

It seems to be new behaviour in OOo 2.0 that when a new toolbar group is added
(by means of a .xcu) it appears floating by default so the user is free and
encouraged to place it wherever they see fit. I myself find this great, but I
have a client that find it annoying... Well, so here I am.

Hi Jorge,

what do you mean with .xcu and toolbar group?.
What type of toolbar are you speaking about? Add-on toolbar, custom 
toolbar or default toolbar (e.g. Standard Bar)?




Is there a way to specify that a new toolbar group should glue right away, just
as they used to? If not or if it would be too difficult, is there a way to add
buttons to standard toolbar groups, which are already glued?
Again, I don't know what you mean with a toolbar group. There is a set 
of default configuration properties for a toolbar. One of the properties 
controls the docking state, but you can only change the default for 
every toolbar. OpenOffice.org doesn't have different default properties 
for the different toolbar types. I don't know if your client wants this 
behavior.
You can change the structure of a toolbar via UNO API. For more 
information search the mailing list as this question was discussed and 
answered several times before.


Regards,
Carsten

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



[api-dev] toolbar glue or adding to standard toolbar groups

2006-03-23 Thread Jorge . Pelizzoni


Hi, all!

It seems to be new behaviour in OOo 2.0 that when a new toolbar group is added
(by means of a .xcu) it appears floating by default so the user is free and
encouraged to place it wherever they see fit. I myself find this great, but I
have a client that find it annoying... Well, so here I am.

Is there a way to specify that a new toolbar group should glue right away, just
as they used to? If not or if it would be too difficult, is there a way to add
buttons to standard toolbar groups, which are already glued?

Thanks in advance. Cheers,

Jorge.

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



Re: [api-dev] UNO package setting keybindings

2006-03-23 Thread Bart Aimar



Paolo Mantovani ha scritto:

Hi Bart,




In other way how I can clear the registrated shortcut at document level
and give back (useable/active) the same shortcut from the global (or
module) level.



you should use the method :
XAcceleratorConfiguration.removeKeyEvent(aKeyEvt)


Thank's Paolo... and I'm sorry for the nth silly question...

ciao

Bart

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



Re: [api-dev] [code snippet] Managing keyboard shortcuts

2006-03-23 Thread Paolo Mantovani
Hi,

Sorry, but *just* after pressing "Send" I've seen that the code in the snippet 
uses some external function available only in the whole vocabulary package
This is the fixed version


Alle 11:16, giovedì 23 marzo 2006, Paolo Mantovani ha scritto:
> Hi,
>
> I've retrieved a routine that I used in my package Vocabulary in order to
> set a keyboard-shortcut, so I've thought to share it as a code-snippet.
>
> regards
> Paolo






keybinding
keyboard shortcut
XAcceleratorConfiguration
UIConfigurationManager



Paolo Mantovani


How do I manage keyboard 
shortcuts for a given document type ?



The example code is a subroutine that shows several techniques in order to 
manage keybindings.
The purpose of the macro is to set a key binding (CTRL+T) in order to launch 
a macro (Standard.Module1.Main)
The code checks initially if the keybinding is already used.
In this case the code asks to the user if he wants to change the key and, if 
yes, the old keybinding is removed and replaced with the new one.
Notice the syntax used for the macro URL:
vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application
that follows the specificatios of the new OOo scripting framework (from OOo 
2.0.x)
Sub SetUpKeyBinding

Dim oModuleCfgMgrSupplier As Object
Dim oModuleCfgMgr As Object
Dim oWriterShortCutMgr As Object

Dim sCommand As String
Dim sLocCommand As String
Dim sMsg As String
Dim iMsgResult As Integer

 ' Initialize strings
 sCommand = 
"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application"
 
' Retrieve the module configuration manager from central module 
configuration manager supplier
oModuleCfgMgrSupplier = createUnoService("[EMAIL PROTECTED] 
com.sun.star.ui.ModuleUIConfigurationManagerSupplier}")

' Retrieve the module configuration manager with module identifier
oModuleCfgMgr = 
oModuleCfgMgrSupplier.getUIConfigurationManager("[EMAIL PROTECTED] 
com.sun.star.text.TextDocument}")
oWriterShortCutMgr = oModuleCfgMgr.getShortCutManager

Dim aKeyEvent As New [EMAIL PROTECTED] com.sun.star.awt.KeyEvent}
With aKeyEvent
.Modifiers = [EMAIL PROTECTED] 
com.sun.star.awt.KeyModifier:MOD1} 'API const for the CTRL key = 2
.KeyCode = [EMAIL PROTECTED] com.sun.star.awt.Key:T} 'API 
const for the T key = 531
End With

On Error Resume Next
sLocCommand = oWriterShortCutMgr.getCommandByKeyEvent(aKeyEvent)
On Error GoTo 0 'restore the error handler

Select Case sLocCommand

Case = "" 'no previous bindings
oWriterShortCutMgr.setKeyEvent( aKeyEvent, sCommand )
oWriterShortCutMgr.store

Case = sCommand 'ok the key event is already used by our 
command
'nothing to do

Case Else 'the key event is already used by another command

sMsg = "La combinazione di tasti 
""CTRL+T"" è già usata per il comando:" 
& Chr(10)
sMsg = sMsg & sLocCommand & 
"""." & Chr(10) & Chr(10)
sMsg = sMsg & "Si desidera ugualmente usare 
questa combinazione per lanciare Standard.Module1.Main?"
   
iMsgResult = MsgBox( sMsg, 1)
If iMsgResult = 1 Then
oWriterShortCutMgr.removeKeyEvent( aKeyEvent)
oWriterShortCutMgr.setKeyEvent( aKeyEvent, 
sCommand )
oWriterShortCutMgr.store
End If

End Select

End Sub













Initial 
version





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

Re: [api-dev] Styles and Formatting Dialog

2006-03-23 Thread Kent Gibson
You can do everything with styles programmatically
that you can do with the UI. I only know of one
exception and that is changing the name of the default
style. However you can change the settings of the
default style.  I am not sure if you can hide somehow
the default styles, there are some properties relating
to names of styles in the UI. Also if you want to do
stuff with dialogs I think you will need to probably
use star basic. However I am no expert, especially not
with starbasic.




--- Tuomas R�s�nen <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Can I somehow (programmatically) access Styles and
> Formatting - dialog 
> and chage it's properties. My goal is to hide those
> default style 
> categories and propably to chage the name of Custom
> Styles - category. 
> I'd like to limit users to use only definite styles.
> 
> Thanks,
> 
> Tuomas
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


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



[api-dev] [code snippet] Managing keyboard shortcuts

2006-03-23 Thread Paolo Mantovani
Hi,

I've retrieved a routine that I used in my package Vocabulary in order to set 
a keyboard-shortcut, so I've thought to share it as a code-snippet.

regards
Paolo






keybinding
keyboard shortcut
XAcceleratorConfiguration
UIConfigurationManager



Paolo Mantovani


How do I manage keyboard 
shortcuts for a given document type ?



The example code is a subroutine that shows several techniques in order to 
manage keybindings.
The purpose of the macro is to set a key binding (CTRL+T) in order to launch 
a macro (Standard.Module1.Main)
The code checks initially if the keybinding is already used.
In this case the code asks to the user if he wants to change the key and, if 
yes, the old keybinding is removed and replaced with the new one.
Notice the syntax used for the macro URL:
vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application
that follows the specificatios of the new OOo scripting framework (from OOo 
2.0.x)
Sub SetUpKeyBinding

Dim oModuleCfgMgrSupplier As Object
Dim oModuleCfgMgr As Object
Dim oWriterShortCutMgr As Object

Dim sCommand As String
Dim sLocCommand As String
Dim sMsg As String
Dim iMsgResult As Integer

 ' Initialize strings
 sCommand = 
"vnd.sun.star.script:Standard.Module1.Main?language=Basic&location=application"
 
' Retrieve the module configuration manager from central module 
configuration manager supplier
oModuleCfgMgrSupplier = createUnoService("[EMAIL PROTECTED] 
com.sun.star.ui.ModuleUIConfigurationManagerSupplier}")

' Retrieve the module configuration manager with module identifier
oModuleCfgMgr = 
oModuleCfgMgrSupplier.getUIConfigurationManager("[EMAIL PROTECTED] 
com.sun.star.text.TextDocument}")
oWriterShortCutMgr = oModuleCfgMgr.getShortCutManager
   
Dim aKeyEvent As New [EMAIL PROTECTED] com.sun.star.awt.KeyEvent}
With aKeyEvent
.Modifiers = [EMAIL PROTECTED] com.sun.star.awt.KeyModifier:MOD1} 
'API const for the CTRL key = 2
.KeyCode = [EMAIL PROTECTED] com.sun.star.awt.Key:T} 'API const 
for the T key = 531
End With
   
On Error Resume Next
sLocCommand = oWriterShortCutMgr.getCommandByKeyEvent(aKeyEvent)
On Error GoTo 0 'restore the error handler

Select Case sLocCommand
   
Case = "" 'no previous bindings
oWriterShortCutMgr.setKeyEvent( aKeyEvent, sCommand )
oWriterShortCutMgr.store
   
Case = sCommand 'ok the key event is already used by our command
'nothing to do
   
Case Else 'the key event is already used by another command
   
'sMsg = "La combinazione di tasti 
""CTRL+T"" è già usata per il comando:" 
& Chr(10)
'sMsg = sMsg & sLocCommand & """." 
& Chr(10) & Chr(10)
'sMsg = sMsg & "Si desidera ugualmente usare questa 
combinazione per lanciare Standard.Module1.Main?"
 
sMsg = GetResString(1026) & Chr(10)
sMsg = sMsg & sLocCommand & """." & 
Chr(10) & Chr(10)
sMsg = sMsg & GetResString(1027)
   
iMsgResult = MsgBox( sMsg, 1)
If iMsgResult = 1 Then
oWriterShortCutMgr.removeKeyEvent( aKeyEvent)
oWriterShortCutMgr.setKeyEvent( aKeyEvent, sCommand )
oWriterShortCutMgr.store
End If
   
End Select
   
End Sub













Initial 
version




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

Re: [api-dev] How to chang a text to HyperLink

2006-03-23 Thread Michal TOMA
Hi Steffen,

thanks a lot for your help, your code helped to solve my issue! I now have
a search en repalce with formating!

Micheal

> Hi Michael,
>
> from your example I do not really see that you actually do a search:
>
> Adding some stuff to your example code:
>
>
> xReplaceable = (com.sun.star.util.XReplaceable)
>   UnoRuntime.queryInterface(
>com.sun.star.util.XReplaceable.class, ooDoc);
>
> xReplaceDescr = (com.sun.star.util.XReplaceDescriptor)
>   xReplaceable.createReplaceDescriptor();
>
> xReplaceDescr.setSearchString = "";
>
> XInterface xTextRange = xReplaceable.findFirst(xReplaceDescr);
>
> XPropertySet xPropSet = (XPropertySet)
>UnoRuntime.queryInterface(XPropertyReplace.class, xTextRange);
>
> xPropSet.setPropertyValue("HyperLinkURL","http://www.openoffice.org";);
>
>
> HTH, Steffen
>
> mt wrote:
>> Hello,
>>
>> I'm writing a templating system using the UNO API. I managed to make te
>> first part (search and replace). Now I'm trying to write the second part
>> whera I would like to search for a given word, if found change the
>> attributes of the text. It seems to more or less work with standard
>> properties like fontweight, color, etc. But when I try to change the
>> HyperLinkURL property my code fires an UnknownPorpertyExcpetion. Here is
>> the piece of code I use for my tests:
>>
>> xReplaceable = (com.sun.star.util.XReplaceable)
>> UnoRuntime.queryInterface(
>> com.sun.star.util.XReplaceable.class, ooDoc);
>>
>> xReplaceDescr = (com.sun.star.util.XReplaceDescriptor)
>> xReplaceable.createReplaceDescriptor();
>>
>> XPropertySet xPropSet = (XPropertySet)
>> UnoRuntime.queryInterface(XPropertyReplace.class, xReplaceDescr);
>>
>> xPropSet.setPropertyValue("HyperLinkURL","http://www.openoffice.org";);
>>
>> I would expect this to add an URL to all my replaced fields, like it is
>> the case for a BOLD font for exemple. I think I don't understand the
>> whole
>> textcursor concept.
>>
>> I basically need to achieve the following.
>> - search for my text
>> - select the text
>> - add the HyperLinkURL property to the text
>>
>> it seems simple byt I don't know how to extract the necesseary (it
>> seems)
>> text range end cursor objects from the XSearchable result.
>>
>> Any help would be appreciated.
>>
>> Thanks,
>> Michal
>>
>>
>>
>>
>>
>> -
>> 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]
>
>

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



Re: [api-dev] UNO package setting keybindings

2006-03-23 Thread Paolo Mantovani
Hi Bart,

Alle 09:17, giovedì 23 marzo 2006, Bart Aimar ha scritto:
> A final question about shortcut... (I hope!)
>
>
> Now I can register the shortcut at document level.
> But what is the the code to unregister it?
>
> In other way how I can clear the registrated shortcut at document level
> and give back (useable/active) the same shortcut from the global (or
> module) level.

you should use the method :
XAcceleratorConfiguration.removeKeyEvent(aKeyEvt)

see here for details:
http://api.openoffice.org/docs/common/ref/com/sun/star/ui/XAcceleratorConfiguration.html

ciao
Paolo M

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



[api-dev] Re: [dev] Integrating external program with OOo on Windows - request for assistance!

2006-03-23 Thread Anders S. Johansen

OK, have not ahd much luck posting top [EMAIL PROTECTED], so am trying
again...

Quoting Mathias Bauer <[EMAIL PROTECTED]>:

[Hide Quoted Text]

Anders S. Johansen wrote:


Our goal is to implement a few functions/methods, preferably
encapsulated in an object (but not necessarily) that will allow DW
to integrate with Open
Office/Star Office (OO). The following describes the necessary functions in
detail. See conventions regarding cursor position etc. at the end of this
document.

  bool IsOOoWriterWindow(const HWND w);

Return TRUE if the window referred to by the HWND handle 'w' supports the
functions listed below.


That should be easy to implement if you are fine with using at least
OOo2.0 because in that version we have an API that allows to retrieve
the HWND of all OOo document windows.


OK. I have a way to get the currently forground window, so that will work
nicely. I then need a way to check, say:

bool isOOoWindow(const HWND w);

[Hide Quoted Text]

From this function description I assume that your application will only

interface with "normal" text, but not with text in dialogs etc.?


  bool GetContext(const HWND w, char** Context, int &pos);

Fetches, if possible, the current cursor position, and the current text
from the OO window referred to by the HWND handle 'w'. Cursor position is
returned in the 'pos' value, and the text in the 'Context'. If the
operation is performed
correctly, the function returns TRUE, else it returns FALSE.


We have an API for cursor travelling, but I don't understand how a
single integer value can describe a cursor position. Can you explain?
What is the "reference point" for your position?


OK.

^ is cursor

^hello <-- pos == 0

h^ello <-- pos == 1


[Hide Quoted Text]

  void ChangeRange(const HWND w, char *NewString, const int
start, const int length);

Replace a substring in the current text ranging from position 'start' to
position 'start+length' with the text referred to by 'NewString', in the
window referred to by the HWND handle 'w'.


Once we have clarified the cursor position question I'm sure that this
won't be a problem. That means, we need a "translation" from your
description of a cursor position to what we have for it.


See above.

[Hide Quoted Text]

  void SelRange(const HWND w, const int start, const int length);

Select (highlight) the substring of the current text ranging from position
'start' to position 'start+length' in the window referred to by the HWND
handle 'w'.

  void SetSelpos(const HWND w, const int i);


Ditto.


Ditto ;)

Move the insertion point/cursor to position 'i' in the window referred
to by the HWND handle 'w'.


Ditto.


Ditto ;)

[Hide Quoted Text]

oIf other methods/signatures come more natural to the OO
integration, that´s just fine by me. The important thing is to get
the basic functionality, not
necessarily how it is achieved.


Usually I would recommend to use our API directly, but in your case
where Borland C++ shall be used and only a few, very simple API calls
are needed a C library as an encapsulation is fine. This library needs
to be created with MSVC++ or it has to be implemented using OLE
Automation. Using our API through OLE Automation in C++ is a little bit
tedious, but it's easy once you have got it and for such a few API calls
it's bearable.


A C-style DLL is just fine. In fact, it is quite easy for me to work with.

BTW: I thought that the best list would be dev@api.openoffice.org but
dev@openoffice.org should be OK here also. One move is enough. :-)


OK, I have tried a few times, but it has not shown up in the archives. Not I
experiment with a new method (joining, then mailing to thwe list).


This message was sent using IMP, the Internet Messaging Program.



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



Re: [api-dev] UNO package setting keybindings

2006-03-23 Thread Bart Aimar

A final question about shortcut... (I hope!)


Now I can register the shortcut at document level.
But what is the the code to unregister it?

In other way how I can clear the registrated shortcut at document level 
and give back (useable/active) the same shortcut from the global (or 
module) level.


Many thanks for your help

Bart

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



Re: [api-dev] New Component in Java in order to implement XMultiPropertySet Support

2006-03-23 Thread Stephan Bergmann

Kent Gibson wrote:

Hi-ya

I am rendering 500 page documents with loads of
XTextFrames (about 20 per page) and most of the
parameters I set are always the same. 


Unfortunately com.sun.star.text.TextFrame does not
support XMultiPropertySet or XFastPropertySet. If I
create my own Component as described in the guide "4.5
Simple Component in Java", will I be able to basically
subclass TextFrame and implement my own support for
XMultiPropertySet, or at least in some way set these
standard parameters quicker? My aim is to speed things
up for objects that I use a lot.


com.sun.star.text.TextFrame is a description of what functionality some 
software artifact must have in order to count as an instance of 
com.sun.star.text.TextFrame in the UNO world.  That artifact could be 
pretty much anything, and UNO does not offer any way to "subclass" it.


Of course, you could create your own artifact that adheres to the 
com.sun.star.text.TextFrame description, and which could (in principle) 
be used as a replacement of some other com.sun.star.text.TextFrame 
aritfact.  However, the notion of what exactly an (old-style) UNO 
services is are left a bit fuzzy ("how do I obtain instances of that 
service?", corrected now with the introduction of new-style services), 
so that you might or might not have a chance of successfully injecting 
your replacement into the OOo system.  At any rate, you probably do not 
want to create a complete replacement for com.sun.star.text.TextFrame, 
anyway.


If you only want to have XMultiPropertySet as a convenience for your own 
client (and not to improve execution performance), you could create a 
wrapper around an existing TextFrame instance, implement 
XMultiPropertySet at the wrapper, and forward a single call to your 
XMultiPropertySet as N calls to the wrapped TextFrame.


If, however, you think that instances of TextFrame should generally 
support XMultiPropertySet, you could see that the existing 
implementations of TextFrame in the OOo source code are extended by this 
optional interface, and then your client code could test for the 
existence of the optional interface, and use it if available.


-Stephan


thanks.


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



[api-dev] Styles and Formatting Dialog

2006-03-23 Thread Tuomas Räsänen

Hi,

Can I somehow (programmatically) access Styles and Formatting - dialog 
and chage it's properties. My goal is to hide those default style 
categories and propably to chage the name of Custom Styles - category. 
I'd like to limit users to use only definite styles.


Thanks,

   Tuomas

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