LibreOffice Module sdext (master) 1
treevisitorfactory.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
23#include "drawtreevisiting.hxx"
24
25namespace pdfi
26{
27 namespace {
28
29 struct WriterTreeVisitorFactory : public TreeVisitorFactory
30 {
31 WriterTreeVisitorFactory() {}
32
33 virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override
34 {
35 return std::make_shared<WriterXmlOptimizer>(rProc);
36 }
37
38 virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
39 StyleContainer& rStyles,
40 PDFIProcessor& rProc ) const override
41 {
42 return std::make_shared<WriterXmlFinalizer>(rStyles,rProc);
43 }
44
45 virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override
46 {
47 return std::make_shared<WriterXmlEmitter>(rEmitContext);
48 }
49 };
50
51 struct ImpressTreeVisitorFactory : public TreeVisitorFactory
52 {
53 ImpressTreeVisitorFactory() {}
54
55 virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override
56 {
57 return std::make_shared<DrawXmlOptimizer>(rProc);
58 }
59
60 virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
61 StyleContainer& rStyles,
62 PDFIProcessor& rProc ) const override
63 {
64 return std::make_shared<DrawXmlFinalizer>(rStyles,rProc);
65 }
66
67 virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override
68 {
69 return std::make_shared<DrawXmlEmitter>(rEmitContext, DrawXmlEmitter::IMPRESS_DOC);
70 }
71 };
72
73 struct DrawTreeVisitorFactory : public TreeVisitorFactory
74 {
75 DrawTreeVisitorFactory() {}
76
77 virtual std::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const override
78 {
79 return std::make_shared<DrawXmlOptimizer>(rProc);
80 }
81
82 virtual std::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
83 StyleContainer& rStyles,
84 PDFIProcessor& rProc ) const override
85 {
86 return std::make_shared<DrawXmlFinalizer>(rStyles,rProc);
87 }
88
89 virtual std::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const override
90 {
91 return std::make_shared<DrawXmlEmitter>(rEmitContext, DrawXmlEmitter::DRAW_DOC);
92 }
93 };
94
95 }
96
98 {
99 return std::make_shared<WriterTreeVisitorFactory>();
100 }
102 {
103 return std::make_shared<ImpressTreeVisitorFactory>();
104 }
106 {
107 return std::make_shared<DrawTreeVisitorFactory>();
108 }
109}
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< TreeVisitorFactory > TreeVisitorFactorySharedPtr
TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory()
TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory()
TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory()