1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_PDFI_TREEVISITING_HXX 25 #define INCLUDED_PDFI_TREEVISITING_HXX 26 27 #include <sal/config.h> 28 #include <list> 29 30 31 namespace pdfi 32 { 33 class PDFIProcessor; 34 class StyleContainer; 35 struct HyperlinkElement; 36 struct TextElement; 37 struct ParagraphElement; 38 struct FrameElement; 39 struct PolyPolyElement; 40 struct ImageElement; 41 struct PageElement; 42 struct DocumentElement; 43 struct EmitContext; 44 struct Element; 45 46 /** To be visited by all tree element types 47 48 Visitor interface from the "visitor pattern". Implementor gets 49 called with actual tree node instances. 50 */ 51 struct ElementTreeVisitor 52 { 53 virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) = 0; 54 virtual void visit( TextElement&, const std::list< Element* >::const_iterator& ) = 0; 55 virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator& ) = 0; 56 virtual void visit( FrameElement&, const std::list< Element* >::const_iterator& ) = 0; 57 virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator& ) = 0; 58 virtual void visit( ImageElement&, const std::list< Element* >::const_iterator& ) = 0; 59 virtual void visit( PageElement&, const std::list< Element* >::const_iterator& ) = 0; 60 virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator& ) = 0; 61 }; 62 typedef boost::shared_ptr<ElementTreeVisitor> ElementTreeVisitorSharedPtr; 63 64 /** Visitee interface 65 66 To be implemented by every tree node that needs to be 67 visitable. 68 */ 69 struct ElementTreeVisitable 70 { 71 virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) = 0; 72 }; 73 typedef boost::shared_ptr<ElementTreeVisitable> ElementTreeVisitableSharedPtr; 74 } 75 76 #endif 77