[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Import filter factory approach
From:       Karl-Heinz Zimmer <khz () kde ! org>
Date:       2003-12-24 8:40:22
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Dienstag, 23. Dezember 2003 11:34, Rüdiger Knörig wrote:
> Hi folks!

:-)  Hi Rüdiger!

> Currently I'm writing on a read-only KPart for viewing 3D polygon mesh
> files (e.g. .plg files) using Qt's OpenGL widget. Since I will support
> multiple file formats I would like to have a plugin-like approach for
> the import filters including a factory class where all Import plugins
> are registered:
>
>  ImportPlugin *import = factory.importPlugin(mimetype);
>
> There should be an easy way to register new Import plugins in a way
> that make it possible to use dynamically loadable plugins.

This sounds like a good idea to me, but please note that there are two
different kinds of filters:

* filters covering a whole document

* filters working on a single page (or even on a part of a page only)

Example:

    -> Export to PowerPoint would cover a complete presentation.

    -> Export to PNG would cover a single page.

Similar when importing:

    -> Import from PowerPoint (complete doc)

    -> Import some bitmap file (to add it to a single page)


So your filter framework should be capable to cover these different
options, perhaps the way StarOffice does it could help you understand
what I mean?
I am attaching part of a little StarBasic script my son is working on
currently - just to give you an idea how simple yet flexible their
solution is.

Cheers,

Karl-Heinz

- - - - - - snip - - - - snip - - - - snip - - - - snip - - - -

The way how StarOffice's filter framework is used:


document-wide stuff:
- --------------------

DIM oFilter As OBJECT
DIM aFilterData( 2 ) As new com.sun.star.beans.PropertyValue
DIM aDescriptor( 3 ) As new com.sun.star.beans.PropertyValue
DIM sFileName As String
DIM sFileNameBase As String
DIM sFileNameExt As String

oFilter = CreateUnoService("com.sun.star.drawing.GraphicExportFilter")

aFilterData[0].Name  = "Width"
aFilterData[0].Value = 800       ' 640, 704, 1024, 1280
aFilterData[1].Name  = "Translucent"
aFilterData[1].Value = false

aDescriptor[0].Name  = "FilterName"
aDescriptor[0].Value = "GIF"
aDescriptor[1].Name  = "URL"  ' value is set in the loop below
aDescriptor[2].Name  = "FilterData"
aDescriptor[2].Value = aFilterData

sFileNameBase = "PAGE"
sFileNameExt  = ".GIF"


called inside a FOR loop iterating over the pages (oPage == 1 page):
- --------------------------------------------------------------------

sFileName = sFileNameBase + Str( nPage ) + sFileNameExt

aDescriptor[1].Value = ConvertToURL( sFileName )

oFilter.setSourceDocument( oPage )
oFilter.filter( aDescriptor )

- - - - - - snip - - - - snip - - - - snip - - - - snip - - - -
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/6VD7CcaVnbvggDcRAq2/AKDmTeO2bjaE/XpIPwtlcCrSFysszACcDP/i
K7RKwU1/UnTWAKS4SgYU6Cg=
=I0hN
-----END PGP SIGNATURE-----

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic