[scribus-dev] Style Export Feature (primitive version)

Christoph Schäfer christoph-schaefer at gmx.de
Wed Jan 27 05:58:29 CET 2010


Am Dienstag, 26. Januar 2010 17:12:01 schrieb Jain Basil Aliyas:
> Hello,
>
> I've implemented a feature which exports all the styles in a scribus
> document. The story goes like this :
>
> I have a scribus document with many styles in it.One of my friends need the
> styles in that document, so that he can import it into his document using
> the import option in the Style Manager. But my document is confidential, so
> I refused to give him the stuff.
>
> Thinking in this way, I decided to implement this feature!
>
> I've added a pushbutton in the Style Manager, named "Export". Clicking this
> will give you the save dialog to save your file as "sla". This sla will
> contain only the styles in the current document. See a sample generated be
> me :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <SCRIBUSUTF8NEW Version="1.5.0.svn">
>     <DOCUMENT>
>         <STYLE NAME="Default Paragraph Style" DefaultStyle="1" ALIGN="0"
> LINESPMode="0" LINESP="15" INDENT="0" RMARGIN="0" FIRST="0" VOR="0"
> NACH="0" DROP="0" DROPLIN="2" DROPDIST="0"/>
>         <STYLE NAME="Jain's Style" PARENT="Default Paragraph Style" VOR="3"
> FCOLOR="Red"/>
>         <CHARSTYLE CNAME="Default Character Style" DefaultStyle="1"
> FONT="Arial Regular" FONTSIZE="12" FEATURES="inherit" FCOLOR="Black"
> FSHADE="100" SCOLOR="Black" SSHADE="100" TXTSHX="5" TXTSHY="-5" TXTOUT="1"
> TXTULP="-0.1" TXTULW="-0.1" TXTSTP="-0.1" TXTSTW="-0.1" SCALEH="100"
> SCALEV="100" BASEO="0" KERN="0"/>
>     </DOCUMENT>
> </SCRIBUSUTF8NEW>
>
> I imported this document in another place inorder to test whether this
> works correctly, and it works!
>
> I am attaching the patch and 2 files.
>
> smstyleexport.h and smstyleexport.cpp should be placed inside scribus/ui/
> and apply the patch.
>
> *This is a very primitive version, we may think of expanding it by adding a
> feature like selective export of styles rather than simply exporting all
> the styles in document and so on.*
>
> I think this will also help in sharing of Scribus styles and creating a
> database of cool scribus style :)
>

As per discussion with Jain in IRC, I suggest we let Scribus save a style file 
with a separate file extension. I suggest LSY (for Layout Style, but also 
because the extension is not in use by any other app/format). That way, 
people will not try to open a SLA file that contains nothing but styles.

Adventurous developers may then try to write a JavaScript extension for 
InDesign to enable the exchange of style with that program.

The next step would be to extract styles from XTG, IDML, INX, ODT, SXW files 
and other formats Scribus will support in the future.

Christoph





More information about the scribus-dev mailing list