merge the formfield patch from ooo-build
[ooovba.git] / xmloff / source / chart / SchXMLAutoStylePoolP.cxx
blob14474db43faa992c3c4d587253c0b9bec82a9a0b
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: SchXMLAutoStylePoolP.cxx,v $
10 * $Revision: 1.11 $
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"
33 #include "SchXMLAutoStylePoolP.hxx"
34 #include "PropertyMap.hxx"
35 #include "SchXMLExport.hxx"
36 #include "XMLChartPropertySetMapper.hxx"
37 #include <xmloff/families.hxx>
38 #include <xmloff/nmspmap.hxx>
39 #include <xmloff/xmltoken.hxx>
41 using ::xmloff::token::GetXMLToken;
42 using ::xmloff::token::XML_CDATA;
44 SchXMLAutoStylePoolP::SchXMLAutoStylePoolP( SchXMLExport& rSchXMLExport ) :
45 SvXMLAutoStylePoolP( rSchXMLExport ),
46 mrSchXMLExport( rSchXMLExport )
49 SchXMLAutoStylePoolP::~SchXMLAutoStylePoolP()
52 void SchXMLAutoStylePoolP::exportStyleAttributes(
53 SvXMLAttributeList& rAttrList,
54 sal_Int32 nFamily,
55 const ::std::vector< XMLPropertyState >& rProperties,
56 const SvXMLExportPropertyMapper& rPropExp
57 , const SvXMLUnitConverter& rUnitConverter,
58 const SvXMLNamespaceMap& rNamespaceMap
59 ) const
61 const rtl::OUString sCDATA( GetXMLToken( XML_CDATA ));
62 SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties,
63 rPropExp, rUnitConverter, rNamespaceMap );
65 if( nFamily == XML_STYLE_FAMILY_SCH_CHART_ID )
67 for( ::std::vector< XMLPropertyState >::const_iterator iter = rProperties.begin();
68 (iter != rProperties.end()); iter++ )
70 if( iter->mnIndex == -1 )
71 continue;
73 UniReference< XMLPropertySetMapper > aPropMapper =
74 mrSchXMLExport.GetPropertySetMapper();
75 sal_Int16 nContextID = aPropMapper->GetEntryContextId( iter->mnIndex );
76 if( nContextID == XML_SCH_CONTEXT_SPECIAL_NUMBER_FORMAT )
78 sal_Int32 nNumberFormat = -1;
79 if( ( iter->maValue >>= nNumberFormat ) &&
80 ( nNumberFormat != -1 ))
82 rtl::OUString sAttrValue = mrSchXMLExport.getDataStyleName( nNumberFormat );
83 if( sAttrValue.getLength() )
85 mrSchXMLExport.AddAttribute(
86 aPropMapper->GetEntryNameSpace( iter->mnIndex ),
87 aPropMapper->GetEntryXMLName( iter->mnIndex ),
88 sAttrValue );