[api-dev] Re: MailMerge settings

2011-05-12 Thread Paolo Mantovani

Il 12/05/2011 00:32, Ariel Constenla-Haile ha scritto:

Hello Paolo,

On Wednesday 11 May 2011, 13:33, Paolo Mantovani wrote:

Hallo,

I need to change (via API) the database bound to a given document.

In practice I need to perform via API the same operation that you
normally do via the menu Modify->Change Database.


In Writer I see Edit - Exchange Database


Yes, sorry for my heuristic translation from the Italian;)


[]

the above shows you are missing (b), it is not enough to change the
com.sun.star.text.DocumentSettings, you have to instantiate the field masters,
and modify the existing fields.
Note that SwDoc::ChangeDBFields does a few things more:
it updates the text section's condition (a text section may bi hidden
according to a db related condition like Datasource.Table.Field EQ Something
so you have to change Dataource.Table to newdatasource.newtable in your
example)
http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/core/doc/docfld.cxx#1918
it updates *not only* database fields, but also other text fields, see the
switch in
http://svn.services.openoffice.org/opengrok/xref/DEV300_m106/sw/source/core/doc/docfld.cxx#1947


I've studied your reply with great attention and interest.
Thank you very much for the very valuable information and for the 
solution that you suggested.
Unfortunately it seems much more complicated than I could imagine, and 
currently I'm a bit rusty, but I will give it a try.



Thanks again
Paolo Mantovani
--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: MailMerge settings

2011-05-12 Thread Paolo Mantovani

Hi Fernand,

Il 11/05/2011 19:52, Fernand Vanrie ha scritto:

Paolo ,

I think you need "refresh" your textfields,
when needed i can send you some code tomorrow


Thank you for the suggestion.
Actually I forgot to mention that I did already experimented the 
"refresh" method (at textfield collection level) and the "update" method 
at textfield level, and they both did not work for me


ciao
Paolo M

--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] MailMerge settings

2011-05-11 Thread Paolo Mantovani

Hallo,

I need to change (via API) the database bound to a given document.

In practice I need to perform via API the same operation that you 
normally do via the menu Modify->Change Database.


I tried with:

oSet = oDoc.createInstance("com.sun.star.text.DocumentSettings")
oSet.CurrentDatabaseDataSource = "newsource"
oSet.CurrentDatabaseCommandType = com.sun.star.sdb.CommandType.TABLE
oSet.CurrentDatabaseCommand = "newtable"

But this does not affect the database fieldmasters in the document, that 
are still pointing to the old datasource.


It seems that I'm missing something.
Any help?

thank you
Paolo Mantovani

--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: using external libraries with Pyuno components

2011-03-17 Thread Paolo Mantovani

Hi Laurent, Juergen,

thanks for prompt reply,

Il 17/03/2011 14:39, Laurent Godard ha scritto:

Hi paolo

long time !!!

i put my imported .py file inside the extension in a pythonpath directory

the main .py files are at extension root

i found this information long time ago and think it is a reserved
directory name

no declaration in manifest.xml


True, I was aware of this feature and I'm already using in order to 
split my pyuno components in more modules.


Actually I've expressed my question very poorly.

The fact is that Image library (PIL) looks quite complicated.
It contains python modules beside c code that is platform dependent.

so I'm not sure of the path to follow in order to compile and include 
the library in my extension.


Perhaps I should address the question to PIL authors/mantainers...

However, if there is an alternative for not using that library I'd be happy.

In substance I need to load an image (*.jpg) and with a nested cycle 
(rows / columns) I need to look for pixels having certain colors.


After that, I need to clip the original image in many thumbnails

Perhaps is that possible using OOo API's ?

ciao
Paolo M



--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] using external libraries with Pyuno components

2011-03-16 Thread Paolo Mantovani

Hallo,

I'm developing a tool in python that perform some very basic image 
manipulation.

The tool uses the Python Imaging Library (PIL)

Now I would like to integrate my tool in OOo as a pyuno component, but 
PyUno comes without the PIL library


Is there any way to deploy such a dependence inside my extension?

or as an alternative: perhaps pyuno contains a module/library providing 
some basic (raster) image manipulation functions?


thanks for any help
Paolo M


--
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


Re: [api-dev] use of css.container.EnumerableMap

2011-01-06 Thread Paolo Mantovani

Il 05/01/2011 12:31, Andreas Bregas ha scritto:
[]

Problem: This is not very convenient, as the CoreReflection service
is needed to get XIdlClass. Probably in most cases the macro program-
mer knows in advance which types he wants to use. Each type has a
unique name, so it also makes sense to accept the type name, both in

CreateUnoValue( "type",  )

as in

MyUnoObj.MethodWithTypeParameter(  )


So also the following will be supported:

aLongType = CreateUnoValue( "type", "long" )

or as in our case with fixed target type "type":

aMap = com.sun.star.container.EnumerableMap.create( "long", "string" )


I think this is more elegant and matches the usual Basic philosophy
trying to perform sensible conversions automatically.


+1

Great enhancement, I like it

thanks
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] use of css.container.EnumerableMap

2010-12-22 Thread Paolo Mantovani

Hi Frank,

Il 21/12/2010 10:25, Frank Schönheit ha scritto:

Hi Paolo,

[...]

as I was the one who wrote this service (out of a particular need):
Sorry, I wasn't aware that Type is such a ... difficult thing in Basic.
I'll keep that in mind for the next API I design :-\


Thank you, this is great!

In any case, I think that this kind of situation will be repeated in the 
future.


The fact is that the usability and compatibility with StarBasic or other 
scripting languages is not a requirement for new API. (AFAIK)


thank you
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] use of css.container.EnumerableMap

2010-12-20 Thread Paolo Mantovani

Il 18/12/2010 15:00, Paolo Mantovani ha scritto:
[...]

unfortunately the implementation is so complicated and counterintuitive
that nobody will use it.

Of course I'm able to use it even in basic,


ehmmm, clearly it was just my optimistic guess...
Thanks to Ariel, Bernard and Stephan for the responses


ciao
Paolo M


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] use of css.container.EnumerableMap

2010-12-18 Thread Paolo Mantovani

Hi,

after many years, ooo api users have finally got a concrete generic 
implementation of an "associative array" or "Lookup table" or 
"dictionary list"


That's great! this powerful service could greatly simplify the 
development of macros / extension

but..

unfortunately the implementation is so  complicated and counterintuitive 
that nobody will use it.


Of course I'm able to use it even in basic, but how can I explain it to 
a novice that needs to translate from VBA a macro that uses VBA collections?

(however a starbasic example would be grateful)


The new uno service needs initialization, not fully supported in starbasic
The new uno service needs two parameters "UNO Type" a sort of object 
very complex and abstract for a novice not expert in OOP (for example 
99% of macro writers)


This kind of situations tends to discourage anybody that would like to 
migrate but is afraid of loosing his/her skills


regards
Paolo Mantovani

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Dialog control like JPanel in UNO awt

2010-10-26 Thread Paolo Mantovani

Hi,

Il 26/10/2010 05:33, Pivithuru Wijegunawardana ha scritto:

Hi,

I am searching for a JPanel in java  like performing dialog control in
Openoffice to contain some other controls inside. And this control model
should be able to make visible and invisible such that the controls inside
it also does the same action. I looked into UnoControlGroupBoxModel, but it
seem to be only a visual component to group controls.
Is the above task possible in UNO awt? If it is possible what control I
should use for that?


The basic and most spread technique to control the visibility of groups 
of controls is by means of "dialog steps"


You may think to dialog steps just like to layers.
Each layer may contain controls.

Both dialog and control models offer a "Step" property that can be set 
to an integer value at design time or even at runtime.


If you set the Step property of the dialog to a given value, only 
controls with the same Step value are shown


The Step=0 have a special meaning:

If you set the *dialog* Step to 0 , all controls will be made visible, 
regardless their Step actual value.


If you set one control Step to 0 , that control wil be always visible, 
regardless the current Step value of the dialog.


A more versatile technique is by using the service: 
com.sun.star.awt.UnoControlContainer


Is not easy to use this control in dialogs, because it is not available 
in the toolbox of the dialog designer (you cannot use it at design time)


Another problem is that UnoControlContainer is not even registered at 
the XMultiServiceFactory of the UnoDialog model, so in theory you 
couldn't even use it at runtime.


In order to workaround the above mentioned limitations, I use a 
technique that makes use of normal FixedText controls as "placeholders" 
at design time.
(Actually you can use any kind of control as placeholders but the 
fixedtext is the more suitable since it doesn't react to mouse/keyboard 
events and it doesn't eat much resources )


At runtime, placeholder controls are replaced (or better: overlayed) by 
a UnoControlContainer instanciated from the main MultiServiceFactory


Please, see the example below:
(before to run it you should prepare an Uno dialog named "Dialog1" with 
two labels (UnoFixedText controls) named "Label1" and "Label2"


More examples of that technique are in the source code of the 
BasicAddonBuilder extension:

http://www.paolo-mantovani.org/downloads/BasicAddonBuilder/


regards
Paolo Mantovani


--8<--


REM  *  BASIC  *

Sub Main
  oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)

  xray oDlg
  oLbl1 = oDlg.getControl("Label1")
  oLbl2 = oDlg.getControl("Label2")

  'create a child window in the area of the oLbl1
  aPosSize = GetRect(0, 0, oLbl1.Size.Width, oLbl1.Size.Height)
  oViewFrame = CreateChildFrame(oLbl1.Peer, aPosSize)

  'create a control container service that will host the whole TranslateBox
  oCont1 = CreateUnoControl("Container")
  With oCont1.Model
.Border = 1 ' 3D border
'.BackgroundColor = //
  End With
  oCont1.createPeer(oViewFrame.ContainerWindow.Toolkit, 
oViewFrame.ContainerWindow)

  oViewFrame.setComponent(oCont1, Null)

  'create a child window in the area of the oLbl1
  aPosSize = GetRect(0, 0, oLbl2.Size.Width, oLbl2.Size.Height)
  oViewFrame = CreateChildFrame(oLbl2.Peer, aPosSize)

  'create a control container service that will host the whole TranslateBox
  oCont2 = CreateUnoControl("Container")
  With oCont2.Model
.Border = 1 ' 3D border
'.BackgroundColor = //
  End With
  oCont2.createPeer(oViewFrame.ContainerWindow.Toolkit, 
oViewFrame.ContainerWindow)

  oViewFrame.setComponent(oCont2, Null)

  oButton1 = InsertNewControl(oCont1, "Button", "Button1")
  oButton1.Label = "1"
  oButton2 = InsertNewControl(oCont2, "Button", "Button2")
  oButton2.Label = "2"

  oDlg.execute

End Sub


'__
Function CreateChildFrame(oParentWin As Object, aPosSize As Object) As 
Object

Dim oChildWin As Object
Dim oToolkit As Object
Dim oChildFrame As Object

  oToolkit = oParentWin.getToolkit

  Dim aDescriptor as new com.sun.star.awt.WindowDescriptor
  With aDescriptor
.Type = com.sun.star.awt.WindowClass.SIMPLE
.WindowServiceName = ""
'.ParentIndex = 0
.Parent = oParentWin
.Bounds = aPosSize
.WindowAttributes = com.sun.star.awt.WindowAttribute.SHOW '+ 
com.sun.star.awt.WindowAttribute.BORDER

  End With

  oChildWin = oToolkit.createWindow(aDescriptor)

  oChildFrame = createUnoService("com.sun.star.frame.Frame")
  oChildFrame.initialize(oChildWin)

  CreateChildFrame = oChildFrame

End Function


'___

[api-dev] ContentIndexMark not linkable

2010-06-12 Thread Paolo Mantovani

Hi all,

A customer needs to migrate many Word documents containing a content 
index based on the document structure (outline) AND from some bookmarks 
in the document.


All the index voices are linked to the corresponding text position in 
the document.


In OpenOffice.org Writer is not possible to generate indexes voices from 
bookmarks, so we have proposed the use of Index Marks 
(com.sun.star.text.ContentIndexMarks)


The problem is that you cannot define a link property for index voices 
generated from indexmarks


So, I'm trying to find a workaround based on API.

The idea is more or less:

1) get the document index object
2) obtain the collection of index marks
3) from each index mark create a bookmark pointing to the same textrange 
(let's call it "mybkmrk_" where  is an integer)


4) from the content-index get the anchor text
5) process it paragraph by paragraph
6) when you find the voices from index mark set the property
HyperlinkURL = "#" & mybkmrk_


Steps 1, 2, 3, 4, 5, are easy, no problem here.

6 (six) would be easy too, but unfortunately I could not find any safe 
way to identify an index voice (or better: the corresponding textrange) 
having the index mark


I'm sorry for the long post but I was unable to describe the problem in 
a shorter way.


Thanks for any help
Paolo Mantovani


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: AW: [api-dev] Range/Cell Address as Parameter for calc addin

2010-05-18 Thread Paolo Mantovani

Il 18/05/2010 19:00, Daniel Rentz ha scritto:

Hello,

Martin Dobiasch schrieb:


My problem is now to convert the Address Object back to a String

public String CSDRangeAddress(XCellRange range)
{
XCellRangeAddressable xAdd=
(XCellRangeAddressable)UnoRuntime.queryInterface(
XCellRangeAddressable.class, range);
CellRangeAddress address = xAdd.getRangeAddress();
//do something here like address.EndRow= 12;
return "...";
}
Is there an API-way to convert CellRangeAddress to a String?


You can use the "AbsoluteName" property of the range, but this will
return the sheet name too.
http://api.openoffice.org/docs/common/ref/com/sun/star/sheet/SheetCellRange.html#AbsoluteName


There is also another way using the css.table.CellRangeAddressConversion 
service

(and css.table.CellAddressConversion also)

example:

oSheet = ThisComponent.Sheets(0)
aAddr = oSheet.getCellRangeByName("A15:F36").RangeAddress

oCnv = _
ThisComponent.createInstance("com.sun.star.table.CellRangeAddressConversion")
oCnv.Address = aAddr
MsgBox oCnv.PersistentRepresentation
MsgBox oCnv.UserInterfaceRepresentation

ciao
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Sending email to multiple recipients

2010-04-19 Thread Paolo Mantovani

Andrew Douglas Pitonyak ha scritto:


When I looked at the service definitions, I thought that I should be 
able to send an email message to multiple people at one time. The 
setCCRecipient, for example, accepts a list of email addresses. Only the 
first address is used.


I tested on Linux using Thunderbird. Does this seem correct? Shall I 
open a bug against this?


IIRC the same problem affects the setAttachement() method also:
in Linux (Thunderbird) only the first element of the sequence is 
actually attached to the created email message.


ciao
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Paths options page customization

2010-04-01 Thread Paolo Mantovani

Hi Fernand,

Fernand Vanrie ha scritto:

Hallo Paolo ,

I was confronted with the same problem, i never tryed to add new nodes 
to the regsitery.
I supose that the new enteries becomes "new" properties for the 
"com.sun.star.util.PathSettings" service ? 


correct

I think you must have to look
at de "localisation name giving" because the properties are in the GUI 
dialog named to the "Local" name specifications, in English "work" 
becomes "My Documents" etc...


You're right, the Paths registry schema defines named paths but without 
localization.
Grepping in my ooo installation path I found that localized names are 
stored in /basis3.2/program/resource/svxit.res

This means that the localization mechanism is not accessible via API

Also, only *some* of the named-paths defined in the 
org.openoffice.Office.Paths registry component are displayed (with 
localized name) in the paths option page.


The mechanism that chooses which path must be shown in the option page 
is also not accessible al api level.




maybe you can there add also new names or rename some pathnodes to your 
names ?



Renaming predefined paths would require root privileges and I suppose 
iit may be quite dangerous.




I never tryed this way but resolved (half) the problem to use the "work" 
node and then gives some meaningfull names to the directories


Yes, actually it could be a quick&easy solution, but not in my case 
because it's too easy to break by the end user and I need something more 
robust.


thanks
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Paths options page customization

2010-04-01 Thread Paolo Mantovani

Hi Carsten,

Carsten Driesner ha scritto:
[...]
Although the Paths option-dialog page looks like it could be extensible 
the internal implementation is not that flexible. I think it's possible 
to extend the code to display and manage arbitrary paths.
The original developer didn't keep in mind that people could extend the 
path configuration. Please write an request for enhancement for the path 
dialog. Hopefully I will find a developer who wants to take care of it.


http://qa.openoffice.org/issues/show_bug.cgi?id=110541

Thank you very much
Paolo Mantovani


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Paths options page customization

2010-03-29 Thread Paolo Mantovani

Hi all,

I'm trying to add a new named path into the options dialog
(Openoffice.org -> paths)

Of course I'm able to add a new nodes in the org.openoffice.Office.Paths
registry component but although the new node is accessible via the
com.sun.star.util.PathSettings UNO service, I couldn't find any way to
make it accessible for the user via the "Paths" option-dialog page.

thanks for any suggestions

ciao
Paolo



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] deploying images in extensions, to be loaded without extension code

2010-03-18 Thread Paolo Mantovani

Hi Frank,

Frank Schoenheit, Sun Microsystems Germany ha scritto:
[...]

Because the problem I originally raised has nothing to do with dialogs.


OK, the problem is "binary resources for extensions" I recognize that.
BUT, some versions ago, when the problem was "text resources for
extensions" the solution was "dialog centric", even if the problem is
more general.


[...]

In my understanding, dialogs can live in documents, or in the
application-wide dialog library. Also, they can be exported from within
the dialog editor as extension (can they?).


Recently this button has been removed but the possibility is still there
at API level:
http://api.openoffice.org/docs/common/ref/com/sun/star/deployment/XPackage.html#exportTo




Conceptually, those are completely different things, and having a common
solution might be pretty complex. 


I can't evaluate the complexity of such an implementation but the
infrastructure for text resources is already there:
would it be so difficult adding binary resources?

(Where "solution" reminds me that I am

not even sure I have an understanding of the problem. I don't even think
that the problem statement can be worded in a way that it applies to all
three above cases.)


IMHO you can express the idea in that way:

"adding the capability of embedding images into UNO controls" (only for
controls that can display images, of course)

The reason for having an unique solution (for example storing the image
in the dialog library container) is simple:
when you start with an extension design, especially if you work in
starbasic, you will start from a basic library into a document (or at
application level) and only after you will export the library.

An approach "extension centric" will force the developer to modify
control properties after creating and installing the extension or, even
worse, to provide code for loading images into controls at runtime, that
should be the problem that you intended to solve.


An alternative approach would be to extend the image control (and any 
other image-aware control) with the possbility to store itself the image.

Well, there's a place in ODF for images, I don't think that image
controls in dialogs in documents should invent another location. As said
above, they should simply be able to use document-embedded images.
I respect your opinion but as i said before I find this approach not 
consistent


Why? If you insert an image in Write, and tell it to be not linked, then
it is embedded into the document. If you insert an image form control,
and tell it to not link, then the image is embedded in the document. If
you put a dialog into a document, and in this dialog, have an image
control, and tell it to not link its image, then the image is embedded
in the document.

I don't see an inconsistency here.


You are evaluating the consistency from the developer's point of view.
I am in the user shoes instead, so my evaluation may be slightly
different :-)

IMHO the inconsistency here is that you can easily copy/move a whole
library (or a single dialog) from a document to another or to the
application level (and viceversa) and this clearly will break any
embedded image in a way that will be totally unexpected for the user.

"Consistency" from the user POV would be:
I design a dialog into a document embedding some images.
Then, I copy/paste the dialog (or even the single image control) into
another library (e.g. into a different document or into a shared
library) and images are still there, just like other properties.

ciao
Paolo

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] deploying images in extensions, to be loaded without extension code

2010-03-17 Thread Paolo Mantovani

Hi Frank,

Frank Schoenheit, Sun Microsystems Germany ha scritto:
[...]

I see two problems:
1) this approach does not solve the same problem for dialogs included in 
documents.


But nowadays, dialogs in documents can embed their images, can't they? I
remember Noel Power having implemented this a while ago. Admittedly, the
only thing I am sure of is that this works for form controls, but IIRC,
he also did this for dialogs in documents ...


I must say that I was not aware of this feature however it seems more a 
workaround.



Even if this does not work currently - those two problems are unrelated.
I think image controls in dialogs in documents should just have the
possibility to access the images in the document, just like form image
controls have.


Why unrelated?
A dialog is a dialog and a binary resource is a binary resource, so, 
what is the reason for using a special technique only for dialogs that 
live into documents?

Why not having an unified solution?



[]
An alternative approach would be to extend the image control (and any 
other image-aware control) with the possbility to store itself the image.


Well, there's a place in ODF for images, I don't think that image
controls in dialogs in documents should invent another location. As said
above, they should simply be able to use document-embedded images.


I respect your opinion but as i said before I find this approach not 
consistent and not easy to understand for the end user



This would hide tecnical problems to the user and would work for dialogs 
either in extension and/or documents


But it would not solve my problem, which is completely unrelated to
dialogs :)


Perhaps I completely missed the problem or perhaps I've expressed myself 
very badly, so let me try to reformulate:


AWT controls and dialogs can live into documents, in shared libraries or 
into extensions but the problem of the resource storage is the same.


Actually, speaking of localization resources, you (developers) designed 
an unified solution for all cases, so I'm just saying that even in case 
of binary resources it would be a good idea to provide an unified 
solution, not specific for dialogs embedded into extensions.

IIRC even in old in VB/VBA versions dialogs and controls can embed images.
From the user POV this is an approach very simple and clean.


ciao
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] deploying images in extensions, to be loaded without extension code

2010-03-17 Thread Paolo Mantovani

Hi Frank,

Frank Schoenheit, Sun Microsystems Germany ha scritto:

Hi,

is there a way to deploy images in an extension, which can be loaded
without calling code in that extension? That is, ideally I would like
the extension to deploy a configuration entry containing a URL, where
the OOo can pass this URL to the graphic provider, which is able to load
the image without actually loading any code from the extension itself.

Say, something like
"private:graphic/extension/extension_name/path_to_image_file", handled
by the GraphicProvider implementation.


Why not the %origin% placeholder?
I just noticed that the graphic provider can handle demacrofyed urls 
like this one:

vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE/uno_packages/sJYsUf_/MyExtension.oxt/icons/lightbulb.jpg




To my best knowledge (and trusting the API documentation), the
GraphicProvider cannot do this currently, but are there other means to
achieve that?

Does our extension infrastructure allow for this?

I could probably mimic what would be the ideal GraphicProvider
implementation: The extension would need to add a configuration entry
specifying the programmatic extension name, plus a path within the
extension folder. The package API would allow to get the actual image
file then.
However, this is ugly (graphics should be referenced by URLs, not some
strange assembled config data), and of course a central implementation
would be preferred.

Hints/Opinions, anybody? If we don't have anything, yet, I'm probably
going to extend the GraphicProvider implementation.


I see two problems:
1) this approach does not solve the same problem for dialogs included in 
documents.


2) How should it work at design time?
When I start with a new extension, I usually create dialogs and macros 
directly in the StarBasic IDE without actually having an extension 
containing images and other resources.

I suppose that almost starbasic peoples use the same way

when you click on a (let's say) image control in order to select an 
image, the environment put automatically the filesystem URL of the image.
If you manually change the URL to a special one (let's say 
"private:graphics/extension/..." the image will disappear from the control.
Not only: when you finally create the extension you must remember to put 
your images in the right path and then make the package, install it and 
only at this point the image will be visible in the control.


IMHO the "image problem" is just a side effect of not having any 
environment that supports the creation of an extension project.


An alternative approach would be to extend the image control (and any 
other image-aware control) with the possbility to store itself the image.


This would hide tecnical problems to the user and would work for dialogs 
either in extension and/or documents


ciao
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] [Fwd: BasicAddOnBuilder question]

2010-01-18 Thread Paolo Mantovani

Alexandro Colorado ha scritto:



On Thu, Jan 14, 2010 at 3:46 AM, Alan Yaniger  wrote:



Hi Paolo,


I use your BasicAddOnBuilder with no problems. However, as user had 
reported

that when she gets to the "Add License" window, all the options are
inactive, and she can't enter a license. Can you guess what the 
problem is?


Please also contact Paolo Mantovani p_ma...@libero.it


I have replied to Alan privately

ciao
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] listbox events

2009-12-15 Thread Paolo Mantovani

Hello Frank,

Frank Schoenheit, Sun Microsystems Germany ha scritto:
[]

Vanilla OOo is correct here. Control listeners are expected to be called
only when any user interaction is involved, or programmatic access to
the control (e.g. when you call ListBox.selectItem or some such).
Changes to the *control model* shall *not* trigger control listeners.

This rule has been settled quite some years ago, sad to see that
obviously the Ubuntu version adds some patches to OOo which violate this
rule.


Unfortunately this problem has broken my extension BasicAddonBuilder so 
 I'm currently dealing with a lot of angry people :-)

I'll try to open the issue on the ubuntu website.

Thank you very much.
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] listbox events

2009-11-21 Thread Paolo Mantovani

Hi,

I'm having a strange problem that affects only certain versions of ooo 3.1.1

In practice, having a listbox model, if you set the SelectedItems 
property, on some ooo version the  itemStateChanged event of the ListBox 
is raised.


The problem does not affect OOo vanilla version (sun build) but affects 
the ooo packaged from Ubuntu.


you can test with the code below (you'll need to prepare a simple dialog 
with a listbox before)



Now, my question is:
what is the correct behaviour:
OOo by sun: the event is NOT raised if you modify the selection from the 
model but it is raised if the user modify the selection manually.


OOo Ubuntu 9.10: the event is alwais raised

IMHO the first is correct or at least is the most used, because I have 
never observed the second in old ooo versions.


thanks
Paolo M


REM  *  BASIC  *

Sub Main
oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
oDlg.Model.ListBox.StringItemList = Array(1,2,3,4,5)

'this line raises the event but only on certain versions
oDlg.Model.ListBox.SelectedItems = (Array(0)) '

oDlg.execute
End Sub


'manually binded to the itemstateChanged event of the listbox
Sub ListBox_itemStateChanged(oEvent As Object)
Print "halo!"
End Sub

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] BASIC: Change toolbar button icon ?

2009-10-29 Thread Paolo Mantovani
Hello Carsten,
Just for let you know that almost all your posts in d...@api are labeled
as "important" in my local archive :-)
Thanks for sharing.
Keep it up!!

ciao
Paolo M


Carsten Driesner ha scritto:
> Jan Holst Jensen wrote:
>> Hi all.
>>
>> I am trying to emulate a togglebutton/checkbox in a custom toolbar.
>> Right now I have settled for having two toolbar buttons with different
>> icons. Only one of them is visible and when it's pressed it toggles
>> the visibility of both buttons using the code below (which sets
>> visibility of a single button with a given label).
>>
>> It works OK but only as long as the user doesn't fiddle with button
>> visibility :-). Is there a way of changing a toolbar button's icon
>> directly from Basic code ? I could not figure out how to do it.
> Hi Jan,
> 
> Your solution looks it a little bit strange. You can set the image of a
> toolbar button with the help of an image manager. Look at the following
> Basic code which uses the image manager to set an image for a button
> that references a Basic macro. I am sure you can adapt the code to your
> needs.
> 
> Regards,
> Carsten
> 
> REM  *  BASIC  *
> 
> REM *** This example creates a new basic macro toolbar button on
> REM *** the Writer standard bar. It doesn't add the button twice.
> REM *** It uses the Writer image manager to set an external image
> REM *** for the macro toolbar button.
> 
> Sub Main
> REM *** String to reference toolbar
> sToolbar = "private:resource/toolbar/standardbar"
> REM *** Macro command to add
> sMyToolbarCmdId = "macro:///Standard.Module1.Test()"
> 
> REM *** Retrieve the module configuration manager from central
> module configuration manager supplier
> oModuleCfgMgrSupplier =
> createUnoService("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")
> 
> REM *** Retrieve the module configuration manager with module
> identifier
> REM *** See com.sun.star.frame.ModuleManager for more information
> oModuleCfgMgr = oModuleCfgMgrSupplier.getUIConfigurationManager(
> "com.sun.star.text.TextDocument" )
> oImageMgr = oModuleCfgMgr.getImageManager()
> 
> oToolbarSettings = oModuleCfgMgr.getSettings( sToolbar, true )
> 
> REM *** Look for our button. Can be identified by the CommandURL
> property.
> bHasAlreadyButton = false
> nCount = oToolbarSettings.getCount()
> for i = 0 to nCount-1
> oToolbarButton() = oToolbarSettings.getByIndex( i )
> nToolbarButtonCount = ubound(oToolbarButton())
> for j = 0 to nToolbarButtonCount
> if oToolbarButton(j).Name = "CommandURL" then
> if oToolbarButton(j).Value = sMyToolbarCmdId then
> bHasAlreadyButton = true
> end if
> endif
> next j
> next i
> 
> Dim oImageCmds(0)
> Dim oImages(0)
> REM *** Check if image has already been added
> if not oImageMgr.hasImage( 0, sMyToolbarCmdId ) then
>
> REM *** Try to load the image from the file URL
> oImage = GetImageFromURL( "file:///c:/test.bmp" )
> if not isNull( oImage ) then
>
> REM *** Insert new image into the Writer image manager
> oImageCmds(0) = sMyToolbarCmdId
> oImages(0) = oImage
> oImageMgr.insertImages( 0, oImageCmds(), oImages() )
> end if
> end if
> 
> if not bHasAlreadyButton then
> sString = "My Macro's"
> oToolbarItem = CreateToolbarItem( sMyToolbarCmdId,
> "Standard.Module1.Test" )
> oToolbarSettings.insertByIndex( nCount, oToolbarItem )
> oModuleCfgMgr.replaceSettings( sToolbar, oToolbarSettings )
> end if
> End Sub
> 
> Function GetImageFromURL( URL as String ) as Variant
> Dim oMediaProperties(0) as new com.sun.star.beans.PropertyValue
> 
> REM *** Create graphic provider instance to load images from
> external files
> oGraphicProvider = createUnoService(
> "com.sun.star.graphic.GraphicProvider" )
> 
> REM *** Set URL property so graphic provider is able to load the image
> oMediaProperties(0).Name  = "URL"
> oMediaProperties(0).Value = URL
> 
> REM *** Retrieve the com.sun.star.graphic.XGraphic instance
> GetImageFromURL = oGraphicProvider.queryGraphic( oMediaProperties() )
> End Function
> 
> Function CreateToolbarItem( Command as String, Label as String ) as Variant
> Dim aToolbarItem(3) as new com.sun.star.beans.PropertyValue
> 
> aToolbarItem(0).Name = "CommandURL"
> aToolbarItem(0).Value = Command
> aToolbarItem(1).Name = "Label"
> aToolbarItem(1).Value = Label
> aToolbarItem(2).Name = "Type"
> aToolbarItem(2).Value = 0
> aToolbarItem(3).Name = "Visible"
> aToolbarItem(3).Value = true
> 
>   CreateToolbarItem = aToolbarItem()
> End Function
> 
> Sub Test
> MsgBox "Test"
> End Sub
> 
> -
> To unsubsc

[api-dev] OOoDraw question

2009-10-14 Thread Paolo Mantovani
Hi *

I need to perform some selection in Draw
Inspecting the result of ThisComponent.getCurrentSelection() I saw that
getCurrentSelection() method results always a
css.drawing.ShapeCollection, regardless you selected one or many shapes

Unfortunately this service is not registered at draw document level but
it is registered at level of the context ServiceManager

So my questions:
1) It is safe to pass a "foreing" service as argument for the select()
method of the document controller?

2) I saw that if I want to perform a single selection I can directly
pass the shape to select (instead of a collection containing the shape)
Will this change in future or can I safely use that way (instead of
using always the shape collection) ?


thanks
Paolo M







-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Macro & ODB documents

2009-06-04 Thread Paolo Mantovani

Paolo Mantovani ha scritto:
[]
This makes impossible to use the open() method in order to launch a form 
from the OnOpen method for example.

   ^
I meant "onDocumentOpen event"

ciao
Paolo

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Macro & ODB documents

2009-06-04 Thread Paolo Mantovani

Hi Frank,

Frank Schönheit - Sun Microsystems Germany ha scritto:

Hi Paolo,


The problem is that forms and report definitions are not documents.
I know, actually they are documents, but this should be an
implementation detail and I hope that in future they will be replaced
from something more suitable than documents.


Call them with another word, if you want :)


Calling them "documents", the distinction between design-time and 
runtime is being lost.
I would call them Form designer and Report designer (at design time) and 
runtime form instance (at runtime)
Not necessarily the form designer has to be the same component used for 
showing a runtime form instance (IMHO this should be an implementation 
detail)


Not necessarily a form/report designer must have an own topframe with UI 
elements like menu and toolbars. For example they could be integrated in 
the ODB document window.


Speaking of runtime forms, again I don't see the necessity for having 
word processor capabilities (menu, toolbars, online help, styles, 
navigator and so on).

IMHO a form could be just a simple window that contains data-aware controls.

I ever thought that using writer documents inside database documents was 
  more a side effect due to the former OOo1.x approach than a precise 
design choiche, but of course this is just my thought.



[]

I still think that defining ThisComponent as "the component from which
the macro was invoked" (as opposed to "the component which the macro is
embedded into") was the better choice, and causes less hassle. Finally,
this means that only newly written code needs to care for the new
concept. If we had changed ThisComponent otherwise, then every existing
code (implementing such a functionality as sketched above) would have
needed to be rewritten.


Thank you for explaining the rationale behind your decisions.
As usual you were very detailed and helpful, so thanks for taking the time.

Regarding the ThisDatabaseDocument thing, I'm experimenting.

The open() method is very simple and straightforward and I'm sure that 
users will be very happy of it, but I noticed a possible problem.


The open method seems not able to create the first connection. This 
means that you can use the open method only for the second form, but you 
still have to launch manually a first form.


This makes impossible to use the open() method in order to launch a form 
from the OnOpen method for example.


Of course you can still use the "old" loadComponentFromUrl() method but 
IMHO it would be better to have a single method that works in every 
situation


Thanks
Paolo M


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Macro & ODB documents

2009-06-04 Thread Paolo Mantovani
Frank Schönheit - Sun Microsystems Germany ha scritto:
> Hi Paolo,
> 
>> Good to hear. This finally corrects a severe inconsistency affecting 
>> former versions.
>> However, if you launch a macro from the IDE, ThisComponent points 
>> correctly to the ODB document, but if you launch the same macro from a 
>> button placed into a form-document, ThisComponent points to the 
>> form-document itself.
>>
>> This is not a small problem: users will soon start looking for a 
>> solution. Most probably many of them will not recognize the exact terms 
>> of the problem, they will just learn that using ThisComponent.Parent 
>> sometimes does the job.
>> And when this bug will be corrected, all their code will simply stop 
>> working.
> 
> This is not a bug, this behaves as designed:
> http://wiki.services.openoffice.org/wiki/Macros_in_Database_Documents#Global_Variables_in_Basic_Macros.
> See the discussion page of the spec for a reasoning. One major problem
> which would immediately occur if ThisComponent were the DB doc is the
> following: Scripts bound to menu or toolbar items, working on the
> document from which they're invoked, would need to behave differently
> depending on whether they're invoked for a form/report or any other
> document type.

The problem is that forms and report definitions are not documents.
I know, actually they are documents, but this should be an
implementation detail and I hope that in future they will be replaced
from something more suitable than documents.


> If you need access to the database document regardless of the place of
> invocation, use ThisDatabaseDocument. If you need access to the
> sub/document from which the macro was invoked, use ThisComponent.

Thank you for the explanation. I'm sure that I had already read that
specs but I completely missed the ThisDatabaseDocument thing, sorry
I think it is a step back in the consistency of the OOoBase environment
but I guess that backward compatibility reasons have prevailed here.

> 
>> But IMHO the real problem is elsewhere:
>> Normal users (not developers) are struggling with macro in ODB documents 
>> from the beginning.
>> They fill their OOoBase documents with tons of complicated source code, 
>> that mostly they not even understand, and all this pain just because 
>> they would like to launch a form from another.
>>
>> Put a simple way to do this job (for example a dedicated property in 
>> form buttons) and 99.99% of OOoBase users will no more need of any macros
> 
> I definitely wouldn't agree to the "99.99%", but for sure that would be
> a reasonable extension of the existing functionality. Did you by chance
> vote for it when we asked for user input? :)
> (http://blogs.sun.com/GullFOSS/entry/if_you_had_3_wishes)

Sincerely I have no problems launching forms or reports via macro, but
my approach is based on extensions and is not suitable for the majority
of users.
I'm just trying to give some help to Italian users that are asking me to
find some workaround for this very old missing.


Thank you
Paolo M


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Macro & ODB documents

2009-06-03 Thread Paolo Mantovani

Hi all,

As you know, now macros are contained at ODB document level and no more 
at subdocument level (forms and reports)
Good to hear. This finally corrects a severe inconsistency affecting 
former versions.
However, if you launch a macro from the IDE, ThisComponent points 
correctly to the ODB document, but if you launch the same macro from a 
button placed into a form-document, ThisComponent points to the 
form-document itself.


This is not a small problem: users will soon start looking for a 
solution. Most probably many of them will not recognize the exact terms 
of the problem, they will just learn that using ThisComponent.Parent 
sometimes does the job.
And when this bug will be corrected, all their code will simply stop 
working.


But IMHO the real problem is elsewhere:
Normal users (not developers) are struggling with macro in ODB documents 
from the beginning.
They fill their OOoBase documents with tons of complicated source code, 
that mostly they not even understand, and all this pain just because 
they would like to launch a form from another.


Put a simple way to do this job (for example a dedicated property in 
form buttons) and 99.99% of OOoBase users will no more need of any macros



ciao
Paolo M


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Unfortunate document event name - how to fix it?

2009-05-14 Thread Paolo Mantovani
Hi,

Robert Vojta ha scritto:
> On Wed, May 13, 2009 at 7:14 PM, Mathias Bauer  wrote:
> 
> Hi Mathias,
> 
>> The best documentation is an API that doesn't need one. This deals with
>> the fact that people don't like to read documentation. Having "speaking"
>> names for events is a good thing per se, not just some "language
>> aesthetics".
> 
> I totally agree here. I'd vote for better event names (= self
> explanatory). As an extension / component developer I have no problem
> with event name modification / removal / ... in 4.x, 5.x, ... even
> from our business application point of view. It's just minor
> incompatiblity, which can be easily fixed and will lead to shorter
> documentation = in our source code, in OO.o API documentation.
> 

agree 100% on everything
+1 for improved event names.
No problems with removal of deprecated names from the next major version.
The fix for external components using the old name is very easy and the
extension framework offers all the necessry tools to manage the change
with end-users (auto-updates of extensions)

I develop extensions too and in general I'm very happy with openoffice
and its API, not because it's perfect and promises ethernal
compatiblity. These would be utopistic expectations.
If you need eternal compatibility just stay with ooo 1.0 forever.

I'm happy if API gets better and evolve version by version. It's obvious
that at certain point, incompatible changes must happen, so the real
problem is not "IF" but just "HOW" and about this point I'd say that I'd
even prefer a bit more "aggressive" policy

ciao
Paolo M




-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Replace UNO:Paste

2009-04-30 Thread Paolo Mantovani
Hi Cor, Carsten,


Carsten Driesner ha scritto:
> Cor Nouws wrote:
>> Hi,
>>
>> From some threads in the mail archive, I reed it is possible to
>> replace a uno function by one you define yourself.
>> But the example(s) I find are about a component written in Java.
>> Is it possible to do replace UNO:Paste also in OOo-Basic?
>>
>> I think that the devGuide [1] shows the theory, but that is not the
>> same as usable basic code for me ;-)
>>
> Hi Cor,
> 
> Theoretically this could be possible but needs huge effort. Andreas
> Schluens told me that some people tried it

Perhaps that people are me :-)


> but nobody has ever achieved
> a positive result yet. 

It depends. My attempt works well but Andreas said:

a)
Method createUnoListener() was not thought to be used that way. [...]

b)
On the other side I believe you can run into trouble with lifetime of
your basic objects.[...]

a third objection was moved form Ariel, regarding the fact that you'll
need to bind the interceptor to some events in order do start and keep
it bound to the current frame. (unless you don't mean to start it from a
 toolbar button or something similar)
Speaking of extensions, the event binding requires an XJob
implementation and this cannot be done in basic.


> I cannot recommend to create a solution based on
> dispatch intercepting using Basic. As you have to implement several
> interfaces you have to use CreateUnoListener() for every single interface.

Here you'll find an an example of dispatch interceptor in basic that
replaces some dispatches (copy and paste and some others)
See the attached document:
http://api.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=20341

In the same thread you'll find comments from Andreas Schlüns

ciao
Paolo


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



[api-dev] Crash problems with Accessibility

2009-04-13 Thread Paolo Mantovani

Hi,

I've created a sample document with some macros.
The document is available here:
http://drop.io/OOoTestDocuments

The document contains a custom toolbar with two buttons:

Start Accessibility
Launch a macro that register a listener on all menu / menu items
the event handler routine intercept the event FOCUSED and stores
the menuitem caption into an array

Stop Accessibility
unregister all the listeners and creates a logfile with the
content of the array previously created.
In practice the log file contains the "history" of all the menu
items selected by the user.

Before to run the code you have to adapt the logfile path to your system
This is defined in the beginning of the starbasic module containig the 
macros:

Const LOGFILE = 

The code runs without any errors but is extremely unstable and crashes 
very often when you're playing with menus.
I have been unable to find any reasons for that behaviour, so I'm asking 
here for your suggestions


I'm runnig OOo 3.0.1 (300m15 build:9379), SO:Linux/Ubuntu 8.10
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)

Thanks
Paolo Mantovani



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Re: How to access the Storage of an opened OOo document?

2009-04-06 Thread Paolo Mantovani

Hi,


Giuseppe Castagno ha scritto:
[...]

In this first example, I can access the whole document storage,
creating a storage object starting from the document URL.

[...]

In the second example I'll use the XStorageBaseDocument to retrieve
the document storage, here it goes.

[...]
With the above code I got the following (wrong!) document package 
structure:

[...]

Besides I got the following exception:

[...]

I tried to reproduce the problem.
I've prepared a sample document (Calc) with some OLE object embedded.
and some starbasic macros to reproduce the problem:
(I can provide the document if needed)

The code tries to access to the document storage a first time using the 
com.sun.star.embed.StorageFactory and the document URL


and a second time using the XStorageBaseDocument of the document itself

As Giuseppe reported, using the second method causes IO errors

Below the Starbasic code I've used (
In attachment the two log files


Ciao
Paolo M

-
REM  *  BASIC  *

Dim mLog()

Sub Main
  Globalscope.BasicLibraries.loadLibrary("Tools")

oStorageFactory = CreateUnoService("com.sun.star.embed.StorageFactory")
  sURL = "file:///home/paolo/test.ods"
  iMode = com.sun.star.embed.ElementModes.READ

  ReDim mLog()
oMyStorage = 
oStorageFactory.createInstanceWithArguments(Array(sURL, iMode))
  AppendItem(mLog(), "oMyStorage = 
oStorageFactory.createInstanceWithArguments(Array(sURL, iMode))" )

  FillElementList(oMyStorage, "")
  SaveDataToFile("file:///home/paolo/log.txt", mLog())

  ReDim mLog()
  oMyStorage = ThisComponent.getDocumentStorage()
  AppendItem(mLog(), "oMyStorage = ThisComponent.getDocumentStorage()" )
  FillElementList(oMyStorage, "")
  SaveDataToFile("file:///home/paolo/log1.txt", mLog())

End Sub


Sub FillElementList(oStorage, sPath)
on Error goto ErrH
  AppendItem(mLog(), sPath & "/" )
  For Each sElemName In oStorage.ElementNames()
If oStorage.isStorageElement(sElemName) Then

  oElem = oStorage.openStorageElement(sElemName, 
com.sun.star.embed.ElementModes.READ)

  FillElementList(oElem, sPath & "/" & sElemName)
  GoAhead:
Else
  AppendItem(mLog(), sPath & "/" & sElemName)
End If
  Next
  Exit Sub
ErrH:
  AppendItem(mLog(), "openStorageElement :" & sElemName & " - " & Error$ )
  Resume GoAhead

End Sub



Sub AppendItem(mList(), vItem)
Dim iMax As Long

  iMax = UBound(mList())
  iMax = iMax + 1
  Redim Preserve mList(iMax)
  mList(iMax) = vItem

End Sub
oMyStorage = oStorageFactory.createInstanceWithArguments(Array(sURL, iMode))
/
/Configurations2/
/Configurations2/statusbar/
/Configurations2/accelerator/
/Configurations2/accelerator/current.xml
/Configurations2/floater/
/Configurations2/popupmenu/
/Configurations2/progressbar/
/Configurations2/menubar/
/Configurations2/toolbar/
/Configurations2/images/
/Configurations2/images/Bitmaps/
/META-INF/
/arbitrarycontent/
/arbitrarycontent/alienfile.txt
/ObjectReplacements/
/ObjectReplacements/Object 1
/ObjectReplacements/Object 2
/ObjectReplacements/Object 3
/content.xml
/Basic/
/Basic/Standard/
/Basic/Standard/Module1.xml
/Basic/Standard/script-lb.xml
/Basic/script-lc.xml
/styles.xml
/Object 1/
/Object 1/content.xml
/Object 1/styles.xml
/Object 1/meta.xml
/Object 2/
/Object 2/content.xml
/Object 2/styles.xml
/Object 2/meta.xml
/Object 3/
/Object 3/content.xml
/Object 3/styles.xml
/Object 3/meta.xml
/meta.xml
/Thumbnails/
/Thumbnails/thumbnail.png
/settings.xml
oMyStorage = ThisComponent.getDocumentStorage()
/
openStorageElement :Configurations2 - Si è verificata un'eccezione 
Type: com.sun.star.io.IOException
Message: .
/META-INF/
/arbitrarycontent/
/arbitrarycontent/alienfile.txt
/ObjectReplacements/
/ObjectReplacements/Object 1
/ObjectReplacements/Object 2
/ObjectReplacements/Object 3
/content.xml
/Basic/
/Basic/Standard/
/Basic/Standard/Module1.xml
/Basic/Standard/script-lb.xml
/Basic/script-lc.xml
/styles.xml
openStorageElement :Object 1 - Si è verificata un'eccezione 
Type: com.sun.star.io.IOException
Message: .
openStorageElement :Object 2 - Si è verificata un'eccezione 
Type: com.sun.star.io.IOException
Message: .
openStorageElement :Object 3 - Si è verificata un'eccezione 
Type: com.sun.star.io.IOException
Message: .
/meta.xml
/Thumbnails/
/Thumbnails/thumbnail.png
/settings.xml
/Dialogs/
-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Re: [api-dev] OO Writer Extension

2009-04-02 Thread Paolo Mantovani
Hi Cristina,

Cristina Scheau ha scritto:
> Hi!
> I'm Cristina Scheau, a Computer Science student from Romania. I am new to
> Open Office API and  intend to develop a
> XWiki(http://www.xwiki.org<http://www.xwiki.org/xwiki/bin/view/Main/WebHome>)
>  Extension for OO Writer (this is my Gsoc proposal). My question is, there
> is a way to handle events from OO, like saving a document, or creating a new
> document?


Yes,
Your extension must contain a UNO service that supports the
com.sun.star.task.XJob  (or XAsyncJob) interface

Further, you have to include an appropriate configuration file
(jobs.xcu) that will contain information about which event will launch
your XJob component

More info here:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/Jobs

List of supported events:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/WritingUNO/Jobs/List_of_Supported_Events

HTH
Paolo Mantovani



-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] HELP by drawing a line in a Dialog ImageControl

2009-03-20 Thread Paolo Mantovani

Hi Ariel,

Ariel Constenla-Haile ha scritto:

Hello Fernand,

On Friday 20 March 2009, 11:47, Fernand Vanrie wrote:

Paolo ,

Thanks for tyour quick Replay, but the problem must be elsware: its
 the codeines before my drawings who are giving trouble 
oImagcontrol.visible(false) ..some other actions 
oImagcontrol.visible((true)


When i let the ImageControl visible, then the line is drawn when 
changing from invisible to visible no more drawing... same effect 
witht enabling  and setting the dimensions to 0 . I try further 
with the paintlistener or let  the imagecontrol visible al the time

 :-)


as Paolo told you, the things you do with the image control trigger a
 repaint, that is, what you have drawn must be redrawn (by you, not 
by the image control itself).


As a simple example, just draw a line a dialog, then move the dialog
so that part of the line is not visible because it's off-screen. When
you move the dialog back to make it fully visible, that part of the
line has disapear, you must redraw it. Also if you add a paint
listener you'll see when and how many repaint event take place.



I must recognize that I wasn't very clear in my reply.
Your explanation sounds much better :-)

Thanks
Paolo M

-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] HELP by drawing a line in a Dialog ImageControl

2009-03-20 Thread Paolo Mantovani
Fernand Vanrie ha scritto:
> I need some help to resolve a puzzle for me
> I trie to draw a line in a Imagecontrol in a Dialog
> The The line is drawn with the Sub below but only when the sub is called
> from a mouseclick (event) on a other control in the dialog
> When calling the sub from a codeline no drawing, when a I put a "print" 
> before the "DrawRect" then after closing the "printwindow" the draw is
> done 
> why ???

I guess that your modifications become visible only after a repaint event
Please see this code snippet and adapt to your needs (just replace the
dialog with your imagecontrol):

http://codesnippets.services.openoffice.org/Office/Office.DrawingOnDialogs.snip

ciao
Paolo M


-
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org



Re: [api-dev] Re: Intercepting commands ".uno.xxx..."

2008-11-05 Thread Paolo Mantovani
Hello Andreas,

Andreas Schlüns ha scritto:
> Hi Paolo,
[...]
> You are right ... it's possible ... but I wouldnt do that !

And I totally agree, but I like so much to find this kind of sneaky
tricks in StarBasic :-)


> Why ?
> 
> a)
[...]
> b)
> On the other side I believe you can run into trouble with lifetime of
> your basic objects. They are bound to the document ... if it's removed
> from memory your basic bindings are gone ... 

My example was contained into a document, but it could be run even from
a shared library.
AFAIK a global variable into a shared library lives for all the ooo session.
Perhaps using global vars for referencing basic objects would make
things safer?

> ...
> If you know what are you doing there you can try it ... but at least I
> think it's one for OOo-API-experts .-)

Of course you're right! The next time I'll add:
"PLEASE, DON'T TRY THIS AT HOME!!!" :-)

Thanks for the clear and very useful explanation
Paolo Mantovani


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



Re: [api-dev] Re: Intercepting commands ".uno.xxx..."

2008-11-04 Thread Paolo Mantovani

Hi,

Andreas Schlüns ha scritto:

Hi Carlos,


(I'm using Automation Bridge to communicate with OOo)

After reading again all the stuff and trying to digest the java 
sample, this is what I conluded:


I need to implement my own "DispatchProvider" as a COM object an pass 
it as a parameter to "registerDispatchProviderInterceptor", in the 
same way I do to register listeners, am I right? (is this the reason 
why Ariel said this can't be achieved with Basic?)


Exactly. You "register" your interception in the same you register a 
listener. registerDispatchProviderInterceptor() is the right method 
doing that.


And yes ... OOo basic do not support complex structures as e.g. classes
and so it's not possible to implement an interceptor in basic.


Why not? You can register your own dispatch-interceptor in Starbasic and 
you can even define your custom dispatches in order to react to user actions


Please find the small example document in attachment.

ciao
Paolo Mantovani


TestDispatchInterceptor.odt
Description: application/vnd.oasis.opendocument.text
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [api-dev] Scriptable Formula framework.

2008-07-19 Thread Paolo Mantovani
Il domenica 20 luglio 2008 00:56:50 Paolo Mantovani ha scritto:
> Hi Robert,

sorry, I meant to reply to Marcin


ciao
Paolo M

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



Re: [api-dev] Scriptable Formula framework.

2008-07-19 Thread Paolo Mantovani
Hi Robert,

Il venerdì 18 luglio 2008 14:02:31 Marcin Miłkowski ha scritto:
> Robert Vojta pisze:
> > On Thu, Jul 17, 2008 at 10:43 PM, Marcin Miłkowski <[EMAIL PROTECTED]> 
> > wrote:
> >> Unfortunately, Basic functions must be defined in the Standard module,
> >> otherwise they don't work. And therefore they cannot be packed in an
> >> extension.
> >
> > If you put your new function in My macros, it doesn't work. But when
> > you put your function in any library stored within your calc document,
> > it works.
>
> In other words, you cannot pack into the extension, right? It must be
> stored within the document. At least I couldn't find the way and the
> answer on the forum was that it's impossible.
>
> I'm asking because there is a nice Polish "numbers-to-words" macro in
> Basic that we would love to pack into an extension instead of making
> users to copy and paste macros...

You can deploy additional Calc functions making an Add-in. (a special kind of 
extension)
Here you can find an add-in with the italian "number-to-words" function
http://www.paolo-mantovani.org/downloads/PyInLettere/

It's written in Python (unfortunately it's not possible to write add-in's in 
StarBasic)


HTH
Paolo M



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



Re: [api-dev] Macro Questions

2008-06-27 Thread Paolo Mantovani
Hi Hal,

Il venerdì 27 giugno 2008 01:17:22 Hal Vaughan ha scritto:
> Is no answer, in this case, because nobody's done this or because it
> can't be done?

It can be done.
Andrew already gave you some good hints (as usual!) but I'll try anyway to add 
some (hopefully) useful info


> I used to remember parts of the API, but it's tough to learn your way
> around in, and I was hoping I wouldn't have to do much of that again.
>
> Are there functions in the API that a macro (or Java) can address that
> allow saving or renaming or manipulating macros?

Yes, see below

[]
> > So here's what I'm thinking I'd like to do: Write a macro that would
> > prompt for specific text, then ask for the key I want to bind it to.

Ok I suppose that you will do this with a dialog, so, no problems here.


> > Once I enter both, it not only creates the macro on it's own
> > (automatically naming it), 

This is the way to dinamically add macro code:

---
'prepare strings
sLF = Chr(10)
sCode = "REM  *  BASIC  *" & sLF
sCode = sCode & "Sub Test()" & sLF
sCode = sCode & "'  automatically generated macro" & sLF
sCode = sCode & "   MsgBox ""This is a test!""" & sLF
sCode = sCode & "End Sub" & sLF

'get the lib container
oDoc = ThisComponent
oBasicLibs = oDoc.BasicLibraries

'add a new library
oLib = oBasicLibs.createLibrary("MyLib")

'add a module with some code
oLib.insertByName("MyModule", sCode )
---

In this case the code creates a new library and module but you can similarly 
work with existing ones.



> > but also binds it to the key mentioned 
> > (preferably only in that document).  

The following code instead shows the way to bind a key combination 
(ctrl+shift+Z) with the previously created macro ( MyLib.MyModule.Test ), 
only for a specific document

---
'setup the keybinding (ctrl+shift+Z)
Dim aKeyEvt As New com.sun.star.awt.KeyEvent
aKeyEvt.Modifiers = com.sun.star.awt.KeyModifier.SHIFT + _
com.sun.star.awt.KeyModifier.MOD1 'ctrl key
aKeyEvt.KeyCode = com.sun.star.awt.Key.Z

sCmd= _
"vnd.sun.star.script:MyLib.MyModule.Test?language=Basic&location=document"

oShortCutMgr = oDoc.UIConfigurationManager.ShortCutManager
oShortCutMgr.setKeyEvent(aKeyEvt, sCmd)
oShortCutMgr.store()
---

Of course into a real life application you'll need to add a lot of code to 
check (for example) that the key combination is not already in use, or the 
macro name does not contains forbdden chars and so on...



ciao
Paolo M

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



Re: [api-dev] new-style service constructors

2008-06-16 Thread Paolo Mantovani
Hi Ariel,

Il lunedì 16 giugno 2008 07:24:36 Ariel Constenla-Haile ha scritto:
> Hello Paolo,
>
> Paolo Mantovani escribió:
> > In practice, if I well understand Frank's answer, using
> > createWithArguments/AndContext/AndWhatever things it's not better than
> > simply doing:
> >
> > obj = CreateUNOService("service.name")
> > obj.initialize(Array(arg1, arg2, arg3))
> >
> > because this is what (more or less) currently happens behind the scene
>
> this simpler way will fail depending on how is the service implemented.
> For example if we test this on the
> com.sun.star.deployment.ui.PackageManagerDialog, with *this* new-style
> service, one can not *first* call createUnoService() and *then*
> initialize() passing to this last call the constructor's parameters,
> because, as shown in the example bellow, initialize() "fails" == the
> object returned by createUnoService() has no such method, as
> XInitialization is not implemented.
[]

Ok now it's clear, I didn't catch this aspect of the problem.


> Anyway, we, API clients, shouldn't in theory get worried about how
> things are implemented, and rely instead only in the specification... And
> OOo Basic programmers should have a way to instantiate new style services
> at least as simple as createUnoService().

Yes, I hope hope that this issue will be fixed soon 

Thanks again for your patience :-)

ciao
Paolo M



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



Re: [api-dev] new-style service constructors [comes from "How to get the canonical path from a script URL..."

2008-06-15 Thread Paolo Mantovani
Hello Ariel,

Il domenica 15 giugno 2008 23:41:06 Ariel Constenla-Haile ha scritto:
[]
> > I must admit that I don't know the exact meaning of "new-style service"
> > but
[]
> A new style service has constructor(s) to instantiate it, and directly
> returns a reference to its interface.
> For example
[]

Thanks for the clear explanation and examples.



> Notice that one has to use the
> css.lang.XMultiComponentFactory:createInstanceWithContext/createInstanceWit
>hArgumentsAndContext,
>
>
> not the old
> css.lang.XMultiServiceFactory:createInstance/createInstanceWithArguments,
> although the former still works; see Jürgen's comment on
> http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=18526
>
> And even this is not completely "safe" in OOo Basic, as it is
> implementation specific; quoting Frank's in
> http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=18530

In practice, if I well understand Frank's answer, using  
createWithArguments/AndContext/AndWhatever things it's not better than simply 
doing:

obj = CreateUNOService("service.name")
obj.initialize(Array(arg1, arg2, arg3))

because this is what (more or less) currently happens behind the scene



> "So, the bottom line is: createInstanceWithArguments[AndContext] *might*
> work, but if it doesn't (or stops working the next version), don't
> complain."

Ok, I'll not complain, but let me say that IMHO the impact over the (I think) 
most used automation language should have been considered *before* to 
introduce such important modifications 

I don't even dare to ask if and how new-style services can be used or even 
implemented in PyUNO ... 


> Frank's issue requesting support for new-style service constructors in
> Basic is http://www.openoffice.org/issues/show_bug.cgi?id=82918,
> targeted to 3.X due to lack of resources.


Thank you very much
Paolo Mantovani

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



Re: [api-dev] How to get the canonical path from a script URL, or at least the root directories "user" and "share" in a reliable manner ?

2008-06-15 Thread Paolo Mantovani
Hi Ariel,

Il sabato 14 giugno 2008 22:13:45 Ariel Constenla-Haile ha scritto:
[]
> http://api.openoffice.org/docs/common/ref/com/sun/star/script/provider/Scri
>ptURIHelper.html for the service description ("This service is used to help
> transform Scripting Framework storage locations to Scripting Framework
> script URIs and vice versa."), this *seems* to be what you're looking for
> (didn't try it yet in Basic, as there is no simple way to instantiate a
> new-style service here; 

I must admit that I don't know the exact meaning of "new-style service" but 
I've tried with createInstanceWithArguments on the service manager and it 
seems to work:

-
REM  *  BASIC  *

Sub Test
oSM = GetProcessServiceManager()
sSrvc = "com.sun.star.script.provider.ScriptURIHelper"
mArgs() = Array("Python", "share")
oScriptURIHelper = oSM.createInstanceWithArguments(sSrvc, mArgs())

s = _
"vnd.sun.star.script:HelloWord.py$HelloWordPython?language=Python&location=share"
s = oScriptURIHelper.getStorageURI(s)
Print s

s = oScriptURIHelper.getScriptURI(s)
Print s

End Sub
-


ciao
Paolo Mantovani




 

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



Re: [api-dev] How to supress the repair document dialogue?

2008-05-15 Thread Paolo Mantovani
Tobias Krais ha scritto:
> Hi Fernand,
> 
>> is it not one of tharguments needed by "LoadComponentFromURL"
>> for altering the "MacroExecutionMode" i ues the code below i supose your
>> there must been also a "non repair" argument ?
>>
>>  mFileProperties(0).Name="MacroExecutionMode"
>>  mFileProperties(0).Value=4
>> oDocument = StarDesktop.LoadComponentFromURL(ConvertToURL(sfile),
>> "_blank", 0, mFileProperties())
> 
> Thanks for the hint. Can anyone tell me the name of the argument? Is
> there an overview over the arguments available?

In the IDL documentation for the service css.document.MediaDescriptor
I see:

boolean
RepairPackage   [ OPTIONAL ]
let the document be opened in repair mode


but I can't tell more because I never used that argument

ciao
Paolo

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



Re: [api-dev] How to access the binary stream "application/vnd.sun.star.pkg-stream" inside an ODT package?

2008-03-21 Thread Paolo Mantovani
Hi Giuseppe,

Il mercoledì 19 marzo 2008 12:46:05 Giuseppe Castagno ha scritto:
> Hi all,
>
> After I successfully opened a package (e.g. an ODT document) with Java
> using UCB low level APIs, I tried to read the content of one of the
> contained streams.
>
> With no luck so far. Is there somewhere some example about how to do that?
>
> After I successfully opened it with (sorry for the ugly indentation):
> 
[]
> XContentIdentifier xIdPackStream =
> xIdFactory.createContentIdentifier(aThePackageUrl+"/META-INF/manifest.xml")
>;
[]
> It seems the wrong approach since xResultSet throws an exception.
>
> Any help is greatly appreciated.

Perhaps I've been facing a similar problem in past:
If you are using a vnd.sun.star.pkg:// protocol you cannot access 
the /META-INF/manifest.xml because it is actually part of the format
Please, see the following:
http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1590673
http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1590934
http://api.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=13383

greetings from the foggy Ferrara :-)
Paolo M



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



Re: [api-dev] AWT: some questions concerning Toolkit "inconsistencies"

2008-02-29 Thread Paolo Mantovani
Hi Carsten,

[...]
> Hi Paolo,
> 
> I didn't catch that we talk about the UnoControlContainerModel as a 
> "normal" control. It's simple, you cannot nest
> UnoControlContainerModel. Although you can add it them into a
> container model, they won't do anything useful. May be the creator of
> the toolkit project had something in mind with this specialty, I
> don't know.
[...]

The capability to contain other controls would be highly desireable,
specially if you want to make some advanced used interface.

IIRC in VBA there are several controls that are also control-containers,
for example the ImageControl or the tabbed-control and others.

Another missing capability would be to overlay controls.
Currently this is possible but with unpredictable results. Anyway this
is another story.

Back to nested controlcontainers, as said from Ariel, you can nest
containers even today, but the technique used, athough it works fine, it
looks a bit hacky and AFAIK it's not documented (at least not for the
use with UNODialogs )
My presentation at ooocon2007 was about this stuff (among other things)
Actually the user interface of the BasicAddonBuilder extension is built
in that way.

ciao
Paolo M.










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



Re: [api-dev] AWT: some questions concerning Toolkit "inconsistencies"

2008-02-29 Thread Paolo Mantovani
Hi,

Carsten Driesner ha scritto:
[...]
>> Third (and last for now): com.sun.star.awt.UnoControlContainer and
>> com.sun.star.awt.UnoControlContainerModel go beyond my understanding,
>> although I've been using them so far this way
>>
>> - instantiate both at the global service manager
>> - set the model at the control
>> - add the control to a parent XControlContainer
>>
>> It turns out that the model can be instantiated at the dialog model's
>> XMultiServiceManager (obviously just because it supports
>> UnoControlModel), and then be inserted by name in the dialog model's
>> XNameContainer.
>> But when the control model is instantiated this way, there is no control
>> at all: XControlContainer::getControl() at the UnoControlDialog returns
>> null.
> The control is the "view" of the control model. If you insert a model
> there is no view. The view will be created on demand when you call
> execute() at XDialog.

In my test, the result is a null reference, before and after the
execute() call:

-
REM  *  BASIC  *

Sub Main

oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
oCCM =
oDlg.Model.createInstance("com.sun.star.awt.UnoControlContainerModel")
With oCCM
.PositionX = 10
.PositionY = 10
.Width = 45
.Height = 14
End With
oDlg.Model.insertByName("CC", oCCM)

'test before execute
Print IsNull(oDlg.getControl("CC"))

oDlg.execute

'test after execute
Print IsNull(oDlg.getControl("CC"))

End Sub
-

Trying the same test with ordinary controls (controls that are listed in
the dialog-model service manager) you will obtain a valid reference to
the control-view in both cases (before and after the execute() call)


Ciao
Paolo M




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



Re: [api-dev] xStorable.getLocation() return old MS-DOS style path - How to solve?

2008-02-20 Thread Paolo Mantovani
Hi Tobias,

Tobias Krais ha scritto:
> Hi together,
> 
> I have a litte application and need to know the full path of the current
> document. Thus I use the XStorable interface. Using the
> xStorable.getLocation() method returns on a Windows XP system (using OOo
> 2.3): file:/F:/DOKUME1/Tobias/EIGENE1/...
> Correct would be: file:/F:/Dokumente und Einstellungen/Tobias/Eigene
> Dateien/...
> Is there a way to get the REAL full path of the document?

Some time ago it was reported a similar issue on my extension
BasicAddonBuilder:
http://extensions.services.openoffice.org/project/BasicAddonBuilder

This is the thread:
http://extensions.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1830122

And this is the fix that I've applied:

--
Declare Function GetLongPathName Lib "kernel32.dll" Alias
"GetLongPathNameA" ( _
ByVal lpszShortPath As String, lpszLongPath As String, ByVal cchBuffer
As Long) As Long


Function FixDOSFilePath(ByVal sDOSFilePath As String) As String
Dim lLen As Long
Dim sBuffer As String
sBuffer = String(260, Chr(0))
lLen = GetLongPathName(sDOSFilePath, sBuffer, Len(sBuffer))
FixDOSFilePath = Left(sBuffer, lLen)
End Function
--

HTH
Paolo M


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



Re: [api-dev] looking for DecimalSeparator in OOoBasic

2008-02-15 Thread Paolo Mantovani
Hi Cor,

Cor Nouws ha scritto:
> Hi,
> 
> I know how to get the OOoLocale and DecimalSeparatorAsLocale [1], but
> I'm looking for the decimal separator itself.
> I know I should get XLocaleData, but the dev guide [2] says "No further
> functionality is discussed." Cannot find it elsewhere.

The following code works for me :

-
oLocaleData = createUnoService("com.sun.star.i18n.LocaleData")
dim aLoc As New com.sun.star.lang.Locale
aLoc.Language = "it"
aLoc.Country = "IT"
aLocItem = oLocaleData.getLocaleItem(aLoc)
Print aLocItem.decimalSeparator
-


HTH
Paolo M.

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



Re: [api-dev] Learning macros: thanks to all

2008-02-15 Thread Paolo Mantovani

Jonathan Kaye ha scritto:
> Hi all,
> Thanks to the excellent advice I've received I now have (I believe) a
> working and bug free macro. One difficult (for me) piece of it was a macro
> called "cutspace" which scans a string until it finds either a fullstop or
> a space (let's call it a chunk) and gathers all the tones (indicated by
> 1234 in the string) and puts them at the end of the chunk. It works its way
> through the string moving the tones (if they are present) to the correct
> location. This function is only a small part of a much larger one which
> encodes strings in such a was as they are sorted correctly. The encoding
> are generated in a different column from the originals and the sort is
> based on that column (invisible to the reader, of course).
> Here's the code. If there are any OO Basic features I've missed that would
> simplified things, I'd be grateful to hear about them.

Not sure, but perhaps it could be useful:
http://codesnippets.services.openoffice.org/Office/Office.SimpleNaturalSortAlgorithm.snip

Here you can find some basic code that performs various string crunching
(move, search&replace, sort) using Regular Expressions from the
OpenOffice.org. API

ciao
Paolo M

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



Re: [api-dev] Re: the meaning of "="

2008-02-12 Thread Paolo Mantovani
Hi,

Il lunedì 11 febbraio 2008 20:12:48 Jonathan Kaye ha scritto:
> Steffen Grund wrote:
> > Hello,
> >
> > I am not the Basic expert here, but wouldn't something like this work?
> >
> > While Position <> 
> >  Position = Instr(i, ProcessString, " ")
> >  etc. etc. etc.
> > Wend
> >
> > and just initialize Position before, so it does not have the exit value?
>
> Hi Steffen,
> In fact, no it wouldn't. I'm processing entries in a spreadsheet which may
> have an arbitrary number of spaces in them. The entries also contain
> numbers. The idea is that all the numbers within a given chunk have to wind
> up at the end of the chunk next to a following space or EOL. So the exit
> condition would be when there are no more spaces left in the entry. I do
> this by successively shrinking the value of ProcessString with each loop.

I'm not sure to understand what you're trying to archieve.
May you provide an example of the kind of data that you expect as input and 
the correspondig output that you would obtain from the function ?



> The actual code I wrote looks like this:
> Function cutspace(ProcessString) as String
[...]

> Lft = Lft + movetones(Chunk) + " "

What is "movetones" ?


ciao
Paolo M


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



Re: [api-dev] XTextDocument - Mouse double click (XTextTable, XCell)

2008-01-06 Thread Paolo Mantovani
Hi Robert,

Il domenica 6 gennaio 2008 17:27:39 Robert Vojta ha scritto:
> Hallo all,
>
> is there an easy way how to obtain object from XTextDocument, which
> received mouse double click event? I would like to know in which XCell
> (in XTextTable) this event happend. My goal is to open special window
> for XTextTable's XCell editing.

I think that you can do this by registering a XMouseClickHandler in the 
CurrentController of the document.
In the event handler you should check the ViewCursor for the TextTable and 
Cell properties
Please see the example below.

However, the example does not manage the case of current controller changed 
(e.g. if the user creates a new view)
I think that you could manage this case by registering an XFrameActionListener 
on the Desktop service, but I'm not so sure that this is the the best way.

HTH
Paolo M

-

REM  *  BASIC  *

Global oDoc As Object
Global oMouseClickHandler As Object

Sub RegisterMouseClickHandler
oDoc = ThisComponent
oMouseClickHandler = CreateUnoListener( _
  "MyDoc_", "com.sun.star.awt.XMouseClickHandler")
oDoc.CurrentController.addMouseClickHandler(oMouseClickHandler)
End Sub


Sub UnregisterMouseClickHandler
On Error Resume Next
oDoc.CurrentController.removeMouseClickHandler(oMouseClickHandler)
End Sub


Function MyDoc_mousePressed(oEvt As Object) As Boolean

MyDoc_mousePressed = False
End Function


Function MyDoc_mouseReleased(oEvt As Object) As Boolean
If oEvt.ClickCount = 2 And oEvt.Buttons = 1 Then
  oCursor = oDoc.CurrentController.ViewCursor
  If oCursor.getPropertyState("TextTable") = 0 Then
sTable = oCursor.TextTable.Name
sCell = oCursor.Cell.CellName
MsgBox sTable & "." & sCell
  End If
End If
MyDoc_mouseReleased = False
End Function


Sub MyDoc_disposing(oEvt As Object)
'nothing to do
End Sub 

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



Re: [api-dev] How to deploy Python macros as Addon

2007-12-12 Thread Paolo Mantovani
Hi Stephan,

Il lunedì 10 dicembre 2007 10:03:49 Stephan Bergmann ha scritto:
> Noelson Duarte wrote:
> > Hi Paolo,
> >
> > Paolo Mantovani escreveu:
> >>> I want to know if is it possible to deploy it as an Addon
> >>
> >> I think yes
> >>
> >>> and, if yes, what
> >>> is the URL used within addons.xcu to call func1 ?
> >>
> >> You should find this info in the dev-guide, here:
> >> 19.6.1  "Scripting Framework URI Specification"
> >
> > Seems that URI does not work:
> > -
> > vnd.sun.star.script:myScript.py$func1?language=Python&location=user:uno_p
> >ack age/myAddon.oxt
> >
> > When installing, Extension Manager, raises an exeception:
> > Configuration Parser: a com.sun.star.xml.sax.SAXParseExeception ...
> > invalid tokenerror
>
> Could it be that you fail to xml-ize the above URL (i.e., replace "&"
> with "&")?

wooppzz! I think you are right (I'll try ASAP)

Thank you very much
Paolo mantovani

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



Re: [api-dev] How to deploy Python macros as Addon

2007-12-08 Thread Paolo Mantovani
Il sabato 8 dicembre 2007 20:46:46 Noelson Duarte ha scritto:
> Hi Paolo,
>
> Paolo Mantovani escreveu:
> > > I want to know if is it possible to deploy it as an Addon
> >
> > I think yes
> >
> > > and, if yes, what
> > > is the URL used within addons.xcu to call func1 ?
> >
> > You should find this info in the dev-guide, here:
> > 19.6.1  "Scripting Framework URI Specification"
>
> Seems that URI does not work:
> -
> vnd.sun.star.script:myScript.py$func1?language=Python&location=user:uno_pac
>k age/myAddon.oxt
>
> When installing, Extension Manager, raises an exeception:
> Configuration Parser: a com.sun.star.xml.sax.SAXParseExeception ... invalid
> tokenerror

To be true, I got the same error when I tried some months ago.
For this reason my BasicAddonBuilder still uses the old style URI 
("macro:///library.module.macro") for the addons.xcu that it generates.
But unfortunately the old-style URI works only for basic macros. 

I hope that someone else can suggest the right way, I'm interested too in this 
solution.

ciao
Paolo 

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



Re: [api-dev] How to deploy Python macros as Addon

2007-12-08 Thread Paolo Mantovani
Hi Noelson,

Il sabato 8 dicembre 2007 01:37:35 Noelson Duarte ha scritto:
> Hello,
>
> I've a py script with only two functions (no class) . From PyUNO docs I
> know that is possible to deploy scripting framework py files as UNO
> packages. All right.
>
> I want to know if is it possible to deploy it as an Addon 

I think yes

> and, if yes, what 
> is the URL used within addons.xcu to call func1 ?

You should find this info in the dev-guide, here: 
19.6.1  "Scripting Framework URI Specification"


HTH
Paolo

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



Re: [api-dev] SimpleSystemMail

2007-10-14 Thread Paolo Mantovani
Alle 13:36, sabato 13 ottobre 2007, Mathias Bauer ha scritto:
> Paolo Mantovani schrieb:
> > Regarding the problem that you mentioned in your follow-up I've just seen
> > that Mathias has alreadly answered.
> > I can only add that in the SnippetCreator wizard I've used the following
> > strategy:
[]
>
> That's what I suggested, put into Basic source code. :-)

True, actually I didn't add any useful information, I should have read your 
post more carefully :-)

ciao
Paolo M




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



Re: [api-dev] SimpleSystemMail

2007-10-12 Thread Paolo Mantovani
Hi Alexandro,

Alle 09:36, giovedì 11 ottobre 2007, Alexandro Colorado ha scritto:
> Hi Paolo,
>
> In Barcelona I asked you about the possibility of using SimpleSystemMail
> uno service to be able to send email from OpenOffice.org. The only
> reference I got to how it works is through the snippet on Andrew
> Pitonyak's Macro Book.

You can find another example in my SnippetCreator wizard (module DlgSnippet - 
Sub SnippetToEmail )


> Sub SendSimpleMail()
>Dim vMailSystem, vMail, vMessage
>
>vMailSystem=createUnoService("com.sun.star.system.SimpleSystemMail")
>vMail=vMailSystem.querySimpleMailClient()

Regarding the problem that you mentioned in your follow-up I've just seen that 
Mathias has alreadly answered.
I can only add that in the SnippetCreator wizard I've used the following 
strategy:



'try to obtain a mail service
oMailService = createUnoService("com.sun.star.system.SimpleSystemMail")

If IsNull(oMailService) Then
oMailService = createUnoService("com.sun.star.system.SimpleCommandMail")
End If

If IsNull(oMailService) Then
GoTo ErrH
End If





[]
> However I want to know if I would need a transport on my system so the API
> is able to send the email.  This is a similar dilema that I face with
> python's libsmtpd module which is capable of working as an smtpd server
> but there is really not much reference about how to run it.

I don't catch this point (but I must say that I'm not very acquainted with 
network things):

Even if you run an smtpd server from Python, the API relies on an external 
mail client program for sending emails, therefore, the external mail client 
should be previously configured for using your local smtp server.
So I don't see any advantages.


ciao
Paolo M


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



Re: [api-dev] Accessing a dialog from the frame hierarchy

2007-10-10 Thread Paolo Mantovani
ore flexibility but at the cost of some more code lines, especially for the 
UnoControls management


> For my original question, Mathias Bauer suggested 
> implementing a singleton UNO service for the dialog,
> but I was hoping 
> for some simpler way. I'm basically trying to create a glossary window
> for my app, acting something like the OOo Stylist (non-modal,
> always-on-top) and fully accessible to macros from the API.
>
> Bit long for a question, but it seems to me a useful problem to resolve.
> Hope someone can help me out here.

regards
Paolo Mantovani

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



Re: [api-dev] instantiating InstanceLocker from BASIC

2007-10-06 Thread Paolo Mantovani
Hello Marc,

Alle 14:50, sabato 6 ottobre 2007, Marc Santhoff ha scritto:
> Hi,
>
> when running this macro:
>
> 
> global doc as object
>
> sub LockerCheck
>   dim args(1) as new com.sun.star.beans.PropertyValue
>
>   doc = ThisComponent
>   args(0).Name = "xInstance"
>   args(0).Value = doc
>   args(1).Name = "nActions"
>   args(1).Value = 1 'com.sun.star.embed.PREVENT_CLOSE
>   psm = GetProcessServiceManager()
>   lck = 
> psm.createInstanceWithArguments("com.sun.star.embed.InstanceLocker",
> args()) if NOT IsNull(lck) then lck.dispose()
> end sub
> 
>
> the answer is not 42 but a messagebox saying:
>
>   css.lang.IllegalArgumentException
>   Nonempty reference is expected as the first argument!
>
> In parallel to the IDE there is only one writer doc opened for filling
> "ThisComponent" with something useful.
>
> What's going wrong here?
>


It seems that the problem is in the way in which you are passing arguments.
I've tried in this way:

sub LockerCheck
doc = ThisComponent
psm = GetProcessServiceManager()
args() = Array(doc, 3)
lck = _
psm.createInstanceWithArguments("com.sun.star.embed.InstanceLocker", args())
end sub

No error are raised in this case, and I'm quite sure that arguments are 
correctly processed .but I've got some crashes :-(
It seems that there are further problems, please check.
BTW what are you trying to achieve with this code? (I'm curious :-)


ciao
Paolo M



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



Re: [api-dev] Complex toolbars

2007-09-14 Thread Paolo Mantovani
Hi Dietmar,

Alle 20:07, giovedì 13 settembre 2007, Dietmar Hiller ha scritto:
> Am Dienstag, den 11.09.2007, 10:15 +0200 schrieb Carsten Driesner:
> > Hi Dietmar,
> >
> > ...You can use the complex toolbar controller feature with BASIC. ...

I must admit that I am very surprised to read this, and I'm very curious to 
hear some more details from Carsten

I ever thought that it was not possible since the documentation says that 
"Every add-on which wants to support a toolbar must be a dispatch 
provider..."

Infact, this seems to imply that the add-on must be written into a programming 
language that supports the definition and implementation of UNO services but 
AFAIK this is not currently possible in StarBasic.


> I am at my wits' end.
> My understanding up to now is: I have the configuration file
> "ProtocolHandler.xcu" where I define a handler that is passing to me
> events defined in the URL of my toolbar elements. Now I just need to
> create an initializer and a listener to catch these events. Here I am
> stuck, I admit I am not deep enough into the heart of UNO to understand
> the online SDK sufficiently to know what to do in BASIC now. The example
> is of course object oriented and without knowing the objects in detail
> it is tough to understand.
> So here is the deal I want to offer. Someone please take me by the hand
> to find my way (I already googled, obviously I am the first) and I will
> write a comprehensive code snippet or wiki (your choice) for followers
> in BASIC and support them through the forums.

I've tried some experiments and I've created an example StartBasic package 
where I was able to manage in a very limited way a "complex toolbar control"

I didn't use the dispatch mechanism because, as I said, I have no idea how to 
implement and register a dispatch provider in starbasic, so I tried a 
different approach, with the LayoutManager and accessibility API's

Actually I was able to load a list of items into a combobox and I was able to 
get the selected value when the user changes the selection
Most probably there is also the possibility to enable/disable and hide/show 
the combobox.

For other complex controls than comboboxes I was not able to make any 
operations, so I am at my wits end too :-)


ciao
Paolo Mantovani

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



Re: [api-dev] Moving CoceSnippets into the Wiki?

2007-08-28 Thread Paolo Mantovani
Hi Juergen,

Alle 09:00, martedì 28 agosto 2007, Juergen Schmidt ha scritto:
[...]
> > This is not needed, the snippet creator is already able to edit existing
> > snippets.
> > Just download the original codesnippet from the repository using the
> > "snippet source" link, and open it with the snippet creator. (you should
> > find the "open" button in the "SnippetCreator" toolbar )
>
> I know this feature and have already used it but it still requires one
> more step by hand. 

True

> I thought more about an automatism without 
> downloading the snippet manually.

As you know, this is something that we could manage.

I don't want to speak in favour or against the wiki proposal because I haven't 
a clear opinion yet.
I want only say that If you'll decide to keep the current solution, I'll be 
happy (as usual) to put my effort in order to improve the snippet-creator 
extension.

That said, I'm not so sure that the lack of snippet submissions is really due 
to the difficulties that you mentioned (not completely at least)

Perhaps the initial idea behind the snippet repository is 
now a bit outdated and we should discuss about this and about our goals before 
to replace the tools that we're using.

ciao
Paolo Mantovani






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



Re: [api-dev] Moving CoceSnippets into the Wiki?

2007-08-27 Thread Paolo Mantovani
Hi,

Alle 18:04, lunedì 27 agosto 2007, Laurent Godard ha scritto:
> Hi juergen
>
> >> In other words: Are we really sure migration to the Wiki is the best
> >> way? I'm uncertain about it.
> >
> > we are not 100% sure but it is worth a test from my point of view. We
> > haven't really a huge number of snippets and the question is why. My
> > impression is that it is to complicate. It might be also a solution to
> > have some kind of snippet creator form integrated in the existing infra
> > structure. But then it is the question who would be able and have the
> > time to prepare such a form ... Or we can extend the snippet creator to
> > support direct import of existing snippets ...
>
> sounds good to me
> may be make a call for volunteers ?

This is not needed, the snippet creator is already able to edit existing 
snippets.
Just download the original codesnippet from the repository using the "snippet 
source" link, and open it with the snippet creator. (you should find 
the "open" button in the "SnippetCreator" toolbar )

The only problem is that the "snippet source" link worked well in a first 
moment but currently it seems broken.

regards
Paolo Mantovani


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



Re: [api-dev] how to do custom formula functions embedded in the document?

2007-08-01 Thread Paolo Mantovani
Hi Christian,

Alle 10:09, mercoledì 1 agosto 2007, Ionel Maries Cristian ha scritto:
> eh... that's a start. how about xml processing ? i need a dom-like access
> and very posibly features like xpath and xsl transformation.

I think that you could try with the com.sun.star.xml.dom.DocumentBuilder 
service, but I've no experience with it.
This is a quick experimenti that I've just tried:

8<
REM  *  BASIC  *

Sub ExampleDOM
oDocBuilder = createUnoservice("com.sun.star.xml.dom.DocumentBuilder")
oUcb = createUnoService("com.sun.star.ucb.SimpleFileAccess")
sUrl = "file:///home/paolo/CodeSnippet.snip"
oFile = oUcb.OpenFileReadWrite(sUrl)

oXmlDoc = oDocBuilder.parse(oFile.GetInputStream)
'use xray to inspect oXmlDoc and discover how to
'work with child-nodes and xml-attributes
End Sub
8<


In alternative you can use a SAX parser:
check the source of the SnippetCreator utility:
http://www.paolo-mantovani.org/downloads/SnippetCreator/
You'll find a starbasic module "ImportXML" that uses the 
com.sun.star.xml.sax.Parser service.


ciao
Paolo M

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



Re: [api-dev] List of supported language names

2007-07-26 Thread Paolo Mantovani
Hi Juergen,

Alle 08:19, giovedì 19 luglio 2007, Juergen Schmidt ha scritto:
> Hi Paolo,
>
> it's a good question and i assume that you can't get a list of all
> supported languages via API. For the NetBeans plugin we hard coded this
> list which is of course not optimal. Anyway a list which you get from
> your current working office can be out dated s well.

Grepping in the $OFFICE/program/resource/ dir, I've found that the svx*.res 
file contains the list that I'm looking for.
I've tried to extract the strings from there with a "brute force" method :-) 
but without success:
8<
REM  *  BASIC  *
Global oResSrv
sub ExtractResStrings
oResSrv = GetDefaultContext.getByName( _
  "/singletons/com.sun.star.resource.OfficeResourceLoader")
oBundle = oResSrv.loadBundle_default("svx")
j = 0
oDoc = StarDesktop.LoadComponentFromURL( _
 "private:factory/scalc","_default",0,Array())
oSheet = oDoc.Sheets(0)
  For I = 0 To 35000
sText = oBundle.getDirectElement("string:" & I)
If Trim(sText) <> "" Then
  oSheet.getCellByPosition(0,j).String = "string:" & I
  oSheet.getCellByPosition(1,j).String = sText
  j = j+1
End If
  Next I
end sub
8<

Anyway I recognize that even if I would be able to extract the information 
from the office resources, it would be a poor solution, because it would 
depends from an implementation detail (the resource identifiers) that, as 
stated in the IDL documentation, may change in a next ooo version 


> I would suggest a 
> hard coded list + free edit field to support future languages. The list
> can be updated from version to version.

Yes this would be the best option, but 150 locales x 150 translations are a 
table with  over 20K elements. It seems a huge work for a single (lazy) 
person (me) :-) 
So I'm trying find a shortcut to avoid all this hard work :-)


> I will try to find out if we can provide an API for that and if the info
> is available somewhere in the office (i expect not, at least not for a
> single language version)

I guess that the "lang-table" should be already in the office resources 
because it is shown in the basic IDE (the new dialog localization tool, for 
example)
Perhaps an API that provide the information could be done "simply" creating an 
optional interface for the service com.sun.star.i18n.LocaleData, just like 
the XLocaleData2, that provides the getAllCurrencies2 method to get all 
currencies for a given locale.

However, I think that an API for getting localized lang-Info would be a great 
help for developers that want to provide extensions for the basic IDE (just 
like basicaddonbuilder in effect) 
For example, extensions that assist the user in the creation of certain 
dialogs could use this API.

Back to my specific needs:
In meantime I've better investigated the API and I've found a way to get 
something very near to my needs.

the com.sun.star.i18n.LocaleData service supports the method:

  XLocaleData.getAllInstalledLocaleNames()

this method gets a sequence with all supported locales (currently are 149)
The same interface supports also the method:

  XLocaleData.getLanguageCountryInfo(aLocale)

Combining these two methods I've been able to get a list of all supported 
languages and countries with their descriptive names.

Of course, descriptive names are given in English only (not localized) , but 
it's indeed a great step ahead for me and I will adopt this solution in my 
app (BasicAddonBuilder), at least in a first moment.


Thank you
Paolo mantovani


P.S.:
Just in case someone's interested, below the code that I've used to test the 
service. The macro creates a calc document with information about all 
supported locales:

REM  *  BASIC  *

Sub Main
oLocaleData = _
 createUnoService("com.sun.star.i18n.LocaleData")
oDoc = StarDesktop.LoadComponentFromURL( _
 "private:factory/scalc","_default",0,Array())
oSheet = oDoc.Sheets(0)

i=0
oSheet.getCellByPosition(0,i).String = "[Locale ID]"
oSheet.getCellByPosition(1,i).String = "[Locale description]"

i=1
For Each aLocale In oLocaleData.AllInstalledLocaleNames()
  aInfo = oLocaleData.getLanguageCountryInfo(aLocale)
  sLocID = aInfo.Language
  If aInfo.Country <> "" Then
sLocID = sLocID & "_" & aInfo.Country
  End If
  If aInfo.Variant <> "" Then
sLocID = sLocID & "_" & aInfo.Variant
  End If
  
  sLocDesc = aInfo.LanguageDefaultName
  If aInfo.CountryDefaultName <> "" Then
sLocDesc = sLocDesc & " (" & aInfo.CountryDefaultName & ")"
  End If
  
  oSheet.getCellByPosition(0,i).String = sLocID
  oSheet.getCellByPosition(1,i).String = sLocDesc
  
  i = i + 1
Next

End Sub

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



Re: [api-dev] Some Calc Java Macro Issues:

2007-07-18 Thread Paolo Mantovani
Hi,

Alle 17:49, mercoledì 18 luglio 2007, Juergen Schmidt ha scritto:
> Hi Denis,
>
> Denis Camargo wrote:
> > I would like to thank everyone for the hints and tips and code
> > supplied. I have deployed a new version of my Java macro, and its
> > performance has improved by staggering 3,500%. The class in my last
> > post is working fine, I am able to activate the autofilters now
> > easily.
> >
> > I would like to suggest adding that class to the code snippets
> > project. How can I do it?
>
> you can find infos on the main site
> http://codesnippets.services.openoffice.org/index.xml. there you will
> find also a link to Paolo's useful SnippetCreator extension.

I've just seen that in that page there are 2 links, but one of them points to 
an old version of the snippet-creator. However, the latest version is here:

http://www.paolo-mantovani.org/downloads/SnippetCreator/

Also installation instructions are a bit outdated (based on the old pkgchk 
tool) 

regards
Paolo Mantovani

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



Re: [api-dev] Hmm ... (Re: [api-dev] Is there an example for packaging macros as an extension somewhere

2007-07-14 Thread Paolo Mantovani
Hello Rony,

Alle 10:43, venerdì 13 luglio 2007, Rony G. Flatscher ha scritto:
[...]
> After reading the text you pointed me to and looking once more to the
> BasicAddonBuilder I finally looked through the "View -> Toolbars" and
> saw there was a Basic Addon Toolbar, which I found afterwards, and as
> you write, consists of one entry.

In effect the small toolbar is not easily visible because it initially appears 
docked in the top-left corner. I'll put it floating in a 
next version of the package


>
> In the meantime I looked over the code which is really impressive ans
> shows the high command Paolo has gained over that area of OOo!
>
> Unfortunately, at the moment it would be a little bit too much time
> consuming research effort to try to extend it to cater generically for
> all macro languages that happen to be installed on the system.
>
> Things like:
>
> * how to get a list of the installed macro languages,
>   o what is the exact spelling of a macro language (E.g. "java"
> vs. "Java"),
>   o what is the URL to indicate a specific macro from a specific
> macro language should be used (with or without arguments),
> * how to get a list of existing macro libraries
>   o "user-home"/user/Scripts
>   o "shared-hoome"/shared/Scripts
> * how to get a list of
>   o existing macro files (in the Python case there are macros
> right in "./Scripts/python", i.e., the home of macro
> language directory contains already scripts.
>
> These questions are probably easy to answer by those in the know, which
> would help save quite some research time. (Maybe someone who knows could
> just give hints/pointers where to look into?)

All these information are accessible through the singleton:
"com.sun.star.script.browse.theBrowseNodeFactory"

I've put a basic example at the end of this post.
Copy the source in your StarBasic IDE and run the first macro.
It should create a spreadsheet with a hierarchical list of the macros for all 
supported languages. (it may take some time...)

>
> Once this knowledge is available, one could start to try to generalize
> the current BasicAddonBuilder to become a true "MacroAddonBuilder" (like
> having a choice for the desired macro language initially, and maybe even
> allow to pick any macro from any macro language to execute, if a toolbar
> button or menu option got chosen)?


All the necessary code is (more or less) already in the BasicAddonBuilder, but 
I've deliberately limited the choice to Starbasic only. Not only, I've used 
the old style macro URL's in the generated addons.xcu. ("macro:" protocol 
instead of the new and language agnostic "vnd.sun.star.script:" protocol)

This is because in my first experiments I got errors trying to install an 
addons.xcu with commands specified with the "vnd.sun.star.script:" protocol.

Anyway I think that it would be possibile (even if not so trivial) to make the 
BasicAddonBuilder language agnostic, removing limitations to basic only that 
I've introduced, but this would work only in the scripting domain, and not 
for deployng UNO components.
A more generic solution was suggested from Mathias Bauer in this post:
http://extensions.openoffice.org/servlets/ReadMsg?list=dev&msgNo=513

Until now I was oriented in this direction, but I'm open to any suggestions 
and contributions.
But, before to add new features I would like to finish my todo list:
- Localization of UI items in the generated Addons.xcu 
- Versioning support
- Licensing support
- Dependances support

and I really need help for the first entry! :-)
I've posted my question here some days ago but I didn't receive any reply ;-(
http://api.openoffice.org/servlets/ReadMsg?list=dev&msgNo=17858

Perhaps my question was not well explained?

ciao
Paolo M

-8<-


REM  *  BASIC  *

Dim oSheet As Object
Dim iRow As Integer

sub BrowseMacrosExample
  oDoc = StarDesktop.loadComponentFromUrl( _
"private:factory/scalc","_default",0,Array())
  oSheet = oDoc.Sheets(0)
  
  oBrowseNodeFactory = GetDefaultContext.getValueByName( _
"/singletons/com.sun.star.script.browse.theBrowseNodeFactory")

  iViewType = _
com.sun.star.script.browse.BrowseNodeFactoryViewTypes.MACROORGANIZER
  aMasterProviders() = oBrowseNodeFactory.createView(iViewType).ChildNodes()
  
  iLevel = 0
  iRow = 0
  For Each oMasterProvider in aMasterProviders()
oSheet.getCellByPosition(iLevel, iRow).String = oMasterProvider.Name
PrintChildNodes(oMasterProvider, iLevel+1)
iRow = iRow+1
  Next oMasterProvider

end sub

Sub PrintChildNodes(oParent, iLevel)
On error resume next
  For Each oChild In oParent.ChildNodes()
iRow = iRow+1
oSheet.getCellByPosition(iLevel, iRow).String = oChild.Name
If HasUnoInterfaces(oChild, "com.sun.star.beans.XPropertySet") Then
  If oChild.PropertySetInfo.hasPropertyByName("URI") Then
oSheet.getCellByPositio

Re: [api-dev] MODEL and CONTROL have different size ?why have

2007-07-12 Thread Paolo Mantovani
Hi Fernand,

Alle 11:11, giovedì 12 luglio 2007, Fernand Vanrie ha scritto:
> Hallo again,
>
> Recantly i experienced that the Model and the Control of an dialog
> ellement  have different sizes
>
> more: when setting the userGUI scaling to 100% then the ratio  between
> Model and Control is
>
> 1.95 for the Vertical dimensions
>
> 1.62 for the Horizontal dimensions
>
> This ratio's changes when using a different scaling factor in the user GUI
>
> Can someone explains me the reason for this "bissar" differences in sizes ?


Perhaps do you mean that in the control model the measures are in ma(*) while 
in the control view the measures are in pixels?

(*) Map AppFont (ma) is an internal measure unit that is device and resolution 
independent. One Map AppFont unit is equal to 1/8 of the system font height 
and 1/4 in width.

HTH
Paolo M

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



Re: [api-dev] List and webarchive IDs

2007-06-28 Thread Paolo Mantovani
Hi Christian,

Alle 20:15, martedì 26 giugno 2007, Christian Lohmaier ha scritto:
> Hi Paolo, *,
>
> On 6/26/07, Paolo Mantovani <[EMAIL PROTECTED]> wrote:
> > Alle 13:10, lunedì 25 giugno 2007, Christian Lohmaier ha scritto:
> > > [IDs of the ML and the Webinterface]
> >
> > Thank you for the useful information.
> >
> > But  (perhaps I'm missing something), does it exist any way to obtain the
> > mailinglist-ID  for a given message? or shoud I find it by tries and
> > errors?
>
> One that was delivered to you: Yes, there is a Return-Path header like
> this: Return-Path: <[EMAIL PROTECTED]>
>
> Where the 17945 would be the mailinglist-ID of that message.

Ah OK now I see! it's the first header! 
I was too blind to see it before!

> Unfortunately, this header is not added to the web-archive on the ooo site,
> and most other web-archives strip many headers as well.
>
> (And getting the mail again, when you still have access to it is
> pretty pointless)

In effect...


>
> So the only way to get it is via the index unfortunately :-(

Thanks again, I didn't know all that things.

I filed an issue:
http://www.openoffice.org/issues/show_bug.cgi?id=78985


ciao
Paolo M

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



Re: [api-dev] List and webarchive IDs (was: SnippetCreator on German Windows XP: errors, because "filename too long" !)

2007-06-26 Thread Paolo Mantovani
Hi Christian,

Alle 13:10, lunedì 25 giugno 2007, Christian Lohmaier ha scritto:
> Hi *,
>
> On 6/25/07, Paolo Mantovani <[EMAIL PROTECTED]> wrote:
> > [...]
> > ops! :-)
> > This is the unwanted result of one of my attempts to get the original
> > message from the ezmlm program (the ML manager)
> >
> > BTW I discovered (empirically) that, strangely, you have to apply a +84
> > to the message ID number in your request.
>
> No, that's not the case. Unfortunately, the IDs of the webinterface
> and those the
> mailinglist uses don't macht, and there's no constant difference, that
> 84 is just by
> chance, and probably tomorrow you'd have to use another number.
>
> You unfortunately have to retrieve the index of the messages first to
> get the real ID

Thank you for the useful information. 

But  (perhaps I'm missing something), does it exist any way to obtain the 
mailinglist-ID  for a given message? or shoud I find it by tries and errors? 


> (or use mail-archive.com, the reply from there should have a correct
> reply-to header set, although the address needs to be changed to that 
> of the ML) 

Yes, I've seen. Good advice, thanks!


regards
Paolo Mantovani

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



Re: [api-dev] SnippetCreator on German Windows XP: errors, because "filename too long" !

2007-06-26 Thread Paolo Mantovani
Alle 16:03, lunedì 25 giugno 2007, Rony G. Flatscher ha scritto:
[]
> after my posting I realized that I was using the "shared" variant of
> installing the snippet creator which "lands" the files in another file
> system branch than user, so I wanted to double check after I got some
> time again, whether the "user" part is working as well (it does!).
>
> So all of these variants of installing and de-installing the
> SnippetCreator (still on OOo 2.1, didn't have a chance to update to
> 2.2.1 yet) works on the German version of Windows XP:
>
> * commandline "unopkg add SnippetCreator-20070624.oxt", starting
>   Snippet creator successfully, de-installing with "unopkg add
>   SnippetCreator-20070624.oxt",
> * from within OOo using the extension manager: adding o.k., starting
>   Snippet creator o.k., de-installing Snippet creator o.k.,
> * running "unopkg gui" which allows to install extensions also as
>   shared: adding o.k., starting Snippet creator o.k., de-installing
>   Snippet creator o.k.
>
> So it really seems, that everything (in all of those combinations) works!

Great!
Thank you very much for the deep testing.
Paolo Mantovani

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



[api-dev] List of supported language names ()

2007-06-26 Thread Paolo Mantovani
hi *

The StarBasic IDE now has a dialog where you can manage localized strings for 
your StarBasic dialogs or controls.

From this dialog, by pressig the Add button, you can access to another dialog 
that contains a list of all supported language names.

I need to implement a very similar dialog , where the user can insert a string 
for a given locale (previously selected from a list)

Where all that localized language names are stored? 
Are they accessible via the com.sun.star.resource.OfficeResourceLoader 
singleton ? 

thanks
Paolo M






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



Re: [api-dev] SnippetCreator on German Windows XP: errors, because "filename too long" !

2007-06-25 Thread Paolo Mantovani
Hello Rony,

Alle 11:47, lunedì 25 giugno 2007, Rony G. Flatscher ha scritto:
> Buongiorno Paolo,
>
> > Sorry for the late reply, but for some reasons I missed your message (now
> > found in the ML archive)
>
> Nothing to be sorry of! Just saw that my original post (2007-06-14)
> popped up yesterday (2007-06-24) again, as if it came back from the
> Pirates of the Caribbean... ;)

ops! :-)
This is the unwanted result of one of my attempts to get the original message 
from the ezmlm program (the ML manager)

BTW I discovered (empirically) that, strangely, you have to apply a +84 to the 
message ID number in your request.

> > Although the issue seems not specific of the SnippetCreator extension
> > (and may potentially affect other extensions), I tried to workaround by
> > shortening my registry path. The new version is available here:
> > http://www.paolo-mantovani.org/downloads/SnippetCreator/
> >
> > Please have a try and let me know.
>
> Thank you very much for your help!
>
> Was able to successfully install this version of the snippet creator
> (using the command line as: "unopkg add --shared
> SnippetCreator-20070624.oxt") and am able to run it!

Great, I'll wait some days for the announce, in meantime any feedback are 
welcome

Thank you
Paolo M

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



Re: [api-dev] SnippetCreator on German Windows XP: errors, because "filename too long" !

2007-06-24 Thread Paolo Mantovani
Hi Rony,

Date: Thu, 14 Jun 2007 21:31:51 +0200
From: Rony G. Flatscher
> Hi there,
>
> when installing the SnippetCreator on a German version of Windows XP an
> interesting problem may occur: the length of the path (including the
> file name "AddonConfiguration.xcs") exceeds even some of the operating
> system (!) functions like copy (!!). It is not possible to delete that
> file from the command line with the "del" command, however using the
> Windows explorer works fine.
>
> Here is the path into which the SnippetCreator gets installed to on a
> German Windows XP. As you can see, the profiles' root is already named
> quite long as: "Dokumente und Einstellungen":
[]
> Is there anything I could/should do to remedy the situation and gain a
> working installation of the SnippetCreator? (This is OOo 2.1 at the
> moment, will be upgrading to 2.2.1 over the weekend.)

Sorry for the late reply, but for some reasons I missed your message (now 
found in the ML archive)
Although the issue seems not specific of the SnippetCreator extension (and may 
potentially affect other extensions), I tried to workaround by shortening my 
registry path.
The new version is available here:
http://www.paolo-mantovani.org/downloads/SnippetCreator/

Please have a try and let me know.

Thanks again for your feedback
Paolo Mantovani

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



Re: [api-dev] [code snippet] PrivateProfileString

2007-06-24 Thread Paolo Mantovani
Hi Cor,

Alle 21:26, sabato 23 giugno 2007, Cor Nouws ha scritto:
> Hi Paolo,
>
> Thanks for your pointers,
>
> Paolo Mantovani wrote:
> > I this post :
> > http://scripting.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=48
> > you can find a similar replacement but based on the
>
> So your only four years ahead ;-)

:-)
In general, storing/retrieving persistent information is a very old problem.
I think that many ooo extensions or macros have their own approach for this 
task.

> If I read it correct, its especially for the OO registry, not for
> (txt)ini-files like:

Correct.


> >>Anyway, I've made two functions myself, which could be placed in the
> >>codesnippets.
> >>Is someone skilled in doing that swiftly?
> >
> > Have you tried with the SnippetCreator wizard?
> > It should be very helpful in order to write codesnippets with a minimal
> > effort
>
> I have noticed, but not yet tried. I happened to read a comment lately
> on this(?) list, from two people having some trouble running it,

Thank you for the info!
For some reason I missed that post. sorry
I'll try to fix the problem very soon

ciao
Paolo M

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



Re: [api-dev] [code snippet] PrivateProfileString

2007-06-22 Thread Paolo Mantovani
Hi ,

Alle 17:17, venerdì 22 giugno 2007, Cor Nouws ha scritto:
> Hi,
>
> Those familiar with VBA might know the PrivateProfileString function,
> that can read/write the Windows registry as well as an ini-file.
> The latter had my interest and I searched for an existing replacement;
> makes conversions easier.
> But I didn't find any replacement (maybe didn't seach good enough).

I this post :
http://scripting.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=48
you can find a similar replacement but based on the 
com.sun.star.registry.SimpleRegistry service, instead of the old style basic 
statements for file I/O

Since my code is very old (May 2003) it uses the css.frame.Settings service 
that in meantime has been deprecated and should be replaced with the 
css.util.PathSettings service. A part from this it should work quite well


> Anyway, I've made two functions myself, which could be placed in the
> codesnippets.
> Is someone skilled in doing that swiftly?

Have you tried with the SnippetCreator wizard?
It should be very helpful in order to write codesnippets with a minimal effort

ciao
Paolo M

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



Re: [api-dev] AWT Table in OpenOffice.org

2007-05-03 Thread Paolo Mantovani
Hi,

Alle 10:24, giovedì 3 maggio 2007, Frank Schönheit - Sun Microsystems Germany 
ha scritto:
> Hi Cedric,
>
> > I'ld like to create a table to present some data in an OpenOffice.org
> > dialog. I'ld like to know which service(s) should be used to create a
> > table like the one in the "Options > Fonts" page.
>
> There is no AWT table control available (yet), sorry.
> I suppose the only 
> chance is to add a lot of single controls in a table-like layout, and
> manage them (including scrolling and the like) manually. Not really
> convincing, admittedly.

it would be an interesting challenge, however.
(and very useful if released as uno component !)

I did something similar in the BasicAddonBuilder package :
http://wiki.services.openoffice.org/wiki/Extensions_Packager

infact, the menu / toolbar preview are implemented in StarBasic using many awt 
controls created and managed runtime.
The menu preview (pseudo) control is in practice a table with four columns, so 
I hope you can find some useful ideas.
All the related code is in the MenuPreview and ToolbarPreview modules (library 
BasicAddonBuilderServices)

There is a problem because AWT does not supply "logical colors" so in certain 
cases a custom component does not respect the environment settings.

Another problem is the integration into AWT dialogs:
Dialog controls are normally created via the DialogModel::XMultiServiceFactory 
interface.
Unfortunately there is no way (AFAIK) to register your own controls in that 
factory.
You can create awt controls from the default ServicaManager, but 
they will not support the UnoControlDialogElement service (that supply 
properties like Step, TabIndex, Tag etc.)
So I had to use a trick to add my "pseudo" awt controls and make them to 
behave properly in the "host" dialog.


regards
Paolo M




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



Re: [api-dev] Re: How to re-select a multi selection with a macro?

2007-04-23 Thread Paolo Mantovani
Alle 09:18, lunedì 23 aprile 2007, Volker Lenhardt ha scritto:
> Paolo Mantovani schrieb:
> > Hi Johnny,
> >
> > Alle 19:43, domenica 22 aprile 2007, Johnny Andersson ha scritto:
> >> 2007/4/21, Johnny Andersson <[EMAIL PROTECTED]>:
> >>> I know how to do that with simple selections (I am talking about
> >>> Writer, but it would also be interesting to know the same about Calc)
> >>> with only one selection, and I thought I figured out how to do it with
> >>> several selections, but my idea failed completely. No matter what I
> >>> did, I couldn't reselect more than one single selection.
> >
> > I've already asked the same question some days ago, but unfortunately it
> > seems that nobody has the answer.
> >
> > http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=169
> >2337
[]
> Hi,
>
> it could be worth while taking Andrew Pitonyak's selected text framework
> into consideration:
>
> Homepage: http://www.pitonyak.org/oo.php
> Document: http://www.pitonyak.org/AndrewMacro.odt
> Chapter: 7.3. Andrew's Selected Text Framework

Of course I've read the Andrew's manual, but I'm still not able to make a 
multiple selection in Writer using macros.
Would you please give me more precise instructions ?

thanks
Paolo M



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



Re: [api-dev] Re: How to re-select a multi selection with a macro?

2007-04-22 Thread Paolo Mantovani
Hi Johnny,

Alle 19:43, domenica 22 aprile 2007, Johnny Andersson ha scritto:
> 2007/4/21, Johnny Andersson <[EMAIL PROTECTED]>:
> > I know how to do that with simple selections (I am talking about Writer,
> > but it would also be interesting to know the same about Calc) with only 
> > one selection, and I thought I figured out how to do it with several
> > selections, but my idea failed completely. No matter what I did, I
> > couldn't reselect more than one single selection.

I've already asked the same question some days ago, but unfortunately it seems 
that nobody has the answer.

http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1692337

ciao
Paolo M

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



Re: [api-dev] Replaceing selected text with Basic Macro

2007-04-16 Thread Paolo Mantovani
Alle 00:31, martedì 17 aprile 2007, Johnny Andersson ha scritto:
> I have a small problem that I just can't figure out at these late hours
> (00:13 right now):
>
> I have written a macro that reads highlighted text and replaces it with
> something else (which is calculated by the macro).
>
> To read the highlighted text I use ThisComponent.getCurrentSelection
> ().getByIndex(0).getString().
>
> This caused me no problems, however I couldn't figure out the parameter in
> getByIndex(0). Why 0? What does it mean? 0 what? I tried 1 and 2 but they
> only caused errors.

Because the getCurrentSelection() method in writer normally gets a
com.sun.star.text.TextRanges (that is a container)
In general it contains at least one TextRange, but in case of multiple 
selection it contains more elements.
Use the getCount() method to discover how many TextRanges are actually 
selected


> Ok, I guess I can figure that one out myself with some help from Google, so
> here is my real question:
>
> When I replace the highlighted text, I do that with
> ThisComponent.getCurrentSelection().getByIndex(0).setString(MyString). The
> problem is that I want the new inserted string also to be highlighted, so I
> can perform the macro on it without having to highlight it manually.
>
> Any ideas? Is there some better way to do this?
>
> Just an example to illustrate what I mean:
[]

Hoping that I have correctly understood your example, the following code 
should do (more or less) what you need.
Check the Andrew Pitonyak's macro document for better techniques and examples

---8<---
REM  *  BASIC  *

Sub Main

oRange = ThisComponent.currentselection(0)
oText = oRange.getText()

oCursor = oText.createTextCursorByRange(oRange)
bAbsorb = True
oText.insertString( oRange, "new string", bAbsorb)

'restore selection
ThisComponent.CurrentController.select(oRange)

End Sub
---8<---


ciao
Paolo M

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



Re: [api-dev] Quotes in strings (OpenOffice.org Basic)

2007-04-16 Thread Paolo Mantovani
Alle 23:21, lunedì 16 aprile 2007, Johnny Andersson ha scritto:
> Hi!
>
> I can't figure out how to sent a quote character (") to a function.
> '"' doesn't work and things like "\"" doesn't work either, and of course
> """ also will fail.

You can use double quoting inside a string in this way:

print "this is ""a"" string"
print 

ciao
Paolo

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



Re: [api-dev] extension's max supported OOo version

2007-03-25 Thread Paolo Mantovani
Hello Mathias,

Alle 08:41, venerdì 23 marzo 2007, Mathias Bauer ha scritto:
[]
> >> I suppose one can think of more things which contribute to an
> >> extension's required environment, but are not guaranteed to be stable
> >> over major OOo upgrades.
> >
> > dispatch Url's are probably one of these things.
>
> Not necessarily. My take on dispatch URL's is that they should stay
> stable also except if we removed the functionality in a newer version.
> But even in this case the code using it would still work; you just
> wouldn't get a dispatch for the URL and so the dispatch appears to be
> disabled, something the extension must be able to handle anyway
>
> So the generic nature of the dispatch API helps to keep the code
> compatible even if the funtionality behind the dispatch might have been
> changed or removed. Everything else can be dealt with in the code.
[]

Thanks for the clarification.
However I've cited dispatch URL's only because I recently had to fix an old 
macro that stopped to work with ooo2.0
The macro uses the dispatchHelper to open the spell dialog.
In ooo1.x the dispatch URL was ".uno:Spelling" and in ooo2.x it has been 
changed in ".uno:SpellDialog"
Anyway I've retrieved this info using the macro recorder, so I couldn't say if 
the URL ".uno:SpellDialog" was already in ooo1.x 

Thank you
Paolo M

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



Re: [api-dev] extension's max supported OOo version (was: [api-dev] external application getting OOo version number)

2007-03-22 Thread Paolo Mantovani
Hi,

Alle 20:20, giovedì 22 marzo 2007, Frank Schönheit - Sun Microsystems Germany 
ha scritto:
> Hi Stephan,
[...]
> I suppose one can think of more things which contribute to an
> extension's required environment, but are not guaranteed to be stable
> over major OOo upgrades.

dispatch Url's are probably one of these things.

ciao
Paolo M

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



Re: [api-dev] performing multiple selections in Writer

2007-03-17 Thread Paolo Mantovani
Alle 16:29, sabato 17 marzo 2007, Christoph Jopp ha scritto:
> P.S.:
>
> I forgot to say:
> The Selection-Array consists of two elements more than selections are in
> the document.
> The "real" selections are found through index 1 to n-1.

The first elem (0) is an empty range that represents the current cursor 
position (I think)


ciao
Paolo M

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



Re: [api-dev] performing multiple selections in Writer

2007-03-17 Thread Paolo Mantovani
Hi Christoph,


Alle 16:26, sabato 17 marzo 2007, Christoph Jopp ha scritto:
> Hi Paolo,
>
> I played a bit around with your code and found following:
>
> You can hand an array of TextRanges to .select()
>
> So the code
>
> oCurrCon = ThisComponent.CurrentController
> oSelect() = ThisComponent.getCurrentController().getSelection()
> oSelect().getByIndex(1).setString("ciao")
> oCurrCon.select(oSelect())
>
> Does nearly what you want, but has still some problems.
>
> The changed TextRange will not be "visibly" selected in this multiple
> selection 

This is exactly what I would to avoid, so this is not a solution for me



> but will do so in a single selection 
>
> oCurrCon.select(oSelect().getByIndex(1))
>
> All other - unchanged - elements of the array will.

Simply because the select method does not recognize the XTextRanges container 
as a valid object to select

In practice, this instruction:
oCurrCon.select(oSelect())

equivals to this one:
oCurrCon.select(Null) 

In other words, the XTextRanges container that you get from the 
getCurrentSelection call is simply ignored by the select method


> Somehow the TextRanges in the array seem to be not updated properly.
> Also, if you let the Controller visibly select a single TextRange first,
> you can change visible selection to another TextRange but also can't
> create a visible multiple selection afterwards through
> CurrentController.select(...).

this is the point.



>
> If this is no bug, I find it not very reasonable at least.

Nobody can say that this is a bug because it seems that there is no 
documentation about what can be passed to the select method and what results 
you may expect.

Anyway I would consider reasonable that if an object is the output of a 
getSelection() call the same object should be selectable.



>
> Maybe I'll find a workaround later.

You'll be  welcome :-)


ciao
Paolo M

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



[api-dev] performing multiple selections in Writer

2007-03-16 Thread Paolo Mantovani
Hi all,

sorry for the dumb question, but I'm not able to figure this out..

I've a macro that modify the selected text (in writer)
example:

txtrange = ThisComponent.CurrentSelection(0)
txtrange.setString("ciao")

At this point the selection is lost, but I can easily restore it in this way:

ThisComponent.CurrentController.select(txtrange)

The problem is with multiple selections: 
Perhaps I'm missing something, but I couldn't find any way to perform a 
multiple selection via API.

Or perhaps does it exists another way to modify the selected text without to 
lost the user selection?


Thank you for any help
Paolo M

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



Re: [api-dev] Changing images in dialog interactively

2007-02-27 Thread Paolo Mantovani
Hi Dietmar,

Alle 19:20, martedì 27 febbraio 2007, Dietmar Hiller ha scritto:
> Hallo Carsten,
>
> Am Sonntag, den 25.02.2007, 19:09 +0100 schrieb Carsten Driesner:
> > Dietmar Hiller schrieb:
> > > I want to interactively change the image in an "ImageControl" of a
> > > dialog.
> > > ...
> >
> > ...
> > Am I right that your images are also part of your extension?
>
> Yes that's the problem. Therefore I do not know the location of the
> images in the end.
> Actually there is a discussion on
> http://www.oooforum.org/forum/viewtopic.phtml?p=209595#209595 , but I
> was not yet able to try that approach (the evenings are too short). I
> intend to follow on there now.

You can find another explanation with some example here:
http://marketing.openoffice.org/ooocon2005/presentations/thursday_d4.sxi

The following basic extensions use the same approach for images shown in their 
dialogs:
http://www.paolo-mantovani.org/downloads/BasicAddonBuilder/BasicAddonBuilder-20061201.uno.pkg
http://www.paolo-mantovani.org/downloads/SnippetCreator/SnippetCreator-20060707.uno.pkg

In attachment you'll find an example extension with a minimal implementation 
of the same concept

ciao
Paolo Mantovani




library1.oxt
Description: Zip archive
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: [api-dev] [code snippet] Improve sorting capabilities

2007-02-09 Thread Paolo Mantovani
Alle 14:55, venerdì 9 febbraio 2007, Stefan Weigel ha scritto:

> Thank you. It is not exactly the same effect, because the current
> region should only be selected if the current selection contains one
> single cell. Otherwise, if the current selection contains a range of
> more than one cell, the selection must not be changed.

of course you're right

[...]
> So there needs to be added some if-clause regarding the number of
> rows or columns in the current selection. That´s easy for me, I think.

Don't forget the cases of multiple range and shapes selection ;-)


ciao
Paolo M

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



Re: [api-dev] [code snippet] Improve sorting capabilities

2007-02-09 Thread Paolo Mantovani
Hi Stefan,

Alle 22:28, giovedì 8 febbraio 2007, Stefan Weigel ha scritto:
> Hi Paolo,
>
> Paolo Mantovani schrieb:
> > There are some reasons fon not using the method
> >  XSheetCellCursor::collapseToCurrentRegion()
> > instead? or perhaps am I missing something ?
>
> Oh yes, there is a reason: I am an absolute beginner with
> programming in OpenOffice.org and simply did not know about this method.
>
> Thank you for the hint.

The following sub should have the same effect of your original 
SelectCurrentRange

In effect you don't need to select the current region to use it in your 
following code, unless you do it in order to give some feedback to the user

sub SelectCurrentRegion
Dim oDoc, oSheet, oSelection, oCursor

oDoc = ThisComponent
oSheet = oDoc.CurrentController.ActiveSheet
oSelection = oDoc.CurrentSelection

oCursor = oSheet.createCursorByRange(oSelection)
oCursor.collapseToCurrentRegion()
oDoc.CurrentController.select(oCursor)

End Sub


>
> Coming from Microsoft´s VBA I am completely spoiled by the Visual
> Basic IDE, that automatically shows up all possible methods,
> properties and subobjects while typing. I have not managed yet to
> develop my strategy in order to easily find these things in
> OpenOffice.org Basic.

I use Xray from Bernard Marcelly.
Used in conjunction with the SDK it is an exceptional tool to investigate ooo 
API objects.

ciao
Paolo M





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



Re: [api-dev] [code snippet] Improve sorting capabilities

2007-02-09 Thread Paolo Mantovani
Alle 22:28, giovedì 8 febbraio 2007, Stefan Weigel ha scritto:
> Hi Paolo,
>
> Paolo Mantovani schrieb:
> > There are some reasons fon not using the method
> >  XSheetCellCursor::collapseToCurrentRegion()
> > instead? or perhaps am I missing something ?
>
> Oh yes, there is a reason: I am an absolute beginner with
> programming in OpenOffice.org and simply did not know about this method.

Ok, I was not sure to have understood correctly your code because of the 
german comments.

ciao
Paolo M

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



Re: [api-dev] [code snippet] Improve sorting capabilities

2007-02-08 Thread Paolo Mantovani
Hi Stefan,

Thank you for the nice code-snippet. (and useful of course :-)
Just a small question:
I see a sub SelectCurrentRange where you used the dispatchHelper to select the 
current region:
There are some reasons fon not using the method
 XSheetCellCursor::collapseToCurrentRegion() 
instead? or perhaps am I missing something ?

thanks
Paolo M

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



Re: [api-dev] Most convenient way to delete cells in a macro?

2007-01-27 Thread Paolo Mantovani
Alle 17:19, sabato 27 gennaio 2007, Johnny Andersson ha scritto:
[...]
> By the way, do you happen to know if there is a better way to check if a
> cell range is empty than the following?
>
> Dim Blah As Variant
> Blah=ThisComponent.Sheets.getByIndex
> (0).getCellRangeByPosition(0,2,1,2).getDataArray()
> If IsEmpty(Blah) Then
>{Do something}
> EndIf

I have never tried this way.
it would seem not so bad, except for the poor performance in case of very big 
cell range. (I'm guessing but I'm not 100% sure anyway)

Personally I would try with one of the query* methods, for example :

iCellAttr = _
com.sun.star.sheet.CellFlags.VALUE + _
com.sun.star.sheet.CellFlags.DATETIME + _
com.sun.star.sheet.CellFlags.STRING + _
com.sun.star.sheet.CellFlags.ANNOTATION + _
com.sun.star.sheet.CellFlags.FORMULA + _
com.sun.star.sheet.CellFlags.HARDATTR + _
com.sun.star.sheet.CellFlags.STYLES + _
com.sun.star.sheet.CellFlags.OBJECTS + _
com.sun.star.sheet.CellFlags.EDITATTR + _
com.sun.star.sheet.CellFlags.FORMATTED

oQueryResult = thisComponent.CurrentSelection.queryContentCells(iCellAttr)
print oQueryResult.count



ciao
Paolo M

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



Re: [api-dev] Most convenient way to delete cells in a macro?

2007-01-27 Thread Paolo Mantovani
Alle 13:04, sabato 27 gennaio 2007, Johnny Andersson ha scritto:
[]
> I recorded a macro when I deleted a cell range and the result looks like
> this:
[]

Just for info: if you often use the macro recorder for your macro projects, 
perhaps you may want to try the DispatchToAPI recorder, an alternative macro 
recorder (for Calc) that generate API based code.

For example, the macro that you have recorded in order to select a range and 
delete it's content would appears like the following (just recorded by me):

---
REM  *  BASIC  *

sub Main
' Recorded by Paolo Mantovani
' Date: Sat Jan 27 14:39:34 2007

' get access to the document
oDocumentModel = ThisComponent
oDocumentView = oDocumentModel.getCurrentController()
oDocumentFrame = oDocumentView.Frame

' the dispatcher service is used to send commands from the 
' document frame to the underlaying office application
oDispatcher = CreateUnoService("com.sun.star.frame.DispatchHelper")

oCellRange = oDocumentView.ActiveSheet.getCellRangeByName("A5:B6")
oDocumentView.select(oCellRange)

iContentType = com.sun.star.sheet.CellFlags.STRING + _
com.sun.star.sheet.CellFlags.VALUE + _
com.sun.star.sheet.CellFlags.DATETIME + _
com.sun.star.sheet.CellFlags.FORMULA + _
com.sun.star.sheet.CellFlags.ANNOTATION + _
com.sun.star.sheet.CellFlags.FORMATTED + _
com.sun.star.sheet.CellFlags.OBJECTS

oDocumentView.Selection.ClearContents(iContentType)

end sub


The dispatchToAPI recorder is deployed as OOo extension and is freely 
available from here:

http://www.paolo-mantovani.org/downloads/DispatchToApiRecorder/

You need also to install at least one "transformer" (currently there is only a 
Calc Transformer)
The transformer is also an extension and is the component that actually makes 
the Dispatch-to-API translation of the macro code
http://www.paolo-mantovani.org/downloads/DispatchToApiRecorder/transformers/

After the installation, you do not need to know anything else:
reboot openoffice and just use the macro recorder as usual.

If you want to switch back to the "classic" macro recorder you have only to 
remove or disable both extensions from the extension manager dialog.

Feel free to contact me for any further information

ciao
Paolo M


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



Re: [api-dev] Most convenient way to delete cells in a macro?

2007-01-27 Thread Paolo Mantovani
Hi Johnny,

Alle 13:04, sabato 27 gennaio 2007, Johnny Andersson ha scritto:
> Hi!
>
> Sorry for bothering again...
>
> When I delete the contents of a cell in a macro (for a spreadsheet
> document) I just set ThisComponent.Value to 0 and .String to "" and maybe
> also Formula to "" for each cell.
> Is there a quicker way to do this, requiring only one instruction?
> I want to obtain the same result as the backspace key does to a selected
> cell  range.
>
> I recorded a macro when I deleted a cell range and the result looks like
> this:
[...]
> I guess I could shorten this quite a bit and still keep the functionality,
> but isn't there an easier way?

You can also use "regular" Calc API's in this way:

REM  *  BASIC  *

Option Explicit

Sub TestClearContents
Dim oRange As Object
Dim iCellAttr As Integer

iCellAttr = _
com.sun.star.sheet.CellFlags.VALUE + _
com.sun.star.sheet.CellFlags.DATETIME + _
com.sun.star.sheet.CellFlags.STRING + _
com.sun.star.sheet.CellFlags.ANNOTATION + _
com.sun.star.sheet.CellFlags.FORMULA + _
com.sun.star.sheet.CellFlags.HARDATTR + _
com.sun.star.sheet.CellFlags.STYLES + _
com.sun.star.sheet.CellFlags.OBJECTS + _
com.sun.star.sheet.CellFlags.EDITATTR

oRange = ThisComponent.Sheets(0).getCellRangeByName("A1:B4")
oRange.ClearContents(iCellAttr)

End Sub



ciao
Paolo M

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



[api-dev] [announce] BasicAddonBuilder extension - new version

2006-12-01 Thread Paolo Mantovani
Hi all,

It's available a new version of the BasicAddonBuilder extension:
A tool that allow you to export a StarBasic library in the OpenOffice.org 
extension format.
By a wizard style dialog you can define in a very easy manner all UI elements 
needed from your extension without having to deal with complicated xml files.

More info:
http://wiki.services.openoffice.org/wiki/Extensions_Packager#BasicAddonBuilder

Please, notice that this is a very first version, partially untested and 
potentially dangerous for your data.
Be careful

Any feedback is welcome

Thank you
Paolo mantovani

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



Re: [api-dev] [SOLVED] zip write access throug UCB

2006-11-28 Thread Paolo Mantovani
Hi Mikhail, Kai,


Thank you very much for your replies.
Sincerely I didn't notice the note about the flush command. 
My mistake of course, but perhaps the docu could be improved here:

The examples on the dev guide are all generic (not about a specific content 
type), so the flush command is never shown.
Furthermore, when I read the IDL spec of the PCPFolder I found this:
 
  XCommandProcessor

Description
This interface is implemented according to the specification of service 
Content .


Aha!, OK!
So I jumped on the css.ucb.Content page and read, but the flush command is 
never mentioned.

Thanks again
Paolo M







Alle 09:15, martedì 28 novembre 2006, Kai Sommerfeld ha scritto:
> Hi all,
>
> Mikhail Voitenko wrote:
> > Hi Paolo,
> >
> > The provided by you link points to a solution using Package component.
> > But the writing to a zip file works well using the UCB too.
> >
> > The provided by you UCB-based example looks good from the first view,
> > except the missing "flash" command. It should be executed on the root
>
>  Actually, the name of the command is "flush".
>
> > content of the zip file "vnd.sun.star.zip:// > file>/". This command triggers the storing of all the changes made to
> > the zip file.
>
>  For your interest: The "flush" command has been introduced for
> performance reasons. As you can imagine zipping the whole file
> automatically upon every write operation can be quiete time consuming...
>
>  Documentation of the "flush" command can be found here:
> http://api.openoffice.org/docs/common/ref/com/sun/star/ucb/PackageFolderCon
>tent.html
>
> - Kai.
>
> -
> 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] [SOLVED] zip write access throug UCB

2006-11-25 Thread Paolo Mantovani
Hi,

I solved using the technique explained from Mikhail Voitenko in this old post:
http://api.openoffice.org/servlets/ReadMsg?listName=dev&msgNo=13383

Thank you
Paolo Mantovani

Alle 20:26, venerdì 24 novembre 2006, Paolo Mantovani ha scritto:
> Hi,
>
> me again, about zip packages...
> Thanks to help from Kai Sommerfeld I was able to read any contents into a
> zip file
>
> Now I'm trying to *write* contents, but again :-(  without any luke
> Please see my test code below
> Notice that if I try with a regular file URL the code works perfectly and I
> can modify or delete the file.
>
> Any help will be appreciated
> Paolo M
>
>
> REM  *  BASIC  *
>
> Sub WriteManifestTest
>
> oSM = GetProcessServiceManager()
> oUCB = oSM.createInstanceWithArguments( _
> "com.sun.star.ucb.UniversalContentBroker", Array("Local","Office"))
>
> sUrl = "file:///home/paolo/Library1.uno.pkg"
> sUrl = _
> "vnd.sun.star.zip://" & Join(Split(sUrl, "/"), "%2F")
> & "/META-INF/manifest.xml"
>
> 'sUrl = "file:///home/paolo/manifest.xml" '<---this works
> oID = oUCB.createContentIdentifier(sUrl)
> oProvider = oUCB.queryContentProvider(sUrl)
> oContent = oProvider.queryContent(oID)
>
> 'now write the manifest with empty data
> oMySinc = CreateUnoService("com.sun.star.io.Pipe")
> oWriter = CreateUnoService("com.sun.star.packages.manifest.ManifestWriter")
> oWriter.writeManifestSequence(oMySinc, array())
>
> Dim aArg1 As New com.sun.star.ucb.InsertCommandArgument
> aArg1.ReplaceExisting = True
> aArg1.Data = oMySinc
> UcbExecuteCommand(oContent, "insert", aArg1)
>
> 'UcbExecuteCommand(oContent, "delete", True)
>
> End Sub
>
>
> Function UcbExecuteCommand(oContent As Object, _
> sCommandName As String, aArgument As Variant) As Variant
>
> ' Assemble command to execute.
> Dim aCommand As New com.sun.star.ucb.Command
> aCommand.Name = sCommandName
> aCommand.Handle = -1 ' not available
> aCommand.Argument = aArgument
>
> ' Note: throws CommandAbortedException and Exception since
> ' we pass null for the XCommandEnvironment parameter
> UcbExecuteCommand = oContent.execute(aCommand, 0, Null)
>
> End Function
>
> -
> 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] zip write access throug UCB

2006-11-24 Thread Paolo Mantovani
Hi,

me again, about zip packages...
Thanks to help from Kai Sommerfeld I was able to read any contents into a zip 
file

Now I'm trying to *write* contents, but again :-(  without any luke
Please see my test code below
Notice that if I try with a regular file URL the code works perfectly and I 
can modify or delete the file.

Any help will be appreciated
Paolo M


REM  *  BASIC  *

Sub WriteManifestTest

oSM = GetProcessServiceManager()
oUCB = oSM.createInstanceWithArguments( _
"com.sun.star.ucb.UniversalContentBroker", Array("Local","Office"))

sUrl = "file:///home/paolo/Library1.uno.pkg"
sUrl = _
"vnd.sun.star.zip://" & Join(Split(sUrl, "/"), "%2F") 
& "/META-INF/manifest.xml"

'sUrl = "file:///home/paolo/manifest.xml" '<---this works
oID = oUCB.createContentIdentifier(sUrl)
oProvider = oUCB.queryContentProvider(sUrl)
oContent = oProvider.queryContent(oID)

'now write the manifest with empty data 
oMySinc = CreateUnoService("com.sun.star.io.Pipe")
oWriter = CreateUnoService("com.sun.star.packages.manifest.ManifestWriter")
oWriter.writeManifestSequence(oMySinc, array())

Dim aArg1 As New com.sun.star.ucb.InsertCommandArgument
aArg1.ReplaceExisting = True
aArg1.Data = oMySinc
UcbExecuteCommand(oContent, "insert", aArg1)

'UcbExecuteCommand(oContent, "delete", True)

End Sub


Function UcbExecuteCommand(oContent As Object, _
sCommandName As String, aArgument As Variant) As Variant

' Assemble command to execute.
Dim aCommand As New com.sun.star.ucb.Command
aCommand.Name = sCommandName
aCommand.Handle = -1 ' not available
aCommand.Argument = aArgument

' Note: throws CommandAbortedException and Exception since
' we pass null for the XCommandEnvironment parameter
UcbExecuteCommand = oContent.execute(aCommand, 0, Null)

End Function

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



Re: [api-dev] accessing to a zip through UCB

2006-11-24 Thread Paolo Mantovani
Hi Kai,

first of all, thanks for your prompt reply!
see my comments inline:

Alle 14:59, venerdì 24 novembre 2006, Kai Sommerfeld ha scritto:
> Hi Paolo,
>
> > sUrl = "file:///home/paolo/Library1.uno.pkg"
> >
> > 'This one DOES NOT WORK!
> > sUrl = _
> > "vnd.sun.star.pkg://" & Join(Split(sUrl, "/"), "%2F")
> > & "/META-INF/manifest.xml"
>
>  Using "vnd.sun.star.zip://" instead of "vnd.sun.star.pkg://" should do
> the trick.

It works!!! Great!!


>  "vnd.sun.star.pkg" URL addresses an OO.o package, not a plain zip file.
>  OO.o package does not allow access to all content of the zip file it
> actually resides in. 
> The fact that an OO.o package is a zip file is 
> actually an implementation detail.

I didn't thought this, but it actually makes sense, especially for the 
manifest.xml that is a special file for ooo packages and in the other hand it 
is a regular content for zip files.


Thank you very much
Paolo Mantovani

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



[api-dev] accessing to a zip through UCB

2006-11-24 Thread Paolo Mantovani
Hi,

I'm trying to read the manifest.xml content into a zipped package using the 
UniversalContentBroker service, but without any success.

When I execute the "open" command I get the following error:
Type: com.sun.star.ucb.InteractiveAugmentedIOException
Message: "Got no data stream!"
What am I doing worng?
(See my testing code below)

Thanks for any help
Paolo M


--
REM  *  BASIC  *

Sub ReadManifestTest

oSM = GetProcessServiceManager()
oUCB = oSM.createInstanceWithArguments( _
"com.sun.star.ucb.UniversalContentBroker", 
Array("Local","Office"))

sUrl = "file:///home/paolo/Library1.uno.pkg"

'This one DOES NOT WORK!
sUrl = _
"vnd.sun.star.pkg://" & Join(Split(sUrl, "/"), "%2F") 
& "/META-INF/manifest.xml"

'   sUrl = "file:///home/paolo/manifest.xml" '<-- This WORKS!

oID = oUCB.createContentIdentifier(sUrl)
oProvider = oUCB.queryContentProvider(sUrl)
oContent = oProvider.queryContent(oID)

oPropSet = UcbExecuteCommand(oContent, "getPropertySetInfo", Null)
oResult = UcbExecuteCommand(oContent, "getPropertyValues", 
oPropSet.getProperties())
print oResult.getString(1) ' OK! "application/vnd.sun.star.pkg-stream

Dim aArg As New com.sun.star.ucb.OpenCommandArgument2
aArg.Mode = com.sun.star.ucb.OpenMode.DOCUMENT
aArg.Priority = 32768

oMySinc = CreateUnoService("com.sun.star.io.DataInputStream")
aArg.Sink = oMySinc

aRes = UcbExecuteCommand(oContent, "open", aArg) ' ERROR HERE

oReader = 
CreateUnoService("com.sun.star.packages.manifest.ManifestReader")
mManifestProps() = oReader.readManifestSequence(oMySinc)

End Sub


Function UcbExecuteCommand(oContent As Object, _
sCommandName As String, aArgument As Variant) As Variant

' Assemble command to execute.
Dim aCommand As New com.sun.star.ucb.Command
aCommand.Name = sCommandName
aCommand.Handle = -1 ' not available
aCommand.Argument = aArgument
 
' Note: throws CommandAbortedException and Exception since
' we pass null for the XCommandEnvironment parameter
UcbExecuteCommand = oContent.execute(aCommand, 0, Null)

End Function

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



Re: [api-dev] question about XLibraryContainerExport

2006-11-17 Thread Paolo Mantovani
Hi Fernand,

Alle 10:22, venerdì 17 novembre 2006, Fernand Vanrie ha scritto:
> Paolo,
>
> Have a look at this treat:
> http://api.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=15360
>72 and also some others at my name

Thanks for the pointer and excuse me for not having searched the ML archive 
before to post.

>
> Maybe there is a workaround coping first to thz "global" an then back to
> the document

Good hint! I'll try to do in this way.


Thank you very much
Paolo Mantovani

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



  1   2   3   >