Review Request: Add svg support to the flake library
Thorsten Zachmann
t.zachmann at zagge.de
Fri Aug 19 06:10:33 BST 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/102315/#review5813
-----------------------------------------------------------
I had a short look today and will already post what I saw. I will post more about the putting it into flake later.
karbon/ui/KarbonPart.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5134>
I guess that code should only be executed once as otherwise the same factory gets added again when you open a new document. You can see the class InitOnce in KPrDocument on how I solved it there
libs/flake/svg/SvgSerializable.h
<http://git.reviewboard.kde.org/r/102315/#comment5136>
Is there any special reason you added this function and not call SvgStyleWriter::saveSvgStyle directly?
In all cases it is called it is called with this a shape and then it can be removed and it not needed to pass.
plugins/artistictextshape/ArtisticTextShape.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5135>
how about using a static_cast<KoShape*> here instead of the c cast?
plugins/artistictextshape/ArtisticTextShapeFactory.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5137>
With this change the factory will never be used to load the artistic path shape.
And should we not provide backward compatibility for the feature?
plugins/pathshapes/ellipse/EllipseShape.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5138>
Will that result in not saving it if the arc is not a full arc?
plugins/pathshapes/ellipse/EllipseShape.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5141>
getting the elemente twise is expensive. the attribute methods allows a default value to returned when it is not found. The only one lookup is needed.
plugins/pathshapes/ellipse/EllipseShape.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5139>
Could this part be used commonly?
plugins/pathshapes/rectangle/RectangleShape.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5140>
Is it not possible to use the attribute method with a default value of 0.0. That will speedup the loading as it only needs to lookup the data once.
plugins/pictureshape/PictureShape.cpp
<http://git.reviewboard.kde.org/r/102315/#comment5142>
Please read the value only ones as described before.
- Thorsten
On Aug. 13, 2011, 4:53 p.m., Jan Hambrecht wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/102315/
> -----------------------------------------------------------
>
> (Updated Aug. 13, 2011, 4:53 p.m.)
>
>
> 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 236562, 271360 and 274654.
> http://bugs.kde.org/show_bug.cgi?id=236562
> 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/20110819/993bd670/attachment.htm>
More information about the calligra-devel
mailing list