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_SLIDESHOW_DOCTREENODESUPPLIER_HXX
29 #define INCLUDED_SLIDESHOW_DOCTREENODESUPPLIER_HXX
30 
31 #include "doctreenode.hxx"
32 
33 
34 /* Definition of DocTreeNodeSupplier interface */
35 
36 namespace slideshow
37 {
38     namespace internal
39     {
40         /** Interface to retrieve DocTreeNodes from subsettable
41             shapes.
42 
43             Shapes which implement the AttributableShape interface
44             also provides this interface, providing methods to
45             retrieve specific DocTreeNode objects from the shape. The
46             methods mainly distinguish various ways on how to specify
47             the actual DocTreeNode to return.
48 
49             If a requested DocTreeNode is not available when one of
50             the methods below is called, an empty DocTreeNode will be
51             returned (the predicate DocTreeNode::isEmpty() will return
52             true). If, on the other hand, the shape cannot determine,
53             for internal reasons, the internal tree node structure,
54             all those methods will throw an
55             ShapeLoadFailedException. This is, in fact, a delayed error
56             that could also have been reported during shape
57             construction, but might be postponed until the missing
58             information is actually requested.
59          */
60         class DocTreeNodeSupplier
61         {
62         public:
63             /** Query number of tree nodes of the given type this
64                 shape contains.
65 
66             	The value returned by this method minus one is the
67             	maximum value permissible at the getTreeNode()
68             	method, for the given node type.
69 
70                 @throws ShapeLoadFailedException, if tree node structure
71                 cannot be determined.
72              */
73             virtual sal_Int32 getNumberOfTreeNodes( DocTreeNode::NodeType eNodeType ) const = 0; // throw ShapeLoadFailedException;
74 
75             /** Create DocTreeNode from shape.
76 
77 		        This method creates a DocTreeNode from a shape, a
78                 given node type and a running index into the shape's
79                 DocTreeNodes of the given type.
80 
81                 @param nNodeIndex
82                 Starting with 0, every DocTreeNode of the shape that
83                 has type eNodeType is indexed. The DocTreeNode whose
84                 index equals nNodeIndex will be returned.
85 
86                 @param eNodeType
87                 Type of the node to return
88 
89                 @return the DocTreeNode found, or the empty
90                 DocTreeNode, if nothing was found.
91 
92                 @throws ShapeLoadFailedException, if tree node structure
93                 cannot be determined.
94             */
95             virtual DocTreeNode getTreeNode( sal_Int32				nNodeIndex,
96                                              DocTreeNode::NodeType	eNodeType ) const = 0; // throw ShapeLoadFailedException;
97 
98             /** Query number of tree nodes of the given type this
99                 subset contains.
100 
101             	The value returned by this method minus one is the
102             	maximum value permissible at the
103             	getSubsetTreeNode() method, for the given node
104             	type.
105 
106                 @param rParentNode
107                 The parent node, below which the number of tree nodes
108                 of the given type shall be counted.
109 
110                 @param eNodeType
111                 Node type to count.
112 
113                 @throws ShapeLoadFailedException, if tree node structure
114                 cannot be determined.
115              */
116             virtual sal_Int32 getNumberOfSubsetTreeNodes( const DocTreeNode& 	rParentNode,
117                                                           DocTreeNode::NodeType eNodeType ) const = 0; // throw ShapeLoadFailedException;
118 
119             /** Create DocTreeNode from shape subset.
120 
121 		        This method creates a DocTreeNode from a shape, a
122 		        parent tree node, a given node type and a running
123 		        index into the shape's DocTreeNodes of the given type.
124 
125                 @param rParentNode
126                 Parent node, below which the tree node with the given
127                 type shall be selected.
128 
129                 @param nNodeIndex
130                 Starting with 0, every DocTreeNode of the shape that
131                 has type eNodeType is indexed. The DocTreeNode whose
132                 index equals nNodeIndex will be returned.
133 
134                 @param eNodeType
135                 Type of the node to return
136 
137                 @return the DocTreeNode found, or the empty
138                 DocTreeNode, if nothing was found.
139 
140                 @throws ShapeLoadFailedException, if tree node structure
141                 cannot be determined.
142             */
143             virtual DocTreeNode getSubsetTreeNode( const DocTreeNode& 		rParentNode,
144                                                    sal_Int32				nNodeIndex,
145                                                    DocTreeNode::NodeType	eNodeType ) const = 0; // throw ShapeLoadFailedException;
146         };
147 
148     }
149 }
150 
151 #endif /* INCLUDED_SLIDESHOW_DOCTREENODESUPPLIER_HXX */
152