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 "XMLLabelSeparatorContext.hxx"
27
28 #include "SchXMLParagraphContext.hxx"
29 #include <xmloff/xmltoken.hxx>
30 #include <xmloff/xmltkmap.hxx>
31 #include "xmloff/xmlnmspe.hxx"
32 #include <xmloff/xmlimp.hxx>
33 #include <xmloff/nmspmap.hxx>
34
35 TYPEINIT1( XMLLabelSeparatorContext, XMLElementPropertyContext );
36
37 using namespace ::com::sun::star;
38
XMLLabelSeparatorContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const::rtl::OUString & rLocalName,const XMLPropertyState & rProp,::std::vector<XMLPropertyState> & rProps)39 XMLLabelSeparatorContext::XMLLabelSeparatorContext(
40 SvXMLImport& rImport, sal_uInt16 nPrfx,
41 const ::rtl::OUString& rLocalName,
42 const XMLPropertyState& rProp,
43 ::std::vector< XMLPropertyState > &rProps ) :
44 XMLElementPropertyContext(
45 rImport, nPrfx, rLocalName, rProp, rProps ),
46 m_aSeparator()
47 {
48 }
49
~XMLLabelSeparatorContext()50 XMLLabelSeparatorContext::~XMLLabelSeparatorContext()
51 {}
52
StartElement(const uno::Reference<xml::sax::XAttributeList> &)53 void XMLLabelSeparatorContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/ )
54 {
55 }
56
CreateChildContext(sal_uInt16 nPrefix,const::rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> &)57 SvXMLImportContext* XMLLabelSeparatorContext::CreateChildContext(
58 sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
59 const uno::Reference< xml::sax::XAttributeList > & /*xAttrList*/ )
60 {
61 SvXMLImportContext* pContext = NULL;
62 if( xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_P ) )
63 {
64 pContext = new SchXMLParagraphContext( GetImport(),
65 rLocalName, m_aSeparator );
66 }
67 if( !pContext )
68 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
69
70 return pContext;
71 }
72
EndElement()73 void XMLLabelSeparatorContext::EndElement()
74 {
75 if( m_aSeparator.getLength() )
76 {
77 // aProp is a member of XMLElementPropertyContext
78 aProp.maValue <<= m_aSeparator;
79 SetInsert( sal_True );
80 }
81
82 XMLElementPropertyContext::EndElement();
83 }
84