1*aaef562fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*aaef562fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*aaef562fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*aaef562fSAndrew Rist  * distributed with this work for additional information
6*aaef562fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*aaef562fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*aaef562fSAndrew Rist  * "License"); you may not use this file except in compliance
9*aaef562fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*aaef562fSAndrew Rist  *
11*aaef562fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*aaef562fSAndrew Rist  *
13*aaef562fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*aaef562fSAndrew Rist  * software distributed under the License is distributed on an
15*aaef562fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*aaef562fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*aaef562fSAndrew Rist  * specific language governing permissions and limitations
18*aaef562fSAndrew Rist  * under the License.
19*aaef562fSAndrew Rist  *
20*aaef562fSAndrew Rist  *************************************************************/
21*aaef562fSAndrew Rist 
22*aaef562fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_SLIDESHOW_DOCTREENODESUPPLIER_HXX
25cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_DOCTREENODESUPPLIER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "doctreenode.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir 
30cdf0e10cSrcweir /* Definition of DocTreeNodeSupplier interface */
31cdf0e10cSrcweir 
32cdf0e10cSrcweir namespace slideshow
33cdf0e10cSrcweir {
34cdf0e10cSrcweir     namespace internal
35cdf0e10cSrcweir     {
36cdf0e10cSrcweir         /** Interface to retrieve DocTreeNodes from subsettable
37cdf0e10cSrcweir             shapes.
38cdf0e10cSrcweir 
39cdf0e10cSrcweir             Shapes which implement the AttributableShape interface
40cdf0e10cSrcweir             also provides this interface, providing methods to
41cdf0e10cSrcweir             retrieve specific DocTreeNode objects from the shape. The
42cdf0e10cSrcweir             methods mainly distinguish various ways on how to specify
43cdf0e10cSrcweir             the actual DocTreeNode to return.
44cdf0e10cSrcweir 
45cdf0e10cSrcweir             If a requested DocTreeNode is not available when one of
46cdf0e10cSrcweir             the methods below is called, an empty DocTreeNode will be
47cdf0e10cSrcweir             returned (the predicate DocTreeNode::isEmpty() will return
48cdf0e10cSrcweir             true). If, on the other hand, the shape cannot determine,
49cdf0e10cSrcweir             for internal reasons, the internal tree node structure,
50cdf0e10cSrcweir             all those methods will throw an
51cdf0e10cSrcweir             ShapeLoadFailedException. This is, in fact, a delayed error
52cdf0e10cSrcweir             that could also have been reported during shape
53cdf0e10cSrcweir             construction, but might be postponed until the missing
54cdf0e10cSrcweir             information is actually requested.
55cdf0e10cSrcweir          */
56cdf0e10cSrcweir         class DocTreeNodeSupplier
57cdf0e10cSrcweir         {
58cdf0e10cSrcweir         public:
59cdf0e10cSrcweir             /** Query number of tree nodes of the given type this
60cdf0e10cSrcweir                 shape contains.
61cdf0e10cSrcweir 
62cdf0e10cSrcweir             	The value returned by this method minus one is the
63cdf0e10cSrcweir             	maximum value permissible at the getTreeNode()
64cdf0e10cSrcweir             	method, for the given node type.
65cdf0e10cSrcweir 
66cdf0e10cSrcweir                 @throws ShapeLoadFailedException, if tree node structure
67cdf0e10cSrcweir                 cannot be determined.
68cdf0e10cSrcweir              */
69cdf0e10cSrcweir             virtual sal_Int32 getNumberOfTreeNodes( DocTreeNode::NodeType eNodeType ) const = 0; // throw ShapeLoadFailedException;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir             /** Create DocTreeNode from shape.
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		        This method creates a DocTreeNode from a shape, a
74cdf0e10cSrcweir                 given node type and a running index into the shape's
75cdf0e10cSrcweir                 DocTreeNodes of the given type.
76cdf0e10cSrcweir 
77cdf0e10cSrcweir                 @param nNodeIndex
78cdf0e10cSrcweir                 Starting with 0, every DocTreeNode of the shape that
79cdf0e10cSrcweir                 has type eNodeType is indexed. The DocTreeNode whose
80cdf0e10cSrcweir                 index equals nNodeIndex will be returned.
81cdf0e10cSrcweir 
82cdf0e10cSrcweir                 @param eNodeType
83cdf0e10cSrcweir                 Type of the node to return
84cdf0e10cSrcweir 
85cdf0e10cSrcweir                 @return the DocTreeNode found, or the empty
86cdf0e10cSrcweir                 DocTreeNode, if nothing was found.
87cdf0e10cSrcweir 
88cdf0e10cSrcweir                 @throws ShapeLoadFailedException, if tree node structure
89cdf0e10cSrcweir                 cannot be determined.
90cdf0e10cSrcweir             */
91cdf0e10cSrcweir             virtual DocTreeNode getTreeNode( sal_Int32				nNodeIndex,
92cdf0e10cSrcweir                                              DocTreeNode::NodeType	eNodeType ) const = 0; // throw ShapeLoadFailedException;
93cdf0e10cSrcweir 
94cdf0e10cSrcweir             /** Query number of tree nodes of the given type this
95cdf0e10cSrcweir                 subset contains.
96cdf0e10cSrcweir 
97cdf0e10cSrcweir             	The value returned by this method minus one is the
98cdf0e10cSrcweir             	maximum value permissible at the
99cdf0e10cSrcweir             	getSubsetTreeNode() method, for the given node
100cdf0e10cSrcweir             	type.
101cdf0e10cSrcweir 
102cdf0e10cSrcweir                 @param rParentNode
103cdf0e10cSrcweir                 The parent node, below which the number of tree nodes
104cdf0e10cSrcweir                 of the given type shall be counted.
105cdf0e10cSrcweir 
106cdf0e10cSrcweir                 @param eNodeType
107cdf0e10cSrcweir                 Node type to count.
108cdf0e10cSrcweir 
109cdf0e10cSrcweir                 @throws ShapeLoadFailedException, if tree node structure
110cdf0e10cSrcweir                 cannot be determined.
111cdf0e10cSrcweir              */
112cdf0e10cSrcweir             virtual sal_Int32 getNumberOfSubsetTreeNodes( const DocTreeNode& 	rParentNode,
113cdf0e10cSrcweir                                                           DocTreeNode::NodeType eNodeType ) const = 0; // throw ShapeLoadFailedException;
114cdf0e10cSrcweir 
115cdf0e10cSrcweir             /** Create DocTreeNode from shape subset.
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 		        This method creates a DocTreeNode from a shape, a
118cdf0e10cSrcweir 		        parent tree node, a given node type and a running
119cdf0e10cSrcweir 		        index into the shape's DocTreeNodes of the given type.
120cdf0e10cSrcweir 
121cdf0e10cSrcweir                 @param rParentNode
122cdf0e10cSrcweir                 Parent node, below which the tree node with the given
123cdf0e10cSrcweir                 type shall be selected.
124cdf0e10cSrcweir 
125cdf0e10cSrcweir                 @param nNodeIndex
126cdf0e10cSrcweir                 Starting with 0, every DocTreeNode of the shape that
127cdf0e10cSrcweir                 has type eNodeType is indexed. The DocTreeNode whose
128cdf0e10cSrcweir                 index equals nNodeIndex will be returned.
129cdf0e10cSrcweir 
130cdf0e10cSrcweir                 @param eNodeType
131cdf0e10cSrcweir                 Type of the node to return
132cdf0e10cSrcweir 
133cdf0e10cSrcweir                 @return the DocTreeNode found, or the empty
134cdf0e10cSrcweir                 DocTreeNode, if nothing was found.
135cdf0e10cSrcweir 
136cdf0e10cSrcweir                 @throws ShapeLoadFailedException, if tree node structure
137cdf0e10cSrcweir                 cannot be determined.
138cdf0e10cSrcweir             */
139cdf0e10cSrcweir             virtual DocTreeNode getSubsetTreeNode( const DocTreeNode& 		rParentNode,
140cdf0e10cSrcweir                                                    sal_Int32				nNodeIndex,
141cdf0e10cSrcweir                                                    DocTreeNode::NodeType	eNodeType ) const = 0; // throw ShapeLoadFailedException;
142cdf0e10cSrcweir         };
143cdf0e10cSrcweir 
144cdf0e10cSrcweir     }
145cdf0e10cSrcweir }
146cdf0e10cSrcweir 
147cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_DOCTREENODESUPPLIER_HXX */
148