List Info

Thread: KOffice 2.0 plan for object embedding.




KOffice 2.0 plan for object embedding.
user name
2006-07-14 11:37:30
The other day we were talking about kspread and how to let
it use flake. 
And it showed there was still quite some different opinions
about the 
topic.  We talked about it further and here is a summary of
the way we 
want to go in 2.0

First; the 1.x way is using KoPart.  An advanced KPart.
any part is implemented by providing a widget that is placed
on the canvas 
of another application.
This has various disadvantages:
- widgets can't be rotated. So parts can't either.
- no transparancy possible; its always square.
- zooming of parts sucks.  Printing a part means to zoom and
crop, which 
currently just does not work very relyably. For various
reasons.
- It tends to be too much;  having a horizontal line in
kword should not 
imply I have to embed a whole karbon doc.  Same for just 1
or 10x10 cells 
of kspread.

So; on to the flakes idea.
The idea is to have each application find parts that are to
be shared. In 
KWord this is a text shape.  Nothing more.  In Krita this is
both a layer 
and a group of layers. Maybe more.

The technical part of getting this realized means to select
what exactly 
to make into a flake.  Choose something that is usefull as a
separate 
component in other applications.
One obvious pitfall here is what it means to make something
a flake. Flake 
does not ship a canvas and a KoShape is nothing but a class
you have to 
extend and implement its paint() method for.
This has the effect that an application can reuse the
application-specific 
libraries for the painting and therefor provide a flake
without actually 
using it itself. For minimum impact on the application
internals.
To use other applications flakes you need to follow the
simple steps 
detailed in the flake docs which allows flake shapes to be
drawn on top 
of your own already existing canvas.

For simple shapes (think regularpolygon) its easy to leave
all the 
interaction to the application the user is working in. For
more complex 
shapes, or even loading a set of shapes like an eps in
karbon I suggest 
to not extend KoShape but KoShapeContainer. This gives moves
a lot of 
power to the flake itself.  This strategy really is the
replacement of 
KoPart in that it allows a whole document to be embedded
with all its 
shapes and child shapes.

There are some things you should know when you implement the
paint of your 
own KoShape inheriting class.
A KoShape uses the postscript point totally. This means you
will not need 
to do any conversion in your application.  KSpread can get
rid of the 
dozens of zooms and unzooms in Cell 
Next there is a plugin tester app, as posted on this list
earlier; load 
your plugin and see if it paints correctly and if it does
things like 
non-square borders correctly.

I suggest kspread to create a flake that will print a
pre-defined set of 
cells. (x times y)
I suggest kchart to export about the same as its part does
now.
I suggest KFormula to export about the same as its part does
now.
I suggest karbon _uses_ a shape that is in the koffice
libraries (either 
as a real shape or as an object in a separate library) for
basic vector 
shapes. It should also export a shape that is capable of
loading a vector 
graphics file of any complexity.
I suggest kivio to export a basic shape that can draw a
single stencil.  
It should also export a graph shape that combines several
stencil shapes.

These are the main apps; I have not really looked at the
others to see how 
they can be integrated.  Maybe others can follow the ideas
above and 
extrapolate.

Any questions; feel free to look me up on #koffice
-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 11:48:05
On 7/14/06, Thomas Zander <zanderkde.org> wrote:
> I suggest kspread to create a flake that will print a
pre-defined set of
> cells. (x times y)

The thing is, these cells can contain formulas so they may
need to be
recalculated every now and then, they can depend on other
cells
outside the given range - so basically it'd require full
kspread to be
loaded anyway, or a ton of functionality to be dropped in
the flake
version.

/ Tomas
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 11:59:05
> First; the 1.x way is using KoPart.  An advanced KPart.
> any part is implemented by providing a widget that is
placed on the canvas
> of another application.
> This has various disadvantages:
> - widgets can't be rotated. So parts can't either.
> - no transparancy possible; its always square.
> - zooming of parts sucks.  Printing a part means to
zoom and crop, which
> currently just does not work very relyably. For various
reasons.
> - It tends to be too much;  having a horizontal line in
kword should not
> imply I have to embed a whole karbon doc.  Same for
just 1 or 10x10 cells
> of kspread.

> One obvious pitfall here is what it means to make
something a flake. Flake
> does not ship a canvas and a KoShape is nothing but a
class you have to
> extend and implement its paint() method for.

Looks like some kind of "Flyweight" pattern,
where the various shapes
share a common renderer (i.e. a QPainter object)
Is it planned to to more things, e.g. dispatching mouse and
keyboard events?
This should allow for things like in-place-editing of
shapes.

I think input dispatching is important because the flake
doesn't know
about its contains. It may be displayed scaled to 3x its
size or rotated
45degrees.
So only the container knows the correct screen-to-world
transformation matrix
for its embedded flake.

> For simple shapes (think regularpolygon) its easy to
leave all the
> interaction to the application the user is working in.
For more complex
> shapes, or even loading a set of shapes like an eps in
karbon I suggest
> to not extend KoShape but KoShapeContainer. This gives
moves a lot of
> power to the flake itself.  This strategy really is the
replacement of
> KoPart in that it allows a whole document to be
embedded with all its
> shapes and child shapes.

While I more or less understand what if a Flake (or KoShape)
is, I don't
quite understand about KoShapeContainer. I assume this is
still not a
canvas implementation?

Regards
Dirk

_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 12:45:02
On Friday 14 July 2006 13:48, Tomas Mecir wrote:
> > I suggest kspread to create a flake that will
print a pre-defined set
> > of cells. (x times y)
>
> The thing is, these cells can contain formulas so they
may need to be
> recalculated every now and then, they can depend on
other cells
> outside the given range - so basically it'd require
full kspread to be
> loaded anyway, or a ton of functionality to be dropped
in the flake
> version.

To be clear; its perfectly ok to remove any cell-data
outside the given 
range.

And I fully expect the full kspread to be loaded anyway.
This is not about 
stripping down kspread, this is about creating a different
way to show 
the cells-data.
For example; I expect the kspread shape to live in a subdir
and to create 
a plugin file (kspread_flake.a) by extending KoShape and
having as one of 
its members the data structure required for holding the data
of the 
visible cells.
It would use the kspread core library to access that data
and it would use 
the methods and classes from the core library to do all the
calculations.
-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 12:36:45
On Friday 14 July 2006 13:59, Dirk Schönberger wrote:
> > One obvious pitfall here is what it means to make
something a flake.
> > Flake does not ship a canvas and a KoShape is
nothing but a class you
> > have to extend and implement its paint() method
for.
>
> Looks like some kind of "Flyweight"
pattern, where the various shapes
> share a common renderer (i.e. a QPainter object)

Not specifically; but we allow this design to be used, yes.

> Is it planned to to more things, e.g. dispatching mouse
and keyboard
> events? This should allow for things like
in-place-editing of shapes.

We use KoTool extending plugins for that.

For example; the KoTextShape has an accompanying KoTextTool.
See http://www.koffice.org/developer/apidocs/libs-flak
e/index.html
The KoShapeFactory and the KoToolFactory have matching ids
to join them.

> > For simple shapes (think regularpolygon) its easy
to leave all the
> > interaction to the application the user is working
in. For more
> > complex shapes, or even loading a set of shapes
like an eps in karbon
> > I suggest to not extend KoShape but
KoShapeContainer. This gives
> > moves a lot of power to the flake itself.  This
strategy really is
> > the replacement of KoPart in that it allows a
whole document to be
> > embedded with all its shapes and child shapes.
>
> While I more or less understand what if a Flake (or
KoShape) is, I
> don't quite understand about KoShapeContainer. I
assume this is still
> not a canvas implementation?

Think of a KoShape as it was a QWidget. But very
lightweight.
We have KoShapeContainer to allow it to contain other
shapes. Like a 
QWidget that shows children.

-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 13:04:26
On 7/14/06, Thomas Zander <zanderkde.org> wrote:
> To be clear; its perfectly ok to remove any cell-data
outside the given
> range.
>
> And I fully expect the full kspread to be loaded
anyway. This is not about
> stripping down kspread, this is about creating a
different way to show
> the cells-data.
> For example; I expect the kspread shape to live in a
subdir and to create
> a plugin file (kspread_flake.a) by extending KoShape
and having as one of
> its members the data structure required for holding the
data of the
> visible cells.
> It would use the kspread core library to access that
data and it would use
> the methods and classes from the core library to do all
the calculations.


Hmm, that might be doable. Guess I'll need to have a better
look at
the whole Flake thing though. Also, the thing needs to be
done in a
way so that there's as much code reuse as possible - having
two
painting routines, one for main app and one for flake, is a
no-go.

/ Tomas
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 13:55:33
Hi,

I'm sorry to ask a stupid question, but what is the
practical benefit
of this for our users?  What would a KSpread flake give them
that
isn't already available via the KoParts system?

Regards
Robert.

On 14/07/06, Tomas Mecir <mecirtgmail.com> wrote:
> On 7/14/06, Thomas Zander <zanderkde.org> wrote:
> > To be clear; its perfectly ok to remove any
cell-data outside the given
> > range.
> >
> > And I fully expect the full kspread to be loaded
anyway. This is not about
> > stripping down kspread, this is about creating a
different way to show
> > the cells-data.
> > For example; I expect the kspread shape to live in
a subdir and to create
> > a plugin file (kspread_flake.a) by extending
KoShape and having as one of
> > its members the data structure required for
holding the data of the
> > visible cells.
> > It would use the kspread core library to access
that data and it would use
> > the methods and classes from the core library to
do all the calculations.
>
>
> Hmm, that might be doable. Guess I'll need to have a
better look at
> the whole Flake thing though. Also, the thing needs to
be done in a
> way so that there's as much code reuse as possible -
having two
> painting routines, one for main app and one for flake,
is a no-go.
>
> / Tomas
> _______________________________________________
> koffice-devel mailing list
> koffice-develkde.org
> h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
>
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 14:01:50
On 7/14/06, Robert Knight <robertknightgmail.com> wrote:
> Hi,
>
> I'm sorry to ask a stupid question, but what is the
practical benefit
> of this for our users?  What would a KSpread flake give
them that
> isn't already available via the KoParts system?


To my understanding, it's more light-weight and more
flexible than
KParts. There may be other benefits, but I'll leave those
for someone
more experienced to comment on 

/ Tomas
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 14:21:24
> Hi,
>
> I'm sorry to ask a stupid question, but what is the
practical benefit
> of this for our users?  What would a KSpread flake give
them that
> isn't already available via the KoParts system?
>

I would think something like a table which looks like it is
part of the
container document, instead of just a widget which just
happen to be on
the same place.
Think things like the following:

- same scale factor than the parent document
- no scroll bars (wich belong to the KSpread document
window), there
should be displayed just a subview of a document (say 10x10
cells),
instead of the whole KSpread GUI (including things like
toolbars and
multiple sheets)
- if the "parent" application allows for e.g.
rotated flakes, you could
see a rotated table.

From what I know, the only problem is that there currently
exist no good
container application which could show the possible features
;)
A good candidate for such a application would be something
which is more
DTP oriented than e.g. KWord, i.e. something like Scribus,
but with better
KOffice integration.

Another idea about what could be possible is the
"Ragtime" suite
(http://www.ragtime.de)
Unfortunately I have not found good screenshots which show
the
capabilities :(

Regards
Dirk


_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
KOffice 2.0 plan for object embedding.
user name
2006-07-14 15:14:05
On Friday 14 July 2006 16:21, Dirk Schönberger wrote:
> I would think something like a table which looks like
it is part of the
> container document, instead of just a widget which just
happen to be on
> the same place.
> Think things like the following:
>
> - same scale factor than the parent document
> - no scroll bars (wich belong to the KSpread document
window), there
> should be displayed just a subview of a document (say
10x10 cells),
> instead of the whole KSpread GUI (including things like
toolbars and
> multiple sheets)

Exactly; see also my introduction parag on the disadvantages
of koparts in 
the long email at the start of this thread.

> - if the "parent" application allows for
e.g. rotated flakes, you could
> see a rotated table.

All applications allow rotated flakes as that functionality
is part of the 
flake library 
Included skewed and scaled shapes.

> From what I know, the only problem is that there
currently exist no
> good container application which could show the
possible features ;) 

Well, there are two; the test app[1] and KWord already shows
most of the 
features, but they are just not nearly as polished as I want
them to 
be 

> A 
> good candidate for such a application would be
something which is more
> DTP oriented than e.g. KWord, i.e. something like
Scribus, but with
> better KOffice integration.

For such purposes KWord already is very much capable of
doing what you 
want. Scribus is naturally more mature, but a huge chunk of
the features 
needed for DTP will be available in KWord 2.0 and various
are already 
there.
Really; I think you will be pleasantly surprised by the work
already done.  
See; http://www.kdede
velopers.org/blog/91 for various blogs over the past 
weeks that show this kind of stuff I've been working on.



1) You can get it using:
darcs get --partial ht
tp://people.fruitsalad.org/zander/software/flake
-- 
Thomas Zander
_______________________________________________
koffice-devel mailing list
koffice-develkde.org
h
ttps://mail.kde.org/mailman/listinfo/koffice-devel
[1-10] [11-12]

about | contact  Other archives ( Real Estate discussion Medical topics )