Re: [api-dev] Removing focus from a control

2008-10-28 Thread Christoph Jopp
Hi Andrew,

tried to reproduce the behaviour of your code.
The results were:
 With OOo 2.4 and 3.0 both on Linux. At first I could only change the
status of the checkbox if I turned the document to not editable and thus
could of course change nothing in cell A2.
But with the document set to editable and the form turned to Design Mode
off (from toolbar  Form Design) it worked  even without the dispatch call.

Hope that helps
Christoph
 

Andrew Douglas Pitonyak schrieb:
> I was recently asked how to solve a "simple" problem.
>
> A checkbox in a Calc document calls a macro when it is "clicked".
>
> I want the macro to select a cell such that the cell is in input mode.
>
> Ignoring the checkbox, I can use code similar to the following:
>
> Sub CellSelectOne
>  Dim oCell
>  Dim oSheet
>
>  REM Get the first sheet.
>  oSheet = ThisComponent.getSheets().getByIndex(0)
>  REM Get cell A2
>  oCell = oSheet.GetCellbyPosition( 0, 1 )
>  REM Move the selection to cell A2
>  ThisComponent.CurrentController.Select(oCell)
>
>  Dim oFrame
>  Dim oDisp
>
>  oFrame = ThisComponent.CurrentController.Frame
>  oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
>  oDisp.executeDispatch(oFrame, ".uno:SetInputMode", "", 0, Array())
> End Sub
>
> I even tried this:
>
>  Dim args2(0) as new com.sun.star.beans.PropertyValue
>  args2(0).Name = "ToPoint"
>  args2(0).Value = "$G$4"
>  oDisp.executeDispatch(oFrame, ".uno:GoToCell", "", 0, args2())
>
> When the macro returns, the checkbox still has focus.
>

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



Re: [api-dev] NetBeans Plug-in 2.0.0 : descriptions not added in the manifest nor in the oxt

2008-10-28 Thread Juergen Schmidt

Hi Ariel,

Ariel Constenla-Haile wrote:

Hi all,

in NetBeans Plug-in 2.0.0 the extension descriptions (added to the
description.xml using the "Project Properties" dialog) are not added in
the manifest nor added to the oxt, so there is no description at all.
that is not the same. The descriptions in the project properties dialog 
will be referenced in the description.xml. The descriptions in the 
manifest are the old mechanism and i would say the are deprecated. Maybe 
the documentation is not up-to-date.


I talked to Joachim and the related cws will come into 3.1. I thought it 
was in 3.0. Anyway the plugin supports only the new way that is a 
reference in the description.xml.


That the description folder isn't packed into the oxt file seems to be a 
bug. It seems that the 20 plugin version has some problems. We will fix 
it asap.


Juergen




To reproduce:

1. right-click on the project root in the "Project" tree view, and
choose "Properties"

2. in the "Project Properties" dialog, select the category
"OpenOffice.org" - "Display"

3. in "Description" select the "Browse" button, and choose a .txt file
with the extension description

This will create a new folder "description" with the file and an entry
in the description.xml:







Issues:

* the plug-in does not create an entry in the uno-manifest (AFAIK there
must be an entry per tooltip; this is planned to change, but it still
works this way)

  manifest:media-type="application/vnd.sun.star.package-bundle-description;locale=en-US" 


   manifest:full-path="description/desc-en-US.txt" />


* the "description" folder and its content are not added to the OXT


Regards,
Ariel.





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



Re: [api-dev] Removing focus from a control

2008-10-28 Thread Bernard Marcelly

Hi Andrew,
I found the same problem with a simple control Button. You have to set 
focus again on the document window (sort of).

Just add this instruction at end of your macro:
  oFrame.ContainerWindow.setFocus

By the way, I did not know the .uno:SetInputMode trick !
__
Bernard


Message de Andrew Douglas Pitonyak  date 2008-10-28 04:36 :

I was recently asked how to solve a "simple" problem.

A checkbox in a Calc document calls a macro when it is "clicked".

I want the macro to select a cell such that the cell is in input mode.

Ignoring the checkbox, I can use code similar to the following:

Sub CellSelectOne
 Dim oCell
 Dim oSheet

 REM Get the first sheet.
 oSheet = ThisComponent.getSheets().getByIndex(0)
 REM Get cell A2
 oCell = oSheet.GetCellbyPosition( 0, 1 )
 REM Move the selection to cell A2
 ThisComponent.CurrentController.Select(oCell)

 Dim oFrame
 Dim oDisp

 oFrame = ThisComponent.CurrentController.Frame
 oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
 oDisp.executeDispatch(oFrame, ".uno:SetInputMode", "", 0, Array()) End Sub

I even tried this:

 Dim args2(0) as new com.sun.star.beans.PropertyValue
 args2(0).Name = "ToPoint"
 args2(0).Value = "$G$4"
 oDisp.executeDispatch(oFrame, ".uno:GoToCell", "", 0, args2())

When the macro returns, the checkbox still has focus.




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



Re: [api-dev] NetBeans Plug-in 2.0.0 : descriptions not added in the manifest nor in the oxt

2008-10-28 Thread Ariel Constenla-Haile

Hi Jürgen,

Juergen Schmidt escribió:

Hi Ariel,

Ariel Constenla-Haile wrote:

Hi all,

in NetBeans Plug-in 2.0.0 the extension descriptions (added to the
description.xml using the "Project Properties" dialog) are not added in
the manifest nor added to the oxt, so there is no description at all.
that is not the same. The descriptions in the project properties dialog 
will be referenced in the description.xml. The descriptions in the 
manifest are the old mechanism and i would say the are deprecated. Maybe 
the documentation is not up-to-date.


http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extension_Description
seems to be up-to-date:

Versions of OOo earlier than 3.1 use the "Tooltip Description" of an 
extension which is kept in the  manifest.xml. Using the "Tooltip 
Description" is *deprecated* as of OOo 3.1 and that functionality will 
not be maintained. Since then the description is specified in the 
description.xml. OOo 3.1 and later will first try to get the description 
from the description.xml. If there is none then it will try to get the 
tooltip description. That is, extensions can start to use this feature 
and need not necessarily require OOo 3.1. However, developers should be 
aware that the tooltip description may be removed in the future.



As OOo 3.0 extensions (in /sdext and /filter/source/pdfimport) use the 
package-bundle-description thing, I thought that also the NB plug-in 
2.0.0 (released for/together with OOo 3.0.0) would work for OOo 3.0.0 
;-) ... at least considering that 3.1 release is in March 5th, 2009 
(http://wiki.services.openoffice.org/wiki/OOoRelease31) and we are 
supposed to develop for the current OOo version, not for 5/6 month to 
come...


I talked to Joachim and the related cws will come into 3.1. I thought it 
was in 3.0. Anyway the plugin supports only the new way that is a 
reference in the description.xml.


yes, that's clear from 
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extension_Description


That the description folder isn't packed into the oxt file seems to be a 
bug. It seems that the 20 plugin version has some problems. We will fix 
it asap.


IMHO placing this version in the NB update center was a little premature 
(for production work this version has already given me several 
headaches), next time if you do a pre-release for testing and announce 
it here, I'm sure many of us will help testing it.


Regards
Ariel


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
- Was mich nicht umbringt,
macht mich härter."
Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

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



Re: [api-dev] NetBeans Plug-in 2.0.0 : descriptions not added in the manifest nor in the oxt

2008-10-28 Thread Juergen Schmidt

Ariel Constenla-Haile wrote:

Hi Jürgen,

Juergen Schmidt escribió:

Hi Ariel,

Ariel Constenla-Haile wrote:

Hi all,

in NetBeans Plug-in 2.0.0 the extension descriptions (added to the
description.xml using the "Project Properties" dialog) are not added in
the manifest nor added to the oxt, so there is no description at all.
that is not the same. The descriptions in the project properties 
dialog will be referenced in the description.xml. The descriptions in 
the manifest are the old mechanism and i would say the are deprecated. 
Maybe the documentation is not up-to-date.


http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extension_Description 


seems to be up-to-date:

Versions of OOo earlier than 3.1 use the "Tooltip Description" of an 
extension which is kept in the  manifest.xml. Using the "Tooltip 
Description" is *deprecated* as of OOo 3.1 and that functionality will 
not be maintained. Since then the description is specified in the 
description.xml. OOo 3.1 and later will first try to get the description 
from the description.xml. If there is none then it will try to get the 
tooltip description. That is, extensions can start to use this feature 
and need not necessarily require OOo 3.1. However, developers should be 
aware that the tooltip description may be removed in the future.



As OOo 3.0 extensions (in /sdext and /filter/source/pdfimport) use the 
package-bundle-description thing, I thought that also the NB plug-in 
2.0.0 (released for/together with OOo 3.0.0) would work for OOo 3.0.0 
;-) ... at least considering that 3.1 release is in March 5th, 2009 
(http://wiki.services.openoffice.org/wiki/OOoRelease31) and we are 
supposed to develop for the current OOo version, not for 5/6 month to 
come...

sure, i agree. That was simply a communication problem.



I talked to Joachim and the related cws will come into 3.1. I thought 
it was in 3.0. Anyway the plugin supports only the new way that is a 
reference in the description.xml.


yes, that's clear from 
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Extensions/Extension_Description 



That the description folder isn't packed into the oxt file seems to be 
a bug. It seems that the 20 plugin version has some problems. We will 
fix it asap.


IMHO placing this version in the NB update center was a little premature 
(for production work this version has already given me several 
headaches), next time if you do a pre-release for testing and announce 
it here, I'm sure many of us will help testing it.
well, thanks for your offering to test it. We will definitely handle it 
a little bit different in the future.


Juergen



Regards
Ariel





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



Re: [api-dev] API discussion/announce in the API mailing list?

2008-10-28 Thread Frank Schönheit - Sun Microsystems Germany
> my proposal[1]: why not announcing and discussing this topics directly 
> in *this* API mailing list? (and let [EMAIL PROTECTED]/ 
> [EMAIL PROTECTED] for internal C++ API or whatever name 
> you give to the core C++ code)

Nobody else interested in the topic, except Ariel, Bernard, and /me? Is
everybody happy with such things being announced in
[EMAIL PROTECTED] (or, well, not being announced at all)? Jürgen,
do you have an opinion on this?

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



Re: [api-dev] Removing focus from a control

2008-10-28 Thread Andrew Douglas Pitonyak

Thanks Bernard...

It had not occurred to me to manually set the focus on the container window.

Matthias, this should solve your problem...

Bernard Marcelly wrote:

Hi Andrew,
I found the same problem with a simple control Button. You have to set 
focus again on the document window (sort of).

Just add this instruction at end of your macro:
  oFrame.ContainerWindow.setFocus

By the way, I did not know the .uno:SetInputMode trick !
__
Bernard


Message de Andrew Douglas Pitonyak  date 2008-10-28 04:36 :

I was recently asked how to solve a "simple" problem.

A checkbox in a Calc document calls a macro when it is "clicked".

I want the macro to select a cell such that the cell is in input mode.

Ignoring the checkbox, I can use code similar to the following:

Sub CellSelectOne
 Dim oCell
 Dim oSheet

 REM Get the first sheet.
 oSheet = ThisComponent.getSheets().getByIndex(0)
 REM Get cell A2
 oCell = oSheet.GetCellbyPosition( 0, 1 )
 REM Move the selection to cell A2
 ThisComponent.CurrentController.Select(oCell)

 Dim oFrame
 Dim oDisp

 oFrame = ThisComponent.CurrentController.Frame
 oDisp = createUnoService("com.sun.star.frame.DispatchHelper")
 oDisp.executeDispatch(oFrame, ".uno:SetInputMode", "", 0, Array()) 
End Sub


I even tried this:

 Dim args2(0) as new com.sun.star.beans.PropertyValue
 args2(0).Name = "ToPoint"
 args2(0).Value = "$G$4"
 oDisp.executeDispatch(oFrame, ".uno:GoToCell", "", 0, args2())

When the macro returns, the checkbox still has focus.




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



--
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] Where to register MouseClickHandler in an Add-On?

2008-10-28 Thread wheelsdong

Hi,
I am trying to create a simple OO Add-On supporting context menu, mouse
click and menu command.
I created an simple OpenOffice.org Add-on using the OpenOffice plugin for
NetBeans.
And I implemented two interfaces: com.sun.star.ui.XContextMenuInterceptor
and com.sun.star.awt.XMouseClickHandler. 
The ContextMenuInterceptor and MouseClickHandler are registered in
initialize() function. 

However, The problem is:
1, When I clicked the right mouse button, initialize() will be called, so
ContextMenuInterceptor and MouseClickHandler are registered more than one
time.
So If a left mouse button is pressed and released, the mouseReleased
function will be called many times.
2, The first time I click the newly added menu title, initialize() will also
be called.

My question is:
Since initialize() may be called many times. Where should I register
ContextMenuInterceptor and MouseClickHandler so that they are called only
once?

Thank you very much for your help.

Below are some code for your reference:

public void initialize(Object[] object)
throws com.sun.star.uno.Exception {
if (object.length > 0) {
m_xFrame = (com.sun.star.frame.XFrame) UnoRuntime.queryInterface(
com.sun.star.frame.XFrame.class, object[0]);

System.out.println("initialize is called. ");

XController xController = m_xFrame.getController();

// register context menu
// problem: how to add context menu immediately when the program is loaded?
if (xController != null) {
com.sun.star.ui.XContextMenuInterception xContextMenuInterception =
(com.sun.star.ui.XContextMenuInterception) UnoRuntime.queryInterface(
com.sun.star.ui.XContextMenuInterception.class, xController);

if (xContextMenuInterception != null) {
com.sun.star.ui.XContextMenuInterceptor xContextMenuInterceptor =
(com.sun.star.ui.XContextMenuInterceptor) UnoRuntime.queryInterface(
com.sun.star.ui.XContextMenuInterceptor.class, this);
xContextMenuInterception.registerContextMenuInterceptor(xContextMenuInterceptor);
}

// register mouse handler
com.sun.star.awt.XUserInputInterception xUserInputInterception =
(com.sun.star.awt.XUserInputInterception) UnoRuntime.queryInterface(
com.sun.star.awt.XUserInputInterception.class, xController);
if (xUserInputInterception != null) {
xUserInputInterception.addMouseClickHandler(this);
}
}
}
}wheelsdong 
  
Posts: 3
Joined: Sun Oct 19, 2008 9:12 am 
Primary OS: Ms Windows XP 
OOo version: 2.4.X 
Secondary OS(s): Mac OS 
Private messageE-mail 
-- 
View this message in context: 
http://www.nabble.com/Where-to-register-MouseClickHandler-in-an-Add-On--tp20221786p20221786.html
Sent from the openoffice - api dev mailing list archive at Nabble.com.


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