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_dbaxml.hxx"
26 #ifndef DBA_XMLAUTOSTYLE_HXX
27 #include "xmlAutoStyle.hxx"
28 #endif
29 #ifndef DBA_XMLHELPER_HXX
30 #include "xmlHelper.hxx"
31 #endif
32 #ifndef DBA_XMLEXPORT_HXX
33 #include "xmlExport.hxx"
34 #endif
35 #ifndef _XMLOFF_FAMILIES_HXX_
36 #include <xmloff/families.hxx>
37 #endif
38 #ifndef _TOOLS_DEBUG_HXX
39 #include <tools/debug.hxx>
40 #endif
41 namespace dbaxml
42 {
43 	using namespace ::com::sun::star::uno;
44 	using namespace ::com::sun::star::xml::sax;
45 
exportStyleAttributes(SvXMLAttributeList & rAttrList,sal_Int32 nFamily,const::std::vector<XMLPropertyState> & rProperties,const SvXMLExportPropertyMapper & rPropExp,const SvXMLUnitConverter & rUnitConverter,const SvXMLNamespaceMap & rNamespaceMap) const46 void OXMLAutoStylePoolP::exportStyleAttributes(
47 			SvXMLAttributeList& rAttrList,
48 			sal_Int32 nFamily,
49 			const ::std::vector< XMLPropertyState >& rProperties,
50 			const SvXMLExportPropertyMapper& rPropExp
51 			, const SvXMLUnitConverter& rUnitConverter,
52 			const SvXMLNamespaceMap& rNamespaceMap
53             ) const
54 {
55 	SvXMLAutoStylePoolP::exportStyleAttributes( rAttrList, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap );
56 	if ( nFamily == XML_STYLE_FAMILY_TABLE_COLUMN )
57 	{
58 		UniReference< XMLPropertySetMapper > aPropMapper = rODBExport.GetColumnStylesPropertySetMapper();
59 		::std::vector< XMLPropertyState >::const_iterator i = rProperties.begin();
60 		::std::vector< XMLPropertyState >::const_iterator aEnd = rProperties.end();
61 		for ( ; i != aEnd ; ++i )
62 		{
63 			sal_Int16 nContextID = aPropMapper->GetEntryContextId(i->mnIndex);
64 			switch (nContextID)
65 			{
66 				case CTF_DB_NUMBERFORMAT :
67 				{
68 					sal_Int32 nNumberFormat = 0;
69 					if ( i->maValue >>= nNumberFormat )
70 					{
71 						rtl::OUString sAttrValue = rODBExport.getDataStyleName(nNumberFormat);
72 						if ( sAttrValue.getLength() )
73 						{
74 							GetExport().AddAttribute(
75                                 aPropMapper->GetEntryNameSpace(i->mnIndex),
76                                 aPropMapper->GetEntryXMLName(i->mnIndex),
77                                 sAttrValue );
78 						}
79 					}
80 					break;
81 				}
82 			}
83 		}
84 	}
85 }
DBG_NAME(OXMLAutoStylePoolP)86 DBG_NAME(OXMLAutoStylePoolP)
87 // -----------------------------------------------------------------------------
88 OXMLAutoStylePoolP::OXMLAutoStylePoolP(ODBExport& rTempODBExport):
89 	SvXMLAutoStylePoolP(rTempODBExport),
90 	rODBExport(rTempODBExport)
91 {
92     DBG_CTOR(OXMLAutoStylePoolP,NULL);
93 
94 }
95 // -----------------------------------------------------------------------------
~OXMLAutoStylePoolP()96 OXMLAutoStylePoolP::~OXMLAutoStylePoolP()
97 {
98 
99     DBG_DTOR(OXMLAutoStylePoolP,NULL);
100 }
101 // -----------------------------------------------------------------------------
102 
103 //----------------------------------------------------------------------------
104 } // namespace dbaxml
105 // -----------------------------------------------------------------------------
106