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 0 : struct WriterTreeVisitorFactory : public TreeVisitorFactory
28 : {
29 0 : WriterTreeVisitorFactory() {}
30 :
31 0 : virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const SAL_OVERRIDE
32 : {
33 0 : return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlOptimizer(rProc));
34 : }
35 :
36 0 : virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
37 : StyleContainer& rStyles,
38 : PDFIProcessor& rProc ) const SAL_OVERRIDE
39 : {
40 0 : return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlFinalizer(rStyles,rProc));
41 : }
42 :
43 0 : virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor&) const SAL_OVERRIDE
44 : {
45 0 : return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlEmitter(rEmitContext));
46 : }
47 : };
48 :
49 0 : struct ImpressTreeVisitorFactory : public TreeVisitorFactory
50 : {
51 0 : 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, PDFIProcessor& rProc) const SAL_OVERRIDE
66 : {
67 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext,
68 : DrawXmlEmitter::IMPRESS_DOC,
69 : rProc
70 0 : ));
71 : }
72 : };
73 :
74 0 : struct DrawTreeVisitorFactory : public TreeVisitorFactory
75 : {
76 0 : DrawTreeVisitorFactory() {}
77 :
78 0 : virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const SAL_OVERRIDE
79 : {
80 0 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc));
81 : }
82 :
83 0 : virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor(
84 : StyleContainer& rStyles,
85 : PDFIProcessor& rProc ) const SAL_OVERRIDE
86 : {
87 0 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc));
88 : }
89 :
90 0 : virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor& rProc) const SAL_OVERRIDE
91 : {
92 : return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext,
93 : DrawXmlEmitter::DRAW_DOC,
94 : rProc
95 0 : ));
96 : }
97 : };
98 :
99 0 : TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory()
100 : {
101 0 : return TreeVisitorFactorySharedPtr(new WriterTreeVisitorFactory());
102 : }
103 0 : TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory()
104 : {
105 0 : return TreeVisitorFactorySharedPtr(new ImpressTreeVisitorFactory());
106 : }
107 0 : TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory()
108 : {
109 0 : return TreeVisitorFactorySharedPtr(new DrawTreeVisitorFactory());
110 : }
111 : }
112 :
113 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|