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 #ifndef INCLUDED_PDFI_TREEVISITING_HXX
29 #define INCLUDED_PDFI_TREEVISITING_HXX
30 
31 #include <sal/config.h>
32 #include <list>
33 
34 
35 namespace pdfi
36 {
37     class  PDFIProcessor;
38     class  StyleContainer;
39     struct HyperlinkElement;
40     struct TextElement;
41     struct ParagraphElement;
42     struct FrameElement;
43     struct PolyPolyElement;
44     struct ImageElement;
45     struct PageElement;
46     struct DocumentElement;
47     struct EmitContext;
48     struct Element;
49 
50     /** To be visited by all tree element types
51 
52         Visitor interface from the "visitor pattern". Implementor gets
53         called with actual tree node instances.
54      */
55     struct ElementTreeVisitor
56     {
57         virtual void visit( HyperlinkElement&, const std::list< Element* >::const_iterator& ) = 0;
58         virtual void visit( TextElement&, const std::list< Element* >::const_iterator&  ) = 0;
59         virtual void visit( ParagraphElement&, const std::list< Element* >::const_iterator&  ) = 0;
60         virtual void visit( FrameElement&, const std::list< Element* >::const_iterator&  ) = 0;
61         virtual void visit( PolyPolyElement&, const std::list< Element* >::const_iterator&  ) = 0;
62         virtual void visit( ImageElement&, const std::list< Element* >::const_iterator&  ) = 0;
63         virtual void visit( PageElement&, const std::list< Element* >::const_iterator&  ) = 0;
64         virtual void visit( DocumentElement&, const std::list< Element* >::const_iterator&  ) = 0;
65     };
66     typedef boost::shared_ptr<ElementTreeVisitor> ElementTreeVisitorSharedPtr;
67 
68     /** Visitee interface
69 
70         To be implemented by every tree node that needs to be
71         visitable.
72      */
73     struct ElementTreeVisitable
74     {
75         virtual void visitedBy( ElementTreeVisitor&, const std::list< Element* >::const_iterator& rParentIt ) = 0;
76     };
77     typedef boost::shared_ptr<ElementTreeVisitable> ElementTreeVisitableSharedPtr;
78 }
79 
80 #endif
81