1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_sdext.hxx" 30 31 #include "treevisitorfactory.hxx" 32 #include "writertreevisiting.hxx" 33 #include "drawtreevisiting.hxx" 34 35 namespace pdfi 36 { 37 struct WriterTreeVisitorFactory : public TreeVisitorFactory 38 { 39 WriterTreeVisitorFactory() {} 40 41 virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const 42 { 43 return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlOptimizer(rProc)); 44 } 45 46 virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( 47 StyleContainer& rStyles, 48 PDFIProcessor& rProc ) const 49 { 50 return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlFinalizer(rStyles,rProc)); 51 } 52 53 virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor&) const 54 { 55 return boost::shared_ptr<ElementTreeVisitor>(new WriterXmlEmitter(rEmitContext)); 56 } 57 }; 58 59 struct ImpressTreeVisitorFactory : public TreeVisitorFactory 60 { 61 ImpressTreeVisitorFactory() {} 62 63 virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const 64 { 65 return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc)); 66 } 67 68 virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( 69 StyleContainer& rStyles, 70 PDFIProcessor& rProc ) const 71 { 72 return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc)); 73 } 74 75 virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor& rProc) const 76 { 77 return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext, 78 DrawXmlEmitter::IMPRESS_DOC, 79 rProc 80 )); 81 } 82 }; 83 84 struct DrawTreeVisitorFactory : public TreeVisitorFactory 85 { 86 DrawTreeVisitorFactory() {} 87 88 virtual boost::shared_ptr<ElementTreeVisitor> createOptimizingVisitor(PDFIProcessor& rProc) const 89 { 90 return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlOptimizer(rProc)); 91 } 92 93 virtual boost::shared_ptr<ElementTreeVisitor> createStyleCollectingVisitor( 94 StyleContainer& rStyles, 95 PDFIProcessor& rProc ) const 96 { 97 return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlFinalizer(rStyles,rProc)); 98 } 99 100 virtual boost::shared_ptr<ElementTreeVisitor> createEmittingVisitor(EmitContext& rEmitContext, PDFIProcessor& rProc) const 101 { 102 return boost::shared_ptr<ElementTreeVisitor>(new DrawXmlEmitter(rEmitContext, 103 DrawXmlEmitter::DRAW_DOC, 104 rProc 105 )); 106 } 107 }; 108 109 TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory() 110 { 111 return TreeVisitorFactorySharedPtr(new WriterTreeVisitorFactory()); 112 } 113 TreeVisitorFactorySharedPtr createImpressTreeVisitorFactory() 114 { 115 return TreeVisitorFactorySharedPtr(new ImpressTreeVisitorFactory()); 116 } 117 TreeVisitorFactorySharedPtr createDrawTreeVisitorFactory() 118 { 119 return TreeVisitorFactorySharedPtr(new DrawTreeVisitorFactory()); 120 } 121 } 122 123