Review Request: Add svg support to the flake library

Jan Hambrecht jaham at gmx.net
Sat Aug 13 17:05:23 BST 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102315/
-----------------------------------------------------------

Review request for Calligra.


Summary
-------

This patch adds support for loading and saving embedded svg files within odf documents. There is an interface SvgSerializable which shapes can choose to implement to provide support for saving and loading themselves to and from svg. There are already some shapes ported to use that interface, namely ArtisticTextShape, EllipseShape, RectangleShape, PictureShape.
It also adds support for saving generic shapes to svg by utilizing the QSvgGenerator. Saving generic shapes to svg might be further improved in the future by having support to save odf to a single (flat) xml files which could be embedded into a svg document. This way we could utilize the native saving and loading support of non-svg shapes to not lose any data. Compatibility with other svg applications is ensured by using a svg:switch element which makes it possible to save different representations of a shape inside a svg document. 
I put the svg classes into the flake library for now as I created a circular dependency between flake and the svg stuff while working on the patch.
However this dependency is currently not there anymore, so we might put these svg classes back into a separate lib. There are two things which might be considered which would then not allow separating flake and the svg classes.
1. There is a shape factory SvgShapeFactory which must be added to the shape registry to allow creating individual shapes from embedded svg content instead of using the VectorShape to display embedded svg content. The thing is, that this decision is probably application specific as e.g. karbon absolutely wants to have individual shape created from embeded svg content, whereas words might be perfectly happy to have the vector shape display svg content. If the factory is not added to the shape registry then copy pasting pure svg shapes like the artistic text shape is not possible without losing data (it would save itself to an embedded svg file but copying would produce a vector shape). So if we want the SvgShapeFactory always added to the shape registry, we probably would do that inside the shape registry itself.
2. Merging the two functions from SvgSerializable into KoShape. If we want to do that we would depend on the svg classes and separating them from flake would no longre be possible.


This addresses bugs 271360 and 274654.
    http://bugs.kde.org/show_bug.cgi?id=271360
    http://bugs.kde.org/show_bug.cgi?id=274654


Diffs
-----

  CMakeLists.txt d85a06f 
  braindump/plugins/stateshape/StateShapeFactory.cpp 526c182 
  braindump/plugins/webshape/WebShapeFactory.cpp 9c18655 
  filters/karbon/CMakeLists.txt a979a73 
  filters/karbon/svg/CMakeLists.txt 14debd3 
  filters/karbon/svg/SvgClipPathHelper.h 05c4e62 
  filters/karbon/svg/SvgClipPathHelper.cpp 0fc6378 
  filters/karbon/svg/SvgCssHelper.h 86238b5 
  filters/karbon/svg/SvgCssHelper.cpp d4a959b 
  filters/karbon/svg/SvgExport.cpp 1c49c7c 
  filters/karbon/svg/SvgFilterHelper.h 64d5828 
  filters/karbon/svg/SvgFilterHelper.cpp 56a093a 
  filters/karbon/svg/SvgGradientHelper.h 83486c2 
  filters/karbon/svg/SvgGradientHelper.cpp c2a6090 
  filters/karbon/svg/SvgGraphicContext.h 0daa8cd 
  filters/karbon/svg/SvgLoadingContext.h 770a304 
  filters/karbon/svg/SvgLoadingContext.cpp a7bb4a1 
  filters/karbon/svg/SvgParser.h bd8a9dd 
  filters/karbon/svg/SvgParser.cpp c539e90 
  filters/karbon/svg/SvgPatternHelper.h 70b14ac 
  filters/karbon/svg/SvgPatternHelper.cpp 42da550 
  filters/karbon/svg/SvgSavingContext.h 2022b00 
  filters/karbon/svg/SvgSavingContext.cpp 2333910 
  filters/karbon/svg/SvgTextHelper.h b0b3060 
  filters/karbon/svg/SvgTextHelper.cpp 6104664 
  filters/karbon/svg/SvgUtil.h 87a8f14 
  filters/karbon/svg/SvgUtil.cpp 92f635c 
  filters/karbon/svg/SvgWriter.h 2644ce1 
  filters/karbon/svg/SvgWriter.cpp 2bcc664 
  karbon/ui/KarbonPart.cpp 1eb5319 
  kexi/shapes/relationdesign/kexirelationdesignfactory.cpp 2cfd5b9 
  kpresenter/part/KPrPlaceholderShapeFactory.cpp fdca058 
  libs/flake/CMakeLists.txt b9f388f 
  libs/flake/KoConnectionShapeFactory.cpp 7e96f2b 
  libs/flake/KoPathShapeFactory.cpp c62658e 
  libs/flake/KoShapeFactoryBase.h 79a893d 
  libs/flake/KoShapeFactoryBase.cpp fbbab41 
  libs/flake/KoShapeRegistry.h 593e61a 
  libs/flake/KoShapeRegistry.cpp 06e4c7c 
  libs/flake/svg/SvgClipPathHelper.h PRE-CREATION 
  libs/flake/svg/SvgClipPathHelper.cpp PRE-CREATION 
  libs/flake/svg/SvgCssHelper.h PRE-CREATION 
  libs/flake/svg/SvgCssHelper.cpp PRE-CREATION 
  libs/flake/svg/SvgFilterHelper.h PRE-CREATION 
  libs/flake/svg/SvgFilterHelper.cpp PRE-CREATION 
  libs/flake/svg/SvgGradientHelper.h PRE-CREATION 
  libs/flake/svg/SvgGradientHelper.cpp PRE-CREATION 
  libs/flake/svg/SvgGraphicContext.h PRE-CREATION 
  libs/flake/svg/SvgGraphicContext.cpp PRE-CREATION 
  libs/flake/svg/SvgLoadingContext.h PRE-CREATION 
  libs/flake/svg/SvgLoadingContext.cpp PRE-CREATION 
  libs/flake/svg/SvgParser.h PRE-CREATION 
  libs/flake/svg/SvgParser.cpp PRE-CREATION 
  libs/flake/svg/SvgPatternHelper.h PRE-CREATION 
  libs/flake/svg/SvgPatternHelper.cpp PRE-CREATION 
  libs/flake/svg/SvgSavingContext.h PRE-CREATION 
  libs/flake/svg/SvgSavingContext.cpp PRE-CREATION 
  libs/flake/svg/SvgSerializable.h PRE-CREATION 
  libs/flake/svg/SvgSerializable.cpp PRE-CREATION 
  libs/flake/svg/SvgShapeFactory.h PRE-CREATION 
  libs/flake/svg/SvgShapeFactory.cpp PRE-CREATION 
  libs/flake/svg/SvgStyleParser.h PRE-CREATION 
  libs/flake/svg/SvgStyleParser.cpp PRE-CREATION 
  libs/flake/svg/SvgStyleWriter.h PRE-CREATION 
  libs/flake/svg/SvgStyleWriter.cpp PRE-CREATION 
  libs/flake/svg/SvgUtil.h PRE-CREATION 
  libs/flake/svg/SvgUtil.cpp PRE-CREATION 
  libs/flake/svg/SvgWriter.h PRE-CREATION 
  libs/flake/svg/SvgWriter.cpp PRE-CREATION 
  plugins/artistictextshape/ArtisticTextLoadingContext.h PRE-CREATION 
  plugins/artistictextshape/ArtisticTextLoadingContext.cpp PRE-CREATION 
  plugins/artistictextshape/ArtisticTextShape.h 253113e 
  plugins/artistictextshape/ArtisticTextShape.cpp 1883968 
  plugins/artistictextshape/ArtisticTextShapeFactory.cpp de4ad1f 
  plugins/artistictextshape/ArtisticTextTool.cpp 2c57c07 
  plugins/artistictextshape/CMakeLists.txt f92533d 
  plugins/chartshape/ChartShapeFactory.cpp 793aa46 
  plugins/commentshape/CommentShapeFactory.cpp 869cc66 
  plugins/formulashape/KoFormulaShapeFactory.cpp 588a9e2 
  plugins/musicshape/MusicShapeFactory.cpp c61e9fc 
  plugins/pathshapes/CMakeLists.txt e773367 
  plugins/pathshapes/ellipse/EllipseShape.h 4bc766e 
  plugins/pathshapes/ellipse/EllipseShape.cpp 0576f5d 
  plugins/pathshapes/ellipse/EllipseShapeFactory.cpp 9fa50fe 
  plugins/pathshapes/enhancedpath/EnhancedPathShapeFactory.cpp 4086698 
  plugins/pathshapes/rectangle/RectangleShape.h 08d5423 
  plugins/pathshapes/rectangle/RectangleShape.cpp 9caca45 
  plugins/pathshapes/rectangle/RectangleShapeFactory.cpp 51c92fb 
  plugins/pathshapes/star/StarShapeFactory.cpp 984b938 
  plugins/pictureshape/CMakeLists.txt 1539312 
  plugins/pictureshape/PictureShape.h 527d2e4 
  plugins/pictureshape/PictureShape.cpp 5dc1c7b 
  plugins/pictureshape/PictureShapeFactory.cpp 313e1be 
  plugins/pluginshape/PluginShapeFactory.cpp 6aa335a 
  plugins/textshape/TextShapeFactory.cpp 365b2e7 
  plugins/treeshape/TreeShapeFactory.cpp b7b36ec 
  plugins/vectorshape/VectorShapeFactory.cpp eeb1674 
  plugins/videoshape/VideoShapeFactory.cpp 7b27bd4 
  tables/shape/TableShapeFactory.cpp ef9cccf 

Diff: http://git.reviewboard.kde.org/r/102315/diff


Testing
-------


Thanks,

Jan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20110813/9050e2e4/attachment.htm>


More information about the calligra-devel mailing list