Re: [api-dev] Re: OpenNewView

2006-02-21 Thread Mathias Bauer
Vincenzo Giuliano wrote:

 Abstract:
 
 Vincenzo Giuliano wrote:
 
I am not able to open new view on calc document
  

 
 Whoever seeks will find.
 I writed this method which is fit for every OO Document and it opens
 always the view.
 what do you think of it?
 Can I improve it?

The code does what the menu command Window-New Window does. That's OK.
It's the best you can do for the time being. Besides that I think that
OOo currently does not treat OpenNewView correctly, means: it looks
like a bug.

Best regards,
Mathias

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

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



Re: [api-dev] Java: adding functionality to newly created menu item

2006-02-21 Thread Mathias Bauer
Tobias Krais wrote:

 Hi all,
 
 after I created successfully a new menu and menu item I now want to add
 functionality to the menu item. The functionality should be implemented
 in Java. Can you tell me where to start to learn doing this, or tell me
 some package- / interfacenames that are involved in doing this?

Menu commands are command strings that are handed over to the so called
Dispatch Framework. You can place internal commands there and then
some OOo code will be called or (if an interceptor is placed into OOo)
also some external code. You can also place external commands there
that can trigger code you provide in your component.

To make OOo call such external code you have to use commands with your
own naming scheme and implement and install a so called protocol
handler that handles commands using the scheme. All this is described
in the Developers Guide in the chapters about Dispatching and Add-Ons.

Best regards,
Mathias

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

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



Re: [api-dev] Re: Re: OpenNewView

2006-02-21 Thread Mathias Bauer
Vincenzo Giuliano wrote:

 Mathias Bauer wrote:
 
I think that
OOo currently does not treat OpenNewView correctly, means: it looks
like a bug.
  

 Hi Mathias,
 from what I can see, I gather that the java method can be useful.
 I could publish it as snippet code, what do you think of it?
 Regards,Vincenzo.

Yes, it can be useful until we get the bug fixed.

Best regards,
Mathias

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

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



Re: [api-dev] How to close the quickstarter

2006-03-02 Thread Mathias Bauer
Didier Dorange-Pattoret wrote:

 Declare Function GetActiveWindow Lib quot;user32quot; () As Long
 Declare Sub ExitProcess Lib quot;kernel32quot; (ByVal uExitCode As Long)
 
 Sub Essai
rem getting the active windowapos;s handle.
hWnd = GetActiveWindow()
rem closing all active windows
On error resume Next
myEnum = StarDesktop.Components.CreateEnumeration
Do while myEnum.HasmoreElements
oDoc = myEnum.NextElement
If HasUnoInterfaces(oDoc, quot;[EMAIL PROTECTED] 
 com.sun.star.util.XCloseable}quot;) Then
oDoc.close(true)
Else
oDoc.dispose()
End If
Loop
On error goto 0
rem closing the quickstarter
ExitProcess(hWnd)
 End Sub 

Just to avoid confusion: of course this does not just close the
quickstarter, it shuts down the whole OOo process. That the QS is also
closed is more a collateral damage. :-)
As a side effect remote bridges or OLE connections that might be there
will be broken.

So you should better declare this snippet as something that terminates
the OOo process even if the QS is running. This will set expectations
right.

I think we should finally provide an API to close the QS to avoid such
desperate attempts. :-)

Best regards,
Mathias

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

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



Re: [api-dev] How to set print to file

2006-03-02 Thread Mathias Bauer
Alexandro Colorado wrote:

 I got a macro which prints a document:
 
 dispatcher.executeDispatch(document, .uno:PrintDefault, , 0, Array())
 
 However I was unable to find an interface for printing to a document,  
 doing some research on the reference I found the FileName which is used in  
 case of printing to a file but I couldnt find any other option to set it  
 as a PrinttoFile.

The models of all OOo documents support com.sun.star.view.XPrintable.
There you find a method print that allows to add parameters as
PrintOptions.

In Basic you can write

dim args(0) as new com.sun.star.beans.PropertyValue
args(0).Name = FileName
args(0).Value = sFileName

ThisComponent.print(args())

Please note that sFileName must be a system file name, not a URL,
because it will be handed over to the printing API of the OS.

Best regards,
Mathias

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

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



Re: [api-dev] Java: adding functionality to newly created menu item

2006-03-09 Thread Mathias Bauer
Tobias Krais wrote:

 You explanation helps me. I will patch the ProtocolHandler config.

There is no reason to patch any config file. You should provide your own
protocolhandler.xcu in a UNO package and OOo will automatically merge
your file into the built in one (but only in memory, not on disk).

Best regards,
Mathias

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

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



Re: [api-dev] Chaining Frames : ChainedTextFrame

2006-03-10 Thread Mathias Bauer
Kent Gibson wrote:

 The Developer's Guide says that Chaining Frames is not
 possible (yet). I had a go anyway hoping it was out of
 date. No luck.
 
 So is this correct? Chaning is not Supported?

First: please start a new thread when you write a mail about a new
topic, use the reply button only if you really reply to a mail. This
will perhaps also increase the possible number of answers.

What frames are you talking about (text frames?) and what do you mean
with chaining?

Best regards,
Mathias

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

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



Re: [api-dev] Impossible to close a Base document

2006-03-15 Thread Mathias Bauer
Frank Schönheit - Sun Microsystems Germany wrote:

 That's why it's hard to tell who has the ownership of the document. If
 it were the frame (opened by the user), and the frame would close it,
 then the script would break. If it were the script, and the script would
 close the doc, then the frame would silently be closed, too, even if the
 user doesn't want this.

If a sript that closes the frame is executed by the user he surely wants
this. :-)

 However, this interpretation might be too strict (and the scenario too
 esoteric). Should probably discuss this with the people who implemented
 the closing mechanism for the other document types, they must have had
 reasons to do it the way they did :)

See my other answer. :-)

Ciao,
Mathias

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

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



Re: [api-dev] Styles and Formatting Dialog

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

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

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

Best regards,
Mathias

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

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



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

2006-03-28 Thread Mathias Bauer
Anders Johansen wrote:

 The ONLY things that matter are, that
 * I can get the entire text (for spell checking)
 * I can convert a position in the entire text to a position in a part  
 of the editable text of an OO document (so I can replace a word  
 during spell check)
 * I can get the current position (expressed as an int), and the  
 current text, and hence parse out the current partially written word  
 (if any)
 * I can replace the current word with another one (word prediction)

 For example in Word I do it by requesting all text (WholeStory I  
 think it's called), and then calculating the difference in one-letter- 
 movements to the current selection.
 
 Assuming that the document consists of 3 chuncks of text, one could  
 do like this:
 
 Context = text from part 1 + text from part 2 + text from part 3
 
 if (cursor is in part 1) {
Position = position in part 1;
 } else if (cursor is in part 2) {
Position = length of text in part 1 + position in part 2;
 } else ...
 
 This would leave the problem of handling highlights that span  
 boundaries of text blocks.
 
 You see, from my point of view the ORDER of the text blocks does not  
 matter. I do not have to parse the text in the order it is written or  
 read, really, although it would be nice if the order was somewhat sane.

OK, so the tricky part will be to have a reliable algorithm that
serializes every possible arrangement of text on a single Writer page.
Or the whole text of a document? Should be doable but needs some
thinking. After this coding will not be the biggest problem. :-)

 I forgot to mention: if you want to use char* to address strings there
 is another problem because OOo strings are 16Bit UniCode strings, so a
 suitable data type should be used. You could workaround this by
 converting all strings received by our API to UTF-8 encoded strings in
 the DLL with C-API but then you can't rely on the usual pointer  
 arithmetics.
 
 Don't need pointer calcs. Just need to replace a chunk of text with  
 something else for spell checking or word prediction.

So you would be fine with getting the text as UTF-8 encoded byte strings?

Best regards,
Mathias

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

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



Re: [api-dev] New component: instead of .uno:SaveAs .uno:SaveTo

2006-03-28 Thread Mathias Bauer
Tobias Krais wrote:

 Hi again,
 
 I now had success with creating my first component. I can register it
 and use in in the menus. Thank you all!
 
 But now I want to write a second component: it should be the same as
 already exists: .uno:SaveAs. But the functionality should be
 different: it should store the object's persistent data to a URL and
 continues to be a representation of the old URL.
 
 It is the same difference as in XStorable.storeAsURL() and
 XStorable.storeToURL().
 
 My question: is it the easiest way to develop a complete new component
 or can I reuse the main parts of .uno:SaveAs?

You can reuse everything. You can dispatch the .uno:SaveAs command but
with an additional argument, a boolean PropertyValue named SaveTo.

The drawback of this approach is that you will only get the filters that
are available in SaveAs, but not the ones you get in Export, e.g. PDF.

Best regards,
Mathias

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

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



Re: [api-dev] How to tell a component the current XComponent?

2006-03-28 Thread Mathias Bauer
Tobias Krais wrote:

 Hi together,
 
 I created my first component and have now a big problem:
 -%-
 private XComponent openDocument = null;
 [...]
 // Querying for the interface XPrintable on the loaded document
 XPrintable xPrintable = (XPrintable)
 UnoRuntime.queryInterface(XPrintable.class, openDocument);
 -%-
 
 I want to print the current document, but I don't know how to tell the
 component the XComponent the user used when clicking on the item of the
 menu.
 
 Can anybody tell me how to do this?

 Or generally: how to give variables to components?

By using their API.
Sorry, this isn't a joke, it's just the truth. A more useful answer
depends on the component you want to use.

So what kind of component are you talking about? As an example, if your
component is a job or a document event listener it gets a frame object
on initialization or execution time (and the frame is able to tell the
component the document it belongs to). The same is true for Dispatch
objects since OOo2.0.x (x=2 IIRC).

Best regards,
Mathias

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

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



Re: [api-dev] DocumentConfiguration

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

 Hi again,
 
 My goal is to prevent user from using default styles in textdocs. 
 Apparently those default styles cannot be disabled, so I need to make 
 everything manually. One thing I have to do is to remove accelerators 
 modifying styles. (e.g. CTRL + 1 = Heading 1).
 I tried to remove that accelerator with the code below, but nothing 
 happened. CTRL+1 was still working. What did I do wrong?

Perhaps the short cut is hardcoded? Would be a bug IMHO.

 And is there easier way to achieve my goal? Can I include a 
 configuration file in my template to setup accelerators for my document? 
 ( just like menubar.xml ) And if, where should I put it? There is 
 configuration file for global and module accelerators 
 ($OFFICE_DIR/share/config/soffice.cfg/global/accelerator/en-US/default.xml 
 and e.g. 
 $OFFICE_DIR/share/config/soffice.cfg/modules/swriter/accelerator/en-US/default.xml)
  
 for the whole OpenOffice but in template files there is only 
 /configuration2/menubar/menubar.xml)

You can attach keyboard configurations to documents or templates. If I'm
not completely wrong this should be mentioned in Developers Guide. The
easiest way is to use the Save Button in the configuration dialog and
select your document or template as a target.

Best regards,
Mathias

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

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



Re: [api-dev] com.sun.star.mail

2006-04-07 Thread Mathias Bauer
Peter Eberlein wrote:

 Hi,
 
 I would like to use the subject module for mailing, because 
 com.sun.star.system.SimpleSystemMail has some restrictions (no access to 
 body).
 
 I can connect to SMTP (thanks to ms777) with the following snippet, but 
 found no way to instanciate a com.sun.star.mail.MailMessage 
 (CreateUNOService(com.sun.star.mail.MailMessage) gives me a null-object).
 
 Any hints?

IIRC there is no implementation for this service in OOo at all. OOo's
strategy for mailing is to use the system mailer (via SimpleMail and
SimpleSystemMail), OOo doesn't want to be a replacement for a mail program.

With an own builtg in SMTP engine OOo would need to provide (and
maintain) at least an outbox folder, that's nothing we want to do.

Best regards,
Mathias

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

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



Re: [api-dev] OOO 2.0.2: macro for bulk or single conversion of odt to pdf?

2006-04-07 Thread Mathias Bauer
Francis Jones wrote:

 This looks like a bug on the Windows version:
 
 Input: C:\tmp\test\1234.odt
 Output from ConvertToURL(): file:///C:/tmp/test/1234.odt
 
 There are 3 fwd slashes before the drive specifier, but there should 
 only be 2.

No, 3 slashes are correct as Tom already pointed out in the mail you
have replied to.

Best regards,
Mathias

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

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



Re: [api-dev] Calc: loading file with key-shortcuts .sxc v/.ods

2006-04-07 Thread Mathias Bauer
Ennio-Sr wrote:

 Hi all!
 [OOo-2.0.2-6 on Gnu/Linux - i386]
 
 I have two versions of the same Calc spreadsheet: file.sxc and file.ods.
 A particular keyboard configuration for this file was saved in a file
 named AAA-KbdCfg using the Organize Macros command ; then I saved an
 OO-Basic macro to automatically load 'AAA-KbdCfg':
 
 # rem ##
 # sub kbd_cfg_macro
 # rem --
 # rem define variables
 # dim documentnbsp;nbsp; as object
 # dim dispatcher as object
 # rem --
 # rem get access to the document
 # documentnbsp;nbsp; = ThisComponent.CurrentController.Frame
 # dispatcher = createUnoService(com.sun.star.frame.DispatchHelper)
 # rem --
 # dispatcher.executeDispatch(document, .uno:ConfigureDialog, , 0, Array())
 # end sub
 rem #
 
 and included a call to this ('Kbd_cfg_macro') in another macro
 started automatically when the file is opened.
 
 Now, if I open file.sxc, the 'Kbd_Cfg_macro' starts regularly and
 the Customize menu appears, where from I can hit 'Load' and choose the 
 'AAA-KbdCfg' file, whereas opening the .ods file nothing happens!

Did you check wether the ods file contains the event binding of your
macro? And are you sure that the bound macro is started when the
document is loaded?

Best regards,
Mathias

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

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



Re: [api-dev] Calc: loading file with key-shortcuts .sxc v/.ods

2006-04-07 Thread Mathias Bauer
Ennio-Sr wrote:

 Hi Mathias,
 
 The answer was 'yes' for both your questions. However, by now I've
 re-obtained the same performance as I had under 1.1.4 after re-building
 the file containing the keyboard configuration ('AAA-KbdCfg').

Nice to hear that it finally worked for you.
BTW: I don't know if this is possible for you, but if you want to use a
special keyboard configuration for certain documents it could be easier
to store this configuration directly into those documents or store it
into a template and create the documents from this template (documents
inherit their UI config from their template).

Best regards,
Mathias

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

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



Re: [api-dev] Calc: loading file with key-shortcuts .sxc v/.ods

2006-04-09 Thread Mathias Bauer
Ennio-Sr wrote:

 Mathias, that is exactly what I thought I was doing: for each group of
 files sharing the same macro-shortkey associations I'm loading the file
 where the particular configuration was stored (calling the relative
 macro from within the main one associated with the 'open document'
 event and saved into  the document itself) [1]; but may be I'm missing
 some better feature ? In this case, I should very much appreciate it if
 you would suggest any specific readings.

My recommendation would be to use the template mechanism: create a
document template that contains the configuration you want to have:
create a new document, store the shortcut configuration into it and then
save this document with File-Templates-Save.

Then create all new documents that should use this shortcut
configuration from this template using File-New-Templates and Documents.

Best regards,
Mathias

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

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



Re: [api-dev] custom menu to document in relation to cust.menu in Writer

2006-04-19 Thread Mathias Bauer
Cor Nouws wrote:

 Hi all,
 
 Before adding some comment to #63445, I post this below, to see what
 others think.
 
 I created a custom menu, bounded to the document. There was already a
 Writer-bounded menu, And that also was linked to that new document
 
 It turned out that before saving the new menu in the document, first the
 other menu had to be removed in the Customize-dialog. This removing only
 applied for that specific document: the Writer-bounded menu was no
 longer present in that specific document. This can be desirable, when
 sending an document with menu to someone else
 
 However, the consequence is, that when a document document-bounded menu
 is loaded, an Writer-bounded menu, existing in OOo where the
 document+menu is made, is not available. This is something to keep in mind.
 
 Is this fully correct? Are others familiar with this behaviour?

Yes, you can have only one menu configuration per module because every
change immediately takes effect. So all of your changes are done on top
of the current, global Writer menu configuration.

I wouldn't complain if you called this a design bug. ;-)

Best regards,
Mathias

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

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



Re: [api-dev] Proposal: Easy to use complex toolbar controls for add-ons

2006-04-20 Thread Mathias Bauer
Paolo Mantovani wrote:

 I must admit that I don't understand this problem.
 In the current addon's implementation, the toolbar-button calls the macro 
 specified in the URL field, without to pass the frame reference. (at least 
 AFAIK)
 
 From the side of the static code, you can use StarDesktop.currentComponent() 
 to get the document that contains the toolbar from which the macro has been 
 launched.
 At least, this is what I currently do in my starbasic addon's

Yes, but there is no code in your Add-On that maintains the status of
the buttons in the toolbar (it is currently impossible to write such
code in basic because you have to provide an object to the dispatch
framework). Carsten proposal enriches the communication of this object
to the dispatch framework and so it is nothing that can be used from Basic.

The interface between a basic code snippet and a toolbar button is only
passive, means: the basic code is called from inside the toolbar
button, but never the other way around because there is no object in the
basic code that is bound to the controller.

Any static approaches will fail because the whole communication between
toolbar controls and the status event sources is dynamic by nature.
*If* we think about a way to support status information via basic we
should think about helper dispatch objects that can be parameterized
from basic. The main problem will be how we can insert them into the
dispatch chain. Perhaps we can use the macro dispatcher as a medium (the
same object that executes the macro when the button is clicked).

Best regards,
Mathias

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

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



Re: [api-dev] creating non-modal dialog

2006-04-21 Thread Mathias Bauer
Paolo Mantovani wrote:

 Hi Laurent,
 
 Alle 13:58, giovedì 20 aprile 2006, Laurent Godard ha scritto:
 Hi Paolo

  It sounds quite strange to me that a UNOControlDialog behaves as
  non-modal.

 a hack iirc is to set the visible property to true
 do not use execute
 but loop over a global boolean to detect a stop set
 do not forget a wait statement in the loop to allow other process to
 work :-)

 the global idea (tested a long time ago)
 [...]
 Feel free to ask, i may find some old code
 
 Np, your example is perfectly understandable 
 It works!
 
 Cool!! I didn't know this trick! :-)

It's not a trick - all vcl based dialogs can be executed either modal
(using execute) or modeless (using setVisible(True)). But this alone is
not enough, a dialog started with setVisible is still a modal one if you
have a polling loop like in Laurents example, the only difference is
that the modality is in the macro code and not in VCL (where BTW it
takes *much* less CPU cycles to do nothing except waiting).

There might be another unexpected side effect with the basic loop: the
existence of such a loop (either in Basic or in VCL) makes it necessary
to prevent the closing(/destruction of the dialog or its parent window
before the loop ends (otherwise a crash will happen sooner or later).
For this reason VCL disables the parent window of the dialog so that you
can't close it while the excute() call is done.

It's possible that in the example with the Basic loop where vcl doesn't
know about this modality the parent window is not disabled and so you
can shoot yourself in the foot by closing the parent window while the
dialog is waiting for input. You can try it out, but please try the
Basic IDE and a document window as a parent (by starting the macro from
inside either one), they might behave differently here.

A real modeless treatment that does not suffer from this pain needs
that your macro terminates after the dialog is shown (no wait loop!) and
sleeps until a callback from the dialog awakes it again (click
handler). AFAIK this means that your dialog must be kept in a global
variable so that termination of your macro does not kill the dialog
automatically.

Best regards,
Mathias

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

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



Re: [api-dev] creating non-modal dialog

2006-04-21 Thread Mathias Bauer
Tuomas Räsänen wrote:

 My goal is to create a non-modal dialog to replace default Styles and
 Formatting - dialog.
 MyDialog contains a listbox for styles just like the Style and
 Formatting - dialog.
 
 I would appreciate your opinion about the way I have done this dialog.
 There is also a problem: this dialog won't close when clicking that
 cross at top right corner of the dialog.
 What I've done wrong?

I'm not a dialog API expert, but the following line of code looks
strange to me:

 xPSetDialog.setPropertyValue(Closeable, new Boolean(false));

I understand this as a command that this dialog shouldn't be closeable
and so it isn't surprising that nothing happens when you click on the
closer. OTOH I wonder why there is a closer at all in this case but this
might be a bug or imperfection.

Best regards,
Mathias

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

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



Re: [api-dev] UNO wrapper project

2006-04-24 Thread Mathias Bauer
Alexandro Colorado wrote:

 A feature that might make IDE better is integrated to Xray or PyXray on a  
 way that can autocomplete the methods however basic itself is limited  
 within the UNO framework. 

This is an oversimplification and an overcomplication at the same time.
:-) Wether you can have autocompletion or not is not a matter of the
language or their binding to UNO or not, it's a matter of the type system.

Autocompletion needs static typing, means: you must know the type of an
object to be able to autocomplete written code to the methods of the object.

So if you want autocompletion in a programming language you must
integrate static typing into it. This is possible with *every*
programming language, even with OpenOffice.org Basic.

OTOH exactly Basic programmers don't like static typing (means: they
don't like typing their variables at all ;-)), so you have to make a
choice.

As I already suggested in [EMAIL PROTECTED]: offering *optional* static
typing would allow us to implementing autocompletion in the BasicIDE for
all developers that take this option, means something like

dim doc as com.sun.star.textTextDocument
doc = StarDesktop.loadComponentFomURL(...)

instead of

dim doc
doc = StarDesktop.loadComponentFomURL(...)

would enable the IDE to autocomplete the code if the user starts to type
doc.

Best regards,
Mathias

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

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



Re: [api-dev] Closing documents w/ simplest possible converter..and a few other questions

2006-04-24 Thread Mathias Bauer
Kirk Israel wrote:

 Also, I noticed it doesn't seem to be closing the
 document it opens...I can't delete them after the program completes,
 the system (Windows XP) says they're in use.  I assume this is related
 to how an instance of OOo seems to be opening behind the scenes. In
 general I'm fine with that still running in the background, since it
 makes subsequent requests faster...but I will definately need to be
 able to clean up the pre-converted files... is there a way to close
 the document properly that will unlock it?  is there a seperate way of
 stopping the OOo instance, if I wanted to?

Call xThisComponent.close( True ) on the css.util.XCloseable interface
of the created document after you are done with it.

 Second, http://www.oooforum.org/forum/viewtopic.phtml?p=11744  not
 only has a list of Filters (is there a better place to get that list
 from?) it also suggests using HTML (StarWriter) in palce of
 HTML...that's what I had to do as well to convert a Word .doc. Is
 that the best practice?

OOo has three kinds of text documents: TextDocument, WebDocument,
MasterDocument. When you load a Word file a TextDocument will be created
so you have to use the HTML filter of the TextDocument for HTML export.
HTML is the filter of the WebDocument, so using this filter name for
exporting a TextDocument should produce an error, HTML (StarWriter) is
the correct name (the name is determined by history).

BTW: for the other way around (HTML-doc) you should specify HTML
(StarWriter) as *input* filter explicitly, otherwise OOo will create a
WebDocument by default and the WebDocument has much less export formats
than the TextDocument, especially it lacks a Word export filter.

Best regards,
Mathias

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

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-24 Thread Mathias Bauer
Kent Gibson wrote:

 Hi-ya
 
 Sorry to pester but does anyone have any ideas? I
 tried to explain the problem clearly but it is a
 tricky problem. I suppose I could summarise it by
 asking, how would one convert a hidden document
 efficiently into a non hidden document. Right now it
 takes me about 3 minutes to render the document and
 then about 10 minutes just to convert it into a non
 hidden document for viewing.

OOO 2.0.2 allows you to make a hidden document visible by a simple API
call. Is that what you want?

In Basic it's simply:

doc.loadComponentFromURL(...) ' hidden loading
'
' now do with the document what you want
'
' now make it visible
doc.CurrentController.Frame.ContainerWindow.setVisible( True )

You could do the same in older versions (the API already existed) but
the document would behave strange afterwards (file will not be released
when document is closed), it needed some fixes in the code that have
been applied in 2.0.2.

But admittedly I don't understand how this is related to your original
question about the bad performance for refreshing a document by reloading.

BTW: considering that each refresh requires a complete write/read
cycle I don't think that the performance is as expected. In general the
load/save performance in OOo is not very good and we are working on
this, but don't expect exact promises now about when we will reach which
performance gain.

Best regards,
Mathias

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

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-25 Thread Mathias Bauer
Kent Gibson wrote:

 argh. please help. this is driving me batty. 
 
 Ok i have an empty frame,
 
 XWindow xWindow = ( XWindow )
 UnoRuntime.queryInterface( XWindow.class,
 officeWindow.getUNOWindowPeer() );
 object = serviceFactory.createInstance(
 com.sun.star.frame.Frame );
 XFrame documentFrame = ( XFrame )
 UnoRuntime.queryInterface( XFrame.class, object );
 documentFrame.initialize( xWindow );
 documentFrame.setName( documentFrame.toString() );
 
 // Register frame at the desktop
 XFrames xFrames = ( ( XFramesSupplier )
 UnoRuntime.queryInterface( XFramesSupplier.class,
 desktop ) ).getFrames();
 xFrames.append( documentFrame );
 
 then I go and create a blank document and put it into
 my frame:
 
 XComponentLoader frameComponentLoader = (
 XComponentLoader ) UnoRuntime.queryInterface(
 XComponentLoader.class, documentFrame);
 loadedComponent =
 frameComponentLoader.loadComponentFromURL( url,
 _self, 0, args ); 
 
 the purpose so that I can see a nice blank doc.
 
 then I go and create another blank doc. I do some
 rendering and I want
 to replace my first doc with the second doc.

This isn't possible so easily. There are several other options, but I
don't know which I should recommend because I don't know what your goal
is. You could:

- not create the first document at all (why do you?)
- add the model of the second document to a MediaDescriptor and use
loadComponentFromURL at the first frame, thus replacing the first doc
- perhaps even don't create a second frame and only use a standalone
model that you insert in the same way into your frame

It's hard do make a good suggestion without knowing your intended
workflow or functionality.

 for example this does not work:
 documentFrame.setComponent(
 documentFrame.getContainerWindow(),officeDocument.getCurrentController());

Yes, this is not possible, a controller is owned by a frame as soon as
you have created it and it can be only in one frame at a time. This
means once you remove it from a frame to put it into another one the
frame will dispose of the controller.

You only can move the *model* from one frame to another (or have it in
more than one frame at the same time), thus creating a new controller
each time you insert the model into a frame.
Currently this needs the way mentioned above (use a Model parameter in
MediaDescriptor, see DevGuide), we are working on an API to make this
easier and more elegant.

 The guide saysCurrently, the only way for clients to
 construct a frame and insert a OpenOffice.org document
 into it, is to use the
 com.sun.star.frame.XComponentLoader interface of the
 com.sun.star.frame.Desktop but this is not
 clear to me.

Yes, as I said: Controllers can't be moved between frames, the only way
to get a model into a frame is to create a new Controller. And the only
way to achieve this currently is loadComponentFromURL.

Best regards,
Mathias

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

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



Re: [api-dev] Unanswered Question - Reloading Document - Convert Hidden Doc to NonHidden Doc

2006-04-26 Thread Mathias Bauer
Kent Gibson wrote:

 thanks for the details. What you said about adding a
 model to the media descriptor seems very interesting.
 However it does not seem to be documented. I tried
 something quickly along these lines:
 
 XModel model = ( XModel ) UnoRuntime.queryInterface(
 XModel.class, connection.getTextDocument());
 
 PropertyValue prop1 = new PropertyValue();
 prop1.Name = Model; 
 prop1.Value = model;
 
 loadedComponent =
 frameComponentLoader.loadComponentFromURL(
 private:stream, _self, 0, args );
 
 and I get 
 om.sun.star.lang.IllegalArgumentException: URL seems
 to be an unsupported one.

It seems that OOo tries to do a type detection though this is
superfluous here. I will check this. Meanwhile you could try to provide
a valid stream here to workaround the problem (it will not be used for
loading!).

Best regards,
Mathias

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

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



Re: [api-dev] Closing documents w/ simplest possible converter..and a few other questions

2006-05-04 Thread Mathias Bauer
Kirk Israel wrote:

 Mathias,
 many thanks, I got the close aspect working.
 
 In general, is there any filter that...tries less hard, I guess I
 would say, in terms of capturing more of the traditional HTML aspects,
 and less of the CSS Font information? Or will I probably be filtering
 that by hand?

I'm not sure if I understand your question; anyway, there is only one
HTML filter. Does that anwert it? ;-)

 Second, with the kind of basic converstion I'm doing, is there any way
 to neatly bundle the neccesary OOo bits w/o doing a full install? Or
 are things too integrated to have a distributable subset like that?

You will always need a complete OOo application, not necessarily a
complete *installation*.

Explanation: on Windows you can unpack OOo2 by using setup /a and use it
from where you unpacked it to. Now you don't have a system integration
because OOo is not really installed, just unpacked, but from your
POV this seems to be advantage. The drawback is that without system
integration you can't use the new OOo bootstrapping process for your
Java program, you have to create the OOo connection by hand as you did
in OOo1.

From this complete installation you could remove all unnecessary bits
but admittedly I don't know what exactly you can remove.

 Oh, and thirdly, should I try to publish my cleaned up simple
 conversion example somwhere (besides my own site, even though my
 personal site isn't usually so techie) and if so where?

Usually this is where our code snippet base comes in handy. You could
add your example there if there isn't anything like it already.

Best regards,
Mathias

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

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



Re: [api-dev] View

2006-05-04 Thread Mathias Bauer
Francesco Liuzzi wrote:

 How can I work on the same document using different views?

The simplest way is to take the frame of your current view and dispatch
the command .uno:NewWindow to it. This will create a second view like
the menu command in the Window menu.

Best regards,
Mathias

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

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



Re: [api-dev] XScrollbar

2006-05-08 Thread Mathias Bauer
Kent Gibson wrote:

 I do a lot of add hoc rendering. At one point the user
 scrolls around and then renders the document again,
 and all I want to do is reset the scrollbars back to
 where the user was. I reuse the frame but the document
 is getting rerendered. 

You can achieve this by listening for OnVisAreaChanged Events of the
document. This way you also get notifications if the size of the visible
part of the document changes.

Best regards,
Mathias

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

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



Re: [api-dev] Resolved: Urgent Unanswered Question - Issue id 63211

2006-05-08 Thread Mathias Bauer
Fernand Vanrie wrote:

 Kent, and others
 
 Yes thats what y meaned, its common (and strange) that some 
 property-informatiion only can be founded/obtained after you placed 
 the object in the the document. For some property's (graphics)  i had to 
 enumerate, all graphics,  to optain some info from a, individual 
 graphic. why ???

Some properties are not part of the document model (like the automatic
height of a frame) and you need to layout the document to get it.

Without a view Writer doesn't create a layout so you need to create a
view to force Writer to calculate the missing property. Additionally you
need some luck that the API allows you to ask for it. ;-)

Best regards,
Mathias

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

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



Re: [api-dev] Easy to use complex toolbar controls for add-ons

2006-05-10 Thread Mathias Bauer
Laurent Godard wrote:

 i red rapidelly but is it possible to implement the reactors of objects 
 in Basic ?It seems to me that Paolo already asked something like this, no ?
 
 a way could be a generic service taking the macro name as argument and 
 doing a transparent relay. Would it be difficult to do ? i do not think  so

We could provide a generic DispatchObject Service that implements the
css.frame.XDispatch interface. This interface allows the UI element it
is bound to to execute its bound command or query for the new interfaces
created by Carsten for the new callbacks, so this generic object will
also implement all these nice new interfaces just to forward to macros.

For this purpose each of these callbacks (dispatch() being the
simplest) will be transferred to a corresponding event and through an
event binding interface the object allows to bind a macro to them.

The tricky parts are that the macros need a defined signature for each
of the callback macros and that we must be able to hand over different
kinds of parameters to the macros. The first is only not nice (wrong
macro bindings might lead to a crash), but for the second I'm not sure
wether we can do this. We have to check this with Andreas Bregas.

Perhaps instead of macro event bindings we could use listeners as Basic
is able to implement them? But I'm not sure wether listeners implemented
in Basic will survive the termination of the macro that registers
them. But you or Paolo as Basic experts know, I assume. ;-)

There still is the other way around: once a UI element gets a dispatch
object it will register at it as a css.frame.XStatusEventListener and
expects to receive status events. Thew new controls don't make any sense
without providing proper status information.

The macro code must be able to provide this information and it must be
able to *update* it when needed. So each created dispatch object must be
accessible somehow later to send a new status. This means: you must
store the information for this somewhere, you can't store it in
variables in your basic code because you shouldn't have your macro
running permanently by using a busy loop. So where should the data go?

You see: a lot of questions to answer. But not impossible. :-)
Perhaps it would help if you ore Paolo could describe a possible use
case where you would like to use the new toolbar control features in
basic code.

Best regards,
Mathias

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

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



Re: [api-dev] Easy to use complex toolbar controls for add-ons

2006-05-14 Thread Mathias Bauer
Laurent Godard wrote:

 Hi Mathias
 
 Thanks for your response
 
 Perhaps instead of macro event bindings we could use listeners as Basic
 is able to implement them? But I'm not sure wether listeners implemented
 in Basic will survive the termination of the macro that registers
 them. But you or Paolo as Basic experts know, I assume. ;-)

 
 sounds interresting
 listeners can survive using a global variable
 but, the remaining problem is how to start the listeners

Hm, listeners can be registered by another macro, that itself can by
started by an event - and the listeners themselves are called by the
event source. Or what do you mean?

 The macro code must be able to provide this information and it must be
 able to *update* it when needed. So each created dispatch object must be
 accessible somehow later to send a new status. This means: you must
 store the information for this somewhere, you can't store it in
 variables in your basic code because you shouldn't have your macro
 running permanently by using a busy loop. So where should the data go?
 
 
 using a global variable let you store information

The problem with global variables is that they are, well, global. If you
have more than one extension they might use the same global variables.
Or is there something like global in the library or module scope that
still can survive the termination of the macro? (Sorry, I'm not an OOo
Basic expert.)

 ok let's try
 
 - a dropdown list in the toolbar nammed myToolbarObject
 - this object has an event change
 - reacting on this event, a macro can be called, passing an event 
 objetc, containing the source of that event

As already mentioned: currently there is no way to pass an object to a
macro that shall be called by macro URL or macro name. Problem number one.

 to setup the called macro via the event, a new node could be insterted 
 in the addon.xcu
 prop oor:name=ControlType oor:type=xs:string
  valueCombobox/value
  /prop
 ...
 ...
 ...
 prop oor:name=Events 
  prop oor:name=change oor:type=xs:string
prop oor:name=URL oor:type=xs:string
   valuemacro://mylib.mymodule.aMacro/value
  /prop
  prop oor:name=otherevent oor:type=xs:string
prop oor:name=URL oor:type=xs:string
   valuemacro://mylib.mymodule.otherMacro/value
  /prop
  /prop
 
 and then having a macro
 
 sub aMacro(event)
theCombo = event.source
'print the combobox name
print event.source.Name
 end sub
 
 So this is a kind of listeners but that are automatically launched when 
 loading the toolbar (btw, this should already be done)
 Then, reacting on an event is calling the specified macro with the event 
 object as argument. that's why i spoke of a kind of relaying

If I understood correctly you want to create a listbox in the toolbar
that depending on the selected entry calls different macros, right? Now
let's discuss the way how the listbox gets filled. This is the point
where the status updating comes into play: a dispatch object will
initialize the listbox and also change its content. As already described
this is the second problem I see that needs to be solved if we want to
use all the new toolbar features in Basic.

Your example seems to be simpler: I don't see that you want to change
the content of the listbox at runtime, so having a static dropdown menu
button that gets the macros to be called for each list entry by a
configuration file (Addon.xcu) and not by status updating as described
by Carsten would be enough. Why establishing a complex communication
channel for something that is sent only once?

If you just want to allow listboxes in toolbars bound to Basic macros we
could make this possible by creating a new toolbar button type that
reads the list from the Addon.xcu, just like a sub menu in the Addon menu.

Best regards,
Mathias

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

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



Re: [api-dev] Easy to use complex toolbar controls for add-ons

2006-05-15 Thread Mathias Bauer
Hi Paolo,

Paolo Mantovani wrote:

 Just a small addition:
 Of course, holding a reference of the listener into a global variable is a 
 good thing, (especially when you need to de-register it at latter time), 
 anyway, the listener survives even if you don't store it in a global var:
 
 AFAIK a registered listener is not disposed by the Basic engine while the 
 broadcaster still holds a reference to it:
 f.e. with the following code you will be bothered by the msgbox whenever you 
 change selection, and to kill the listener you must close the document:
 
 --
 Sub testListener()
 oListener = createUnoListener(Doc_, _
 com.sun.star.view.XSelectionChangeListener)
 ThisComponent.CurrentController.addSelectionChangeListener(oListener)
 End Sub
 
 Sub Doc_selectionChanged(oEvent)
 msgbox ciao
 End Sub
 
 Sub Document_disposing(oEvent)
 'nothing to do
 End Sub
 --

That sounds like a clear sign that listeners implemented in Basic will
work as long as their library code is not swapped out. So I think the
listener approach would be the way to go because it solves the problem
of handing over objects to the basic code quite easily.

This morning I had another idea that might solve the other problems: if
we use a dispatch object service as a relay between the UI elements
and the basic code as I proposed we also can use this object as a
storage for data associated to this connection, e.g. by providing a
property container (that is used from Basic quite easily!). This way you
don't need to use global variables. And if we want to send status
updates to the UI element we can do this based on the data stored at the
object and by calling a forwarding method of the object.

The only problem then will be to identify the dispatch object amongst
the bunch of them that might have been created, but as we can make frame
and command URL accessible to the listener (implemented in Basic) we can
use the combination of both as a unique identifier for searching for the
dispatch object in a global container of such objects. I will draw up
this in a more detailed manner.

Best regards,
Mathias

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

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



Re: [api-dev] Easy to use complex toolbar controls for add-ons

2006-05-16 Thread Mathias Bauer
Laurent Godard wrote:

 Hi Carsten
 
 Just for your infomration. The new toolbar controller enhancements are
 not a com.sun.star.awt substitution. The implementation is deeply
 integrated into the Office framework and therefore cannot support the
 same feature set as low-level awt controls! Most functions are supported
 or can be added without any problem.
 
 thanks for your precision
 but this sounds odd to me regarding UNO nature and componentization
 
 I'll have a look (m169 just finished downloading) trying to understand
 how it actually works (with an external poor user pow)
 But i think that script coders are expecting to have access to the
 standard features and events of such controls and that's why i told
 about the awt controls

Carsten already explained why our concept is more abstract than the AWT.
But there is another reason why we don't expose concrete controls: we
don't want to lose the flexibility to change our UI. As an example, if
OOo would ever want to implement something like the new ribbon GUI
from the upcoming MS Office 12 we could do that without any changes in
the other code of OOo, just because there is no code anywhere in OOo
except in the LayoutManager that knows about the concrete build-up of
the UI elements. We only expose what we think belongs to the nature of
the dispatched commands, not how they are visualized. At the end that's
what the Dispatch API (and Carsten's new extensions) is about.

As an example, if your command is assigned to a list of element where
you can choose one and also have a status information about which one
was chosen for the current context the natural representation of this
fact is an element list, so there is an API to exchange list functions.
But we don't expose wether we represent this list as a list box or
something else so that we are free in our current and future(!)
implementations, we only expose the idea of a list being part of our
GUI. Think about it in the following way (I again take the example of an
element list):

Your code is assigned to one or more GUI elements that visualize a list
of elements (e.g. strings) and allow to choose one of them. OTOH these
elements expect from your code that it tells them which element should
be taken as the currently selected one (if possible). That's the
contract between your code and the GUI. How the elements look (if they
look at all - they could be implemented completely different, e.g. by
assistive technologies, as accoustic controls etc.) and where they are
located is not only unknown to you, it's completely irrelevant. I hope
you can see the benefit of this approach and that you don't loose
anything with it because all essential information is handled through
the abstract communication API(s) laid out by Carsten.

I for myself would have liked to have abstract assignments of commands
to types (like string list, integer value etc.) instead of
(button) control names, but Carsten preferred the control names instead
because it looks simpler and less techy. As it is his baby I think
that's okay, but OTOH it seems that it sets wrong expectations.

Best regards,
Mathias

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

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



Re: [api-dev] Easy to use complex toolbar controls for add-ons

2006-05-16 Thread Mathias Bauer
Laurent Godard wrote:

 Hi Mathias
 
 Hm, listeners can be registered by another macro, that itself can by
 started by an event - and the listeners themselves are called by the
 event source. Or what do you mean?

 
 how is the first macro called ?

Event bindings, jobs ...

 regarding, the scope, as paolo sais, it seems to be possible that
 listeners are not unregistred when the macro ends
 i've never tested this way but this does not solve this specific problem
 (perharps using an array ?)

*If* listeners survive the macro termination at all I assume they
don't need a global variable; as long as they are registered somewhere
there is another object that should hold them alive. My apprehensions
have been that it's not a question of object life time but some basic
internal problems. We should check that. IMHO Basic listeners should
work until their UNO RefCount goes down to zero.

 As already mentioned: currently there is no way to pass an object to a
 macro that shall be called by macro URL or macro name. Problem number one.
 
 that's why i spoke about an intermediate that relay the call, adding the
 event
 Btw, do you mean inside the code or through xcu files ?

Inside the code. And a relay object doesn't really help here. At the
end there has to be an object that calls the macro by URL, e.g. by using
macro URL dispatching or Scripting Framework call and IIRC you can't
pass an object reference or anything else than strings either way. But
please see my last comment in this mail.

 If I understood correctly you want to create a listbox in the toolbar
 that depending on the selected entry calls different macros, right?
 
 no
 take the uno list objetc
 it has events, i want to have the same ones

That's what you wrote. But is it really what you need? ;-)
Without dynamic status updating and receiving all the events are pretty
useless. *If* you want to use them you need to think about ways to store
the data and perhaps update the UI elements on demand.

 Now let's discuss the way how the listbox gets filled. This is the point
 where the status updating comes into play: a dispatch object will
 initialize the listbox and also change its content. As already described
 this is the second problem I see that needs to be solved if we want to
 use all the new toolbar features in Basic.
 
 right, but teh same mechanism previously proposed can be used, no ?
 i tis a matter of event intializing

We face the same problems here: if you call a macro by name all you can
pass to it are string parameters. But again please see below.

 Your example seems to be simpler: I don't see that you want to change
 the content of the listbox at runtime, so having a static dropdown menu
 button that gets the macros to be called for each list entry by a
 configuration file (Addon.xcu) and not by status updating as described
 by Carsten would be enough. Why establishing a complex communication
 channel for something that is sent only once?
 
 argh, perharps my example was not so good explained
 obviously, i want to be able to manipulate the listbox dynamically !!
 fill it, remove items, retreive active item ...
 like a real componenent

OK, in this case you need the full program and this maybe can be done by
implementing the idea I described in my last mail. Perhaps we should
continue there.

Best regards,
Mathias

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

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



Re: [api-dev] Easy to use complex toolbar controls for add-ons

2006-05-16 Thread Mathias Bauer
Laurent Godard wrote:

 The only problem then will be to identify the dispatch object amongst
 the bunch of them that might have been created, but as we can make frame
 and command URL accessible to the listener (implemented in Basic) we can
 use the combination of both as a unique identifier for searching for the
 dispatch object in a global container of such objects. I will draw up
 this in a more detailed manner.
 
 each toolbar objects has a name
 so a getByName like over a sequence could be a solution

Please forget the toolbars. ;-)
The command URL is the only thing that counts, in conjunction with a
frame reference. I hope I can make this clear in a more elaborated
description. I'm afraid I will not be able to provide it before the
weekend. I'm working on OOo programmability mostly as a volunteer
also. :-)

Best regards,
Mathias

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

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



Re: [api-dev] GRAPHIC questions

2006-05-18 Thread Mathias Bauer
Fernand Vanrie wrote:

 Placing  an embedded -grahpic  into a WriterDoc (with the GUI or withe
 the API) gives different results depending if  you  placed it as  a
 linked-graphic or and embedded-graphic.
 Embedded gives us  the orinal dimensions (as difined in the
 Imagefile-header)  gives us the correct orginal-size , the image had a
 scale of 100% and a correct image-size 
 Linked gives us the a  wrong orginal size (based on 96 DPI)  a
 scaling  with a percentage to optain a correct  image size !! Is
 this behabior wanted or is it a bug ?

Sounds like a bug to me. I suggest creating an issue.

 Before we place the image we can resize and  reformat the graphic and
 define if we embed or link the grahic.  I tried different ways to
 acomplish this task, it can be done, opening a hidden drawdoc and then
 place the grapic as a Shade,  and finaly exporting the drawpage using
 the filteroptions to re-size and re-format the imagefile. To avoid the
 hidden drawdoc i tryed differend ways to acomplis  the same task:
 Using the GrapchicProvider.storeGraphic  and defining the MIMEtype was
 a prommesing option , I can do the re-formating,  but i found noway to
 re-size the imagefile, there exist some filteroptions  but found noware
 any documentation.
 Exporting  the Shape instead of the DrawPage   with a filter avoid
 the use of  a hidden DrawDoc , works the filtername gives us the right
 format  but:  the filter ignorges the re-sizing options.
 Exporting the Writer-Drawpage let crashes OO (no  pagesize i supose)

I have to admit that I don't understand what you are trying to achieve.
You started writing about inserting graphics and that you have some
problems with it, but now you talk about storing graphics. Do I
understand you correctly that storing graphics isn't your real goal, you
just do it as part of a workaround to overcome limitations for the
resizing/reformatting options? If that is correct: what would you really
like to do, without any workarounds?

Best regards,
Mathias

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

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



Re: [api-dev] how to make the macros available to all users of a Windows Terminal server

2006-05-25 Thread Mathias Bauer
Jo wrote:

 Hi Carsten,
 
 Many thanks for your answer. The next problem is that when logged on as 
 a different user the library containing the macros is not available. I 
 tried to also copy the basic code as follows:
 
 C:\Documents and Settings\My Username\Application 
 Data\OpenOffice.org2\user\basic\ETUC\*.* 
 
 to C:\Program Files\OpenOffice.org 2.0\share\basic\ETUC\
 
 
 But the module is not recognized any more. When I try to do it properly, 
 then the Add... button becomes grey when I select Macros and Dialog 
 boxes of OpenOffice.org.
 
 Can you help me out on this one too?

I'm not Carsten but I hope I can help too. :-)

Basic has an administration file for all of its libraries and just
copying libraries won't help without updating this file. Unfortunately
this file is part of each user profile so it needs manual operations in
all user installations. Not recommended. Deploying libraries for all
users admittedly is a little bit awkward in OOo.

The best way is to create a UNO package from the libs and install it
with unopkg --shared.

Creating packages will be supported by the BasicIDE in OOo2.0.3. The
created packages of course will work in any OOo2 version.

Best regards,
Mathias

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

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



Re: [api-dev] switching components in one frame

2006-05-25 Thread Mathias Bauer
Marc Santhoff wrote:

 Hi,
 
 I'm asking myself if it is possible to start implementing the following
 scenario:
 
 A doc is opened in a frame (and window). On a command of the user the
 component attached to the frame is stored elsewhere to keep the
 reference and a second document (component) is loaded into that frame.
 After a task is done by the user the second component get's saved and
 destroyed and the first component is attached to the frame again.
 
 The goal is to reuse the window presented to the user with variing
 contents.
 
 Will this work or am I asking for trouble regarding attached listeners,
 dispatch or whatelse?

A component inside a frame comprises a controller and a model. You can
not keep the controller without the frame, but you can keep the model
and you can use this model later on to recreate a controller including a
view from it without reloading the document.

To preserve the model from being closed when its last controller gets
destroyed you must register as a close listener at it and deny its
request for becoming closed.

The recreation of the view is a little bit tricky because the necessary
API currently does not exist (it's in the making though).

We ourselves use the following replacement:
use the loadComponentFromURL() method of the desired frame, but pass a
parameter Model in the MediaDescriptor that contains a reference to
the model. This will advise the frame loader to use the existing model
and not creating and loading a new one. You must provide the valid URL
of the document though (or the stream it was loaded from) to pass the
type detection and to avoid confusion in the documents' internal media
descriptor.

Best regards,
Mathias

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

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



Re: [api-dev] switching components in one frame

2006-05-26 Thread Mathias Bauer
Marc Santhoff wrote:

 The recreation of the view is a little bit tricky because the necessary
 API currently does not exist (it's in the making though).
 
 As far as it works, it's okay with me. :) Do you know an issue number
 for watching progress on this topic?

No, but it will be announced in interface.announce once it's done.
We wanted to introduce the new API together with adding the new UNO
features to our models (multiple inheritance interfaces, new style
service with constructors) but it turned out to be more work than expected.

Best regards,
Mathias

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

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



Re: [api-dev] Backgroung conversion crashes when closing last foreground document

2006-05-27 Thread Mathias Bauer
Tobias Krais wrote:

 Hi Mathias,
 
This works perfectly. Nobody is able to kill my little cute programm
:-). But. Users can't close their OpenOffice until I don't remove my
terminate listener. How can I allow users to close their OO and disallow
to close mine?
 
 You confuse me. :-)
 My understanding was that you wanted to prevent exactly this: users
 closing OOo completely before you are done.
 
 Oh! It was not my intension to confuse you :-)
 
 Ah, maybe the problem is that OOo doesn't close its open windows on
 File-Exit when a terminate listener throws a VetoException? Well, this
 would be an unfortunate behavior. Or is it something else?
 
 Thats it. Is there a way to let OO close the open window but to stay in 
 memory?

If a terminate listener prevents windows from becoming closed: not
without changing the source, I'm afraid. I had a quick look into the
source: it seems so. I have to think wether this is a bug or not.

Best regards,
Mathias

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

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



Re: [api-dev] Backgroung conversion crashes when closing last foreground document

2006-05-28 Thread Mathias Bauer
Tobias Krais wrote:

 Hi Mathias,
 
Ah, maybe the problem is that OOo doesn't close its open windows on
File-Exit when a terminate listener throws a VetoException? Well, this
would be an unfortunate behavior. Or is it something else?

Thats it. Is there a way to let OO close the open window but to stay in 
memory?
 
 If a terminate listener prevents windows from becoming closed: not
 without changing the source, I'm afraid. I had a quick look into the
 source: it seems so. I have to think wether this is a bug or not.
 
 in case you submit an issue, please tell me, I'll vote for it :-). Would 
 it be a lot of work to change it?

I just have to find out why we made it that way. There must have been a
reason. :-)

Once we find out that there is no problem with changing it it shouldn't
be much to do.

Best regards,
Mathias

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

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



Re: [api-dev] Backgroung conversion crashes when closing last foreground document

2006-05-30 Thread Mathias Bauer
Hi Christian,

Cristian Fonti wrote:

 Look the issue that i opened, id: 63270

At a first glance I think this something different: this is a problem
that appears when you try to close a document.

Here we are talking about the ability to prevent OOo from shutting down
by still maintaining the ability to close all task windows via File Exit.

So we still can get another issue. :-)

Best regards,
Mathias

 Best Regard
 Cristian
 
 Mathias Bauer ha scritto:
 Mathias Bauer wrote:

   
 Tobias Krais wrote:

 
 Hi Mathias,

   
 Ah, maybe the problem is that OOo doesn't close its open windows on
 File-Exit when a terminate listener throws a VetoException? Well, this
 would be an unfortunate behavior. Or is it something else?
 
 Thats it. Is there a way to let OO close the open window but to stay in 
 memory?
   
 If a terminate listener prevents windows from becoming closed: not
 without changing the source, I'm afraid. I had a quick look into the
 source: it seems so. I have to think wether this is a bug or not.
 
 in case you submit an issue, please tell me, I'll vote for it :-). Would 
 it be a lot of work to change it?
   
 I just have to find out why we made it that way. There must have been a
 reason. :-)

 Once we find out that there is no problem with changing it it shouldn't
 be much to do.
 

 Seems that we can't find a reason why it needs to be that way. If you
 think that it should be changed please file an issue for the framework
 project.

 Best regards,
 Mathias

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


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

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



Re: [api-dev] Restarting a frozen OOo

2006-06-27 Thread Mathias Bauer
Andreas Schlüns wrote:

 This is not an asynchronous signal only ...
 it's our crash handling. That means: one of these threads
 produced a crash and here we try to save all currently open documents. 
 So the deadlock is a follow up of a crash in a remote use case of the 
 office.
 
 Solutions:
 a) Fix the reason for the crash .-)
 b) Disable Recovery in your use case by using the command line parameter 
 -norestore by starting the office.

Well, though I agree that fixing the crash is always a good idea ;-) I
also wonder wether the thread owning the SolarMutex does not return from
the X11 call. Obviously the main thread was going to show a tooltip
window. Once this had been finished the emergency saving process should
continue in the other thread.

Best regards,
Mathias

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

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



Re: [api-dev] Toolbar button added using Addon not enabled

2006-07-13 Thread Mathias Bauer
bharathy b wrote:

 Hi Carsten, thank you for replying. The SDK examples create a
 installable package automatically if you build them with make.  I
 was not aware of this. I will try to find out.Can you please guide me
 more about it.

Please read the build instructions that are part of the SDK. After
installing the SDK correctly you can just go to any example directory
and call make. This will create the package.

 Also ,now i understood Function1refers to a function by name
 Function1. But still i am not clearas to  where should i define
 Function1? Should i define Function1 inside
 ProtocolHandleraddon.java?  Since i am a newbie i am not clear with
 these concepts.

Please read the chapters in the Dev Guide mentioned by Carsten.
Any description here would just repeat what is written there.

Best regards,
Mathias

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

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



Re: [api-dev] Regarding XJobExecutor.

2006-07-18 Thread Mathias Bauer
bharathy b wrote:

 Hi i wanted to know if the following is possible using the
 XJobExecutor.
 
 Is it possible to have more than one trigger method for an
 XJobExecutor?
 
 At present i have added a toolbar button to the writer document using
 an Addon. (Using an UNO Component in Java). Onclick of the button
 creates an htm file in C drive.
 
 But now i need to add more buttons to the writer document using a
 Addon. Suppose i want to add 3 buttons using a single addon. how can
 i specify the trigger method for the remaining 2 buttons.
 
 Are there any better ways of doing this? I tried using
 ProtocolHandlerAddon but i am still not able to understand dispatcher
 implementation and how to  get the Add-on register itself for the
 protocol part of the command URL.
 
 Please reply and suggest me how to accomplish this..

The ProtocolHandler is the right way to do it. The JobExecutor is not a
tool for command dispatching, it's a means to react on events and e.g.
register a service.

The idea of a ProtocolHandler is quite simple: register your component
to be the handler for all commands starting with a particular string
that has the shape of a URL protcocol (like http:). So if any command
with your protocol in front is found in any UI element your component
will be asked for the execution once it is requested by the user.

Tha AddOn.xcu file is the way how you can put commands in your
toolbar(s) or menu.

Please find more about this topic in the DevGuide.

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

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



Re: [api-dev] Regarding XJobExecutor.

2006-07-18 Thread Mathias Bauer
bharathy b wrote:

 Hi   Mathias Thankyou...
   
 Regarding the ProtocolHandlerAddon method..

   I want to know where should i define sayHello( ).

You need to implement a ProtcolHandler, mainly its interface
com.sun.star.frame.XDispatchProvider, as described in the DevGuide.
Take the demo AddOn from the SDK and debug the code. Maybe this shows
you how it works.

Best regards,
Mathias

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

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



Re: [api-dev] XModel - creating standalone

2006-07-21 Thread Mathias Bauer
[EMAIL PROTECTED] wrote:

 Hello
 
 Is it possible to create an XModel standalone, i.e. not part of any frame.

Yes. Create the model as a service and either initialize or load it. In
Basic code:

model = createUNOService(com.sun.star.text.TextDocument)
model.initNew()

will create a new empty text document.

dim mediadescriptor(n) as new com.sun.star.beans.PropertyValue
' fill mediadescriptor
model = createUNOService(com.sun.star.text.TextDocument)
model.load( mediadescriptor )

will create and load a document from what you put into the
mediadescriptor. Of course in this case you don't have a type detection
and you must either put the filter name into the mediadescriptor or
manually call the type detection service (not a big deal).

 For example by Desktop.loadComponentfromURL(_blank, Hidden ... and then
 keeping a handle to XModel.
 This works fine. I then load it into a visible frame by adding a Model
 property to the arguments for the loadComponentFromURL of the visible
 frame. This also works (Discussed on an earlier thread).
 
 Howevwer if I now load a different XModel into this visible frame, any
 current XModel gets disposed automatically - I wan't (under certain
 circumstances) to prevent this, i.e. I want to keep the XModel handle in
 my code for reuse later but still load the new model.

Register a CloseListener at the model and veto against closing as long
as you need the model. Of course then you must keep track of all models
and close them by yourself when you are done with them.

I must confess that I don't remember if this really works in your case
(it definitely works in case of closing the frame) but you could try and
report back. If it doesn't work it's a bug that needs to be fixed.

 Basically I do this because I don't want multiple XFrames open, but still
 want concurrent editing of multiple documents.
 
 I am trying to reduce the overhead of temporarily writing a stream for the
 XModel I remove from the frame and rereading, parsing etc... the stream
 again later.
 
 Keeping with this, where is the most overhead in the API, i.e. creating
 the model, or creating the frame and controller and which uses more
 resources?

The most resources are taken by the model, the frame and controller are
much smaller for non-trivial documents. At least that's my guestimation.

Best regards,
Mathias

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

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



Re: [api-dev] XModel - creating standalone

2006-07-24 Thread Mathias Bauer
Malte von der Lancken-Wakenitz wrote:

 Thanks for your prompt reply.
 
 Yes. Create the model as a service and either initialize or load it. In
 Basic code:

 model = createUNOService(com.sun.star.text.TextDocument)
 model.initNew()

 will create a new empty text document.

 dim mediadescriptor(n) as new com.sun.star.beans.PropertyValue
 ' fill mediadescriptor
 model = createUNOService(com.sun.star.text.TextDocument)
 model.load( mediadescriptor )

 will create and load a document from what you put into the
 mediadescriptor. Of course in this case you don't have a type detection
 and you must either put the filter name into the mediadescriptor or
 manually call the type detection service (not a big deal).

 
 I did not get very far with that. I am writing in java and tried this:
   com.sun.star.text.XTextDocument xm = (com.sun.star.text.XTextDocument)
  queryInterface(com.sun.star.text.XTextDocument.class,
 getMultiServiceFactory().createInstanceWithArguments(com.sun.star.text.TextDocument,
 args));
   
 //(com.sun.star.text.XTextDocument)queryInterface(com.sun.star.text.XTextDocument.class,
 com.sun.star.text.TextDocument);
   xm.attachResource(surl, args);

The last statement doesn't do anything useful and perhaps even will
throw an exception because the document hasn't been initialized properly.

Why don't you try what I recommended:

com.sun.star.frame.XLoadable xm =
(com.sun.star.frame.XLoadable)
queryInterface( com.sun.star.frame.XLoadable.class,
xFact.createInstance(com.sun.star.text.TextDocument));
xm.initNew();

Best regards,
Mathias

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

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



Re: [api-dev] XModel - creating standalone

2006-07-24 Thread Mathias Bauer
Malte von der Lancken-Wakenitz wrote:

 I can't find any method to explicitly load from a url and the above does
 not work (I thought it wouldn't). I scoured the api docs, but nothing. How
 do I do this in java.

Forget createInstanceWithArguments, there is nothing documented that
this shall pass any arguments to the created model. Please refer to my
first mail: com.sun.star.frame.XLoadable is the interface you need for
loading or initializing a document.

 Register a CloseListener at the model and veto against closing as long
 as you need the model. Of course then you must keep track of all models
 and close them by yourself when you are done with them.

 I must confess that I don't remember if this really works in your case
 (it definitely works in case of closing the frame) but you could try and
 report back. If it doesn't work it's a bug that needs to be fixed.
 
 I had allready tried that and the dispose is still being called. I did
 notice that if I use a private:factory type url, i.e. create a doc from
 scratch it does not get disposed. Is this inconsistent behaviour or
 something I am doing wrong?

I can't see why this should make any difference. Please try it with a
document created in the way I described and then report back.

 I have spent about 4 weeks trying to get a set of my own classes to wrap
 some OO functionality to be able to integrate it with my application. I
 have come quite far after trying many things, but still have many
 questions. Would you be prepared to discuss some of them with me during
 the next few weeks? 

Well, I will start a three weeks vaction on thursday, so I'm afraid the
answer is no at least for these three weeks. But there are others here
on the list that should be able to assist you. Of course I can at least
try to answer some questions until the end of the week.

Best regards,
Mathias

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

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



Re: [api-dev] CloseVetoException has no effect

2006-07-26 Thread Mathias Bauer
Christoph Lutz wrote:

 Hi,
 
 I would like to veto the close-action (clicking on the x in a writer
 document) in such a form, that the document doesn't get closed until
 my program decides when it's time to close the document. This should
 be possible by throwing a CloseVetoException in the queryClosing(...)
 handler when getsOwnership==true, but it does not to work with my
 example code (below). The CloseVetoException I throw does not seem to
 prevent OOo from actually closing the document.
 
 Any Ideas what could be wrong with my example?

I think there is nothing wrong. You have registered as a CloseListener
at the document, the model. I assume that this has worked and the
model is still there, so it's not surprising that no notifyClosing was
called.

But that doesn't mean that you have prevented the view(s) on this model
from becoming closed, so the window can be closed as usual. If you want
to prevent the views from being closed you must register as a close
listener at the corresponding frames.

Best regards,
Mathias

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

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



Re: [api-dev] MailMerge keeps temporary file open

2006-07-26 Thread Mathias Bauer
Jens Beier wrote:

 Hi,
 I'm trying to use MailMerge to fill a letter with data from a datasource
 and save it as PDF.
 I'm using the setupConnection() and the doMerge() methods from
 http://codesnippets.services.openoffice.org/Writer/Writer.MailMerge.snip
 
 I'm getting the XComponentContext and the XMultiComponentFactory. Based
 on this I can geht the MailMerge-service. Then I set the
 Mailmerge-properties and execute the XJob.
 
 Everything works fine except that OpenOffice does not close the
 temporary file it uses for this job.
 
 So what do I have to do to get the temporary file closed? Do I have to
 close any special service or interface? In all examples I have found in
 the Developer Guide and in forums nobody seems to close something after
 executing MailMerge.
 
 I'm using OpenOffice 2.0.2 on a Solaris box. Solaris has a limitation to
 the number of open files.
 When I execute the Job several hundred times I'm getting the following
 error when reaching the limitation of open files:
 
 I/O error : Too many open files
 I/O warning : failed to load external entity
 /export/home/asaadm/.openoffice.org2/user/config/javasettings_Solaris_x86.xml
 
 [Java framework] Error in function copyShareSettings (elements.cxx).
 
 and the PDF which is generated only contains symbols like rectangles,...
 
 I'm running out of ideas so could anyone help me? Thanks

I'm afraid that this is a bug.

Best regards,
Mathias

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

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



Re: [api-dev] how to dispatch .uno:ClosePreview from java ?

2006-08-18 Thread Mathias Bauer
Oliver Brinzing wrote:

 Am 07.08.2006 08:41 schrieb Andreas Schlüns:
 If you wish to force a synchronous execution of your dispatch you should
 try the argument Asynchron as [bool] with a valud false.
 
 are you sure, this works ?
 I can see no difference ... the preview is not closed even if I use
 
 xProps[0] = new PropertyValue();
 xProps[0].Name = Asynchron;
 xProps[0].Value = Boolean.FALSE;
 
 Object oDispatch = xDispatch.executeDispatch(xProvider, 
 .uno:ClosePreviewl, , 0, xProps);

The name of the property is SynchronMode and of course its value must
be set to True in case you want to have synchronous execution.

Closing a view synchronously is a little bit risky. If the code is
executed from a call stack that was started somewhere inside a VCL
resource (e.g. a toolbar) it *could* lead to a crash. So you have to try
out if it works.

Best regards,
Mathias

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

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



Re: [api-dev] how to dispatch .uno:ClosePreview from java ?

2006-08-24 Thread Mathias Bauer
Oliver Brinzing wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi Mathias,
 
 The name of the property is SynchronMode and of course its value must
 be set to True in case you want to have synchronous execution.
 
 I tried it, without success, it seems, it's not possible to close the preview 
 from java ...

What means without success? What exactly did you do and what exactly
happened?

Best regards,
Mathias

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

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



Re: [api-dev] ODT to PDF export incorrect, unless Thread.sleep() used

2006-08-27 Thread Mathias Bauer
Tim Anderson wrote:

 Thanks for the tip. I've inserted the following between the load and 
 save - it appears to work:
 
 XTextFieldsSupplier supplier = (XTextFieldsSupplier) 
 UnoRuntime.queryInterface(XTextFieldsSupplier.class, document);
 XEnumerationAccess fields = supplier.getTextFields();
 XRefreshable refreshable = (XRefreshable) 
 UnoRuntime.queryInterface(XRefreshable.class, fields);
 refreshable.refresh();
 
 Is there an explanation for why this works?

It seems that there are some necessary updates to be done after loading
and for performance reasons they usually are done in the background.
IMHO even then there should be some code for forcing these updates in
those cases where they should be up to date, but obviously this doesn't
happen. I consider this to be a bug.

If the Writer uses asynchronous updating procedures and OTOH has some
API calls that require updated objects prior to their execution (like
PDF export or printing) there should be a trigger that these API calls
can use to force all pending updeates (that of course should be
registered there before).

Best regards,
Mathias

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

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



Re: [api-dev] how to dispatch .uno:ClosePreview from java ?

2006-08-27 Thread Mathias Bauer
Oliver Brinzing wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi Mathias,
 
 What means without success? What exactly did you do and what exactly 
 happened?
 
 that means, the preview is not closed, if i open a message box directly after 
 the
 excecuteDispatch(), it does not matter if i use the SynchronMode or not ...
 the message box is shown in preview mode, after closing it, preview mode is 
 still active ...
 without showMessageBox() the preview is closed ...

This shows that closing is not done synchronously and so it is prevented
by the dialog box that is opened before the view can be exchanged. Of
course you can't close a view that contains a modal dialog!

Obviously there is an additional asynchronity in the code that executes
the ClosePreview command, it's not the dispatcher that works
asynchronously. I had a look into the Writer code and indeed this is
what happens. The closing of the preview is done by creating a new view
and replacing the preview in the same window by it, and this is done
asynchronously. I assume this is done to protect against possible
crashes in case execution of the dispatch calls is requested by an
object inside the view that can't cope with being killed itself before
the call returns.

So at least currently you can't do anything against it, except writing
an issue of course asking the Writer developers for switching to a
synchronous exchange of the View (though I don't know if this is feasible).

Best regards,
Mathias Bauer

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

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



Re: [api-dev] Unpublished UNO API

2006-08-28 Thread Mathias Bauer
Bjoern Milcke wrote:

 Hi Jürgen,
 
 I am always happy when one of my demo components developed for
 StarOffice 6.0 (before OO.org) work with StarOffice 8 as well. I think
 it can be a good reason for customers to switch to SO/OO.org using our
 API (with java for example) because they know that the implementation of
 macros, some integration and/or extension is a one time investment and
 would work with future versions as well. It is not really calculable for
 professional ISV's or bigger companies if they have to check their code
 with every new version of the product.

 MS has shown how successful they were with their compatible API's over
 years.
 
 Maybe I missed your irony here, but:
 
 Back in the old days I developed some macros for Word 1.0, which didn't
 run in Word 1.1. After conversion they didn't work in Word 2.0. And
 today those files even don't open (except in OOo ;-) ). I also did some
 macros in Excel. Then they had a German version where they had the idea
 to translate the API! (exit loop = verlasse durchlaufe), then they
 switched back to English (seeing that it was a bad idea). At some point
 there was also the invention of VBA (AFAIR before it was some more basic
 Baisc ;-) ), which was also a change. So, to make a long story short, I
 wouldn't call MS's API in Office very compatible. (I remember they had
 some lengthy methods, where they only changed the order of parameters).
 
 Maybe the API stayed stable since I stopped developing MS Macros (which
 is quite some time ago)
 
 But, I think what is important here: they had conversion tools, or at
 least documentation what changed and how to migrate. I think this is a
 crucial part for the acceptance of changed API. If you open an old
 Macro, get a dialog and say Yes and it still runs, I think nobody
 would object. However, of course, we do not only have Macros, so we need
 at least migration guides for extension programmers who use different
 languages.

This will not solve the problem as this again depends on the work of the
extension programmer. The user still would be lost if the developer
didn't react. If there was only Basic the worst thing that could happen
is a macro that doesn't run (as Basic uses late binding), but in case of
real programming languages most probably OOo would crash.

Best regards,
Mathias

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

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



Re: [api-dev] Assign to Save)-as) events behaviour

2006-09-05 Thread Mathias Bauer
Cor Nouws wrote:

 Hi *,
 
 In order to force/advice the saving of certain documents on a specified
 location, I prepared some macro's, looking at the documents state, name
 and such, and opening the save-dialog.
 Then I assigned the macro's to Save(-As) with Tools|Customisation|Events
 in order that a click on the 'floppy' or File|Save triggers my macro.
 
 However, it appears (2.0.3, on XP, 2.0.2 on Madrake) that my code is
 triggered áfter the regular Save(-As) actions :-\

Yes and no. Your code will be triggered right after the dialog is closed
but before the real saving starts. These events are means to perform
actions on the document before they get saved, not as a hook to replace
the built-in UI code.

 What am I supposed to do to actually replace those?

This is what DispatchInterceptors are for. Unfortunately you can't
implement them in Basic. Replacing dispatch actions triggered by the UI
with macros is currently not supported. Sounds like a good idea though.

Best regards,
Mathias

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

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



Re: [api-dev] GraphicProvider and export of graphics

2006-09-06 Thread Mathias Bauer
Jimmy wrote:

 That's exactly my problem, I can't translate it. It takes some more
 steps in Java to create a GraphicProvider, and I can't get it to work.

Does that mean that

XGraphicProvider xGraphicProvider = (XGraphicProvider)
UnoRuntime.queryInterface(XGraphicProvider.class,
xMSF.createInstance(com.sun.star.graphic.GraphicProvider));

does not return an object?

Best regards,
Mathias

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

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



Re: [api-dev] embed a browser inside openoffice dialog

2006-09-06 Thread Mathias Bauer
Madhan Ponnusamy wrote:

 Hi,
 Is it possible to have a web browser inside the openoffice dialog
 if it is possible what is API used for that purpose

Of course it is possible, but this outside of the scope of the OOo API.
The Gecko engine as well as the Internet Explorer have their own APIs
that can be used to embed them into a system window.

Best regards,
Mathias

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

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



Re: [api-dev] Assign to Save)-as) events behaviour

2006-09-07 Thread Mathias Bauer
Paolo Mantovani wrote:

 Hi Mathias,
 
 Alle 16:50, martedì 5 settembre 2006, Mathias Bauer ha scritto:
 Cor Nouws wrote:
  Hi *,
 
  In order to force/advice the saving of certain documents on a specified
  location, I prepared some macro's, looking at the documents state, name
  and such, and opening the save-dialog.
  Then I assigned the macro's to Save(-As) with Tools|Customisation|Events
  in order that a click on the 'floppy' or File|Save triggers my macro.
 
  However, it appears (2.0.3, on XP, 2.0.2 on Madrake) that my code is
  triggered áfter the regular Save(-As) actions :-\

 Yes and no. Your code will be triggered right after the dialog is closed
 but before the real saving starts. These events are means to perform
 actions on the document before they get saved, not as a hook to replace
 the built-in UI code.

  What am I supposed to do to actually replace those?

 This is what DispatchInterceptors are for. Unfortunately you can't
 implement them in Basic. Replacing dispatch actions triggered by the UI
 with macros is currently not supported. Sounds like a good idea though.
 
 Although an official support is actually missing, with a creative ;-) use 
 of the createUnoListener() function it's possible to intercept dispatches and 
 replace dispatch actions with your arbitrary basic code.

Yes, correct. Of course this is something I recommend only to
experienced developers. Thanks for posting this example. Does it exist
as a code snippet BTW?

We should mention two things here:

Your example does not support the StatusListeners so it will not send
any status events to the GUI. This will work in many cases but not in
all. In case of the Save command this command will never be disabled
then. This is not a serious problem but it will look unusual at least.
In this case it could help to redirect StatusListeners to the
SlaveDispatcher.

The interceptor also must be registered somehow, so binding the macro
that registers it to the event OnViewCreated on a global level is
recommened.

Best regards,
Mathias

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

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



Re: [api-dev] GraphicProvider and export of graphics

2006-09-07 Thread Mathias Bauer
Jimmy wrote:

 An Exception gets thrown, and I don't really know why since xMSF exists, 
 since I can initiate other services with it but it doesn't seem to work 
 for the GraphicProvider.
 
 Code:
 
 XMultiServiceFactory xMSF = (XMultiServiceFactory) 
 UnoRuntime.queryInterface(
 XMultiServiceFactory.class, xTextDocument);

Ah, I see: you took the wrong service manager. For global objects you
must take the one you have bootstrapped, not the one from the document.
The MultiServiceFactory at the document model is only for some special
objects.

If you had posted this in your first mail ...

Best regards,
Mathias

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

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



Re: [api-dev] Disptach Interceptor

2006-09-07 Thread Mathias Bauer
Jimmy wrote:

 I've been trying to implement a dispatch interceptor for commands in my 
 java component without success. I've been checking different examples on 
 the list and the developers guide but couldn't get any of those to work 
 properly. I don't really know how to connect the interceptor to the 
 actual writer component. As I understand it the Frame has to be 
 connected with the XDispatchProviderInterceptor, which is implemented in 
 my Interceptor class. But how am I connecting this class with the frame?

From the DevGuide (in chapter 6.1.6):

This chain usually only consists of the frame and the controller of the
office component it contains, but the frame offers the
com.sun.star.frame.XDispatchProviderInterception interface where other
providers are inserted. They are called before the frame tries to find a
dispatch object for a command URL, so that it is possible to put the
complete dispatch communication in a frame under external control. More
than one interceptor can be registered, thus building a bigger chain.

So please have a look at the
com.sun.star.frame.XDispatchProviderInterception interface that is
supported by the frame.

Best regards,
Mathias

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

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



Re: [api-dev] GraphicProvider and export of graphics

2006-09-07 Thread Mathias Bauer
Jimmy wrote:

 I'm sorry, missed that code in the last e-mail. But which one are you 
 talking about?
 This is my component initialisation and all I get is the xMCF but no 
 xMSF which I need. It's only possible to create the xMSF with an 
 XTextDocument, isn't it?

No, get the service manager from the ComponentContext.

The object you get by calling

xMCF = xComponentContext.getServiceManager();

is the service manager from which you can get your GraphicProvider, in
the same way you got your desktop service fromit.

Sorry for my comment about bootstrapping, I thought you are developing
a standalone Java application, in this case you had to bootstrap UNO to
get a component context.

Best regards,
Mathias

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

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



Re: [api-dev] How can I concatenate a stream word collection

2006-09-09 Thread Mathias Bauer
aloizio wrote:

 Hi
 
 I need to merge some Word files that are streams. I receive it as a
 InputStream collection and I must generate a OutputStream.
 
 I am already able to load them as XInputStream into OpenOffice I but How can
 I write a new word document that contains the previous merged?

Do you mean that you want to concatenate the documents, i.e. load the
first one, attach the second one etc.?

It *could* work by using the XDocumentInsertable interface but
unfortunately the implementation of this interface in Writer has a bug:
it doesn't load from a stream, only from a URL.

So you can load the first document from a stream, put all others into a
temporary file and insert them using the URL. Or you could wait until
the bug is fixed (should be next version past the upcoming 2.0.1
release). I don't remember the Issue ID but I know there is one.

Then you can save the whole file to an empty stream and push it into
your database.

Besr

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

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



Re: [api-dev] Assign to Save)-as) events behaviour

2006-09-09 Thread Mathias Bauer
Paolo Mantovani wrote:

 Your example does not support the StatusListeners so it will not send
 any status events to the GUI. This will work in many cases but not in
 all. In case of the Save command this command will never be disabled
 then. This is not a serious problem but it will look unusual at least.
 
 Of course you are right!
 With a small work I've been able to manage the status-listener (at least for 
 the .uno:Save dispatch) directly from my basic program.
 
 In this case it could help to redirect StatusListeners to the
 SlaveDispatcher.
 
 This would seem a bit more difficult, but I've to experiment more...

Yes, sorry I forgot that in Basic some things are more complicated. :-)
It should be possible to pass the add/removeStatusListener calls to
the SlaveDispatcher but I admit I haven't tested it in Basic.

 The interceptor also must be registered somehow, so binding the macro
 that registers it to the event OnViewCreated on a global level is
 recommened.
 
 I can't find this event among the ones available in the user interface.
 Perhaps is it only available via the API ? 

Yes, it's only available through the API. We could add it to the GUI but
then the configuration would display wrongly in older versions (it would
work though as the event is there for some time). Should we add it to
the GUI? It is at least important for all events that target frames not
documents.

Best regards,
Mathias

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

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



Re: [api-dev] Problem: rtf files haven't header and footer.

2006-09-09 Thread Mathias Bauer
aloizio wrote:

 Hi everybody,
 
 I am trying to merge a lot of RTF documents into only one rtf document. The
 problem happens when some rtf files have header and footer. They don't
 appear in the final merged document. Why the header and footer do not appear
 in merged document? Should I set any parameter of Xcursor or XText?

Do they vanish only in case you merge them or do they also vanish if you
load each file on its own? In case it's the latter it looks like a bug
in the RTF import, in case it's the former I would blame the merger.

Without testing it by myself I assume it's a bug (or perhaps
incompleteness) of the RTF import.

Best regards,
Mathias

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

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



Re: [api-dev] Problem: rtf files haven't header and footer.

2006-09-17 Thread Mathias Bauer
aloizio wrote:

 Hi
 
 The problem happens when The Word Document that contains Header and Footer
 are converted to RTF document. The header and footer normally appear in RTF
 Document. But when the RTF Documents are merged the header and footer do not
 appear  into the merged document. Therefore,  they vanish only in case I
 merge them.

Sounds strange. I recommend to file an issue and attach at least two rtf
example documents that can be used to study the effect.

Best regards,
Mathias

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

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



Re: [api-dev] Problem to connect openoffice via Tomcat

2006-09-19 Thread Mathias Bauer
aloizio wrote:

 Hi everybody,
 
 I am trying to load the OpenOffice using
 com.sun.star.comp.helper.Bootstrap.bootstrap(), frrom web application. But I
 am get the error:
  
 no executable office found
 
 What should I do?

First you should tell more about your environment: which platform, which
OOo version.

Best regards,
Mathias

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

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



Re: [api-dev] XDispatchProvider implementation

2006-09-21 Thread Mathias Bauer
Jimmy wrote:

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

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

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

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

Best regards,
Mathias

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

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



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

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

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

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

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

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

Best regards,
Mathias

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

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



Re: [api-dev] Obscure documentation (Was: [api-dev] insertnewbookmark)

2006-09-26 Thread Mathias Bauer
G. Roderick Singleton wrote:

 On Tue, 2006-09-26 at 10:31 +0200, Stephan Wunderlich wrote:
 Hi Knut,
 
  Ok, thanx. I'll make shure to file issues. There is a lot of them..  
  Starting
  with:  69861 http://www.openoffice.org/issues/show_bug.cgi? 
  id=69861 and
  69863 http://www.openoffice.org/issues/show_bug.cgi?id=69863
 
 That is great :-) ... As you already pointed out a good documentation  
 is crucial if external developers should be attracted to program for  
 OOo.
 So every step to make it better is one in the right direction :-)
 
 
 I agree. One problem though, the documentation project does not have the
 source documents so it is unlikely that the documents in the issues will
 ever be updated. Perhaps the component on the issues is wrong.

I will take care that the issues get the right assignments.

Best regards,
Mathias

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

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



Re: [api-dev] Obscure documentation (Was: [api-dev] insertnewbookmark)

2006-09-27 Thread Mathias Bauer
G. Roderick Singleton wrote:

 WHat is this? I gather from your comments that the guide is proprietary.
 If this is the case then perhaps it is time for the OOo folk to think
 about having one of their own. Certainly an incentive for a project.
 Thanks.

It seems that you don't know all the facts, so let me explain them to you.

Jürgen is already working on this matter for quite some time. It takes
this time, for whatever reasons. Especially Jürgen is one of the
greatest advocates of open sourcing the DevGuide, but giving something
into open source is not just throwing it out and shouting come and get
it.

I can understand that Jürgen is a little bit upset about Laurents
question because it was already answered several times, and the answer
always was: we (the authors) would like to open source it but it's not
that easy, please be patient.

OTOH if anybody else wants to create a new DevGuide nobody will complain
against this (provided that its quality would be sufficient). We have no
commercial interest in the DevGuide.

So please let's not discuss about something that probably won't happen
ever. Thanks.

Best regards,
Mathias

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

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



Re: [api-dev] Obscure documentation (Was: [api-dev] insertnewbookmark)

2006-09-27 Thread Mathias Bauer
G. Roderick Singleton wrote:

 Actually I think he reacted so strongly to my comment on the component
 perhaps being incorrect. The doc project does not have the source for
 the document but the issue shows up in our queue. I thought that we
 might help.

Help is always appreciated. :-)

As I already wrote, I will take care for the correct assignment of the
issues. At the end it will be one of the developers who has to provide
the documentation content so I will search for the right one.

 OTOH if anybody else wants to create a new DevGuide nobody will complain
 against this (provided that its quality would be sufficient). We have no
 commercial interest in the DevGuide.
 
 You know this might not be a bad idea. I will ask to see if any are
 interested. What with the contest, I do not expect a swift response but
 who knows.

My personal opinion (and the one of Jürgen as well IIRC) is that we want
to hand over the DevGuide to the community. Jürgen might correct me
later if I'm wrong, currently he's on a business trip.

This will still not change a lot as most of the content will still come
from the core developers but at least there will be a chance for
others to contribute and of course to translate. Let's hope for the best.

Best regards,
Mathias

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

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



Re: [api-dev] prevent document closing

2006-09-29 Thread Mathias Bauer
Adam Patacchiola wrote:

 Hi,
 
 How can I prevent a document from closing? I've figured out how to do it
 for the frame by adding a CloseListener and throwing a
 CloseVetoException in queryClosing, but this does not seem to work for
 the internal document.

It works the same way. The document will not be closed (=destroyed)
then. I assume that you also want to prevent the document windows from
being closed. This is only possible by registering your listener at the
corresponding frames.

Best regards,
Mathias

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


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



Re: [api-dev] prevent document closing

2006-09-29 Thread Mathias Bauer
Adam Patacchiola wrote:

   //If i add the listener to the frame here, the outer most 
 frame is prevented from closing, but the user can still click the 
 internal document window's close button and the document will close 
 which is not the behavior I want
 /*   XCloseBroadcaster xcb = (XCloseBroadcaster)frame;
 xcb.addCloseListener(new CloseListener());*/

Well, in fact the frame isn't closed, so there is no reason to ask your
listener for permission. There is only one frame object involved, this
object and its window are controlled by the outer (big) closer. The
inner closer (the smaller one) does not control a frame it removes the
component inside the frame from the frame. This feature was introduced
for the last frame (window) of OOo because it allows users to keep OOo
in memory without keeping their last document open.

 //If i add the listener to the xcomponent, the queryClosing 
 method is fired when either the internal document's close button or the 
 frame's close button is clicked, but the document is not prevented from 
 closing
 XCloseBroadcaster xc = (XCloseBroadcaster)xComponent;
 xc.addCloseListener(new CloseListener());

No, it should be: usually closing the document window would also close
the document (means: destroy it) but this shouldn't happen if you
register your listener and veto against closing. Of course you can't
prevent the window from being closed here - in fact you can't do it at
all as I have to admit.

So here's what you should see in the listener you have registered at the
document (component):

- you get a queryClosing
- if you throw a CloseVetoException you shouldn't get any further calls
- if you don't object you should get a closing() as well as a
disposing() notification.

Best regards,
Mathias

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

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



Re: [api-dev] MD5 signing of macros

2006-09-29 Thread Mathias Bauer
Knut Olav Bøhmer wrote:

 Hi,
 
 How about md5 signing macros, and use them so that macros that are checked
 as OK, will allways be accepted without need to press enable macros on
 load.
 One could eaven stretch it futher and use PKI/gpg to accept company
 authorized macros.
 Maybe this is the wrong forum to post this in, Would issue tracker be a good
 place?

You already can sign macros in OOo to exactly achieve this. Please find
the menu item in the file menu of the Basic IDE.

Best regards,
Mathias

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

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



Re: [api-dev] throw exception from OOo Basic

2006-09-29 Thread Mathias Bauer
Knut Olav Bøhmer wrote:

 Hi,
 
 How can I throw an exception from openoffice.org Basic?

You can't. Basic does not support exceptions.

For the case of close prevention we introduced a new service in OOo2.0.3
that takes over the job for you and deals with the exceptions. Currently
I don't have some basic code at hand, only some C++ code using
constructors that needs to be translated first. Will see if I can find
some time.

Best regards,
Mathias

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

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



Re: [api-dev] prevent document closing

2006-09-30 Thread Mathias Bauer
Adam Patacchiola wrote:

 So how do I prevent the inner document window from being closed?

As I wrote already:

 Of course you can't prevent the window from being closed here - in
 fact you can't do it at all as I have to admit.

Sorry for the bad news.

Best regards,
Mathias

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

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



Re: [api-dev] How to lock a text model

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

 Hi to all,
 
 Does someone know a way to lock/unlock the model of a text document,
 that is, to make it temporarily read-only (the user cannot change its
 content) ?
 My purpose is to make sure that when my add-on is currently retrieving
 the text and manipulating it later, it has not changed in between.
 Because I assume OO to be fully multithread, it seems theoretically
 possible to me that the user (or any component other than mine) may
 modify the text while my add-on thread is working on it.

OOo is not multithreaded, but it's possible that two threads can work on
the same OOo model as it is not locked between API calls. This will
change with our new Threading Framework in the future where code
executed in any thread can obtain an exclusive lock for a defined span
of time.

ATM you can't lock a model against changes through its API, but you can
prevent it from being modified through UI operations (dispatch calls).

Best regards,
Mathias

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

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



Re: [api-dev] How to force laying out of document

2006-10-10 Thread Mathias Bauer
Kent Gibson wrote:

 Is there anyway I can force the laying out of the
 document. I have tried using the XRefreshable
 interface and xTextDocument.reformat() and  but that
 still does not seem to really do the trick.

This should be enough IMHO. It is also debatable if retrieving the
LayoutSize property should be already enough to force a layout
calculation before the call returns. Why waiting? Further calls to the
same property will not redo the layout as Writer knows if layouting is
necessary or not.

Best regards,
Mathias

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

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



Re: [api-dev] Calc: Switch DesignMode On/Off

2006-10-10 Thread Mathias Bauer
Frank Schönheit - Sun Microsystems Germany wrote:

 Hi Laurent,
 
how to switch Design Mode on/off via macro in Calc?
 
 did you try
 thisComponent.ApplyFormDesignMode = true|false
 
 This changes the initial form design mode, which is used when opening
 the document.
 
 For switching the current design mode, you need to dispatch the URL
 .uno:SwitchControlDesignMode to the document's frame. I don't have a
 code snippet at hand for this currently, anybody else?

Switching off the design mode with the dispatch API is done in the
following way: (quote signs to avoid line breaks)

 sub designmodeoff

   document   = ThisComponent.CurrentController.Frame
   dispatcher = createUnoService(com.sun.star.frame.DispatchHelper)
   dim args(0) as new com.sun.star.beans.PropertyValue
   args(0).Name = SwitchControlDesignMode
   args(0).Value = false
   dispatcher.executeDispatch(document, .uno:SwitchControlDesignMode, , 0, 
 args1())
 
 end sub

For switching it on you must change one line:

args(0).Value = true

If you want to toggle the design mode you execute the command without
any parameters:

   dim emptyargs()
   dispatcher.executeDispatch(document, .uno:SwitchControlDesignMode, , 0, 
 emptyargs())

The rest as above.

Best regards,
Mathias

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

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



Re: [api-dev] How does one sync within a template?

2006-10-10 Thread Mathias Bauer
G. Roderick Singleton wrote:

 On Fri, 2006-10-06 at 17:22 -0400, G. Roderick Singleton wrote:
 I have been combing through sources, api webpages trying to find the
 command or set of commands that will allow one to synchronize the
 contents (frames) of a page(s) with the contents of the first one. I
 have a special form that is not in the list that the wizard has but
 would like to duplicate how it is done. I would prefer OOoBASIC
 references but take what is available. 
 
 TIA
 
 Perhaps my first question was too naive or too obscure to receive an
 answer so I will try again.  
 
 I am attempting to create a template that will be used in the manner of
 one of the built-in labels. What I would like is to have my template
 synchronize in the same manner as the label. I am hoping that this
 feature is available programmatically but as I said in my first message,
 I cannot find the commands in the sources or the on-line documentation.
 
 So, assuming the synchronizing functions exist as I expect, can they be
 used in OOoBASIC?

Unfortunately the expert for these questions is not available ATM, so I
will do my very best.

IIRC a labels document is nothing else than a document containing a
lot of frames where all frame content links to the content of the first
frame. By changing the first frame and forcing an update of all links
the frames get synchronized.

The command triggering the synchronizing is available at least through
the dispatch API so it can be called on every document that has a view,
even a hidden one would suffice.

Perhaps you can create a simple labels document, save it and look into
the XML file to verify my assumptions. If they are true it should be
possible to use the same mechanism for other coupled frames in an
arbitrary document also.

Best regards,
Mathias

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


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



Re: [api-dev] Calc: Switch DesignMode On/Off

2006-10-11 Thread Mathias Bauer
Frank Schönheit - Sun Microsystems Germany wrote:

 Hi Mathias,
 
 Switching off the design mode with the dispatch API is done in the
 following way: (quote signs to avoid line breaks)
 
sub designmodeoff

  document   = ThisComponent.CurrentController.Frame
  dispatcher = createUnoService(com.sun.star.frame.DispatchHelper)
  dim args(0) as new com.sun.star.beans.PropertyValue
  args(0).Name = SwitchControlDesignMode
  args(0).Value = false
  dispatcher.executeDispatch(document, .uno:SwitchControlDesignMode, , 
 0, args1())

end sub
 
 For switching it on you must change one line:
 
   args(0).Value = true
 
 Didn't know we have *that* cool helpers meanwhile, thanks for pointing out!

We have the DispatchHelper since we have macro recording, IIRC that was
OOo1.1. :-)

Ciao,
Mathias

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

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



Re: [api-dev] UNSANSWERED: a non-modal dialog

2006-10-11 Thread Mathias Bauer
Berend Cornelius wrote:

 Hi Nocolai,
 you may also just set the window of your dialog visible.
 xDialog = 
 xMultiServiceFactory.createInstance(com.sun.star.awt.UnoControlDialog);
 xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xDialog);
 xWindow.setVisible(true);
 
 After that you have to capture your programm flow in a loop because it 
 doesn't stop like when you use the execute() method in a modal dialog.

Why should he create a loop? That's the most annoying thing in a modal
dialog, why would you want to do the same with a modeless one?

The better way is to keep a reference to the dialog and register a
listener at it. The listener will tell you when the dialog was closed
and the reference can be used to close the dialog when it is necessary
or wanted. This could be e.g. when the whole view is closed or when the
dialog has done its job.

Best regards,
Mathias

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

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



Re: [api-dev] Calc: Switch DesignMode On/Off

2006-10-12 Thread Mathias Bauer
Frank Schönheit - Sun Microsystems Germany wrote:

 Hi Mathias,
 
 I'm a little bit unclear about an API for the design mode. First IMHO
 this isn't an API that you would expect to have at the model. It looks
 like something UI related. Maybe we can see this as a view setting?
 Where is it stored in the file format?
 
 It's definitely a view setting, so it would probably belong to the
 controller.
 
 It's not persistent at all. What's persistent is the setting which is
 reflected in the ApplyFormDesignMode property of the model: Whether or
 not the design mode should be initially on or off when the document has
 been loaded.

OK, my memory was that this property reflects the last state of the
DesignMode when the document was saved. If it's something different my
memory obviously fooled me. :-)

Besides that it looks strange that ApplyFormDesignMode is a model
property. Is it stored in the content.xml or in the settings.xml?

Ciao,
Mathias

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

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



Re: [api-dev] How to assign keyboard shortcut to add-on menu

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

 Hi,
 
 I have read an answer by Mathias Bauer mailed on 11/18/2004 that it was 
 not currently possible to assign a keyboard shortcut to an add-on menu 
 line.
 
 Is it still impossible with OO 2.0 ?
 
 Even if the assignment is dynamic (not persistent), made by some API 
 (typically by XAcceleratorConfiguration.setKeyEvent) and not by a XCU 
 file ?
 
 Thank you if you can confirm this (in which case I feel a bit 
 disapointed...).

I'm sorry to disappoint you, but this feature wasn't important enough
until now to attract development resources. Another reason is that we
still are not done with our final design for the global accelerator
configuration (http://www.openoffice.org/issues/show_bug.cgi?id=64717).

Best regards,
Mathias

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

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



Re: [api-dev] Tweaking the api for performance

2006-10-13 Thread Mathias Bauer
Kent Gibson wrote:

 We render documents using the api.  For the most part
 everything is great but performance. 
 
 Are there any ways I can tweak a bit more peformance? 

Hard to give a specific answer for such a general question. :-)

 For example we do not use the database, calc or
 presenation components. Is there any way I can make
 sure these components are not slowing things down? 

If you don't use them they will not hurt you. It's code that is loaded
only on demand.

 If I built OpenOffice myself, is there anyway I could
 optimise the build?

In general I would say yes, but I don't know your requirements are.

 The documents we render are read only, is there any
 way I can make sure that things like UI event
 listeners aren't slowing things down, and if they are
 how can I avoid this penalty?

How do you render the documents? And how do you load them?
Can you point to specific API calls that seem to be slow?

Best regards,
Mathias

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

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



Re: [api-dev] Calc: Switch DesignMode On/Off

2006-10-14 Thread Mathias Bauer
Frank Schönheit wrote:

 Hi Mathias,
 
 Besides that it looks strange that ApplyFormDesignMode is a model
 property. Is it stored in the content.xml or in the settings.xml?
 
 content.xml.
 
 Why is this strange? It's more on the level of, say, the background
 color, than, say, the zoom level: It's an aspect of the document which
 its designer describes how to look like.

I consider it to be strange as it isn't relevant if you access the
document by its API, it is something you only need if you view the
document in an editor. Anyway, there's always a grey zone.

Ciao,
Mathias

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

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



Re: [api-dev] pass com object instance to macro and call methods on it

2006-10-14 Thread Mathias Bauer
Adam Patacchiola wrote:

 Can anyone help me...I posted my question in this thread a while ago:
 http://www.oooforum.org/forum/viewtopic.phtml?p=175288 and haven't been
 able to find an answer yet.

You should explain more exactly what you want to achieve.

I can't understand from where you get the COM object and how you call
the basic macro.

Best regards,
Mathias

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

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



Re: [api-dev] iterating over text

2006-10-16 Thread Mathias Bauer
Hi Daniel,

Daniel Naber wrote:

 Hi,
 
 I posted this on oooforum.org already 
 (http://www.oooforum.org/forum/viewtopic.phtml?t=44933) but it wasn't 
 completly solved, so I need to try here again.
 
 [...] The next problem is that I need to get the text and check it, then 
 navigate to given positions and select them (this is for my grammar 
 checker, LanguageTool). I can use the following code to navigate to given 
 positions, but it seems to count in a different way than the code above 
 (i.e. using XEnumerationAccess): 
  
  XTextCursor cursor = xTextDoc.getText().createTextCursor(); 
  XParagraphCursor xParagraphCursor = (XParagraphCursor) 
  UnoRuntime.queryInterface(XParagraphCursor.class, cursor); 
  boolean hasNextParagraph = true; 
  while (hasNextParagraph) { 
if (paraCount == paragraphNumber) { 
  xParagraphCursor.gotoStartOfParagraph(false); 
  xParagraphCursor.goRight(..., false); 
} 
hasNextParagraph = xParagraphCursor.gotoNextParagraph(false); 
  }  

 So when I find an error in, say, paragraph 10, characters 5 to 8, I 
 cannot use this code to navigate there because it seems to count tables 
 differently (namely it ignores them) and I end up in paragraph 11 instead 
 of 10 with the wrong text selected. 
  
 So how can I combine the first way of iterating over text 
 (XEnumerationAccess) with using the cursor to go right/left/select? In 
 other words, if I have an XEnumeration and XEnumerationAccess, how do I 
 get an XParagraphCursor for that? 

I can't help with your problem, I only wanted to ask wether it is an
option for you to wait for our new Grammar Checking API that will not
require any text iteration from inside the Grammar Checker as it always
gets plain text as a source?

One of the reasons why we want to have a simplified is exactly the point
where you struggled: there is no common paragraph enumeration for *all*
text inside the document. So we will offer one.

Best regards,
Mathias

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

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



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

2006-10-20 Thread Mathias Bauer
Jimmy wrote:

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

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

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

In your code:

 xController = xModel.getCurrentController();

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

 xComponent = xDesktop.getCurrentComponent();

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

Or did I misunderstood your code?

Best regards,
Mathias

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

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



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

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

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

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

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

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

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

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

Best regards,
Mathias

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

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



Re: [api-dev] iterating over text

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

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

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

Ciao,
Mathias

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

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



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

2006-10-22 Thread Mathias Bauer
Hi Julien,

Julien Galand wrote:

 As a conclusion :
 - Either compile a C++ UNO component with the alignment compiler option 
 set to 8 (or at least all SDK/UNO headers).
 - Or the Reference template structure definition should be wrapped 
 with #pragma align(8).
 
 But the latter option is a fix in the SDK. Should I report this to 
 someone ?
 Or should I forward this mail to another dedicated list ?

As Stephan Bergmann is our expert for stuff like this and he already
replied to one of your last mails I assume that he also will have
something to say about your findings.

Stephan currently is just drowned in mails after some days of vacation. :-)

Best regards (and thanks for your efforts),
Mathias

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

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



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

2006-10-22 Thread Mathias Bauer
Jimmy wrote:

 Mathias Bauer schrieb:
 Jimmy wrote:

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

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

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

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

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

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

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

 In your code:

   
 xController = xModel.getCurrentController();
 

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

   
 xComponent = xDesktop.getCurrentComponent();
 

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

 Or did I misunderstood your code?

 Best regards,
 Mathias

   
 So that would lead me to the following code in order to get the 
 xComponent and the xFrame.
 
 xComponent = xModel;
 xFrame = xController.getFrame();
 
 It did fix the problem although the behaviour with the frame 
 handling/opening is still different. But I guess I'll have to rework my 
 workflow then.

Yes, you will face the same problems as we have internally in the
application framework code. In a cross platform application the last you
can rely on is focus and activation handling.

Never use anything like current or active... if you can't cope
with an empty or unexpected result. Code that just takes anything it
gets here can use methods like these successfully but code that assumes
to follow a defined workflow will fail using them.

Best regards,
Mathias

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

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



Re: [api-dev] Where is .xcu file information documented for a filter?

2006-11-01 Thread Mathias Bauer
Ian Shields wrote:

 I've built the FlatXML filter on Linux and installed it. Now my Save
 as dialog has a choice of
 DevGuide FlatXML Write ()
 as one of the types?

Sorry I don't understand. Is this a question or a description of what
you see?

 I've built another filter and used this one as a model, but I've run
 into a few questions:
 1) Why the parentheses in the Save as dialog for FlatXML and my custom
 filter?

Which parantheses? Could you describe exactly what you have seen? And
please post the type and filter data for your filter.

 2) Why no default type (I would have expected xml)
 3) How should one code the .xcu file? In particular, how are the lines:
prop oor:name=Data oor:type=xs:string
 value0,text/plain,,,txt,0/value
/prop
 interpreted and what do the various fields mean?

IIRC this is documented in the developer's guide.

 4) Should a Java filter compiled and built on Linux using gcj (32-bit)
 install on a Windows XP box (mine doesn't) or does it need to be rebuilt
 on the target platform (thus destroying the advantage of using Java).

I never used gcj - but doesn't it create a native library?

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

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



Re: [api-dev] Re: installing ooSetupConnectionURL through UNO package

2006-11-01 Thread Mathias Bauer
Knut Olav Bøhmer wrote:

 Hi is it possible to make a uno package that can be installed or
 uninsulated with unopkg, and installs:
 
 prop oor:name=ooSetupConnectionURL oor:type=xs:string
valuesocket,host=localhost,port=2002;urp;/value
 /prop
 
 Under node oor:name=Office/
 in the file: OfficePath/share/registry/data/org/openoffice/Setup.xcu
 
 Or do something that gives the same effect.

Yes, that's possible. Create a Setup.xcu files containing all necessary
data (see below), put it into a zip file and install it with pckchk.exe.
Or better (but more work) make it a .uno.pkg file and install it with
unopkg.exe. In both cases you can decide to install it per user or for
all users of that installation.

Without guarantee (not tested) the Setup.xcu file should be:

 ?xml version=1.0 encoding=UTF-8?
 oor:component-data xmlns:oor=http://openoffice.org/2001/registry; 
 xmlns:xs=http://www.w3.org/2001/XMLSchema; oor:name=Setup 
 oor:package=org.openoffice
  node oor:name=Office
   prop oor:name=ooSetupConnectionURL oor:type=xs:string
   prop oor:name= oor:type=xs:string
valuesocket,host=localhost,port=2002;urp;/value
   /prop
  /node
 /oor:component-data

(qoute signs used as they prevent line wrapping.)

Ciao,
Mathias

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

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



Re: [api-dev] Changing menus of a document in background

2006-11-06 Thread Mathias Bauer
Tobias Krais wrote:

 Hi together again,
 
 I have one more question. I would like to change the menus in a document
 in the background. Up to now I can change menus for loaded documents in
 the foreground. Here is the code:
 -%-
 XPropertySet xps = (XPropertySet)
   UnoRuntime.queryInterface(XPropertySet.class,
 xDesktop.getCurrentFrame());
 
 XLayoutManager xLayoutManager = (XLayoutManager)
 UnoRuntime.queryInterface(XLayoutManager.class,
 xps.getPropertyValue(LayoutManager));
 -%-
 
 With this code (getCurrentFrame) I can only get the XLayoutManager of
 the foreground Window.
 
 Background info: I wrote a java application that opens a document.
 Shortly after loading the document I start changing the menus. It can
 happen that meanwhile an other OO Document comes in foreground and I
 change the menus of this foreground window.
 
 How can I get the XLayoutManager of the XComponent I am working on with
 my application?

Stefan gave the right answer.

I just wanted to add that relying on which window is in the foreground
is a bad idea in general. It's platform dependent (on Linux it even
depends on the particular window manager installed) and doesn't make
your application reliable. Stefan's suggestion will work always.

To express it in short terms: use currentFrame only if you are fine
with getting which frame whatsoever or even no frame at all when OOo is
still subject to focus changes caused by the WM.

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

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



<    1   2   3   4   5   >