Line data Source code
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 :
21 : #include "treevisitorfactory.hxx"
22 : #include "writertreevisiting.hxx"
23 : #include "drawtreevisiting.hxx"
24 :
25 : namespace pdfi
26 : {
27 4 : struct WriterTreeVisitorFactory : public TreeVisitorFactory
28 : {
29 2 : WriterTreeVisitorFactory() {}
30 :
31 1 : virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const SAL_OVERRIDE
32 : {
33 1 : return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlOptimizer(rProc));
34 : }
35 :
36 1 : virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
37 : StyleContainer& rStyles,
38 : PDFIProcessor& rProc ) const SAL_OVERRIDE
39 : {
40 1 : return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlFinalizer(rStyles,rProc));
41 : }
42 :
43 1 : virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const SAL_OVERRIDE
44 : {
45 1 : return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlEmitter(rEmitContext));
46 : }
47 : };
48 :
49 2 : struct ImpressTreeVisitorFactory : public TreeVisitorFactory
50 : {
51 1 : ImpressTreeVisitorFactory() {}
52 :
53 0 : virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const SAL_OVERRIDE
54 : {
55 0 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc));
56 : }
57 :
58 0 : virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
59 : StyleContainer& rStyles,
60 : PDFIProcessor& rProc ) const SAL_OVERRIDE
61 : {
62 0 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc));
63 : }
64 :
65 0 : virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const SAL_OVERRIDE
66 : {
67 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext,
68 : DrawXmlEmitter::IMPRESS_DOC
69 0 : ));
70 : }
71 : };
72 :
73 8 : struct DrawTreeVisitorFactory : public TreeVisitorFactory
74 : {
75 4 : DrawTreeVisitorFactory() {}
76 :
77 3 : virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const SAL_OVERRIDE
78 : {
79 3 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc));
80 : }
81 :
82 3 : virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
83 : StyleContainer& rStyles,
84 : PDFIProcessor& rProc ) const SAL_OVERRIDE
85 : {
86 3 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc));
87 : }
88 :
89 3 : virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext) const SAL_OVERRIDE
90 : {
91 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext,
92 : DrawXmlEmitter::DRAW_DOC
93 3 : ));
94 : }
95 : };
96 :
97 2 : TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory()
98 : {
99 2 : return TreeVisitorFactorySharedPtr(new WriterTreeVisitorFactory());
100 : }
101 1 : TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory()
102 : {
103 1 : return TreeVisitorFactorySharedPtr(new ImpressTreeVisitorFactory());
104 : }
105 4 : TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory()
106 : {
107 4 : return TreeVisitorFactorySharedPtr(new DrawTreeVisitorFactory());
108 : }
109 : }
110 :
111 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|