Andreas Schneider wrote:
I have several problems integrating a Calc Addin and Addon to make them work together.

1. I catch double clicks on spreadsheet cells. When certain criteria are
met, a dialog should be shown. That works more or less (see problem
number 2), but besides the dialog successfully open, the cell also
switches into edit mode. Is there a way to prevent this? I had hope that
the return value of mousePressed would influence the following behavior,
but it doesn't matter if I return true or false (as it seems). I thought
of something like a custom editor (instead of showing the edit/text field, I would display a dialog with several selections).

As a workaround, you can change the cell cursor position. That ensures the edit mode is stopped.

2. I need to know what the cell contains. I know, I asked that some time
ago, but maybe there's a better solution now. Is there some (maybe even
unofficial) way to calculate values the same way the cell content is
calculated? The "solution" that was given to me some time ago was, to
write into a cell temporarily and then read the content. But there are
several problems: a) I can't really know what return type a function
had, as I could only get the result as string from XText, b) if the cell
has any format settings (like percentage, currency, or something else)
the result is also messed up and finally c) it looks ugly as the user
sees the value change(s) for at least a split second (even when using
the XActionLockable interface).

The result type of a formula in a cell is available with the property "FormulaResultType". If you want to calculate a single function, you can use the FunctionAccess service. Or you could open a hidden document.

Another (maybe even better) solution would be, if I could find
references between cells and volatileresults. That way I could just
check if the cell is somehow connected to a volatileresult delivered by
my addin and then query all necessary values from that one. But I was
not able to find this connection, although one should exist, given that
a XVolatileResult registers listeners.

The cell is just notified using its normal dependency mechanism, it doesn't keep a separate list of VolatileResults. As you probably know, it's up to the AddIn to return the same VolatileResult instance when called again with the same parameters.

Niklas

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

Reply via email to