Calc: Extension providing custom cell rendering - possible ?

View: New views
5 Messages — Rating Filter:   Alert me  

Calc: Extension providing custom cell rendering - possible ?

by Jan Holst Jensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

I would like to be able to render cell content in an owner-draw fashion.

An intuitive way to control this for the end-user (or at least for me)
would be to add a new format to "Format Cells". I was thinking along the
lines of adding an item to "Numbers"->"Category", say "SVG image", and
cells containing SVG instructions would display the SVG graphics instead
of the SVG text. Alternatively a "Format" could be added to the
"User-defined" category ?

The actual rendering instructions that I would like to support are not
SVG but "protein rendering info" as shown at
http://www.biochemfusion.com/downloads/protein_renderer.html. However,
the two problems are equivalent and the rendering info could easily be
translated to SVG if necessary.

Can this be done as an UNO extension or would this need to added
directly into Calc as native functionality ?

PS: I've seen this implemented by a number of vendors in Excel but trust
me - you don't really want to know how they do it (seriously fun hacking
necessary) :-).

Cheers
-- Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Calc: Extension providing custom cell rendering - possible ?

by Niklas Nebel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 06/13/09 11:45, Jan Holst Jensen wrote:

> I would like to be able to render cell content in an owner-draw fashion.
>
> An intuitive way to control this for the end-user (or at least for me)
> would be to add a new format to "Format Cells". I was thinking along the
> lines of adding an item to "Numbers"->"Category", say "SVG image", and
> cells containing SVG instructions would display the SVG graphics instead
> of the SVG text. Alternatively a "Format" could be added to the
> "User-defined" category ?
>
> The actual rendering instructions that I would like to support are not
> SVG but "protein rendering info" as shown at
> http://www.biochemfusion.com/downloads/protein_renderer.html. However,
> the two problems are equivalent and the rendering info could easily be
> translated to SVG if necessary.
>
> Can this be done as an UNO extension or would this need to added
> directly into Calc as native functionality ?
>
> PS: I've seen this implemented by a number of vendors in Excel but trust
> me - you don't really want to know how they do it (seriously fun hacking
> necessary) :-).

There is no such API available. But an extension could register as a
listener for value changes, and then insert shapes into the document for
the desired output. Or would that already fall into the "don't really
want to know" category?

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Calc: Extension providing custom cell rendering - possible ?

by Jan Holst Jensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Niklas Nebel wrote:

> On 06/13/09 11:45, Jan Holst Jensen wrote:
>> I would like to be able to render cell content in an owner-draw fashion.
>>
>> An intuitive way to control this for the end-user (or at least for
>> me) would be to add a new format to "Format Cells". I was thinking
>> along the lines of adding an item to "Numbers"->"Category", say "SVG
>> image", and cells containing SVG instructions would display the SVG
>> graphics instead of the SVG text. Alternatively a "Format" could be
>> added to the "User-defined" category ?
>>
>> The actual rendering instructions that I would like to support are
>> not SVG but "protein rendering info" as shown at
>> http://www.biochemfusion.com/downloads/protein_renderer.html.
>> However, the two problems are equivalent and the rendering info could
>> easily be translated to SVG if necessary.
>>
>> Can this be done as an UNO extension or would this need to added
>> directly into Calc as native functionality ?
>>
>> PS: I've seen this implemented by a number of vendors in Excel but
>> trust me - you don't really want to know how they do it (seriously
>> fun hacking necessary) :-).
>
> There is no such API available. But an extension could register as a
> listener for value changes, and then insert shapes into the document
> for the desired output. Or would that already fall into the "don't
> really want to know" category?

Whether it falls into that category really depends on how it behaves
:-). Are you suggesting adding shapes on top of the cells that I want
custom rendered - and then move the shapes whenever cells change so the
shapes follow the underlying data around ? This is very much like the
"you don't want to know" solutions that I hint at. Not easy to get
working in a robust fashion - uh-oh.

But maybe that is not what you suggested - can I really embed
pictures/shapes in a cell so they are truly in-line in-the-cell ?

My experience with adding graphics to a sheet (in both Excel and Calc)
has always been that the graphics will not follow data in the cell.
Let's say you have an address book in a sheet - column A holds names and
column B holds the people's pictures (that is: pictures are put in the
document on top of column B). As soon as you e.g. change the sort order
of column A a name may then be matched with some random picture since
the pictures are not moved when cell data is shuffled around. This is
the number one problem with all solution attempts that just add standard
graphics to a sheet.

Cheers
-- Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Calc: Extension providing custom cell rendering - possible ?

by Niklas Nebel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 06/18/09 08:18, Jan Holst Jensen wrote:

> Whether it falls into that category really depends on how it behaves
> :-). Are you suggesting adding shapes on top of the cells that I want
> custom rendered - and then move the shapes whenever cells change so the
> shapes follow the underlying data around ? This is very much like the
> "you don't want to know" solutions that I hint at. Not easy to get
> working in a robust fashion - uh-oh.
>
> But maybe that is not what you suggested - can I really embed
> pictures/shapes in a cell so they are truly in-line in-the-cell ?
>
> My experience with adding graphics to a sheet (in both Excel and Calc)
> has always been that the graphics will not follow data in the cell.
> Let's say you have an address book in a sheet - column A holds names and
> column B holds the people's pictures (that is: pictures are put in the
> document on top of column B). As soon as you e.g. change the sort order
> of column A a name may then be matched with some random picture since
> the pictures are not moved when cell data is shuffled around. This is
> the number one problem with all solution attempts that just add standard
> graphics to a sheet.

There are some issues with shapes and their positions. Issue 102061 will
improve that a bit, but basically the component would have to refresh
the shapes. A special API for cell rendering would certainly make things
easier, but we don't have that.

Niklas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: Calc: Extension providing custom cell rendering - possible ?

by Jan Holst Jensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Niklas Nebel wrote:
> There are some issues with shapes and their positions. Issue 102061
> will improve that a bit, but basically the component would have to
> refresh the shapes. A special API for cell rendering would certainly
> make things easier, but we don't have that.
>

Thanks for the pointer. I'll look into locking shapes to cells and see
how it works for me.

If it doesn't, I'll see if I can contribute some fairly generic solution
natively - if I can get my head around the build process ;-).

Cheers
-- Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...