Aaron Digulla wrote:

> Hello,
> 
> I'm working on an application for novel writers. One of the most  
> important parts is the text editor. Right now, I'm at a loss which way  
> is better: Should I embed OO in my application or is it more simple to  
> rewrite OO to match my needs?

Both is possible but embedding surely is more work and can bring you
more nasty bugs to fix. But if the bean works for you, go ahead.

> Basically, I just need a rich text editor where I can control what the  
> user can do depending on where the cursor is in a document. Think of a  
> form editor where users can add text with bold and italics in one  
> place and lists+tables in another and in another, you can have an  
> image but no text, etc.
> 
> So I need to be able to control whether the user can modify something  
> at all and when he can modify the document, what he can do.

What means "control"? Do you just want to have a tool preventing users
from making unwanted changes by accident or do you want to have
something that makes it impossible for the users to do that?

> At first thought, it seems to be most simple to track the cursor  
> position and enable/disable menus and toolbars (along with the  
> keyboard shortcuts) depending on where it is. How could I achieve that  
> from within OO and from an embedded OO in Java?

You can register a DispatchInterceptor at the Frame object containing
the document window that disables or routes all commands as needed. A
SelectionListener can track the cursor position. In case something
relevant happens, the listener can force the Frame to re-check its
Dispatches for all commands found anywhere in any UI element.

> I tried to use OOoBean to embed Writer in my application. After  
> getting rid of every toolbar I could find (using the deprecated  
> set*Visible()-API), I'm left with a last toolbar that won't go away  
> (it contains a combo for the formats, the current font, the font size,  
> bold, italics, underline, etc). My guess is that this is a "floater"  
> but I couldn't find the URL for this UI element so I can't hide it  
> with the XLayoutManager api. Any hints?

It's a bug if you can't get rid of all toolbars without using direct AWT
calls.

> Lastly, I need to get rid of the rulers, too (the user shouldn't be  
> able to change the text width). I found "ViewSettings" which seems to  
> control whether rulers are visible or not, but I couldn't find how to  
> access this class from Java. Any pointers how to achieve that?

The document (model) has an interface css.lang.XMultiServiceFactory.
IIRC you can instantiate a css.view.ViewSettings service using this
interface. I'm not sure if settings made through this API get through
immediately (sure - this would be a bug too, but I never said OOo hasn't
got any ;-)).

> 
> Also, any hints on how to get rid of any space between the text and  
> the frame would be most welcome. The user will always only edit small  
> scenes in the editor, so I'd like to give the impression of an endless  
> sheet of paper which is always as wide as the window (i.e. no print  
> margin, no gray area around the text).

Perhaps using Web Layout can help?

Ciao,
Mathias

-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "[EMAIL PROTECTED]".
I use it for the OOo lists and only rarely read other mails sent to it.


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

Reply via email to