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 27 #ifndef _XMLOFF_XMLSHAPEPROPERTYSETCONTEXT_HXX_ 28 #include "XMLShapePropertySetContext.hxx" 29 #endif 30 #include <xmloff/xmlimp.hxx> 31 #include <xmloff/xmlnumi.hxx> 32 #include "xmltabi.hxx" 33 #include <xmloff/txtprmap.hxx> 34 35 #include "sdpropls.hxx" 36 37 using ::rtl::OUString; 38 using ::rtl::OUStringBuffer; 39 40 using namespace ::com::sun::star; 41 using namespace ::com::sun::star::uno; 42 43 ////////////////////////////////////////////////////////////////////////////// 44 45 TYPEINIT1( XMLShapePropertySetContext, SvXMLPropertySetContext ); 46 47 XMLShapePropertySetContext::XMLShapePropertySetContext( 48 SvXMLImport& rImport, sal_uInt16 nPrfx, 49 const OUString& rLName, 50 const Reference< xml::sax::XAttributeList > & xAttrList, 51 sal_uInt32 nFam, 52 ::std::vector< XMLPropertyState > &rProps, 53 const UniReference < SvXMLImportPropertyMapper > &rMap ) : 54 SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam, 55 rProps, rMap ), 56 mnBulletIndex(-1) 57 { 58 } 59 60 XMLShapePropertySetContext::~XMLShapePropertySetContext() 61 { 62 } 63 64 void XMLShapePropertySetContext::EndElement() 65 { 66 Reference< container::XIndexReplace > xNumRule; 67 if( mxBulletStyle.Is() ) 68 { 69 SvxXMLListStyleContext* pBulletStyle = (SvxXMLListStyleContext*)&mxBulletStyle; 70 xNumRule = pBulletStyle->CreateNumRule( GetImport().GetModel() ); 71 if( xNumRule.is() ) 72 pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ ); 73 } 74 75 Any aAny; 76 aAny <<= xNumRule; 77 78 XMLPropertyState aPropState( mnBulletIndex, aAny ); 79 mrProperties.push_back( aPropState ); 80 81 SvXMLPropertySetContext::EndElement(); 82 } 83 84 SvXMLImportContext *XMLShapePropertySetContext::CreateChildContext( 85 sal_uInt16 nPrefix, 86 const OUString& rLocalName, 87 const Reference< xml::sax::XAttributeList > & xAttrList, 88 ::std::vector< XMLPropertyState > &rProperties, 89 const XMLPropertyState& rProp ) 90 { 91 SvXMLImportContext *pContext = 0; 92 93 switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) ) 94 { 95 case CTF_NUMBERINGRULES: 96 mnBulletIndex = rProp.mnIndex; 97 mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList ); 98 break; 99 case CTF_TABSTOP: 100 pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix, 101 rLocalName, rProp, 102 rProperties ); 103 break; 104 } 105 106 if( !pContext ) 107 pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, 108 xAttrList, 109 rProperties, rProp ); 110 111 return pContext; 112 } 113