merge the formfield patch from ooo-build
[ooovba.git] / xmloff / source / draw / XMLShapePropertySetContext.cxx
blobdb45f63020321456e5ec714a1f97ab0f4fcc5a91
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XMLShapePropertySetContext.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
34 #ifndef _XMLOFF_XMLSHAPEPROPERTYSETCONTEXT_HXX_
35 #include "XMLShapePropertySetContext.hxx"
36 #endif
37 #include <xmloff/xmlimp.hxx>
38 #include <xmloff/xmlnumi.hxx>
39 #include "xmltabi.hxx"
40 #include <xmloff/txtprmap.hxx>
42 #include "sdpropls.hxx"
44 using ::rtl::OUString;
45 using ::rtl::OUStringBuffer;
47 using namespace ::com::sun::star;
48 using namespace ::com::sun::star::uno;
50 //////////////////////////////////////////////////////////////////////////////
52 TYPEINIT1( XMLShapePropertySetContext, SvXMLPropertySetContext );
54 XMLShapePropertySetContext::XMLShapePropertySetContext(
55 SvXMLImport& rImport, sal_uInt16 nPrfx,
56 const OUString& rLName,
57 const Reference< xml::sax::XAttributeList > & xAttrList,
58 sal_uInt32 nFam,
59 ::std::vector< XMLPropertyState > &rProps,
60 const UniReference < SvXMLImportPropertyMapper > &rMap ) :
61 SvXMLPropertySetContext( rImport, nPrfx, rLName, xAttrList, nFam,
62 rProps, rMap ),
63 mnBulletIndex(-1)
67 XMLShapePropertySetContext::~XMLShapePropertySetContext()
71 void XMLShapePropertySetContext::EndElement()
73 Reference< container::XIndexReplace > xNumRule;
74 if( mxBulletStyle.Is() )
76 SvxXMLListStyleContext* pBulletStyle = (SvxXMLListStyleContext*)&mxBulletStyle;
77 xNumRule = pBulletStyle->CreateNumRule( GetImport().GetModel() );
78 if( xNumRule.is() )
79 pBulletStyle->FillUnoNumRule(xNumRule, NULL /* const SvI18NMap * ??? */ );
82 Any aAny;
83 aAny <<= xNumRule;
85 XMLPropertyState aPropState( mnBulletIndex, aAny );
86 mrProperties.push_back( aPropState );
88 SvXMLPropertySetContext::EndElement();
91 SvXMLImportContext *XMLShapePropertySetContext::CreateChildContext(
92 sal_uInt16 nPrefix,
93 const OUString& rLocalName,
94 const Reference< xml::sax::XAttributeList > & xAttrList,
95 ::std::vector< XMLPropertyState > &rProperties,
96 const XMLPropertyState& rProp )
98 SvXMLImportContext *pContext = 0;
100 switch( mxMapper->getPropertySetMapper()->GetEntryContextId( rProp.mnIndex ) )
102 case CTF_NUMBERINGRULES:
103 mnBulletIndex = rProp.mnIndex;
104 mxBulletStyle = pContext = new SvxXMLListStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
105 break;
106 case CTF_TABSTOP:
107 pContext = new SvxXMLTabStopImportContext( GetImport(), nPrefix,
108 rLocalName, rProp,
109 rProperties );
110 break;
113 if( !pContext )
114 pContext = SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName,
115 xAttrList,
116 rProperties, rProp );
118 return pContext;