1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*63bba73cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*63bba73cSAndrew Rist  * distributed with this work for additional information
6*63bba73cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*63bba73cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist  * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*63bba73cSAndrew Rist  *
11*63bba73cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist  *
13*63bba73cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist  * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*63bba73cSAndrew Rist  * specific language governing permissions and limitations
18*63bba73cSAndrew Rist  * under the License.
19*63bba73cSAndrew Rist  *
20*63bba73cSAndrew Rist  *************************************************************/
21*63bba73cSAndrew Rist 
22*63bba73cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir #include "formattributes.hxx"
27cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
28cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
29cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
30cdf0e10cSrcweir #include <rtl/logfile.hxx>
31cdf0e10cSrcweir //.........................................................................
32cdf0e10cSrcweir namespace xmloff
33cdf0e10cSrcweir {
34cdf0e10cSrcweir //.........................................................................
35cdf0e10cSrcweir 
36cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
37cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
38cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
39cdf0e10cSrcweir 
40cdf0e10cSrcweir 
41cdf0e10cSrcweir 	//=====================================================================
42cdf0e10cSrcweir 	//= OAttributeMetaData
43cdf0e10cSrcweir 	//=====================================================================
44cdf0e10cSrcweir 	//---------------------------------------------------------------------
getCommonControlAttributeName(sal_Int32 _nId)45cdf0e10cSrcweir 	const sal_Char* OAttributeMetaData::getCommonControlAttributeName(sal_Int32 _nId)
46cdf0e10cSrcweir 	{
47cdf0e10cSrcweir 		switch (_nId)
48cdf0e10cSrcweir 		{
49cdf0e10cSrcweir 			case CCA_NAME: 				return "name";
50cdf0e10cSrcweir 			case CCA_SERVICE_NAME: 		return "control-implementation";
51cdf0e10cSrcweir 			case CCA_BUTTON_TYPE: 		return "button-type";
52cdf0e10cSrcweir // disabled(AddAttributeIdLegacy)	case CCA_CONTROL_ID: 		return "id";
53cdf0e10cSrcweir 			case CCA_CURRENT_SELECTED: 	return "current-selected";
54cdf0e10cSrcweir 			case CCA_CURRENT_VALUE: 	return "current-value";
55cdf0e10cSrcweir 			case CCA_DISABLED: 			return "disabled";
56cdf0e10cSrcweir 			case CCA_ENABLEVISIBLE: 	return "visible";
57cdf0e10cSrcweir 			case CCA_DROPDOWN: 			return "dropdown";
58cdf0e10cSrcweir 			case CCA_FOR: 				return "for";
59cdf0e10cSrcweir 			case CCA_IMAGE_DATA: 		return "image-data";
60cdf0e10cSrcweir 			case CCA_LABEL: 			return "label";
61cdf0e10cSrcweir 			case CCA_MAX_LENGTH: 		return "max-length";
62cdf0e10cSrcweir 			case CCA_PRINTABLE: 		return "printable";
63cdf0e10cSrcweir 			case CCA_READONLY: 			return "readonly";
64cdf0e10cSrcweir 			case CCA_SELECTED: 			return "selected";
65cdf0e10cSrcweir 			case CCA_SIZE: 				return "size";
66cdf0e10cSrcweir 			case CCA_TAB_INDEX: 		return "tab-index";
67cdf0e10cSrcweir 			case CCA_TARGET_FRAME: 		return "target-frame";
68cdf0e10cSrcweir 			case CCA_TARGET_LOCATION: 	return "href";		// the only special thing here: TargetLocation is represented by an xlink:href attribute
69cdf0e10cSrcweir 			case CCA_TAB_STOP: 			return "tab-stop";
70cdf0e10cSrcweir 			case CCA_TITLE: 			return "title";
71cdf0e10cSrcweir 			case CCA_VALUE: 			return "value";
72cdf0e10cSrcweir             case CCA_ORIENTATION:       return "orientation";
73cdf0e10cSrcweir             case CCA_VISUAL_EFFECT:     return "visual-effect";
74cdf0e10cSrcweir 			default:
75cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OAttributeMetaData::getCommonControlAttributeName: invalid id (maybe you or-ed two flags?)!");
76cdf0e10cSrcweir 		}
77cdf0e10cSrcweir 		return "";
78cdf0e10cSrcweir 	}
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	//---------------------------------------------------------------------
getCommonControlAttributeNamespace(sal_Int32 _nId)81cdf0e10cSrcweir 	sal_uInt16 OAttributeMetaData::getCommonControlAttributeNamespace(sal_Int32 _nId)
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir 		if (CCA_TARGET_LOCATION == _nId)
84cdf0e10cSrcweir 			return XML_NAMESPACE_XLINK;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 		if (CCA_TARGET_FRAME == _nId)
87cdf0e10cSrcweir 			return XML_NAMESPACE_OFFICE;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 		return XML_NAMESPACE_FORM;
90cdf0e10cSrcweir 	}
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	//---------------------------------------------------------------------
getFormAttributeName(FormAttributes _eAttrib)93cdf0e10cSrcweir 	const sal_Char* OAttributeMetaData::getFormAttributeName(FormAttributes _eAttrib)
94cdf0e10cSrcweir 	{
95cdf0e10cSrcweir 		switch (_eAttrib)
96cdf0e10cSrcweir 		{
97cdf0e10cSrcweir 			case faName: 				return "name";
98cdf0e10cSrcweir 			case faServiceName: 		return "service-name";
99cdf0e10cSrcweir 			case faAction: 				return "href";		// the only special thing here: Action is represented by an xlink:href attribute
100cdf0e10cSrcweir 			case faEnctype: 			return "enctype";
101cdf0e10cSrcweir 			case faMethod: 				return "method";
102cdf0e10cSrcweir 			case faTargetFrame: 		return "target-frame";
103cdf0e10cSrcweir 			case faAllowDeletes:		return "allow-deletes";
104cdf0e10cSrcweir 			case faAllowInserts:		return "allow-inserts";
105cdf0e10cSrcweir 			case faAllowUpdates:		return "allow-updates";
106cdf0e10cSrcweir 			case faApplyFilter: 		return "apply-filter";
107cdf0e10cSrcweir 			case faCommand: 			return "command";
108cdf0e10cSrcweir 			case faCommandType: 		return "command-type";
109cdf0e10cSrcweir 			case faEscapeProcessing:	return "escape-processing";
110cdf0e10cSrcweir 			case faDatasource: 			return "datasource";
111cdf0e10cSrcweir 			case faConnectionResource: 	return "connection-resource";
112cdf0e10cSrcweir 			case faDetailFiels: 		return "detail-fields";
113cdf0e10cSrcweir 			case faFilter: 				return "filter";
114cdf0e10cSrcweir 			case faIgnoreResult: 		return "ignore-result";
115cdf0e10cSrcweir 			case faMasterFields: 		return "master-fields";
116cdf0e10cSrcweir 			case faNavigationMode:		return "navigation-mode";
117cdf0e10cSrcweir 			case faOrder: 				return "order";
118cdf0e10cSrcweir 			case faTabbingCycle: 		return "tab-cycle";
119cdf0e10cSrcweir 			default:
120cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OAttributeMetaData::getFormAttributeName: invalid id!");
121cdf0e10cSrcweir 		}
122cdf0e10cSrcweir 		return "";
123cdf0e10cSrcweir 	}
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	//---------------------------------------------------------------------
getFormAttributeNamespace(FormAttributes _eAttrib)126cdf0e10cSrcweir 	sal_uInt16 OAttributeMetaData::getFormAttributeNamespace(FormAttributes _eAttrib)
127cdf0e10cSrcweir 	{
128cdf0e10cSrcweir 		if (faAction == _eAttrib)
129cdf0e10cSrcweir 			return XML_NAMESPACE_XLINK;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 		if (faTargetFrame == _eAttrib)
132cdf0e10cSrcweir 			return XML_NAMESPACE_OFFICE;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 		return XML_NAMESPACE_FORM;
135cdf0e10cSrcweir 	}
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	//---------------------------------------------------------------------
getDatabaseAttributeName(sal_Int32 _nId)138cdf0e10cSrcweir 	const sal_Char* OAttributeMetaData::getDatabaseAttributeName(sal_Int32 _nId)
139cdf0e10cSrcweir 	{
140cdf0e10cSrcweir 		switch (_nId)
141cdf0e10cSrcweir 		{
142cdf0e10cSrcweir 			case DA_BOUND_COLUMN:		return "bound-column";
143cdf0e10cSrcweir 			case DA_CONVERT_EMPTY:		return "convert-empty-to-null";
144cdf0e10cSrcweir 			case DA_DATA_FIELD:			return "data-field";
145cdf0e10cSrcweir 			case DA_LIST_SOURCE:		return "list-source";
146cdf0e10cSrcweir 			case DA_LIST_SOURCE_TYPE:	return "list-source-type";
147cdf0e10cSrcweir             case DA_INPUT_REQUIRED:	    return "input-required";
148cdf0e10cSrcweir 			default:
149cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OAttributeMetaData::getDatabaseAttributeName: invalid id (maybe you or-ed two flags?)!");
150cdf0e10cSrcweir 		}
151cdf0e10cSrcweir 		return "";
152cdf0e10cSrcweir 	}
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 	//---------------------------------------------------------------------
getDatabaseAttributeNamespace(sal_Int32)155cdf0e10cSrcweir 	sal_uInt16 OAttributeMetaData::getDatabaseAttributeNamespace(sal_Int32 /*_nId*/)
156cdf0e10cSrcweir 	{
157cdf0e10cSrcweir 		// nothing special here
158cdf0e10cSrcweir 		return XML_NAMESPACE_FORM;
159cdf0e10cSrcweir 	}
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	//---------------------------------------------------------------------
getBindingAttributeName(sal_Int32 _nId)162cdf0e10cSrcweir     const sal_Char* OAttributeMetaData::getBindingAttributeName(sal_Int32 _nId)
163cdf0e10cSrcweir     {
164cdf0e10cSrcweir 		switch (_nId)
165cdf0e10cSrcweir 		{
166cdf0e10cSrcweir 			case BA_LINKED_CELL:       return "linked-cell";
167cdf0e10cSrcweir             case BA_LIST_LINKING_TYPE: return "list-linkage-type";
168cdf0e10cSrcweir 			case BA_LIST_CELL_RANGE:   return "source-cell-range";
169cdf0e10cSrcweir 			default:
170cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OAttributeMetaData::getBindingAttributeName: invalid id (maybe you or-ed two flags?)!");
171cdf0e10cSrcweir 		}
172cdf0e10cSrcweir 		return "";
173cdf0e10cSrcweir     }
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	//---------------------------------------------------------------------
getBindingAttributeNamespace(sal_Int32)176cdf0e10cSrcweir 	sal_uInt16 OAttributeMetaData::getBindingAttributeNamespace(sal_Int32)
177cdf0e10cSrcweir     {
178cdf0e10cSrcweir 		// nothing special here
179cdf0e10cSrcweir 		return XML_NAMESPACE_FORM;
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	//---------------------------------------------------------------------
getSpecialAttributeName(sal_Int32 _nId)183cdf0e10cSrcweir 	const sal_Char* OAttributeMetaData::getSpecialAttributeName(sal_Int32 _nId)
184cdf0e10cSrcweir 	{
185cdf0e10cSrcweir 		switch (_nId)
186cdf0e10cSrcweir 		{
187cdf0e10cSrcweir 			case SCA_ECHO_CHAR: 			return "echo-char";
188cdf0e10cSrcweir 			case SCA_MAX_VALUE:				return "max-value";
189cdf0e10cSrcweir 			case SCA_MIN_VALUE:				return "min-value";
190cdf0e10cSrcweir 			case SCA_VALIDATION:			return "validation";
191cdf0e10cSrcweir 			case SCA_MULTI_LINE:			return "multi-line";
192cdf0e10cSrcweir 			case SCA_AUTOMATIC_COMPLETION:	return "auto-complete";
193cdf0e10cSrcweir 			case SCA_MULTIPLE: 				return "multiple";
194cdf0e10cSrcweir 			case SCA_DEFAULT_BUTTON: 		return "default-button";
195cdf0e10cSrcweir 			case SCA_CURRENT_STATE: 		return "current-state";
196cdf0e10cSrcweir 			case SCA_IS_TRISTATE: 			return "is-tristate";
197cdf0e10cSrcweir 			case SCA_STATE: 				return "state";
198cdf0e10cSrcweir 			case SCA_COLUMN_STYLE_NAME:		return "text-style-name";
199cdf0e10cSrcweir 			case SCA_STEP_SIZE:		        return "step-size";
200cdf0e10cSrcweir 			case SCA_PAGE_STEP_SIZE:		return "page-step-size";
201cdf0e10cSrcweir 			case SCA_REPEAT_DELAY:		    return "delay-for-repeat";
202cdf0e10cSrcweir             case SCA_TOGGLE:                return "toggle";
203cdf0e10cSrcweir             case SCA_FOCUS_ON_CLICK:        return "focus-on-click";
204cdf0e10cSrcweir 			default:
205cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OAttributeMetaData::getSpecialAttributeName: invalid id (maybe you or-ed two flags?)!");
206cdf0e10cSrcweir 		}
207cdf0e10cSrcweir 		return "";
208cdf0e10cSrcweir 	}
209cdf0e10cSrcweir 
210cdf0e10cSrcweir 	//---------------------------------------------------------------------
getSpecialAttributeNamespace(sal_Int32)211cdf0e10cSrcweir 	sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 /*_nId*/)
212cdf0e10cSrcweir 	{
213cdf0e10cSrcweir 		// nothing special here
214cdf0e10cSrcweir 		return XML_NAMESPACE_FORM;
215cdf0e10cSrcweir 	}
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	//---------------------------------------------------------------------
getOfficeFormsAttributeName(OfficeFormsAttributes _eAttrib)218cdf0e10cSrcweir 	const sal_Char* OAttributeMetaData::getOfficeFormsAttributeName(OfficeFormsAttributes _eAttrib)
219cdf0e10cSrcweir 	{
220cdf0e10cSrcweir 		switch (_eAttrib)
221cdf0e10cSrcweir 		{
222cdf0e10cSrcweir 			case ofaAutomaticFocus:		return "automatic-focus";
223cdf0e10cSrcweir 			case ofaApplyDesignMode:	return "apply-design-mode";
224cdf0e10cSrcweir 			default:
225cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OAttributeMetaData::getOfficeFormsAttributeName: invalid id!");
226cdf0e10cSrcweir 		}
227cdf0e10cSrcweir 		return "";
228cdf0e10cSrcweir 	}
229cdf0e10cSrcweir 
230cdf0e10cSrcweir 	//---------------------------------------------------------------------
getOfficeFormsAttributeNamespace(OfficeFormsAttributes)231cdf0e10cSrcweir 	sal_uInt16 OAttributeMetaData::getOfficeFormsAttributeNamespace(OfficeFormsAttributes /* _eAttrib */)
232cdf0e10cSrcweir 	{
233cdf0e10cSrcweir 		// nothing special here
234cdf0e10cSrcweir 		return XML_NAMESPACE_FORM;
235cdf0e10cSrcweir 	}
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 	//=====================================================================
238cdf0e10cSrcweir 	//= OAttribute2Property
239cdf0e10cSrcweir 	//=====================================================================
240cdf0e10cSrcweir 	//---------------------------------------------------------------------
OAttribute2Property()241cdf0e10cSrcweir 	OAttribute2Property::OAttribute2Property()
242cdf0e10cSrcweir 	{
243cdf0e10cSrcweir 	}
244cdf0e10cSrcweir 
245cdf0e10cSrcweir 	//---------------------------------------------------------------------
~OAttribute2Property()246cdf0e10cSrcweir 	OAttribute2Property::~OAttribute2Property()
247cdf0e10cSrcweir 	{
248cdf0e10cSrcweir 	}
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 	//---------------------------------------------------------------------
getAttributeTranslation(const::rtl::OUString & _rAttribName)251cdf0e10cSrcweir 	const OAttribute2Property::AttributeAssignment* OAttribute2Property::getAttributeTranslation(
252cdf0e10cSrcweir 			const ::rtl::OUString& _rAttribName)
253cdf0e10cSrcweir 	{
254cdf0e10cSrcweir 		ConstAttributeAssignmentsIterator aPos = m_aKnownProperties.find(_rAttribName);
255cdf0e10cSrcweir 		if (m_aKnownProperties.end() != aPos)
256cdf0e10cSrcweir 			return &aPos->second;
257cdf0e10cSrcweir 		return NULL;
258cdf0e10cSrcweir 	}
259cdf0e10cSrcweir 
260cdf0e10cSrcweir 	//---------------------------------------------------------------------
addStringProperty(const sal_Char * _pAttributeName,const::rtl::OUString & _rPropertyName,const sal_Char * _pAttributeDefault)261cdf0e10cSrcweir 	void OAttribute2Property::addStringProperty(
262cdf0e10cSrcweir 		const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
263cdf0e10cSrcweir 		const sal_Char* _pAttributeDefault)
264cdf0e10cSrcweir 	{
265cdf0e10cSrcweir 		implAdd(_pAttributeName, _rPropertyName, ::getCppuType( static_cast< ::rtl::OUString* >(NULL) ),
266cdf0e10cSrcweir 			_pAttributeDefault ? ::rtl::OUString::createFromAscii(_pAttributeDefault) : ::rtl::OUString());
267cdf0e10cSrcweir 	}
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	//---------------------------------------------------------------------
addBooleanProperty(const sal_Char * _pAttributeName,const::rtl::OUString & _rPropertyName,const sal_Bool _bAttributeDefault,const sal_Bool _bInverseSemantics)270cdf0e10cSrcweir 	void OAttribute2Property::addBooleanProperty(
271cdf0e10cSrcweir 		const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
272cdf0e10cSrcweir 		const sal_Bool _bAttributeDefault, const sal_Bool _bInverseSemantics)
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir 		::rtl::OUStringBuffer aDefault;
275cdf0e10cSrcweir 		SvXMLUnitConverter::convertBool(aDefault, _bAttributeDefault);
276cdf0e10cSrcweir 		AttributeAssignment& aAssignment = implAdd(_pAttributeName, _rPropertyName, ::getBooleanCppuType(), aDefault.makeStringAndClear());
277cdf0e10cSrcweir 		aAssignment.bInverseSemantics = _bInverseSemantics;
278cdf0e10cSrcweir 	}
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 	//---------------------------------------------------------------------
addInt16Property(const sal_Char * _pAttributeName,const::rtl::OUString & _rPropertyName,const sal_Int16 _nAttributeDefault)281cdf0e10cSrcweir 	void OAttribute2Property::addInt16Property(
282cdf0e10cSrcweir 		const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
283cdf0e10cSrcweir 		const sal_Int16 _nAttributeDefault)
284cdf0e10cSrcweir 	{
285cdf0e10cSrcweir 		::rtl::OUStringBuffer aDefault;
286cdf0e10cSrcweir 		SvXMLUnitConverter::convertNumber(aDefault, (sal_Int32)_nAttributeDefault);
287cdf0e10cSrcweir 		implAdd(_pAttributeName, _rPropertyName, ::getCppuType( static_cast< sal_Int16* >(NULL) ), aDefault.makeStringAndClear());
288cdf0e10cSrcweir 	}
289cdf0e10cSrcweir 
290cdf0e10cSrcweir 	//---------------------------------------------------------------------
addInt32Property(const sal_Char * _pAttributeName,const::rtl::OUString & _rPropertyName,const sal_Int32 _nAttributeDefault)291cdf0e10cSrcweir 	void OAttribute2Property::addInt32Property(
292cdf0e10cSrcweir 		const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
293cdf0e10cSrcweir 		const sal_Int32 _nAttributeDefault)
294cdf0e10cSrcweir 	{
295cdf0e10cSrcweir 		::rtl::OUStringBuffer aDefault;
296cdf0e10cSrcweir 		SvXMLUnitConverter::convertNumber( aDefault, _nAttributeDefault );
297cdf0e10cSrcweir 		implAdd( _pAttributeName, _rPropertyName, ::getCppuType( static_cast< sal_Int32* >(NULL) ), aDefault.makeStringAndClear() );
298cdf0e10cSrcweir 	}
299cdf0e10cSrcweir 
300cdf0e10cSrcweir 	//---------------------------------------------------------------------
addEnumProperty(const sal_Char * _pAttributeName,const::rtl::OUString & _rPropertyName,const sal_uInt16 _nAttributeDefault,const SvXMLEnumMapEntry * _pValueMap,const::com::sun::star::uno::Type * _pType)301cdf0e10cSrcweir 	void OAttribute2Property::addEnumProperty(
302cdf0e10cSrcweir 			const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
303cdf0e10cSrcweir 			const sal_uInt16 _nAttributeDefault, const SvXMLEnumMapEntry* _pValueMap,
304cdf0e10cSrcweir 			const ::com::sun::star::uno::Type* _pType)
305cdf0e10cSrcweir 	{
306cdf0e10cSrcweir 		::rtl::OUStringBuffer aDefault;
307cdf0e10cSrcweir 		SvXMLUnitConverter::convertEnum(aDefault, _nAttributeDefault, _pValueMap);
308cdf0e10cSrcweir 		AttributeAssignment& aAssignment = implAdd(_pAttributeName, _rPropertyName,
309cdf0e10cSrcweir 			_pType ? *_pType : ::getCppuType( static_cast< sal_Int32* >(NULL) ),
310cdf0e10cSrcweir 				// this assumes that the setPropertyValue for enums can handle int32's ....
311cdf0e10cSrcweir 			aDefault.makeStringAndClear());
312cdf0e10cSrcweir 		aAssignment.pEnumMap = _pValueMap;
313cdf0e10cSrcweir 	}
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 	//---------------------------------------------------------------------
implAdd(const sal_Char * _pAttributeName,const::rtl::OUString & _rPropertyName,const::com::sun::star::uno::Type & _rType,const::rtl::OUString &)316cdf0e10cSrcweir 	OAttribute2Property::AttributeAssignment& OAttribute2Property::implAdd(
317cdf0e10cSrcweir 			const sal_Char* _pAttributeName, const ::rtl::OUString& _rPropertyName,
318cdf0e10cSrcweir 			const ::com::sun::star::uno::Type& _rType, const ::rtl::OUString& /*_rDefaultString*/)
319cdf0e10cSrcweir 	{
320cdf0e10cSrcweir 		OSL_ENSURE(m_aKnownProperties.end() == m_aKnownProperties.find(::rtl::OUString::createFromAscii(_pAttributeName)),
321cdf0e10cSrcweir 			"OAttribute2Property::implAdd: already have this attribute!");
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 		::rtl::OUString sAttributeName = ::rtl::OUString::createFromAscii(_pAttributeName);
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 		AttributeAssignment aAssignment;
326cdf0e10cSrcweir 		aAssignment.sAttributeName = sAttributeName;
327cdf0e10cSrcweir 		aAssignment.sPropertyName = _rPropertyName;
328cdf0e10cSrcweir 		aAssignment.aPropertyType = _rType;
329cdf0e10cSrcweir 
330cdf0e10cSrcweir 		// redundance, the accessor is stored in aAssignment.sAttributeName, too
331cdf0e10cSrcweir 		return m_aKnownProperties[sAttributeName] = aAssignment;
332cdf0e10cSrcweir 	}
333cdf0e10cSrcweir 
334cdf0e10cSrcweir //.........................................................................
335cdf0e10cSrcweir }	// namespace xmloff
336cdf0e10cSrcweir //.........................................................................
337cdf0e10cSrcweir 
338