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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include "XMLChartPropertyContext.hxx"
27 #include "PropertyMap.hxx"
28 
29 #include "XMLSymbolImageContext.hxx"
30 #include "XMLLabelSeparatorContext.hxx"
31 
32 TYPEINIT1( XMLChartPropertyContext, SvXMLImportContext );
33 
34 using namespace ::com::sun::star;
35 
XMLChartPropertyContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const::rtl::OUString & rLName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,sal_uInt32 nFamily,::std::vector<XMLPropertyState> & rProps,const UniReference<SvXMLImportPropertyMapper> & rMapper)36 XMLChartPropertyContext::XMLChartPropertyContext(
37     SvXMLImport& rImport,
38     sal_uInt16 nPrfx,
39     const ::rtl::OUString& rLName,
40     const uno::Reference< xml::sax::XAttributeList > & xAttrList,
41 	sal_uInt32 nFamily,
42     ::std::vector< XMLPropertyState >& rProps,
43     const UniReference< SvXMLImportPropertyMapper >& rMapper ) :
44         SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFamily, rProps, rMapper )
45 {
46 }
47 
~XMLChartPropertyContext()48 XMLChartPropertyContext::~XMLChartPropertyContext()
49 {}
50 
CreateChildContext(sal_uInt16 nPrefix,const::rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,::std::vector<XMLPropertyState> & rProperties,const XMLPropertyState & rProp)51 SvXMLImportContext* XMLChartPropertyContext::CreateChildContext(
52     sal_uInt16 nPrefix,
53     const ::rtl::OUString& rLocalName,
54     const uno::Reference< xml::sax::XAttributeList > & xAttrList,
55     ::std::vector< XMLPropertyState > &rProperties,
56     const XMLPropertyState& rProp )
57 {
58     SvXMLImportContext *pContext = 0;
59 
60 	switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
61 	{
62         case XML_SCH_CONTEXT_SPECIAL_SYMBOL_IMAGE:
63             pContext = new XMLSymbolImageContext( GetImport(), nPrefix, rLocalName, rProp, rProperties );
64             break;
65         case XML_SCH_CONTEXT_SPECIAL_LABEL_SEPARATOR:
66             pContext = new XMLLabelSeparatorContext( GetImport(), nPrefix, rLocalName, rProp, rProperties );
67             break;
68     }
69 
70     // default / no context yet: create child context by base class
71 	if( !pContext )
72     {
73         pContext = SvXMLPropertySetContext::CreateChildContext(
74             nPrefix, rLocalName, xAttrList, rProperties, rProp );
75     }
76 
77 	return pContext;
78 }
79