[api-dev] StarOffice/openOffice.org NetBeans Integration - first public release

2006-10-20 Thread Jürgen Schmidt

Hi,

we have released the first public release of our 
StarOffice/OpenOffice.org NetBeans plugin to collect feedback.


Please see my announcement on our new GullFOSS blog 
(http://blogs.sun.com/GullFOSS/entry/staroffice_openoffice_org_netbeans_integration) 
for more detailed information (where to download, requirements, 
installation instructions, how to use).


The work is ongoing and there is huge space for improvements, so your 
feedback and ideas are highly appreciated.


Juergen

PS: this message is cross posted on [EMAIL PROTECTED], [EMAIL PROTECTED] and 
dev@openoffice.org, please give your feedabck on the [EMAIL PROTECTED] list or to 
me directly


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



Re: [api-dev] Refreshing a modified menu bar

2006-10-20 Thread Carsten Driesner

Bart Aimar wrote:



Paolo Mantovani ha scritto:

Hi Bart,


Ciao Paolo,



It works for me.
It adds a new item named Standard.Module1.Test under the File menu 
of the current document.


I am a stupid man... :-(
I espected a NEW Menu...

In seek to decipher the code, I have not read the first comment... Sorry!

Is possible to create (in same transient way) a nuew menu and concerning 
intems submenu?

Hi Bart,

The transient state is a property of the whole menu bar. So it's 
possible to create a new menu and menu items for this sub menu without 
any problem.


Regards,
Carsten

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



Re: [api-dev] Mac/Linux/Windows problems?

2006-10-20 Thread Mathias Bauer
Jimmy wrote:

 I'm developping a component for Writer which has been tested with 
 Windows and works fine on different machines with different OpenOffice 
 Versions starting from 2.0.2 to 2.0.4.
 
 Now that I'm almost finished with it, I wanted to test the tool on a Mac 
 and on Linux. Surprisingly it failed and I don't really understand how 
 this could happen.
 
 On Linux (Gentoo) with OO.org 2.0.3 and 2.0.4 it fails and on Mac 
 (Intel/PowerPC) it fails with NeoOffice (OO.org 2.0.3). The main problem 
 which I figured out is on startup where the JobExecutor initializes 
 several things.
 
 The following code works with Windows but not with the other ones:
 xComponent = xDesktop.getCurrentComponent();
 
 xDesktop has been initialized but getCurrentComponent() doesn't give 
 anything back, it does so with Windows! (How is this even possible?)

getCurrentComponent() is not reliable as it depends on the
focus/activation handling on the particular OS. Unix systems are well
known to handle focus changes asynchronously so you have a good chance
that directly after starting the first window of OOo
getCurrentComponent() will be empty.

If you want to work reliably use APIs that return you the objects that
you need.

In your code:

 xController = xModel.getCurrentController();

This if fine, you have all you need: the model and the controller of the
document you want to work on.

 xComponent = xDesktop.getCurrentComponent();

Why do you need this at all? Even on Windows it won't give you anything
you don't have already.

Or did I misunderstood your code?

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] Bug in C++ UNO binding of awt::KeyEvent ?

2006-10-20 Thread Mathias Bauer
Julien Galand wrote:

 // BUG (of binding ?) : Use KeyEvent.KeyChar, and not KeyEvent.KeyCode  
 !!
 //
 // Note:
 // The same bug appears when retrieving a KeyEvent, such as
 // XAcceleratorConfiguration.getKeyEventsByCommand(.uno:AddDirect).
 // = the returned KeyEvents have KeyChar filled by what should be in  
 KeyCode.

I think it didn't work because you already have added something before
you used that call. And the remove/setKeyEvent calls have a bug or at
least a special behavior (see below).

 //
 keyEvent.KeyChar = awt::Key::F11;
 keyEvent.Modifiers = awt::KeyModifier::MOD1; // Ctrl+F11
 
 OUString commandURL = OUString::createFromAscii(.uno:AddDirect); //  
 this command is just as a test
 
 try {
   shortcutMgr-removeKeyEvent(keyEvent);
 }
 catch (NoSuchElementException ) {}
 
 shortcutMgr-setKeyEvent(keyEvent, commandURL);
 shortcutMgr-store();

There is a bug(or an unspecified feature?) in the accelerator
configuration: searching for a configuration by Event ignores KeyChar
and KeyFunc, it only uses KeyCode. This can lead to the strangest
effects. Especially your code will force the Accelerator Configuration
to grab the first binding that has MOD1 set and no KeyCode assigned,
whatever that means.

I recommend to do the following:
Make sure that you have the default configuration and use
getKeyEventsByCommand to see what you get. It should yield the same
result as in Basic.

If setKeyEvent still doesn't work with a correctly assigned KeyCode we
must debug it. This could be accelerated if you could deliver your C++
code as an installable and executable extension.

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] iterating over text

2006-10-20 Thread Mathias Bauer
Daniel Naber wrote:

 On Monday 16 October 2006 08:03, Mathias Bauer wrote:
 
 I can't help with your problem, I only wanted to ask wether it is an
 option for you to wait for our new Grammar Checking API that will not
 require any text iteration from inside the Grammar Checker as it always
 gets plain text as a source?
 
 LanguageTool is already released and it has buggy OOo integration so I'd
 like to fix it now. Will the grammar checker API be in 2.1? Can you tell
 when the first binary snapshots with this feature will be available? If
 it's not too far in the future I might indeed give up working with the old
 API.

Not, it won't be in 2.1 as the code freeze for this version will be in 2
weeks. I will ask the developers working on this about their idea about
the release date or availability of snapshots.

Ciao,
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] Mac/Linux/Windows problems?

2006-10-20 Thread Jimmy

Mathias Bauer schrieb:

Jimmy wrote:

  
I'm developping a component for Writer which has been tested with 
Windows and works fine on different machines with different OpenOffice 
Versions starting from 2.0.2 to 2.0.4.


Now that I'm almost finished with it, I wanted to test the tool on a Mac 
and on Linux. Surprisingly it failed and I don't really understand how 
this could happen.


On Linux (Gentoo) with OO.org 2.0.3 and 2.0.4 it fails and on Mac 
(Intel/PowerPC) it fails with NeoOffice (OO.org 2.0.3). The main problem 
which I figured out is on startup where the JobExecutor initializes 
several things.


The following code works with Windows but not with the other ones:
xComponent = xDesktop.getCurrentComponent();

xDesktop has been initialized but getCurrentComponent() doesn't give 
anything back, it does so with Windows! (How is this even possible?)



getCurrentComponent() is not reliable as it depends on the
focus/activation handling on the particular OS. Unix systems are well
known to handle focus changes asynchronously so you have a good chance
that directly after starting the first window of OOo
getCurrentComponent() will be empty.

If you want to work reliably use APIs that return you the objects that
you need.

In your code:

  

xController = xModel.getCurrentController();



This if fine, you have all you need: the model and the controller of the
document you want to work on.

  

xComponent = xDesktop.getCurrentComponent();



Why do you need this at all? Even on Windows it won't give you anything
you don't have already.

Or did I misunderstood your code?

Best regards,
Mathias

  
So that would lead me to the following code in order to get the 
xComponent and the xFrame.


xComponent = xModel;
xFrame = xController.getFrame();

It did fix the problem although the behaviour with the frame 
handling/opening is still different. But I guess I'll have to rework my 
workflow then.


Thanks
Jimmy

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



Re: [api-dev] status of XGalleryThemeProvider

2006-10-20 Thread Kai Ahrens
Hi Laurent,

Laurent Godard wrote:
 Hi
 
 http://api.openoffice.org/docs/common/ref/com/sun/star/gallery/XGalleryThemeProvider.html
 
 is marked as unpublished
 
 are there any plan on this ? how long does something stay unbpublished ?

it's great to hear that you really use this API. AFAIR, I created this
API about 2 years ago, initiated by your submitted task:

http://www.openoffice.org/issues/show_bug.cgi?id=23744

From my point of view, there's no special reason to not mark this
API as final. Although I must admit that I didn't have this
finalization on my daily todo list, I always waited for some
feedback, comments etc. from somebody using this API to
make it better, more usable...

Anyhow, since you seem to have been successfully working with it
and didn't request any new features, I assume that we can make
this API final now.

Nevertheless, I'd like to ask anybody using this API or having
a look at it to still send comments etc. If this last period of
say 1-2 weeks will have been passed, I'll finally publish the
API for the next OOo minor-release/milestone.

With best regards
Kai

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



Re: [api-dev] ScriptProvider is a strange object

2006-10-20 Thread Bernard Marcelly

Bonjour Jürgen Schmidt
Message du 2006-10-20 07:31:

Bernard Marcelly wrote:


I think both cases are bugs. What is the opinion of OOo designers?


i would agree that this is a bug and probably both errors seems to be 
the result of the same error


Please submit an issue



Thanks for your quick answer. I created Issue 70645 for this.

Regards
  Bernard

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



Re: [api-dev] Mac/Linux/Windows problems?

2006-10-20 Thread eric b

Hi,

Just a precision :

NeoOffice 2.0.3 IS NOT OpenOffice.org as mentionned.

And I wonder if this question is  only intended to help NeoOffice,  
and nothing else.








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



Re: [api-dev] status of XGalleryThemeProvider

2006-10-20 Thread Laurent Godard

Hi Kai


Anyhow, since you seem to have been successfully working with it
and didn't request any new features, I assume that we can make
this API final now.

Nevertheless, I'd like to ask anybody using this API or having
a look at it to still send comments etc. If this last period of
say 1-2 weeks will have been passed, I'll finally publish the
API for the next OOo minor-release/milestone.


i'll relay this call as some french user may have some questions and 
requirements :)


thanks a lot Kai

Laurent
--
Laurent Godard [EMAIL PROTECTED] - Ingénierie OpenOffice.org - 
http://www.indesko.com
Nuxeo Enterprise Content Management  http://www.nuxeo.com - 
http://www.nuxeo.org

Livre Programmation OpenOffice.org, Eyrolles 2004-2006

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



Re: [api-dev] Mac/Linux/Windows problems?

2006-10-20 Thread Jimmy
Well of course it's not OpenOffice but it's built of OpenOffice 2.0.3 
which is why I'm testing my component with it. Same goes for Linux where 
I tested my component.
This was an OS specific question since the same problems occured with 
Linux (OpenOffice 2.0.3/4).


regards
jimmy

eric b schrieb:

Hi,

Just a precision :

NeoOffice 2.0.3 IS NOT OpenOffice.org as mentionned.

And I wonder if this question is  only intended to help NeoOffice, and 
nothing else.








-
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] Reset to default style

2006-10-20 Thread Jimmy
How can I reset the CharStyleName of the current cursor to the default 
CharStyleName.

Problem is I can't reset it with the following line:
xCursorProps.setPropertyValue(CharStyleName, Default);

since the default style is for example called Standard in German and I 
don't know what the style is called on whatever language the user is having.


Regards
Jimmy

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



Re: [api-dev] Mac/Linux/Windows problems?

2006-10-20 Thread eric b


Le 20 oct. 06 à 13:43, Jimmy a écrit :


Well of course it's not OpenOffice but it's built of OpenOffice 2.0.3


No, that's not : the source code is modified, the license too.

This is not OpenOffice.org anymore.






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



Re: [api-dev] Mac/Linux/Windows problems?

2006-10-20 Thread Jimmy

Even better, then my component works for two different programs :)



eric b schrieb:


Le 20 oct. 06 à 13:43, Jimmy a écrit :


Well of course it's not OpenOffice but it's built of OpenOffice 2.0.3


No, that's not : the source code is modified, the license too.

This is not OpenOffice.org anymore.






-
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] Refreshing a modified menu bar

2006-10-20 Thread Julien Galand


Le 19 oct. 06, à 14:52, Carsten Driesner a écrit :


Julien Galand wrote:

Thanks for this link.
I had tried this previously and it didn't work, but I think I have  
now found the cause (there is apparently a bug in the C++ UNO binding  
about the awt::KeyEvent structure, for which I have just posted a  
mail in this mailing list), and I could make it work.
But the real question in my previous mail was to display the shortcut  
in the menu line. The code snippet above doesn't change anything in  
the menu added by the transient change method (I have set the same  
command URL on the shortcut and the menu line, hoping that OO would  
associate both automatically).
Is there a way to display for example Ctrl+F12 on the right of a  
menu line (and right-justified) ?

Hi Julien,

OpenOffice.org should display all associated keyboard shortcuts  
automatically in the menu. If it doesn't work for your example, then I  
guess that it's a bug. So could you write me a bug for this issue and  
add a small example to reproduce it?




Hi Carsten,

I have spent several hours to boil down the phenomenon.
From my tests, I have concluded that this display connection of the  
shortcut with its menu line doesn't work when the menu line is in a  
submenu (i.e. not a line in a menu of the menu bar, but in a submenu of  
a menu).

When it is simply a menu line of a menu of the menu bar, it works.

It looks like a bug. I use OO 2.0.3.

With regards to a sample code, I have got one, but only in JScript, as  
I am much more used to it than Basic.
Copy the sample below in a text file, say  
Insert_new_menu_and_shortcut.js.
I launch the script in Windows, with a simple command line (OO should  
be running) :


cscript Insert_new_menu_and_shortcut.js

I hope JScript won't be a burden for you. If it were, tell me and I  
will try to translate it in OO Basic with my little knowledge of it.

Here is the sample :

(you can try both cases, with a simple menu line, or with a submenu, by  
assigning the 3rd parameter of 'InsertMenu')
 
__


var ooServMgr = WScript.CreateObject(com.sun.star.ServiceManager);

var mycommand = macro:///Standard.Module1.Test();

// Set the 3rd parameter to 'true' to insert a submenu in the File  
menu.

// This submenu has only one line.
// Or 'false' to insert only the menu line in the File menu.
//
InsertMenu(ooServMgr, mycommand, true);

InsertShortcut(ooServMgr, mycommand);

function InsertMenu(ooServMgr, myCommand, bWithSubmenu) {
var ooDesktop = ooServMgr.createInstance(com.sun.star.frame.Desktop);
var curFrame  = ooDesktop.getCurrentFrame();
var layoutMgr = curFrame.LayoutManager;

var menuElementName = private:resource/menubar/menubar;
var menuBar = layoutMgr.getElement(menuElementName);
var menuBarSettings = menuBar.getSettings(true);

menuBar.Persistent = false;

// Find the File popup menu.
//
var fileMenuIndex = FindCommand(.uno:PickList, menuBarSettings);

if (fileMenuIndex = 0) {
		var popupMenuItem =  
menuBarSettings.getByIndex(fileMenuIndex).toArray();

var popupMenu = GetProperty(ItemDescriptorContainer, 
popupMenuItem);

//if (FindCommand(myCommand, popupMenu)==-1)
{
var menuItem;
			menuItem = CreateMenuItem(ooServMgr, myCommand, Test shortcut,  
null);


var menuItemPassed = ooServMgr.Bridge_GetValueObject();

menuItemPassed.Set([]com.sun.star.beans.PropertyValue, menuItem);

if (bWithSubmenu) {
var submenu;
submenu =  
menuBarSettings.createInstanceWithContext(ooServMgr.DefaultContext);

submenu.insertByIndex(0, menuItemPassed);

menuItem = CreateMenuItem(ooServMgr, , Test shortcut submenu,  
submenu);


menuItemPassed.Set([]com.sun.star.beans.PropertyValue, menuItem);
}

popupMenu.insertByIndex(popupMenu.getCount(), 
menuItemPassed);
}
}
menuBar.setSettings(menuBarSettings);
}

function FindCommand(command, menuBarSettings) {
for (var i=0; imenuBarSettings.getCount(); i++) {
var popupMenu = menuBarSettings.getByIndex(i).toArray();

for (var j=0; jpopupMenu.length; j++) {
			if (popupMenu[j].Name==CommandURL  popupMenu[j].Value==command)  
return i;

}
}
return -1;
}

function GetProperty(propertyName, properties) {
for (var i = 0; iproperties.length; i++) {
if (properties[i].Name==propertyName) return 
properties[i].Value;
}
return null;
}
  

Re: [api-dev] StarOffice/openOffice.org NetBeans Integration - first public release

2006-10-20 Thread Christoph Jopp
Hi Jürgen,

thank you and the 'OpenOffice.org-NetBeans-PlugIn-Team' for the great work.
It took me just seconds to produce a working test-component package with it.

It seems to be quite stable already with the little task, if there
should turn out some bugs/instability in bigger tasks, I'll report them.

Thanks a lot again
Christoph


Jürgen Schmidt wrote:
 Hi,

 we have released the first public release of our
 StarOffice/OpenOffice.org NetBeans plugin to collect feedback.

 Please see my announcement on our new GullFOSS blog
 (http://blogs.sun.com/GullFOSS/entry/staroffice_openoffice_org_netbeans_integration)
 for more detailed information (where to download, requirements,
 installation instructions, how to use).

 The work is ongoing and there is huge space for improvements, so your
 feedback and ideas are highly appreciated.

 Juergen

 PS: this message is cross posted on [EMAIL PROTECTED], [EMAIL PROTECTED] and
 dev@openoffice.org, please give your feedabck on the [EMAIL PROTECTED] list or
 to me directly

 -
 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] Refreshing a modified menu bar

2006-10-20 Thread Carsten Driesner

Julien Galand wrote:


Le 19 oct. 06, à 14:52, Carsten Driesner a écrit :


Julien Galand wrote:

Thanks for this link.
I had tried this previously and it didn't work, but I think I have 
now found the cause (there is apparently a bug in the C++ UNO binding 
about the awt::KeyEvent structure, for which I have just posted a 
mail in this mailing list), and I could make it work.
But the real question in my previous mail was to display the shortcut 
in the menu line. The code snippet above doesn't change anything in 
the menu added by the transient change method (I have set the same 
command URL on the shortcut and the menu line, hoping that OO would 
associate both automatically).
Is there a way to display for example Ctrl+F12 on the right of a 
menu line (and right-justified) ?

Hi Julien,

OpenOffice.org should display all associated keyboard shortcuts 
automatically in the menu. If it doesn't work for your example, then I 
guess that it's a bug. So could you write me a bug for this issue and 
add a small example to reproduce it?




Hi Carsten,

I have spent several hours to boil down the phenomenon.
 From my tests, I have concluded that this display connection of the 
shortcut with its menu line doesn't work when the menu line is in a 
submenu (i.e. not a line in a menu of the menu bar, but in a submenu of 
a menu).

When it is simply a menu line of a menu of the menu bar, it works.

It looks like a bug. I use OO 2.0.3.

Hi Julien,

If you are right then it would be a bug. It's a little bit strange as I 
can see keyboard shortcuts in sub menus using OOo 2.0.4.

Writer menu:
Table - Insert - Table...Strg+F12
Tools - Update - Fields  F9
Insert - Fields - Other...   Strg+F2
The OpenOffice.org menu implementation uses the accelerator 
configuration to show shortcuts assigned to functions.




With regards to a sample code, I have got one, but only in JScript, as I 
am much more used to it than Basic.
Copy the sample below in a text file, say 
Insert_new_menu_and_shortcut.js.
I launch the script in Windows, with a simple command line (OO should be 
running) :


cscript Insert_new_menu_and_shortcut.js

I hope JScript won't be a burden for you. If it were, tell me and I will 
try to translate it in OO Basic with my little knowledge of it.

Here is the sample :

(you can try both cases, with a simple menu line, or with a submenu, by 
assigning the 3rd parameter of 'InsertMenu')


JScript shouldn't be a problem. I will check you example on Monday and 
may be I am able to shed light on this issue.


Regards,
Carsten

__ 



var ooServMgr = WScript.CreateObject(com.sun.star.ServiceManager);

var mycommand = macro:///Standard.Module1.Test();

// Set the 3rd parameter to 'true' to insert a submenu in the File menu.
// This submenu has only one line.
// Or 'false' to insert only the menu line in the File menu.
//
InsertMenu(ooServMgr, mycommand, true);

InsertShortcut(ooServMgr, mycommand);

function InsertMenu(ooServMgr, myCommand, bWithSubmenu) {
var ooDesktop = ooServMgr.createInstance(com.sun.star.frame.Desktop);
var curFrame  = ooDesktop.getCurrentFrame();
var layoutMgr = curFrame.LayoutManager;

var menuElementName = private:resource/menubar/menubar;
var menuBar = layoutMgr.getElement(menuElementName);
var menuBarSettings = menuBar.getSettings(true);

menuBar.Persistent = false;

// Find the File popup menu.
//
var fileMenuIndex = FindCommand(.uno:PickList, menuBarSettings);

if (fileMenuIndex = 0) {
var popupMenuItem = 
menuBarSettings.getByIndex(fileMenuIndex).toArray();
var popupMenu = GetProperty(ItemDescriptorContainer, 
popupMenuItem);

//if (FindCommand(myCommand, popupMenu)==-1)

{
var menuItem;
menuItem = CreateMenuItem(ooServMgr, myCommand, Test 
shortcut, null);
   
var menuItemPassed = ooServMgr.Bridge_GetValueObject();
menuItemPassed.Set([]com.sun.star.beans.PropertyValue, 
menuItem);
   
if (bWithSubmenu) {

var submenu;
submenu = 
menuBarSettings.createInstanceWithContext(ooServMgr.DefaultContext);

submenu.insertByIndex(0, menuItemPassed);
   
menuItem = CreateMenuItem(ooServMgr, , Test shortcut 
submenu, submenu);
menuItemPassed.Set([]com.sun.star.beans.PropertyValue, 
menuItem);

}
   
popupMenu.insertByIndex(popupMenu.getCount(), menuItemPassed);

}
}
menuBar.setSettings(menuBarSettings);
}

function FindCommand(command, menuBarSettings) {
for (var i=0; imenuBarSettings.getCount(); i++) {
var popupMenu = menuBarSettings.getByIndex(i).toArray();
   
for (var j=0; jpopupMenu.length; j++) {
if (popupMenu[j].Name==CommandURL  
popupMenu[j].Value==command) 

Re: [api-dev] Bug in C++ UNO binding of awt::KeyEvent ?

2006-10-20 Thread Julien Galand


Le 20 oct. 06, à 10:54, Mathias Bauer a écrit :


Julien Galand wrote:


// BUG (of binding ?) : Use KeyEvent.KeyChar, and not KeyEvent.KeyCode
!!
//
// Note:
// The same bug appears when retrieving a KeyEvent, such as
// XAcceleratorConfiguration.getKeyEventsByCommand(.uno:AddDirect).
// = the returned KeyEvents have KeyChar filled by what should be in
KeyCode.



//
keyEvent.KeyChar = awt::Key::F11;
keyEvent.Modifiers = awt::KeyModifier::MOD1; // Ctrl+F11

OUString commandURL = OUString::createFromAscii(.uno:AddDirect); //
this command is just as a test

try {
shortcutMgr-removeKeyEvent(keyEvent);
}
catch (NoSuchElementException ) {}

shortcutMgr-setKeyEvent(keyEvent, commandURL);
shortcutMgr-store();


I recommend to do the following:
Make sure that you have the default configuration and use
getKeyEventsByCommand to see what you get. It should yield the same
result as in Basic.



Hi Mathias,

I have followed your advice. Doing so enabled me to investigate 
further, and I have concluded that there is definitely an alignment 
weakness in the UNO C++ headers.


The point is that I compile my add-on with alignment 2. I thought there 
would be no problem since all UNO structures are wrapped with :

#pragma pack(8)
struct { ... }
#pragma pack()

But there is a subtlety. Nothing is better than an example, the one I 
have coped with :



#pragma pack(push, 8)

struct EventObject {
ReferenceXInterface Source;
};

struct myEventObject {
void *Source;
};

#pragma pack(pop)

== sizeof(EventObject)==4  sizeof(myEventObject)==4

#pragma pack(push, 8)

struct myInputEvent: public myEventObject {
short Modifiers;
};

struct InputEvent: public EventObject {
short Modifiers;
};

#pragma pack(pop)



The size of myInputEvent is 8 (at least with Visual C++), because the 
'myEventObject' type has requested to be aligned on 8-bytes boundary, 
and therefore its 'Source' field must be aligned on 4-bytes boundary.
The compiler adjusts the size of the structure so that an array of 
myInputEvent makes the Source field fall on 4-bytes boundaries.


But if the default alignment compiler option is set to 2, the size of 
InputEvent is 6, even though EventObject and my EventObject look 
equivalent at first sight.


Why ? Because the Reference template is itself a structure, not a 
basic type, and NOT wrapped with  #pragma pack(8). So the compiler 
doesn't bother to keep it aligned on 8-bytes or even 4-bytes boundary.


Consequence :
The awt::KeyEvent structure doesn't match the one of UNO in a C++ 
component compiled with such an option.


As a conclusion :
- Either compile a C++ UNO component with the alignment compiler option 
set to 8 (or at least all SDK/UNO headers).
- Or the Reference template structure definition should be wrapped 
with #pragma align(8).


But the latter option is a fix in the SDK. Should I report this to 
someone ?

Or should I forward this mail to another dedicated list ?

Julien Galand

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



Re: [api-dev] Refreshing a modified menu bar

2006-10-20 Thread Bart Aimar



Carsten Driesner ha scritto:

The transient state is a property of the whole menu bar. So it's 
possible to create a new menu and menu items for this sub menu without 
any problem.


Thank you Carsten for your answer

I tried to perform a running code about... but my ability (as
programmer) is inadeguate...

But I can wait... (actually I use addons.xcu) and I confide in a future 
snippet code

 :-)

Thank's

Bart

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