Changeset View
Changeset View
Standalone View
Standalone View
filters/karbon/svg/SvgExport.cpp
Show All 35 Lines | |||||
36 | #include "SvgExport.h" | 36 | #include "SvgExport.h" | ||
37 | #include <SvgWriter.h> | 37 | #include <SvgWriter.h> | ||
38 | 38 | | |||
39 | #include <KarbonDocument.h> | 39 | #include <KarbonDocument.h> | ||
40 | #include <KarbonPart.h> | 40 | #include <KarbonPart.h> | ||
41 | 41 | | |||
42 | #include <KoDocument.h> | 42 | #include <KoDocument.h> | ||
43 | #include <KoFilterChain.h> | 43 | #include <KoFilterChain.h> | ||
44 | #include <KoPAPageBase.h> | ||||
45 | #include <KoPageLayout.h> | ||||
44 | 46 | | |||
45 | #include <kpluginfactory.h> | 47 | #include <kpluginfactory.h> | ||
46 | 48 | | |||
47 | #include <QString> | 49 | #include <QString> | ||
48 | 50 | | |||
49 | K_PLUGIN_FACTORY_WITH_JSON(SvgExportFactory, "calligra_filter_karbon2svg.json", | 51 | K_PLUGIN_FACTORY_WITH_JSON(SvgExportFactory, "calligra_filter_karbon2svg.json", | ||
50 | registerPlugin<SvgExport>();) | 52 | registerPlugin<SvgExport>();) | ||
51 | 53 | | |||
Show All 10 Lines | 60 | { | |||
62 | KoDocument * document = m_chain->inputDocument(); | 64 | KoDocument * document = m_chain->inputDocument(); | ||
63 | if (!document) | 65 | if (!document) | ||
64 | return KoFilter::ParsingError; | 66 | return KoFilter::ParsingError; | ||
65 | 67 | | |||
66 | KarbonDocument * karbonPart = dynamic_cast<KarbonDocument*>(document); | 68 | KarbonDocument * karbonPart = dynamic_cast<KarbonDocument*>(document); | ||
67 | if (!karbonPart) | 69 | if (!karbonPart) | ||
68 | return KoFilter::WrongFormat; | 70 | return KoFilter::WrongFormat; | ||
69 | 71 | | |||
70 | SvgWriter writer(karbonPart->layers(), karbonPart->pageSize()); | 72 | KoPAPageBase *page = karbonPart->pages().value(0); | ||
73 | if (!page) { | ||||
74 | return KoFilter::WrongFormat; | ||||
75 | } | ||||
76 | const KoPageLayout &layout = page->pageLayout(); | ||||
77 | const QSizeF size(layout.width, layout.height); | ||||
78 | SvgWriter writer(page->shapes(), size); | ||||
71 | if (!writer.save(m_chain->outputFile(), true)) | 79 | if (!writer.save(m_chain->outputFile(), true)) | ||
72 | return KoFilter::CreationError; | 80 | return KoFilter::CreationError; | ||
73 | 81 | | |||
74 | return KoFilter::OK; | 82 | return KoFilter::OK; | ||
75 | } | 83 | } | ||
76 | 84 | | |||
77 | #include "SvgExport.moc" | 85 | #include "SvgExport.moc" |