1*e3508121SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e3508121SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e3508121SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e3508121SAndrew Rist  * distributed with this work for additional information
6*e3508121SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e3508121SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e3508121SAndrew Rist  * "License"); you may not use this file except in compliance
9*e3508121SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*e3508121SAndrew Rist  *
11*e3508121SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*e3508121SAndrew Rist  *
13*e3508121SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e3508121SAndrew Rist  * software distributed under the License is distributed on an
15*e3508121SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e3508121SAndrew Rist  * KIND, either express or implied.  See the License for the
17*e3508121SAndrew Rist  * specific language governing permissions and limitations
18*e3508121SAndrew Rist  * under the License.
19*e3508121SAndrew Rist  *
20*e3508121SAndrew Rist  *************************************************************/
21*e3508121SAndrew Rist 
22*e3508121SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
25cdf0e10cSrcweir #define OOX_DRAWINGML_CHART_CHARTCONTEXTBASE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "oox/core/fragmenthandler2.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir namespace oox { namespace drawingml { class Shape; } }
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace oox {
32cdf0e10cSrcweir namespace drawingml {
33cdf0e10cSrcweir namespace chart {
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // ============================================================================
36cdf0e10cSrcweir 
37cdf0e10cSrcweir template< typename ModelType >
38cdf0e10cSrcweir class ContextBase : public ::oox::core::ContextHandler2
39cdf0e10cSrcweir {
40cdf0e10cSrcweir public:
ContextBase(::oox::core::ContextHandler2Helper & rParent,ModelType & rModel)41cdf0e10cSrcweir     inline explicit     ContextBase( ::oox::core::ContextHandler2Helper& rParent, ModelType& rModel ) :
42cdf0e10cSrcweir                             ::oox::core::ContextHandler2( rParent ), mrModel( rModel ) {}
~ContextBase()43cdf0e10cSrcweir     virtual             ~ContextBase() {}
44cdf0e10cSrcweir 
45cdf0e10cSrcweir protected:
46cdf0e10cSrcweir     ModelType&          mrModel;
47cdf0e10cSrcweir };
48cdf0e10cSrcweir 
49cdf0e10cSrcweir // ============================================================================
50cdf0e10cSrcweir 
51cdf0e10cSrcweir template< typename ModelType >
52cdf0e10cSrcweir class FragmentBase : public ::oox::core::FragmentHandler2
53cdf0e10cSrcweir {
54cdf0e10cSrcweir public:
FragmentBase(::oox::core::XmlFilterBase & rFilter,const::rtl::OUString & rFragmentPath,ModelType & rModel)55cdf0e10cSrcweir     explicit            FragmentBase( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, ModelType& rModel ) :
56cdf0e10cSrcweir                             ::oox::core::FragmentHandler2( rFilter, rFragmentPath, false ), mrModel( rModel ) {}
~FragmentBase()57cdf0e10cSrcweir     virtual             ~FragmentBase() {}
58cdf0e10cSrcweir 
59cdf0e10cSrcweir protected:
60cdf0e10cSrcweir     ModelType&          mrModel;
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // ============================================================================
64cdf0e10cSrcweir 
65cdf0e10cSrcweir /** Help class for all contexts that have only the c:spPr child element.
66cdf0e10cSrcweir  */
67cdf0e10cSrcweir class ShapePrWrapperContext : public ContextBase< Shape >
68cdf0e10cSrcweir {
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir     explicit            ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel );
71cdf0e10cSrcweir     virtual             ~ShapePrWrapperContext();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
74cdf0e10cSrcweir };
75cdf0e10cSrcweir 
76cdf0e10cSrcweir // ============================================================================
77cdf0e10cSrcweir 
78cdf0e10cSrcweir struct LayoutModel;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir /** Handler for a chart layout context (c:layout element).
81cdf0e10cSrcweir  */
82cdf0e10cSrcweir class LayoutContext : public ContextBase< LayoutModel >
83cdf0e10cSrcweir {
84cdf0e10cSrcweir public:
85cdf0e10cSrcweir     explicit            LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel );
86cdf0e10cSrcweir     virtual             ~LayoutContext();
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
89cdf0e10cSrcweir };
90cdf0e10cSrcweir 
91cdf0e10cSrcweir // ============================================================================
92cdf0e10cSrcweir 
93cdf0e10cSrcweir } // namespace chart
94cdf0e10cSrcweir } // namespace drawingml
95cdf0e10cSrcweir } // namespace oox
96cdf0e10cSrcweir 
97cdf0e10cSrcweir #endif
98