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 
27cdf0e10cSrcweir #include "elementexport.hxx"
28cdf0e10cSrcweir #include "strings.hxx"
29cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx"
30cdf0e10cSrcweir #include "eventexport.hxx"
31cdf0e10cSrcweir #include "formenums.hxx"
32cdf0e10cSrcweir #include "formcellbinding.hxx"
33cdf0e10cSrcweir #include "formcellbinding.hxx"
34cdf0e10cSrcweir #include "xmloff/xformsexport.hxx"
35cdf0e10cSrcweir #include "property_meta_data.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir /** === begin UNO includes === **/
38cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp>
39cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
40cdf0e10cSrcweir #include <com/sun/star/io/XPersistObject.hpp>
41cdf0e10cSrcweir #include <com/sun/star/form/FormComponentType.hpp>
42cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
43cdf0e10cSrcweir #include <com/sun/star/form/FormSubmitEncoding.hpp>
44cdf0e10cSrcweir #include <com/sun/star/form/FormSubmitMethod.hpp>
45cdf0e10cSrcweir #include <com/sun/star/sdb/CommandType.hpp>
46cdf0e10cSrcweir #include <com/sun/star/form/NavigationBarMode.hpp>
47cdf0e10cSrcweir #include <com/sun/star/form/TabulatorCycle.hpp>
48cdf0e10cSrcweir #include <com/sun/star/form/FormButtonType.hpp>
49cdf0e10cSrcweir #include <com/sun/star/awt/ScrollBarOrientation.hpp>
50cdf0e10cSrcweir #include <com/sun/star/awt/VisualEffect.hpp>
51cdf0e10cSrcweir #include <com/sun/star/form/ListSourceType.hpp>
52cdf0e10cSrcweir #include <com/sun/star/awt/ImagePosition.hpp>
53cdf0e10cSrcweir /** === end UNO includes === **/
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #include <tools/wintypes.hxx>		// for check states
56cdf0e10cSrcweir #include <xmloff/txtprmap.hxx>
57cdf0e10cSrcweir #include <com/sun/star/form/binding/XBindableValue.hpp>
58cdf0e10cSrcweir #include <com/sun/star/form/binding/XListEntrySink.hpp>
59cdf0e10cSrcweir #include <tools/urlobj.hxx>
60cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
61cdf0e10cSrcweir #include <xmloff/nmspmap.hxx>
62cdf0e10cSrcweir #include <xmloff/XMLEventExport.hxx>
63cdf0e10cSrcweir #include <xmloff/xmluconv.hxx>
64cdf0e10cSrcweir #include <xmloff/xmltoken.hxx>
65cdf0e10cSrcweir #include <tools/time.hxx>
66cdf0e10cSrcweir #include <tools/diagnose_ex.h>
67cdf0e10cSrcweir #include <comphelper/extract.hxx>
68cdf0e10cSrcweir 
69cdf0e10cSrcweir #include <stdio.h>
70cdf0e10cSrcweir #include <algorithm>
71cdf0e10cSrcweir 
72cdf0e10cSrcweir //.........................................................................
73cdf0e10cSrcweir namespace xmloff
74cdf0e10cSrcweir {
75cdf0e10cSrcweir //.........................................................................
76cdf0e10cSrcweir 
77cdf0e10cSrcweir     #if OSL_DEBUG_LEVEL > 0
78cdf0e10cSrcweir         #define RESET_BIT( bitfield, bit ) \
79cdf0e10cSrcweir 			bitfield = bitfield & ~bit
80cdf0e10cSrcweir     #else
81cdf0e10cSrcweir         #define RESET_BIT( bitfield, bit )
82cdf0e10cSrcweir     #endif
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     using namespace ::xmloff::token;
85cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
86cdf0e10cSrcweir 	using namespace ::com::sun::star::sdb;
87cdf0e10cSrcweir 	using namespace ::com::sun::star::awt;
88cdf0e10cSrcweir 	using namespace ::com::sun::star::form;
89cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
90cdf0e10cSrcweir 	using namespace ::com::sun::star::lang;
91cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
92cdf0e10cSrcweir 	using namespace ::com::sun::star::container;
93cdf0e10cSrcweir 	using namespace ::com::sun::star::script;
94cdf0e10cSrcweir 	using namespace ::com::sun::star::io;
95cdf0e10cSrcweir 	using namespace ::com::sun::star::table;
96cdf0e10cSrcweir 	using namespace ::com::sun::star::text;
97cdf0e10cSrcweir     using namespace ::com::sun::star::form::binding;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	//=====================================================================
100cdf0e10cSrcweir 	//= OElementExport
101cdf0e10cSrcweir 	//=====================================================================
OElementExport(IFormsExportContext & _rContext,const Reference<XPropertySet> & _rxProps,const Sequence<ScriptEventDescriptor> & _rEvents)102cdf0e10cSrcweir 	OElementExport::OElementExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxProps,
103cdf0e10cSrcweir 		const Sequence< ScriptEventDescriptor >& _rEvents)
104cdf0e10cSrcweir 		:OPropertyExport(_rContext, _rxProps)
105cdf0e10cSrcweir 		,m_aEvents(_rEvents)
106cdf0e10cSrcweir 		,m_pXMLElement(NULL)
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 	}
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	//---------------------------------------------------------------------
~OElementExport()111cdf0e10cSrcweir 	OElementExport::~OElementExport()
112cdf0e10cSrcweir 	{
113cdf0e10cSrcweir 		implEndElement();
114cdf0e10cSrcweir 	}
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	//---------------------------------------------------------------------
doExport()117cdf0e10cSrcweir 	void OElementExport::doExport()
118cdf0e10cSrcweir 	{
119cdf0e10cSrcweir 		// collect some general information about the element
120cdf0e10cSrcweir 		examine();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 		// first add the attributes necessary for the element
123cdf0e10cSrcweir 		m_rContext.getGlobalContext().ClearAttrList();
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 		// add the attributes
126cdf0e10cSrcweir 		exportAttributes();
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 		// start the XML element
129cdf0e10cSrcweir 		implStartElement(getXMLElementName());
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 		// the sub elements (mostly control type dependent)
132cdf0e10cSrcweir 		exportSubTags();
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 		implEndElement();
135cdf0e10cSrcweir 	}
136cdf0e10cSrcweir 
137cdf0e10cSrcweir 	//---------------------------------------------------------------------
examine()138cdf0e10cSrcweir 	void OElementExport::examine()
139cdf0e10cSrcweir 	{
140cdf0e10cSrcweir 		// nothing to do here
141cdf0e10cSrcweir 	}
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportAttributes()144cdf0e10cSrcweir 	void OElementExport::exportAttributes()
145cdf0e10cSrcweir 	{
146cdf0e10cSrcweir 		// nothing to do here
147cdf0e10cSrcweir 	}
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportSubTags()150cdf0e10cSrcweir 	void OElementExport::exportSubTags()
151cdf0e10cSrcweir 	{
152cdf0e10cSrcweir 		// the properties which where not exported 'til now
153cdf0e10cSrcweir 		exportRemainingProperties();
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 		// the script:events sub tags
156cdf0e10cSrcweir 		exportEvents();
157cdf0e10cSrcweir 	}
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	//---------------------------------------------------------------------
implStartElement(const sal_Char * _pName)160cdf0e10cSrcweir 	void OElementExport::implStartElement(const sal_Char* _pName)
161cdf0e10cSrcweir 	{
162cdf0e10cSrcweir 		m_pXMLElement = new SvXMLElementExport(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, _pName, sal_True, sal_True);
163cdf0e10cSrcweir 	}
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	//---------------------------------------------------------------------
implEndElement()166cdf0e10cSrcweir 	void OElementExport::implEndElement()
167cdf0e10cSrcweir 	{
168cdf0e10cSrcweir 		delete m_pXMLElement;
169cdf0e10cSrcweir 		m_pXMLElement = NULL;
170cdf0e10cSrcweir 	}
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportServiceNameAttribute()173cdf0e10cSrcweir 	void OElementExport::exportServiceNameAttribute()
174cdf0e10cSrcweir 	{
175cdf0e10cSrcweir 		Reference< XPersistObject > xPersistence(m_xProps, UNO_QUERY);
176cdf0e10cSrcweir 		if (!xPersistence.is())
177cdf0e10cSrcweir 		{
178cdf0e10cSrcweir 			OSL_ENSURE(sal_False, "OElementExport::exportServiceNameAttribute: no XPersistObject!");
179cdf0e10cSrcweir 			return;
180cdf0e10cSrcweir 		}
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 		::rtl::OUString sServiceName = xPersistence->getServiceName();
183cdf0e10cSrcweir 		// we don't want to write the old service name directly: it's a name used for compatibility reasons, but
184cdf0e10cSrcweir 		// as we start some kind of new file format here (with this xml export), we don't care about
185cdf0e10cSrcweir 		// compatibility ...
186cdf0e10cSrcweir 		// So we translate the old persistence service name into new ones, if possible
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 		::rtl::OUString sToWriteServiceName = sServiceName;
189cdf0e10cSrcweir #define CHECK_N_TRANSLATE( name )	\
190cdf0e10cSrcweir 		else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_##name))	\
191cdf0e10cSrcweir 			sToWriteServiceName = SERVICE_##name
192cdf0e10cSrcweir 
193cdf0e10cSrcweir 		if (sal_False)
194cdf0e10cSrcweir 			;
195cdf0e10cSrcweir 		CHECK_N_TRANSLATE( FORM );
196cdf0e10cSrcweir 		CHECK_N_TRANSLATE( FORM );
197cdf0e10cSrcweir 		CHECK_N_TRANSLATE( LISTBOX );
198cdf0e10cSrcweir 		CHECK_N_TRANSLATE( COMBOBOX );
199cdf0e10cSrcweir 		CHECK_N_TRANSLATE( RADIOBUTTON );
200cdf0e10cSrcweir 		CHECK_N_TRANSLATE( GROUPBOX );
201cdf0e10cSrcweir 		CHECK_N_TRANSLATE( FIXEDTEXT );
202cdf0e10cSrcweir 		CHECK_N_TRANSLATE( COMMANDBUTTON );
203cdf0e10cSrcweir 		CHECK_N_TRANSLATE( CHECKBOX );
204cdf0e10cSrcweir 		CHECK_N_TRANSLATE( GRID );
205cdf0e10cSrcweir 		CHECK_N_TRANSLATE( IMAGEBUTTON );
206cdf0e10cSrcweir 		CHECK_N_TRANSLATE( FILECONTROL );
207cdf0e10cSrcweir 		CHECK_N_TRANSLATE( TIMEFIELD );
208cdf0e10cSrcweir 		CHECK_N_TRANSLATE( DATEFIELD );
209cdf0e10cSrcweir 		CHECK_N_TRANSLATE( NUMERICFIELD );
210cdf0e10cSrcweir 		CHECK_N_TRANSLATE( CURRENCYFIELD );
211cdf0e10cSrcweir 		CHECK_N_TRANSLATE( PATTERNFIELD );
212cdf0e10cSrcweir 		CHECK_N_TRANSLATE( HIDDENCONTROL );
213cdf0e10cSrcweir 		CHECK_N_TRANSLATE( IMAGECONTROL );
214cdf0e10cSrcweir 		CHECK_N_TRANSLATE( FORMATTEDFIELD );
215cdf0e10cSrcweir 		else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_EDIT))
216cdf0e10cSrcweir 		{	// special handling for the edit field: we have two controls using this as persistence service name
217cdf0e10cSrcweir 			sToWriteServiceName = SERVICE_EDIT;
218cdf0e10cSrcweir 			Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
219cdf0e10cSrcweir 			if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD))
220cdf0e10cSrcweir 				sToWriteServiceName = SERVICE_FORMATTEDFIELD;
221cdf0e10cSrcweir 		}
222cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
223cdf0e10cSrcweir 		Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY);
224cdf0e10cSrcweir 		OSL_ENSURE(xSI.is() && xSI->supportsService(sToWriteServiceName),
225cdf0e10cSrcweir 			"OElementExport::exportServiceNameAttribute: wrong service name translation!");
226cdf0e10cSrcweir 
227cdf0e10cSrcweir #endif
228cdf0e10cSrcweir 		sToWriteServiceName =
229cdf0e10cSrcweir 			m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey(
230cdf0e10cSrcweir 				XML_NAMESPACE_OOO, sToWriteServiceName );
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 		// now write this
233cdf0e10cSrcweir 		AddAttribute(
234cdf0e10cSrcweir 			OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME),
235cdf0e10cSrcweir 			OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME),
236cdf0e10cSrcweir 			sToWriteServiceName);
237cdf0e10cSrcweir 	}
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportEvents()240cdf0e10cSrcweir 	void OElementExport::exportEvents()
241cdf0e10cSrcweir 	{
242cdf0e10cSrcweir 		if (!m_aEvents.getLength())
243cdf0e10cSrcweir 			// nothing to do
244cdf0e10cSrcweir 			return;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 		Reference< XNameReplace > xWrapper = new OEventDescriptorMapper(m_aEvents);
247cdf0e10cSrcweir 		m_rContext.getGlobalContext().GetEventExport().Export(xWrapper);
248cdf0e10cSrcweir 	}
249cdf0e10cSrcweir 
250cdf0e10cSrcweir 	//=====================================================================
251cdf0e10cSrcweir 	//= OControlExport
252cdf0e10cSrcweir 	//=====================================================================
253cdf0e10cSrcweir 	//---------------------------------------------------------------------
OControlExport(IFormsExportContext & _rContext,const Reference<XPropertySet> & _rxControl,const::rtl::OUString & _rControlId,const::rtl::OUString & _rReferringControls,const Sequence<ScriptEventDescriptor> & _rEvents)254cdf0e10cSrcweir 	OControlExport::OControlExport(IFormsExportContext& _rContext,  const Reference< XPropertySet >& _rxControl,
255cdf0e10cSrcweir 		const ::rtl::OUString& _rControlId, const ::rtl::OUString& _rReferringControls,
256cdf0e10cSrcweir 		const Sequence< ScriptEventDescriptor >& _rEvents)
257cdf0e10cSrcweir 		:OElementExport(_rContext, _rxControl, _rEvents)
258cdf0e10cSrcweir 		,m_sControlId(_rControlId)
259cdf0e10cSrcweir 		,m_sReferringControls(_rReferringControls)
260cdf0e10cSrcweir         ,m_nClassId(FormComponentType::CONTROL)
261cdf0e10cSrcweir         ,m_eType( UNKNOWN )
262cdf0e10cSrcweir 		,m_nIncludeCommon(0)
263cdf0e10cSrcweir 		,m_nIncludeDatabase(0)
264cdf0e10cSrcweir 		,m_nIncludeSpecial(0)
265cdf0e10cSrcweir 		,m_nIncludeEvents(0)
266cdf0e10cSrcweir         ,m_nIncludeBindings(0)
267cdf0e10cSrcweir 		,m_pOuterElement(NULL)
268cdf0e10cSrcweir 	{
269cdf0e10cSrcweir 		OSL_ENSURE(m_xProps.is(), "OControlExport::OControlExport: invalid arguments!");
270cdf0e10cSrcweir 	}
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 	//---------------------------------------------------------------------
~OControlExport()273cdf0e10cSrcweir 	OControlExport::~OControlExport()
274cdf0e10cSrcweir 	{
275cdf0e10cSrcweir 		implEndElement();
276cdf0e10cSrcweir 	}
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportOuterAttributes()279cdf0e10cSrcweir 	void OControlExport::exportOuterAttributes()
280cdf0e10cSrcweir 	{
281cdf0e10cSrcweir 		// the control id
282cdf0e10cSrcweir 		if (CCA_NAME & m_nIncludeCommon)
283cdf0e10cSrcweir 		{
284cdf0e10cSrcweir 			exportStringPropertyAttribute(
285cdf0e10cSrcweir 				OAttributeMetaData::getCommonControlAttributeNamespace(CCA_NAME),
286cdf0e10cSrcweir 				OAttributeMetaData::getCommonControlAttributeName(CCA_NAME),
287cdf0e10cSrcweir 				PROPERTY_NAME
288cdf0e10cSrcweir 				);
289cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
290cdf0e10cSrcweir 			//  reset the bit for later checking
291cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_NAME;
292cdf0e10cSrcweir 		#endif
293cdf0e10cSrcweir 		}
294cdf0e10cSrcweir 
295cdf0e10cSrcweir 		// the service name
296cdf0e10cSrcweir 		if (m_nIncludeCommon & CCA_SERVICE_NAME)
297cdf0e10cSrcweir 		{
298cdf0e10cSrcweir 			exportServiceNameAttribute();
299cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
300cdf0e10cSrcweir 			//  reset the bit for later checking
301cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_SERVICE_NAME;
302cdf0e10cSrcweir 		#endif
303cdf0e10cSrcweir 		}
304cdf0e10cSrcweir 	}
305cdf0e10cSrcweir 
306cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportInnerAttributes()307cdf0e10cSrcweir 	void OControlExport::exportInnerAttributes()
308cdf0e10cSrcweir 	{
309cdf0e10cSrcweir 		// the control id
310cdf0e10cSrcweir 		if (CCA_CONTROL_ID & m_nIncludeCommon)
311cdf0e10cSrcweir 		{
312cdf0e10cSrcweir 			OSL_ENSURE(m_sControlId.getLength(), "OControlExport::exportInnerAttributes: have no control id for the control!");
313cdf0e10cSrcweir             m_rContext.getGlobalContext().AddAttributeIdLegacy(
314cdf0e10cSrcweir                 XML_NAMESPACE_FORM, m_sControlId);
315cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
316cdf0e10cSrcweir 			//  reset the bit for later checking
317cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_CONTROL_ID;
318cdf0e10cSrcweir 		#endif
319cdf0e10cSrcweir 		}
320cdf0e10cSrcweir 
321cdf0e10cSrcweir         // "new-style" properties ...
322cdf0e10cSrcweir         exportGenericHandlerAttributes();
323cdf0e10cSrcweir 
324cdf0e10cSrcweir         // common control attributes
325cdf0e10cSrcweir 		exportCommonControlAttributes();
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 		// common database attributes
328cdf0e10cSrcweir 		exportDatabaseAttributes();
329cdf0e10cSrcweir 
330cdf0e10cSrcweir         // attributes related to external bindings
331cdf0e10cSrcweir         exportBindingAtributes();
332cdf0e10cSrcweir 
333cdf0e10cSrcweir 		// attributes special to the respective control type
334cdf0e10cSrcweir 		exportSpecialAttributes();
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 		// add the style references to the attributes
337cdf0e10cSrcweir 		flagStyleProperties();
338cdf0e10cSrcweir 	}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportAttributes()341cdf0e10cSrcweir 	void OControlExport::exportAttributes()
342cdf0e10cSrcweir 	{
343cdf0e10cSrcweir 		exportOuterAttributes();
344cdf0e10cSrcweir 	}
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportSubTags()347cdf0e10cSrcweir 	void OControlExport::exportSubTags() throw (Exception)
348cdf0e10cSrcweir 	{
349cdf0e10cSrcweir 		// for the upcoming exportRemainingProperties:
350cdf0e10cSrcweir 		// if a control has the LabelControl property, this is not stored with the control itself, but instead with
351cdf0e10cSrcweir 		// the control which is referenced by this property. As the base class' exportRemainingProperties doesn't
352cdf0e10cSrcweir 		// know anything about this, we need to prevent that it tries to export this property
353cdf0e10cSrcweir 		exportedProperty(PROPERTY_CONTROLLABEL);
354cdf0e10cSrcweir 
355cdf0e10cSrcweir         // if it's a control supporting XText, then we need to declare all text-related properties
356cdf0e10cSrcweir         // as "already exported". This prevents them from being exported as generic "form:property"-tags.
357cdf0e10cSrcweir         // *If* we would export them this way, they would be completely superfluous, and sometimes even
358cdf0e10cSrcweir         // disastrous, since they may, at import time, override paragraph properties which already have
359cdf0e10cSrcweir         // been set before
360cdf0e10cSrcweir         Reference< XText > xControlText( m_xProps, UNO_QUERY );
361cdf0e10cSrcweir         if ( xControlText.is() )
362cdf0e10cSrcweir         {
363cdf0e10cSrcweir             const XMLPropertyMapEntry* pCharAttributeProperties = XMLTextPropertySetMapper::getPropertyMapForType( TEXT_PROP_MAP_TEXT );
364cdf0e10cSrcweir             while ( pCharAttributeProperties->msApiName )
365cdf0e10cSrcweir             {
366cdf0e10cSrcweir                 exportedProperty( ::rtl::OUString::createFromAscii( pCharAttributeProperties->msApiName ) );
367cdf0e10cSrcweir                 ++pCharAttributeProperties;
368cdf0e10cSrcweir             }
369cdf0e10cSrcweir 
370cdf0e10cSrcweir             const XMLPropertyMapEntry* pParaAttributeProperties = XMLTextPropertySetMapper::getPropertyMapForType( TEXT_PROP_MAP_SHAPE_PARA );
371cdf0e10cSrcweir             while ( pParaAttributeProperties->msApiName )
372cdf0e10cSrcweir             {
373cdf0e10cSrcweir                 exportedProperty( ::rtl::OUString::createFromAscii( pParaAttributeProperties->msApiName ) );
374cdf0e10cSrcweir                 ++pParaAttributeProperties;
375cdf0e10cSrcweir             }
376cdf0e10cSrcweir 
377cdf0e10cSrcweir             // the RichText property is not exported. The presence of the text:p element
378cdf0e10cSrcweir             // will be used - upon reading - as indicator for the value of the RichText property
379cdf0e10cSrcweir             exportedProperty( PROPERTY_RICH_TEXT );
380cdf0e10cSrcweir 
381cdf0e10cSrcweir             // strange thing: paragraphs support both a CharStrikeout and a CharCrossedOut property
382cdf0e10cSrcweir             // The former is a short/enum value, the latter a boolean. The former has a real meaning
383cdf0e10cSrcweir             // (the strikeout type), the latter hasn't. But, when the CharCrossedOut is exported and
384cdf0e10cSrcweir             // later on imported, it overwrites anything which has previously been imported for
385cdf0e10cSrcweir             // CharStrikeout.
386cdf0e10cSrcweir             // 2004-04-14 - #i27729# - fs@openoffice.org
387cdf0e10cSrcweir             exportedProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CharCrossedOut" ) ) );
388cdf0e10cSrcweir         }
389cdf0e10cSrcweir 
390cdf0e10cSrcweir         if ( m_eType == LISTBOX )
391cdf0e10cSrcweir         {
392cdf0e10cSrcweir             // will be exported in exportListSourceAsElements:
393cdf0e10cSrcweir             if ( controlHasUserSuppliedListEntries() )
394cdf0e10cSrcweir                 exportedProperty( PROPERTY_DEFAULT_SELECT_SEQ );
395cdf0e10cSrcweir 
396cdf0e10cSrcweir             // will not be exported in a generic way. Either exportListSourceAsElements cares
397cdf0e10cSrcweir             // for them, or we don't need them
398cdf0e10cSrcweir             exportedProperty( PROPERTY_STRING_ITEM_LIST );
399cdf0e10cSrcweir             exportedProperty( PROPERTY_VALUE_SEQ );
400cdf0e10cSrcweir             exportedProperty( PROPERTY_SELECT_SEQ );
401cdf0e10cSrcweir             exportedProperty( PROPERTY_LISTSOURCE );
402cdf0e10cSrcweir         }
403cdf0e10cSrcweir         if ( m_eType == COMBOBOX )
404cdf0e10cSrcweir             exportedProperty( PROPERTY_STRING_ITEM_LIST );
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 		// let the base class export the remaining properties and the events
407cdf0e10cSrcweir 		OElementExport::exportSubTags();
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 		// special sub tags for some controls
410cdf0e10cSrcweir 		switch (m_eType)
411cdf0e10cSrcweir 		{
412cdf0e10cSrcweir 			case LISTBOX:
413cdf0e10cSrcweir                 // don't export the list entries if the are not provided by the user, but obtained implicitly
414cdf0e10cSrcweir                 // from other sources
415cdf0e10cSrcweir                 // #i26944# - 2004-05-17 - fs@openoffice.org
416cdf0e10cSrcweir                 if ( controlHasUserSuppliedListEntries() )
417cdf0e10cSrcweir 				    exportListSourceAsElements();
418cdf0e10cSrcweir 				break;
419cdf0e10cSrcweir 			case GRID:
420cdf0e10cSrcweir 			{	// a grid control requires us to store all columns as sub elements
421cdf0e10cSrcweir 				Reference< XIndexAccess > xColumnContainer(m_xProps, UNO_QUERY);
422cdf0e10cSrcweir 				OSL_ENSURE(xColumnContainer.is(), "OControlExport::exportSubTags: a grid control which is no IndexAccess?!!");
423cdf0e10cSrcweir 				if (xColumnContainer.is())
424cdf0e10cSrcweir 					m_rContext.exportCollectionElements(xColumnContainer);
425cdf0e10cSrcweir 			}
426cdf0e10cSrcweir 			break;
427cdf0e10cSrcweir 			case COMBOBOX:
428cdf0e10cSrcweir 			{	// a combox box description has sub elements: the items
429cdf0e10cSrcweir 				DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString > );
430cdf0e10cSrcweir 
431cdf0e10cSrcweir                 // don't export the list entries if the are not provided by the user, but obtained implicitly
432cdf0e10cSrcweir                 // from other sources
433cdf0e10cSrcweir                 // #i26944# - 2004-05-17 - fs@openoffice.org
434cdf0e10cSrcweir                 if ( controlHasUserSuppliedListEntries() )
435cdf0e10cSrcweir                 {
436cdf0e10cSrcweir 				    // get the item list
437cdf0e10cSrcweir 				    Sequence< ::rtl::OUString > aListItems;
438cdf0e10cSrcweir 				    m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aListItems;
439cdf0e10cSrcweir 				    // loop through it and write the sub elements
440cdf0e10cSrcweir 				    const ::rtl::OUString* pListItems = aListItems.getConstArray();
441cdf0e10cSrcweir 				    for (sal_Int32 i=0; i<aListItems.getLength(); ++i, ++pListItems)
442cdf0e10cSrcweir 				    {
443cdf0e10cSrcweir 					    m_rContext.getGlobalContext().ClearAttrList();
444cdf0e10cSrcweir 					    AddAttribute(
445cdf0e10cSrcweir 						    OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
446cdf0e10cSrcweir 						    OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
447cdf0e10cSrcweir 						    *pListItems);
448cdf0e10cSrcweir 					    SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "item", sal_True, sal_True);
449cdf0e10cSrcweir 				    }
450cdf0e10cSrcweir                 }
451cdf0e10cSrcweir 			}
452cdf0e10cSrcweir 			break;
453cdf0e10cSrcweir 
454cdf0e10cSrcweir             case TEXT_AREA:
455cdf0e10cSrcweir             {
456cdf0e10cSrcweir                 // if we act as rich text control, we need to export some text:p elements
457cdf0e10cSrcweir                 if ( xControlText.is() )
458cdf0e10cSrcweir                 {
459cdf0e10cSrcweir                     sal_Bool bActingAsRichText = sal_False;
460cdf0e10cSrcweir         			if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_RICH_TEXT ) )
461cdf0e10cSrcweir                     {
462cdf0e10cSrcweir                         OSL_VERIFY(m_xProps->getPropertyValue( PROPERTY_RICH_TEXT ) >>= bActingAsRichText );
463cdf0e10cSrcweir                     }
464cdf0e10cSrcweir 
465cdf0e10cSrcweir                     if ( bActingAsRichText )
466cdf0e10cSrcweir                 		m_rContext.getGlobalContext().GetTextParagraphExport()->exportText( xControlText );
467cdf0e10cSrcweir                 }
468cdf0e10cSrcweir             }
469cdf0e10cSrcweir             break;
470cdf0e10cSrcweir             default:
471cdf0e10cSrcweir                 // nothing do to
472cdf0e10cSrcweir                 break;
473cdf0e10cSrcweir 		}
474cdf0e10cSrcweir 	}
475cdf0e10cSrcweir 
476cdf0e10cSrcweir     //---------------------------------------------------------------------
exportGenericHandlerAttributes()477cdf0e10cSrcweir     void OControlExport::exportGenericHandlerAttributes()
478cdf0e10cSrcweir     {
479cdf0e10cSrcweir 	    const Sequence< Property > aProperties = m_xPropertyInfo->getProperties();
480cdf0e10cSrcweir         for (   const Property* prop = aProperties.getConstArray();
481cdf0e10cSrcweir                 prop != aProperties.getConstArray() + aProperties.getLength();
482cdf0e10cSrcweir                 ++prop
483cdf0e10cSrcweir             )
484cdf0e10cSrcweir         {
485cdf0e10cSrcweir             try
486cdf0e10cSrcweir             {
487cdf0e10cSrcweir                 // see if this property can already be handled with an IPropertyHandler (which, on the long
488cdf0e10cSrcweir                 // term, should be the case for most, if not all, properties)
489cdf0e10cSrcweir                 const PropertyDescription* propDescription = metadata::getPropertyDescription( prop->Name );
490cdf0e10cSrcweir                 if ( propDescription == NULL )
491cdf0e10cSrcweir                     continue;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir                 // let the factory provide the concrete handler. Note that caching, if desired, is the task
494cdf0e10cSrcweir                 // of the factory
495cdf0e10cSrcweir                 PPropertyHandler handler = (*propDescription->factory)( propDescription->propertyId );
496cdf0e10cSrcweir                 ENSURE_OR_CONTINUE( handler.get() != NULL,
497cdf0e10cSrcweir                     "OControlExport::exportGenericHandlerAttributes: invalid property handler provided by the factory!" );
498cdf0e10cSrcweir 
499cdf0e10cSrcweir                 ::rtl::OUString attributeValue;
500cdf0e10cSrcweir                 if ( propDescription->propertyGroup == NO_GROUP )
501cdf0e10cSrcweir                 {
502cdf0e10cSrcweir                     // that's a property which has a direct mapping to an attribute
503cdf0e10cSrcweir                     if ( !shouldExportProperty( prop->Name ) )
504cdf0e10cSrcweir                         // TODO: in the future, we surely need a more sophisticated approach to this, involving the property
505cdf0e10cSrcweir                         // handler, or the property description
506cdf0e10cSrcweir                     {
507cdf0e10cSrcweir                         exportedProperty( prop->Name );
508cdf0e10cSrcweir                         continue;
509cdf0e10cSrcweir                     }
510cdf0e10cSrcweir 
511cdf0e10cSrcweir                     const Any propValue = m_xProps->getPropertyValue( prop->Name );
512cdf0e10cSrcweir                     attributeValue = handler->getAttributeValue( propValue );
513cdf0e10cSrcweir                 }
514cdf0e10cSrcweir                 else
515cdf0e10cSrcweir                 {
516cdf0e10cSrcweir                     // that's a property which is part of a group of properties, whose values, in their entity, comprise
517cdf0e10cSrcweir                     // a single attribute value
518cdf0e10cSrcweir 
519cdf0e10cSrcweir                     // retrieve the descriptions of all other properties which add to the attribute value
520cdf0e10cSrcweir                     PropertyDescriptionList descriptions;
521cdf0e10cSrcweir                     metadata::getPropertyGroup( propDescription->propertyGroup, descriptions );
522cdf0e10cSrcweir 
523cdf0e10cSrcweir                     // retrieve the values for all those properties
524cdf0e10cSrcweir                     PropertyValues aValues;
525cdf0e10cSrcweir                     for (   PropertyDescriptionList::iterator desc = descriptions.begin();
526cdf0e10cSrcweir                             desc != descriptions.end();
527cdf0e10cSrcweir                             ++desc
528cdf0e10cSrcweir                         )
529cdf0e10cSrcweir                     {
530cdf0e10cSrcweir                         // TODO: XMultiPropertySet?
531cdf0e10cSrcweir                         const Any propValue = m_xProps->getPropertyValue( (*desc)->propertyName );
532cdf0e10cSrcweir                         aValues[ (*desc)->propertyId ] = propValue;
533cdf0e10cSrcweir                     }
534cdf0e10cSrcweir 
535cdf0e10cSrcweir                     // let the handler translate into an XML attribute value
536cdf0e10cSrcweir                     attributeValue = handler->getAttributeValue( aValues );
537cdf0e10cSrcweir                 }
538cdf0e10cSrcweir 
539cdf0e10cSrcweir 			    AddAttribute(
540cdf0e10cSrcweir 				    propDescription->attribute.namespacePrefix,
541cdf0e10cSrcweir                     token::GetXMLToken( propDescription->attribute.attributeToken ),
542cdf0e10cSrcweir 				    attributeValue
543cdf0e10cSrcweir                 );
544cdf0e10cSrcweir 
545cdf0e10cSrcweir                 exportedProperty( prop->Name );
546cdf0e10cSrcweir             }
547cdf0e10cSrcweir             catch( const Exception& )
548cdf0e10cSrcweir             {
549cdf0e10cSrcweir         	    DBG_UNHANDLED_EXCEPTION();
550cdf0e10cSrcweir             }
551cdf0e10cSrcweir         }
552cdf0e10cSrcweir     }
553cdf0e10cSrcweir 
554cdf0e10cSrcweir     //---------------------------------------------------------------------
exportCommonControlAttributes()555cdf0e10cSrcweir 	void OControlExport::exportCommonControlAttributes()
556cdf0e10cSrcweir 	{
557cdf0e10cSrcweir 		size_t i=0;
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 		// I decided to handle all the properties here with some static arrays describing the property-attribute
560cdf0e10cSrcweir 		// relations. This leads to somewhat ugly code :), but the only alternative I can think of right now
561cdf0e10cSrcweir 		// would require maps and O(log n) searches, which seems somewhat expensive as this code is used
562cdf0e10cSrcweir 		// very frequently.
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 		// the extra indents for the respective blocks are to ensure that there is no copy'n'paste error, using
565cdf0e10cSrcweir 		// map identifiers from the wrong block
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 		// --------------------------------------------------------------------
568cdf0e10cSrcweir 		// some string properties
569cdf0e10cSrcweir 		{
570cdf0e10cSrcweir 			// the attribute ids of all properties which are expected to be of type string
571cdf0e10cSrcweir 			static sal_Int32 nStringPropertyAttributeIds[] =
572cdf0e10cSrcweir 			{
573cdf0e10cSrcweir 				CCA_LABEL, CCA_TITLE
574cdf0e10cSrcweir 			};
575cdf0e10cSrcweir 			// the names of all properties which are expected to be of type string
576cdf0e10cSrcweir 			static ::rtl::OUString aStringPropertyNames[] =
577cdf0e10cSrcweir 			{
578cdf0e10cSrcweir 				PROPERTY_LABEL, PROPERTY_TITLE
579cdf0e10cSrcweir 			};
580cdf0e10cSrcweir 			OSL_ENSURE(	sizeof(aStringPropertyNames)/sizeof(aStringPropertyNames[0]) ==
581cdf0e10cSrcweir 						sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]),
582cdf0e10cSrcweir 						"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (1)!");
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 			for (i=0; i<sizeof(nStringPropertyAttributeIds)/sizeof(nStringPropertyAttributeIds[0]); ++i)
585cdf0e10cSrcweir 				if (nStringPropertyAttributeIds[i] & m_nIncludeCommon)
586cdf0e10cSrcweir 				{
587cdf0e10cSrcweir 					exportStringPropertyAttribute(
588cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeNamespace(nStringPropertyAttributeIds[i]),
589cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeName(nStringPropertyAttributeIds[i]),
590cdf0e10cSrcweir 						aStringPropertyNames[i]
591cdf0e10cSrcweir 						);
592cdf0e10cSrcweir 				#if OSL_DEBUG_LEVEL > 0
593cdf0e10cSrcweir 					//  reset the bit for later checking
594cdf0e10cSrcweir 					m_nIncludeCommon = m_nIncludeCommon & ~nStringPropertyAttributeIds[i];
595cdf0e10cSrcweir 				#endif
596cdf0e10cSrcweir 				}
597cdf0e10cSrcweir 		}
598cdf0e10cSrcweir 
599cdf0e10cSrcweir 		// --------------------------------------------------------------------
600cdf0e10cSrcweir 		// some boolean properties
601cdf0e10cSrcweir 		{
602cdf0e10cSrcweir 			static sal_Int32 nBooleanPropertyAttributeIds[] =
603cdf0e10cSrcweir 			{	// attribute flags
604cdf0e10cSrcweir 				CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP, CCA_ENABLEVISIBLE
605cdf0e10cSrcweir 			};
606cdf0e10cSrcweir 			static const ::rtl::OUString* pBooleanPropertyNames[] =
607cdf0e10cSrcweir 			{	// property names
608cdf0e10cSrcweir 				&PROPERTY_STATE, &PROPERTY_ENABLED, &PROPERTY_DROPDOWN, &PROPERTY_PRINTABLE, &PROPERTY_READONLY, &PROPERTY_DEFAULT_STATE, &PROPERTY_TABSTOP, &PROPERTY_ENABLEVISIBLE
609cdf0e10cSrcweir 			};
610cdf0e10cSrcweir 			static sal_Bool nBooleanPropertyAttrFlags[] =
611cdf0e10cSrcweir 			{	// attribute defaults
612cdf0e10cSrcweir 				BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE | BOOLATTR_INVERSE_SEMANTICS, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_VOID, BOOLATTR_DEFAULT_FALSE
613cdf0e10cSrcweir 			};
614cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
615cdf0e10cSrcweir 			sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
616cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
617cdf0e10cSrcweir 			sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
618cdf0e10cSrcweir 			OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
619cdf0e10cSrcweir 				"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (2)!");
620cdf0e10cSrcweir 		#endif
621cdf0e10cSrcweir 			for (i=0; i<sizeof(nBooleanPropertyAttributeIds)/sizeof(nBooleanPropertyAttributeIds[0]); ++i)
622cdf0e10cSrcweir 				if (nBooleanPropertyAttributeIds[i] & m_nIncludeCommon)
623cdf0e10cSrcweir 				{
624cdf0e10cSrcweir 					exportBooleanPropertyAttribute(
625cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeNamespace(nBooleanPropertyAttributeIds[i]),
626cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeName(nBooleanPropertyAttributeIds[i]),
627cdf0e10cSrcweir 						*(pBooleanPropertyNames[i]),
628cdf0e10cSrcweir 						nBooleanPropertyAttrFlags[i]);
629cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
630cdf0e10cSrcweir 					//  reset the bit for later checking
631cdf0e10cSrcweir 					m_nIncludeCommon = m_nIncludeCommon & ~nBooleanPropertyAttributeIds[i];
632cdf0e10cSrcweir 		#endif
633cdf0e10cSrcweir 				}
634cdf0e10cSrcweir 		}
635cdf0e10cSrcweir 
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 		// --------------------------------------------------------------------
638cdf0e10cSrcweir 		// some integer properties
639cdf0e10cSrcweir 		{
640cdf0e10cSrcweir 			// now the common handling
641cdf0e10cSrcweir 			static sal_Int32 nIntegerPropertyAttributeIds[] =
642cdf0e10cSrcweir 			{	// attribute flags
643cdf0e10cSrcweir 				CCA_SIZE, CCA_TAB_INDEX
644cdf0e10cSrcweir 			};
645cdf0e10cSrcweir 			static const ::rtl::OUString* pIntegerPropertyNames[] =
646cdf0e10cSrcweir 			{	// property names
647cdf0e10cSrcweir 				&PROPERTY_LINECOUNT, &PROPERTY_TABINDEX
648cdf0e10cSrcweir 			};
649cdf0e10cSrcweir 			static const sal_Int16 nIntegerPropertyAttrDefaults[] =
650cdf0e10cSrcweir 			{	// attribute defaults
651cdf0e10cSrcweir 				5, 0
652cdf0e10cSrcweir 			};
653cdf0e10cSrcweir 
654cdf0e10cSrcweir 			if ( m_nIncludeCommon & CCA_MAX_LENGTH )
655cdf0e10cSrcweir 				exportedProperty(PROPERTY_MAXTEXTLENGTH);
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
658cdf0e10cSrcweir 			sal_Int32 nIdCount = sizeof(nIntegerPropertyAttributeIds) / sizeof(nIntegerPropertyAttributeIds[0]);
659cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof(pIntegerPropertyNames) / sizeof(pIntegerPropertyNames[0]);
660cdf0e10cSrcweir 			sal_Int32 nDefaultCount = sizeof(nIntegerPropertyAttrDefaults) / sizeof(nIntegerPropertyAttrDefaults[0]);
661cdf0e10cSrcweir 			OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount),
662cdf0e10cSrcweir 				"OControlExport::exportCommonControlAttributes: somebody tampered with the maps (3)!");
663cdf0e10cSrcweir 		#endif
664cdf0e10cSrcweir 			for (i=0; i<sizeof(nIntegerPropertyAttributeIds)/sizeof(nIntegerPropertyAttributeIds[0]); ++i)
665cdf0e10cSrcweir 				if (nIntegerPropertyAttributeIds[i] & m_nIncludeCommon)
666cdf0e10cSrcweir 				{
667cdf0e10cSrcweir 					exportInt16PropertyAttribute(
668cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeNamespace(nIntegerPropertyAttributeIds[i]),
669cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeName(nIntegerPropertyAttributeIds[i]),
670cdf0e10cSrcweir 						*(pIntegerPropertyNames[i]),
671cdf0e10cSrcweir 						nIntegerPropertyAttrDefaults[i]);
672cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
673cdf0e10cSrcweir 					//  reset the bit for later checking
674cdf0e10cSrcweir 					m_nIncludeCommon = m_nIncludeCommon & ~nIntegerPropertyAttributeIds[i];
675cdf0e10cSrcweir 		#endif
676cdf0e10cSrcweir 				}
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 
679cdf0e10cSrcweir 		}
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 		// --------------------------------------------------------------------
682cdf0e10cSrcweir 		// some enum properties
683cdf0e10cSrcweir 		{
684cdf0e10cSrcweir 			if (m_nIncludeCommon & CCA_BUTTON_TYPE)
685cdf0e10cSrcweir 			{
686cdf0e10cSrcweir 				exportEnumPropertyAttribute(
687cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_BUTTON_TYPE),
688cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_BUTTON_TYPE),
689cdf0e10cSrcweir 					PROPERTY_BUTTONTYPE,
690cdf0e10cSrcweir 					OEnumMapper::getEnumMap(OEnumMapper::epButtonType),
691cdf0e10cSrcweir 					FormButtonType_PUSH);
692cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
693cdf0e10cSrcweir 				//  reset the bit for later checking
694cdf0e10cSrcweir 				m_nIncludeCommon = m_nIncludeCommon & ~CCA_BUTTON_TYPE;
695cdf0e10cSrcweir 		#endif
696cdf0e10cSrcweir 			}
697cdf0e10cSrcweir 			if ( m_nIncludeCommon & CCA_ORIENTATION )
698cdf0e10cSrcweir 			{
699cdf0e10cSrcweir 				exportEnumPropertyAttribute(
700cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace( CCA_ORIENTATION ),
701cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName( CCA_ORIENTATION ),
702cdf0e10cSrcweir 					PROPERTY_ORIENTATION,
703cdf0e10cSrcweir 					OEnumMapper::getEnumMap( OEnumMapper::epOrientation ),
704cdf0e10cSrcweir                     ScrollBarOrientation::HORIZONTAL
705cdf0e10cSrcweir                 );
706cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
707cdf0e10cSrcweir 				//  reset the bit for later checking
708cdf0e10cSrcweir 				m_nIncludeCommon = m_nIncludeCommon & ~CCA_ORIENTATION;
709cdf0e10cSrcweir 		#endif
710cdf0e10cSrcweir 			}
711cdf0e10cSrcweir 
712cdf0e10cSrcweir             if ( m_nIncludeCommon & CCA_VISUAL_EFFECT )
713cdf0e10cSrcweir             {
714cdf0e10cSrcweir 				exportEnumPropertyAttribute(
715cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace( CCA_VISUAL_EFFECT ),
716cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName( CCA_VISUAL_EFFECT ),
717cdf0e10cSrcweir 					PROPERTY_VISUAL_EFFECT,
718cdf0e10cSrcweir 					OEnumMapper::getEnumMap( OEnumMapper::epVisualEffect ),
719cdf0e10cSrcweir                     VisualEffect::LOOK3D
720cdf0e10cSrcweir                 );
721cdf0e10cSrcweir 			#if OSL_DEBUG_LEVEL > 0
722cdf0e10cSrcweir 				//  reset the bit for later checking
723cdf0e10cSrcweir 				m_nIncludeCommon = m_nIncludeCommon & ~CCA_VISUAL_EFFECT;
724cdf0e10cSrcweir 			#endif
725cdf0e10cSrcweir             }
726cdf0e10cSrcweir 		}
727cdf0e10cSrcweir 
728cdf0e10cSrcweir 		// --------------------------------------------------------------------
729cdf0e10cSrcweir 		// some properties which require a special handling
730cdf0e10cSrcweir 
731cdf0e10cSrcweir 		// the target frame
732cdf0e10cSrcweir 		if (m_nIncludeCommon & CCA_TARGET_FRAME)
733cdf0e10cSrcweir 		{
734cdf0e10cSrcweir 			exportTargetFrameAttribute();
735cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
736cdf0e10cSrcweir 			//  reset the bit for later checking
737cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_FRAME;
738cdf0e10cSrcweir 		#endif
739cdf0e10cSrcweir 		}
740cdf0e10cSrcweir 
741cdf0e10cSrcweir 		// max text length
742cdf0e10cSrcweir 		if ( m_nIncludeCommon & CCA_MAX_LENGTH )
743cdf0e10cSrcweir 		{
744cdf0e10cSrcweir 			// normally, the respective property would be "MaxTextLen"
745cdf0e10cSrcweir 			// However, if the model has a property "PersistenceMaxTextLength", then we prefer this
746cdf0e10cSrcweir 
747cdf0e10cSrcweir 			// determine the name of the property to export
748cdf0e10cSrcweir 			::rtl::OUString sTextLenPropertyName( PROPERTY_MAXTEXTLENGTH );
749cdf0e10cSrcweir 			if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_PERSISTENCE_MAXTEXTLENGTH ) )
750cdf0e10cSrcweir 				sTextLenPropertyName = PROPERTY_PERSISTENCE_MAXTEXTLENGTH;
751cdf0e10cSrcweir 
752cdf0e10cSrcweir 			// export it
753cdf0e10cSrcweir 			exportInt16PropertyAttribute(
754cdf0e10cSrcweir 				OAttributeMetaData::getCommonControlAttributeNamespace( CCA_MAX_LENGTH ),
755cdf0e10cSrcweir 				OAttributeMetaData::getCommonControlAttributeName( CCA_MAX_LENGTH ),
756cdf0e10cSrcweir 				sTextLenPropertyName,
757cdf0e10cSrcweir 				0
758cdf0e10cSrcweir 			);
759cdf0e10cSrcweir 
760cdf0e10cSrcweir 			// in either way, both properties count as "exported"
761cdf0e10cSrcweir 			exportedProperty( PROPERTY_MAXTEXTLENGTH );
762cdf0e10cSrcweir 			exportedProperty( PROPERTY_PERSISTENCE_MAXTEXTLENGTH );
763cdf0e10cSrcweir 
764cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
765cdf0e10cSrcweir 			//  reset the bit for later checking
766cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_MAX_LENGTH;
767cdf0e10cSrcweir 		#endif
768cdf0e10cSrcweir 		}
769cdf0e10cSrcweir 
770cdf0e10cSrcweir 		if (m_nIncludeCommon & CCA_TARGET_LOCATION)
771cdf0e10cSrcweir 		{
772cdf0e10cSrcweir 			exportTargetLocationAttribute(false);
773cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
774cdf0e10cSrcweir 			//  reset the bit for later checking
775cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_TARGET_LOCATION;
776cdf0e10cSrcweir 		#endif
777cdf0e10cSrcweir 		}
778cdf0e10cSrcweir 
779cdf0e10cSrcweir 		// OJ #99721#
780cdf0e10cSrcweir 		if (m_nIncludeCommon & CCA_IMAGE_DATA)
781cdf0e10cSrcweir 		{
782cdf0e10cSrcweir 			exportImageDataAttribute();
783cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
784cdf0e10cSrcweir 			//  reset the bit for later checking
785cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_IMAGE_DATA;
786cdf0e10cSrcweir 		#endif
787cdf0e10cSrcweir 		}
788cdf0e10cSrcweir 
789cdf0e10cSrcweir 		// the for attribute
790cdf0e10cSrcweir 		// the target frame
791cdf0e10cSrcweir 		if (m_nIncludeCommon & CCA_FOR)
792cdf0e10cSrcweir 		{
793cdf0e10cSrcweir 			if (m_sReferringControls.getLength())
794cdf0e10cSrcweir 			{	// there is at least one control referring to the one we're handling currently
795cdf0e10cSrcweir 				AddAttribute(
796cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_FOR),
797cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_FOR),
798cdf0e10cSrcweir 					m_sReferringControls);
799cdf0e10cSrcweir 			}
800cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
801cdf0e10cSrcweir 			//  reset the bit for later checking
802cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~CCA_FOR;
803cdf0e10cSrcweir 		#endif
804cdf0e10cSrcweir 		}
805cdf0e10cSrcweir 
806cdf0e10cSrcweir 		if ((CCA_CURRENT_VALUE | CCA_VALUE) & m_nIncludeCommon)
807cdf0e10cSrcweir 		{
808cdf0e10cSrcweir 			const sal_Char* pCurrentValuePropertyName = NULL;
809cdf0e10cSrcweir 			const sal_Char* pValuePropertyName = NULL;
810cdf0e10cSrcweir 
811cdf0e10cSrcweir 			// get the property names
812cdf0e10cSrcweir 			getValuePropertyNames(m_eType, m_nClassId, pCurrentValuePropertyName, pValuePropertyName);
813cdf0e10cSrcweir 
814cdf0e10cSrcweir 			static const sal_Char* pCurrentValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_VALUE);
815cdf0e10cSrcweir 			static const sal_Char* pValueAttributeName = OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE);
816cdf0e10cSrcweir 			static const sal_uInt16 nCurrentValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_VALUE);
817cdf0e10cSrcweir 			static const sal_uInt16 nValueAttributeNamespaceKey = OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE);
818cdf0e10cSrcweir 
819cdf0e10cSrcweir 			// add the atrtributes if necessary and possible
820cdf0e10cSrcweir 			if (pCurrentValuePropertyName && (CCA_CURRENT_VALUE & m_nIncludeCommon))
821cdf0e10cSrcweir             {
822cdf0e10cSrcweir                 // don't export the current-value if this value originates from a data binding
823cdf0e10cSrcweir                 // #i26944# - 2004-05-17 - fs@openoffice.org
824cdf0e10cSrcweir                 if ( controlHasActiveDataBinding() )
825cdf0e10cSrcweir                     exportedProperty( ::rtl::OUString::createFromAscii( pCurrentValuePropertyName ) );
826cdf0e10cSrcweir                 else
827cdf0e10cSrcweir 				    exportGenericPropertyAttribute(
828cdf0e10cSrcweir 					    nCurrentValueAttributeNamespaceKey,
829cdf0e10cSrcweir 					    pCurrentValueAttributeName,
830cdf0e10cSrcweir 					    pCurrentValuePropertyName
831cdf0e10cSrcweir                     );
832cdf0e10cSrcweir             }
833cdf0e10cSrcweir 
834cdf0e10cSrcweir 			if (pValuePropertyName && (CCA_VALUE & m_nIncludeCommon))
835cdf0e10cSrcweir 				exportGenericPropertyAttribute(
836cdf0e10cSrcweir 					nValueAttributeNamespaceKey,
837cdf0e10cSrcweir 					pValueAttributeName,
838cdf0e10cSrcweir 					pValuePropertyName);
839cdf0e10cSrcweir 
840cdf0e10cSrcweir 			OSL_ENSURE((NULL == pValuePropertyName) == (0 == (CCA_VALUE & m_nIncludeCommon)),
841cdf0e10cSrcweir 				"OControlExport::exportCommonControlAttributes: no property found for the value attribute!");
842cdf0e10cSrcweir 			OSL_ENSURE((NULL == pCurrentValuePropertyName ) == (0 == (CCA_CURRENT_VALUE & m_nIncludeCommon)),
843cdf0e10cSrcweir 				"OControlExport::exportCommonControlAttributes: no property found for the current-value attribute!");
844cdf0e10cSrcweir 
845cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
846cdf0e10cSrcweir 			//  reset the bit for later checking
847cdf0e10cSrcweir 			m_nIncludeCommon = m_nIncludeCommon & ~(CCA_CURRENT_VALUE | CCA_VALUE);
848cdf0e10cSrcweir 		#endif
849cdf0e10cSrcweir 		}
850cdf0e10cSrcweir 
851cdf0e10cSrcweir 		OSL_ENSURE(0 == m_nIncludeCommon,
852cdf0e10cSrcweir 			"OControlExport::exportCommonControlAttributes: forgot some flags!");
853cdf0e10cSrcweir 			// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
854cdf0e10cSrcweir 			// be 0 now ...
855cdf0e10cSrcweir 	}
856cdf0e10cSrcweir 
857cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportDatabaseAttributes()858cdf0e10cSrcweir 	void OControlExport::exportDatabaseAttributes()
859cdf0e10cSrcweir 	{
860cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
861cdf0e10cSrcweir 		sal_Int32 nIncludeDatabase = m_nIncludeDatabase;
862cdf0e10cSrcweir #endif
863cdf0e10cSrcweir 		// the only string property: DataField
864cdf0e10cSrcweir 		if (DA_DATA_FIELD & m_nIncludeDatabase)
865cdf0e10cSrcweir 		{
866cdf0e10cSrcweir 			exportStringPropertyAttribute(
867cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeNamespace(DA_DATA_FIELD),
868cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeName(DA_DATA_FIELD),
869cdf0e10cSrcweir 				PROPERTY_DATAFIELD);
870cdf0e10cSrcweir             RESET_BIT( nIncludeDatabase, DA_DATA_FIELD );
871cdf0e10cSrcweir 		}
872cdf0e10cSrcweir 
873cdf0e10cSrcweir         // InputRequired
874cdf0e10cSrcweir         if ( DA_INPUT_REQUIRED & m_nIncludeDatabase )
875cdf0e10cSrcweir         {
876cdf0e10cSrcweir             exportBooleanPropertyAttribute(
877cdf0e10cSrcweir                 OAttributeMetaData::getDatabaseAttributeNamespace( DA_INPUT_REQUIRED ),
878cdf0e10cSrcweir                 OAttributeMetaData::getDatabaseAttributeName( DA_INPUT_REQUIRED ),
879cdf0e10cSrcweir                 PROPERTY_INPUT_REQUIRED,
880cdf0e10cSrcweir                 BOOLATTR_DEFAULT_TRUE
881cdf0e10cSrcweir             );
882cdf0e10cSrcweir             RESET_BIT( nIncludeDatabase, DA_INPUT_REQUIRED );
883cdf0e10cSrcweir         }
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 		// the only int16 property: BoundColumn
886cdf0e10cSrcweir 		if (DA_BOUND_COLUMN & m_nIncludeDatabase)
887cdf0e10cSrcweir 		{
888cdf0e10cSrcweir 			exportInt16PropertyAttribute(
889cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeNamespace(DA_BOUND_COLUMN),
890cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeName(DA_BOUND_COLUMN),
891cdf0e10cSrcweir 				PROPERTY_BOUNDCOLUMN,
892cdf0e10cSrcweir 				0);
893cdf0e10cSrcweir             RESET_BIT( nIncludeDatabase, DA_BOUND_COLUMN );
894cdf0e10cSrcweir 		}
895cdf0e10cSrcweir 
896cdf0e10cSrcweir 		// ConvertEmptyToNull
897cdf0e10cSrcweir 		if (DA_CONVERT_EMPTY & m_nIncludeDatabase)
898cdf0e10cSrcweir 		{
899cdf0e10cSrcweir 			exportBooleanPropertyAttribute(
900cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeNamespace(DA_CONVERT_EMPTY),
901cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeName(DA_CONVERT_EMPTY),
902cdf0e10cSrcweir 				PROPERTY_EMPTY_IS_NULL,
903cdf0e10cSrcweir 				BOOLATTR_DEFAULT_FALSE
904cdf0e10cSrcweir 				);
905cdf0e10cSrcweir             RESET_BIT( nIncludeDatabase, DA_CONVERT_EMPTY );
906cdf0e10cSrcweir 		}
907cdf0e10cSrcweir 
908cdf0e10cSrcweir 		// the only enum property: ListSourceType
909cdf0e10cSrcweir 		if (DA_LIST_SOURCE_TYPE & m_nIncludeDatabase)
910cdf0e10cSrcweir 		{
911cdf0e10cSrcweir 			exportEnumPropertyAttribute(
912cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeNamespace(DA_LIST_SOURCE_TYPE),
913cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE_TYPE),
914cdf0e10cSrcweir 				PROPERTY_LISTSOURCETYPE,
915cdf0e10cSrcweir 				OEnumMapper::getEnumMap(OEnumMapper::epListSourceType),
916cdf0e10cSrcweir 				ListSourceType_VALUELIST
917cdf0e10cSrcweir 				);
918cdf0e10cSrcweir             RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE_TYPE );
919cdf0e10cSrcweir 		}
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 		if (m_nIncludeDatabase & DA_LIST_SOURCE)
922cdf0e10cSrcweir 		{
923cdf0e10cSrcweir 			exportListSourceAsAttribute();
924cdf0e10cSrcweir             RESET_BIT( nIncludeDatabase, DA_LIST_SOURCE );
925cdf0e10cSrcweir 		}
926cdf0e10cSrcweir 
927cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
928cdf0e10cSrcweir 		OSL_ENSURE(0 == nIncludeDatabase,
929cdf0e10cSrcweir 			"OControlExport::exportDatabaseAttributes: forgot some flags!");
930cdf0e10cSrcweir 			// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
931cdf0e10cSrcweir 			// be 0 now ...
932cdf0e10cSrcweir #endif
933cdf0e10cSrcweir 	}
934cdf0e10cSrcweir 
935cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportBindingAtributes()936cdf0e10cSrcweir 	void OControlExport::exportBindingAtributes()
937cdf0e10cSrcweir     {
938cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
939cdf0e10cSrcweir 		sal_Int32 nIncludeBinding = m_nIncludeBindings;
940cdf0e10cSrcweir #endif
941cdf0e10cSrcweir 
942cdf0e10cSrcweir         // ....................................................
943cdf0e10cSrcweir         if ( m_nIncludeBindings & BA_LINKED_CELL )
944cdf0e10cSrcweir         {
945cdf0e10cSrcweir             exportCellBindingAttributes( ( m_nIncludeBindings & BA_LIST_LINKING_TYPE ) != 0 );
946cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
947cdf0e10cSrcweir 			//  reset the bit for later checking
948cdf0e10cSrcweir 			nIncludeBinding = nIncludeBinding & ~( BA_LINKED_CELL | BA_LIST_LINKING_TYPE );
949cdf0e10cSrcweir 		#endif
950cdf0e10cSrcweir         }
951cdf0e10cSrcweir 
952cdf0e10cSrcweir         // ....................................................
953cdf0e10cSrcweir         if ( m_nIncludeBindings & BA_LIST_CELL_RANGE )
954cdf0e10cSrcweir         {
955cdf0e10cSrcweir             exportCellListSourceRange();
956cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
957cdf0e10cSrcweir 			//  reset the bit for later checking
958cdf0e10cSrcweir 			nIncludeBinding = nIncludeBinding & ~BA_LIST_CELL_RANGE;
959cdf0e10cSrcweir 		#endif
960cdf0e10cSrcweir         }
961cdf0e10cSrcweir 
962cdf0e10cSrcweir         if ( m_nIncludeBindings & BA_XFORMS_BIND )
963cdf0e10cSrcweir         {
964cdf0e10cSrcweir             exportXFormsBindAttributes();
965cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
966cdf0e10cSrcweir 			//  reset the bit for later checking
967cdf0e10cSrcweir 			nIncludeBinding = nIncludeBinding & ~BA_XFORMS_BIND;
968cdf0e10cSrcweir 		#endif
969cdf0e10cSrcweir         }
970cdf0e10cSrcweir 
971cdf0e10cSrcweir         if ( m_nIncludeBindings & BA_XFORMS_LISTBIND )
972cdf0e10cSrcweir         {
973cdf0e10cSrcweir             exportXFormsListAttributes();
974cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
975cdf0e10cSrcweir 			//  reset the bit for later checking
976cdf0e10cSrcweir 			nIncludeBinding = nIncludeBinding & ~BA_XFORMS_LISTBIND;
977cdf0e10cSrcweir 		#endif
978cdf0e10cSrcweir         }
979cdf0e10cSrcweir 
980cdf0e10cSrcweir         if ( m_nIncludeBindings & BA_XFORMS_SUBMISSION )
981cdf0e10cSrcweir         {
982cdf0e10cSrcweir             exportXFormsSubmissionAttributes();
983cdf0e10cSrcweir         #if OSL_DEBUG_LEVEL > 0
984cdf0e10cSrcweir 			//  reset the bit for later checking
985cdf0e10cSrcweir 			nIncludeBinding = nIncludeBinding & ~BA_XFORMS_SUBMISSION;
986cdf0e10cSrcweir 		#endif
987cdf0e10cSrcweir         }
988cdf0e10cSrcweir 
989cdf0e10cSrcweir         OSL_ENSURE( 0 == nIncludeBinding,
990cdf0e10cSrcweir 			"OControlExport::exportBindingAtributes: forgot some flags!");
991cdf0e10cSrcweir 			// in the debug version, we should have removed every bit we handled from the mask, so it should
992cdf0e10cSrcweir 			// be 0 now ...
993cdf0e10cSrcweir     }
994cdf0e10cSrcweir 
995cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportSpecialAttributes()996cdf0e10cSrcweir 	void OControlExport::exportSpecialAttributes()
997cdf0e10cSrcweir 	{
998cdf0e10cSrcweir 		sal_Int32 i=0;
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir 		// ----------------------
1001cdf0e10cSrcweir 		// the boolean properties
1002cdf0e10cSrcweir 		{
1003cdf0e10cSrcweir 			static const sal_Int32 nBooleanPropertyAttributeIds[] =
1004cdf0e10cSrcweir 			{	// attribute flags
1005cdf0e10cSrcweir 				SCA_VALIDATION, SCA_MULTI_LINE, SCA_AUTOMATIC_COMPLETION, SCA_MULTIPLE, SCA_DEFAULT_BUTTON, SCA_IS_TRISTATE,
1006cdf0e10cSrcweir                 SCA_TOGGLE, SCA_FOCUS_ON_CLICK
1007cdf0e10cSrcweir 			};
1008cdf0e10cSrcweir 			static const ::rtl::OUString* pBooleanPropertyNames[] =
1009cdf0e10cSrcweir 			{	// property names
1010cdf0e10cSrcweir 				&PROPERTY_STRICTFORMAT, &PROPERTY_MULTILINE, &PROPERTY_AUTOCOMPLETE, &PROPERTY_MULTISELECTION, &PROPERTY_DEFAULTBUTTON, &PROPERTY_TRISTATE,
1011cdf0e10cSrcweir                 &PROPERTY_TOGGLE, &PROPERTY_FOCUS_ON_CLICK
1012cdf0e10cSrcweir 			};
1013cdf0e10cSrcweir 			sal_Int32 nIdCount = sizeof(nBooleanPropertyAttributeIds) / sizeof(nBooleanPropertyAttributeIds[0]);
1014cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
1015cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
1016cdf0e10cSrcweir 			OSL_ENSURE((nIdCount == nNameCount),
1017cdf0e10cSrcweir 				"OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!");
1018cdf0e10cSrcweir 		#endif
1019cdf0e10cSrcweir             const sal_Int32* pAttributeId = nBooleanPropertyAttributeIds;
1020cdf0e10cSrcweir             const ::rtl::OUString** pPropertyName = pBooleanPropertyNames;
1021cdf0e10cSrcweir 			for ( i = 0; i < nIdCount; ++i, ++pAttributeId, ++pPropertyName )
1022cdf0e10cSrcweir             {
1023cdf0e10cSrcweir 				if ( *pAttributeId& m_nIncludeSpecial)
1024cdf0e10cSrcweir 				{
1025cdf0e10cSrcweir 					exportBooleanPropertyAttribute(
1026cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeNamespace( *pAttributeId ),
1027cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeName( *pAttributeId ),
1028cdf0e10cSrcweir 						*(*pPropertyName),
1029cdf0e10cSrcweir                         ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BOOLATTR_DEFAULT_TRUE : BOOLATTR_DEFAULT_FALSE
1030cdf0e10cSrcweir 					);
1031cdf0e10cSrcweir 			#if OSL_DEBUG_LEVEL > 0
1032cdf0e10cSrcweir 				//  reset the bit for later checking
1033cdf0e10cSrcweir 				m_nIncludeSpecial = m_nIncludeSpecial & ~*pAttributeId;
1034cdf0e10cSrcweir 			#endif
1035cdf0e10cSrcweir 				}
1036cdf0e10cSrcweir             }
1037cdf0e10cSrcweir 		}
1038cdf0e10cSrcweir 
1039cdf0e10cSrcweir 		// ----------------------
1040cdf0e10cSrcweir 		// the integer properties
1041cdf0e10cSrcweir 		{
1042cdf0e10cSrcweir 			static sal_Int32 nIntegerPropertyAttributeIds[] =
1043cdf0e10cSrcweir 			{	// attribute flags
1044cdf0e10cSrcweir 				SCA_PAGE_STEP_SIZE
1045cdf0e10cSrcweir 			};
1046cdf0e10cSrcweir 			static const ::rtl::OUString* pIntegerPropertyNames[] =
1047cdf0e10cSrcweir 			{	// property names
1048cdf0e10cSrcweir                 &PROPERTY_BLOCK_INCREMENT
1049cdf0e10cSrcweir 			};
1050cdf0e10cSrcweir 			static const sal_Int32 nIntegerPropertyAttrDefaults[] =
1051cdf0e10cSrcweir 			{	// attribute defaults (XML defaults, not runtime defaults!)
1052cdf0e10cSrcweir 				10
1053cdf0e10cSrcweir 			};
1054cdf0e10cSrcweir 
1055cdf0e10cSrcweir             sal_Int32 nIdCount = sizeof( nIntegerPropertyAttributeIds ) / sizeof( nIntegerPropertyAttributeIds[0] );
1056cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
1057cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof( pIntegerPropertyNames ) / sizeof( pIntegerPropertyNames[0] );
1058cdf0e10cSrcweir 			OSL_ENSURE( ( nIdCount == nNameCount ),
1059cdf0e10cSrcweir 				"OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
1060cdf0e10cSrcweir             sal_Int32 nDefaultCount = sizeof( nIntegerPropertyAttrDefaults ) / sizeof( nIntegerPropertyAttrDefaults[0] );
1061cdf0e10cSrcweir 			OSL_ENSURE( ( nIdCount == nDefaultCount ),
1062cdf0e10cSrcweir 				"OControlExport::exportSpecialAttributes: somebody tampered with the maps (3)!" );
1063cdf0e10cSrcweir 		#endif
1064cdf0e10cSrcweir 			for ( i = 0; i < nIdCount; ++i )
1065cdf0e10cSrcweir 				if ( nIntegerPropertyAttributeIds[i] & m_nIncludeSpecial )
1066cdf0e10cSrcweir 				{
1067cdf0e10cSrcweir 					exportInt32PropertyAttribute(
1068cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeNamespace( nIntegerPropertyAttributeIds[i] ),
1069cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeName( nIntegerPropertyAttributeIds[i] ),
1070cdf0e10cSrcweir 						*( pIntegerPropertyNames[i] ),
1071cdf0e10cSrcweir 						nIntegerPropertyAttrDefaults[i]
1072cdf0e10cSrcweir 					);
1073cdf0e10cSrcweir 			#if OSL_DEBUG_LEVEL > 0
1074cdf0e10cSrcweir 				//  reset the bit for later checking
1075cdf0e10cSrcweir 				m_nIncludeSpecial = m_nIncludeSpecial & ~nIntegerPropertyAttributeIds[i];
1076cdf0e10cSrcweir 			#endif
1077cdf0e10cSrcweir 				}
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir             if ( SCA_STEP_SIZE & m_nIncludeSpecial )
1080cdf0e10cSrcweir             {
1081cdf0e10cSrcweir                 ::rtl::OUString sPropertyName;
1082cdf0e10cSrcweir                 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_LINE_INCREMENT ) )
1083cdf0e10cSrcweir                     sPropertyName = PROPERTY_LINE_INCREMENT;
1084cdf0e10cSrcweir                 else if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_SPIN_INCREMENT ) )
1085cdf0e10cSrcweir                     sPropertyName = PROPERTY_SPIN_INCREMENT;
1086cdf0e10cSrcweir                 else
1087cdf0e10cSrcweir                     OSL_ENSURE( sal_False, "OControlExport::exportSpecialAttributes: not property which can be mapped to step-size attribute!" );
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir                 if ( sPropertyName.getLength() )
1090cdf0e10cSrcweir 					exportInt32PropertyAttribute(
1091cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeNamespace( SCA_STEP_SIZE ),
1092cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeName( SCA_STEP_SIZE ),
1093cdf0e10cSrcweir 						sPropertyName,
1094cdf0e10cSrcweir 						1
1095cdf0e10cSrcweir 					);
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir             #if OSL_DEBUG_LEVEL > 0
1098cdf0e10cSrcweir 				//  reset the bit for later checking
1099cdf0e10cSrcweir 				m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STEP_SIZE;
1100cdf0e10cSrcweir 			#endif
1101cdf0e10cSrcweir             }
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir         }
1104cdf0e10cSrcweir 
1105cdf0e10cSrcweir 		// -------------------
1106cdf0e10cSrcweir 		// the enum properties
1107cdf0e10cSrcweir 		{
1108cdf0e10cSrcweir 			if (SCA_STATE & m_nIncludeSpecial)
1109cdf0e10cSrcweir 			{
1110cdf0e10cSrcweir 				exportEnumPropertyAttribute(
1111cdf0e10cSrcweir 					OAttributeMetaData::getSpecialAttributeNamespace(SCA_STATE),
1112cdf0e10cSrcweir 					OAttributeMetaData::getSpecialAttributeName(SCA_STATE),
1113cdf0e10cSrcweir 					PROPERTY_DEFAULT_STATE,
1114cdf0e10cSrcweir 					OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
1115cdf0e10cSrcweir 					STATE_NOCHECK);
1116cdf0e10cSrcweir 			#if OSL_DEBUG_LEVEL > 0
1117cdf0e10cSrcweir 				//  reset the bit for later checking
1118cdf0e10cSrcweir 				m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_STATE;
1119cdf0e10cSrcweir 			#endif
1120cdf0e10cSrcweir 			}
1121cdf0e10cSrcweir 
1122cdf0e10cSrcweir 			if (SCA_CURRENT_STATE & m_nIncludeSpecial)
1123cdf0e10cSrcweir 			{
1124cdf0e10cSrcweir 				exportEnumPropertyAttribute(
1125cdf0e10cSrcweir 					OAttributeMetaData::getSpecialAttributeNamespace(SCA_CURRENT_STATE),
1126cdf0e10cSrcweir 					OAttributeMetaData::getSpecialAttributeName(SCA_CURRENT_STATE),
1127cdf0e10cSrcweir 					PROPERTY_STATE,
1128cdf0e10cSrcweir 					OEnumMapper::getEnumMap(OEnumMapper::epCheckState),
1129cdf0e10cSrcweir 					STATE_NOCHECK);
1130cdf0e10cSrcweir 			#if OSL_DEBUG_LEVEL > 0
1131cdf0e10cSrcweir 				//  reset the bit for later checking
1132cdf0e10cSrcweir 				m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_CURRENT_STATE;
1133cdf0e10cSrcweir 			#endif
1134cdf0e10cSrcweir 			}
1135cdf0e10cSrcweir 		}
1136cdf0e10cSrcweir 
1137cdf0e10cSrcweir 		// --------------------------------------------------------------------
1138cdf0e10cSrcweir 		// some properties which require a special handling
1139cdf0e10cSrcweir         // the repeat delay
1140cdf0e10cSrcweir         {
1141cdf0e10cSrcweir 		    if ( m_nIncludeSpecial & SCA_REPEAT_DELAY )
1142cdf0e10cSrcweir 		    {
1143cdf0e10cSrcweir 		        DBG_CHECK_PROPERTY( PROPERTY_REPEAT_DELAY, sal_Int32 );
1144cdf0e10cSrcweir 
1145cdf0e10cSrcweir                 sal_Int32 nRepeatDelay = 0;
1146cdf0e10cSrcweir                 m_xProps->getPropertyValue( PROPERTY_REPEAT_DELAY ) >>= nRepeatDelay;
1147cdf0e10cSrcweir                 Time aTime;
1148cdf0e10cSrcweir                 aTime.MakeTimeFromMS( nRepeatDelay );
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir 			    AddAttribute(OAttributeMetaData::getSpecialAttributeNamespace( SCA_REPEAT_DELAY )
1151cdf0e10cSrcweir 						    ,OAttributeMetaData::getSpecialAttributeName( SCA_REPEAT_DELAY )
1152cdf0e10cSrcweir 						    ,SvXMLUnitConverter::convertTimeDuration( aTime, nRepeatDelay % 1000 ) );
1153cdf0e10cSrcweir 
1154cdf0e10cSrcweir 		        exportedProperty( PROPERTY_REPEAT_DELAY );
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir             #if OSL_DEBUG_LEVEL > 0
1157cdf0e10cSrcweir 			    //  reset the bit for later checking
1158cdf0e10cSrcweir 			    m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_REPEAT_DELAY;
1159cdf0e10cSrcweir 		    #endif
1160cdf0e10cSrcweir 		    }
1161cdf0e10cSrcweir         }
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir 		// ----------------------------------
1164cdf0e10cSrcweir 		// the EchoChar property needs special handling, cause it's a Int16, but must be stored as one-character-string
1165cdf0e10cSrcweir 		{
1166cdf0e10cSrcweir 			if (SCA_ECHO_CHAR & m_nIncludeSpecial)
1167cdf0e10cSrcweir 			{
1168cdf0e10cSrcweir 				DBG_CHECK_PROPERTY( PROPERTY_ECHO_CHAR, sal_Int16 );
1169cdf0e10cSrcweir 				sal_Int16 nValue(0);
1170cdf0e10cSrcweir 				m_xProps->getPropertyValue(PROPERTY_ECHO_CHAR) >>= nValue;
1171cdf0e10cSrcweir 				if (nValue)
1172cdf0e10cSrcweir 				{
1173cdf0e10cSrcweir 					::rtl::OUString sCharacter(reinterpret_cast<const sal_Unicode*>(&nValue), 1);
1174cdf0e10cSrcweir 					AddAttribute(
1175cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeNamespace(SCA_ECHO_CHAR),
1176cdf0e10cSrcweir 						OAttributeMetaData::getSpecialAttributeName(SCA_ECHO_CHAR),
1177cdf0e10cSrcweir 						sCharacter);
1178cdf0e10cSrcweir 				}
1179cdf0e10cSrcweir 				exportedProperty(PROPERTY_ECHO_CHAR);
1180cdf0e10cSrcweir 			#if OSL_DEBUG_LEVEL > 0
1181cdf0e10cSrcweir 				//  reset the bit for later checking
1182cdf0e10cSrcweir 				m_nIncludeSpecial = m_nIncludeSpecial & ~SCA_ECHO_CHAR;
1183cdf0e10cSrcweir 			#endif
1184cdf0e10cSrcweir 			}
1185cdf0e10cSrcweir 		}
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir 		// ----------------------------------
1188cdf0e10cSrcweir 		if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
1189cdf0e10cSrcweir 		{
1190cdf0e10cSrcweir 			// need to export the min value and the max value as attributes
1191cdf0e10cSrcweir 			// It depends on the real type (FormComponentType) of the control, which properties hold these
1192cdf0e10cSrcweir 			// values
1193cdf0e10cSrcweir 			const sal_Char* pMinValuePropertyName = NULL;
1194cdf0e10cSrcweir 			const sal_Char* pMaxValuePropertyName = NULL;
1195cdf0e10cSrcweir 			getValueLimitPropertyNames(m_nClassId, pMinValuePropertyName, pMaxValuePropertyName);
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir 			OSL_ENSURE((NULL == pMinValuePropertyName) == (0 == (SCA_MIN_VALUE & m_nIncludeSpecial)),
1198cdf0e10cSrcweir 				"OControlExport::exportCommonControlAttributes: no property found for the min value attribute!");
1199cdf0e10cSrcweir 			OSL_ENSURE((NULL == pMaxValuePropertyName) == (0 == (SCA_MAX_VALUE & m_nIncludeSpecial)),
1200cdf0e10cSrcweir 				"OControlExport::exportCommonControlAttributes: no property found for the max value attribute!");
1201cdf0e10cSrcweir 
1202cdf0e10cSrcweir 			// add the two attributes
1203cdf0e10cSrcweir 			static const sal_Char* pMinValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MIN_VALUE);
1204cdf0e10cSrcweir 			static const sal_Char* pMaxValueAttributeName = OAttributeMetaData::getSpecialAttributeName(SCA_MAX_VALUE);
1205cdf0e10cSrcweir 			static const sal_uInt16 nMinValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MIN_VALUE);
1206cdf0e10cSrcweir 			static const sal_uInt16 nMaxValueNamespaceKey = OAttributeMetaData::getSpecialAttributeNamespace(SCA_MAX_VALUE);
1207cdf0e10cSrcweir 
1208cdf0e10cSrcweir 			if (pMinValuePropertyName && (SCA_MIN_VALUE & m_nIncludeSpecial))
1209cdf0e10cSrcweir 				exportGenericPropertyAttribute(
1210cdf0e10cSrcweir 					nMinValueNamespaceKey,
1211cdf0e10cSrcweir 					pMinValueAttributeName,
1212cdf0e10cSrcweir 					pMinValuePropertyName);
1213cdf0e10cSrcweir 
1214cdf0e10cSrcweir 			if (pMaxValuePropertyName && (SCA_MAX_VALUE & m_nIncludeSpecial))
1215cdf0e10cSrcweir 				exportGenericPropertyAttribute(
1216cdf0e10cSrcweir 					nMaxValueNamespaceKey,
1217cdf0e10cSrcweir 					pMaxValueAttributeName,
1218cdf0e10cSrcweir 					pMaxValuePropertyName);
1219cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
1220cdf0e10cSrcweir 			//  reset the bit for later checking
1221cdf0e10cSrcweir 			m_nIncludeSpecial = m_nIncludeSpecial & ~(SCA_MIN_VALUE | SCA_MAX_VALUE);
1222cdf0e10cSrcweir 		#endif
1223cdf0e10cSrcweir 		}
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir 		// ----------------------------------
1226cdf0e10cSrcweir         if ( SCA_IMAGE_POSITION & m_nIncludeSpecial )
1227cdf0e10cSrcweir         {
1228cdf0e10cSrcweir             exportImagePositionAttributes();
1229cdf0e10cSrcweir             RESET_BIT( m_nIncludeSpecial, SCA_IMAGE_POSITION );
1230cdf0e10cSrcweir         }
1231cdf0e10cSrcweir 
1232cdf0e10cSrcweir 		OSL_ENSURE(0 == m_nIncludeSpecial,
1233cdf0e10cSrcweir 			"OControlExport::exportSpecialAttributes: forgot some flags!");
1234cdf0e10cSrcweir 			// in the dbg_util version, we should have removed every bit we handled from the mask, so it should
1235cdf0e10cSrcweir 			// be 0 now ...
1236cdf0e10cSrcweir 	}
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir 	//---------------------------------------------------------------------
getScalarListSourceValue() const1239cdf0e10cSrcweir     ::rtl::OUString OControlExport::getScalarListSourceValue() const
1240cdf0e10cSrcweir     {
1241cdf0e10cSrcweir 		::rtl::OUString sListSource;
1242cdf0e10cSrcweir 		Any aListSource = m_xProps->getPropertyValue( PROPERTY_LISTSOURCE );
1243cdf0e10cSrcweir 		if ( !( aListSource >>= sListSource ) )
1244cdf0e10cSrcweir 		{
1245cdf0e10cSrcweir 			Sequence< ::rtl::OUString > aListSourceSequence;
1246cdf0e10cSrcweir 			aListSource >>= aListSourceSequence;
1247cdf0e10cSrcweir 			if ( aListSourceSequence.getLength() )
1248cdf0e10cSrcweir 				sListSource = aListSourceSequence[ 0 ];
1249cdf0e10cSrcweir 		}
1250cdf0e10cSrcweir         return sListSource;
1251cdf0e10cSrcweir     }
1252cdf0e10cSrcweir 
1253cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportListSourceAsAttribute()1254cdf0e10cSrcweir 	void OControlExport::exportListSourceAsAttribute()
1255cdf0e10cSrcweir 	{
1256cdf0e10cSrcweir 		// DA_LIST_SOURCE needs some special handling
1257cdf0e10cSrcweir 		DBG_CHECK_PROPERTY_NO_TYPE( PROPERTY_LISTSOURCE );
1258cdf0e10cSrcweir 
1259cdf0e10cSrcweir         ::rtl::OUString sListSource = getScalarListSourceValue();
1260cdf0e10cSrcweir 		if ( sListSource.getLength() )
1261cdf0e10cSrcweir 		{	// the ListSource property needs to be exported as attribute, and it is not empty
1262cdf0e10cSrcweir 			AddAttribute(
1263cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeNamespace(DA_LIST_SOURCE),
1264cdf0e10cSrcweir 				OAttributeMetaData::getDatabaseAttributeName(DA_LIST_SOURCE),
1265cdf0e10cSrcweir 				sListSource);
1266cdf0e10cSrcweir 		}
1267cdf0e10cSrcweir 
1268cdf0e10cSrcweir         exportedProperty( PROPERTY_LISTSOURCE );
1269cdf0e10cSrcweir 	}
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir 	//---------------------------------------------------------------------
getSequenceInt16PropertyAsSet(const::rtl::OUString & _rPropertyName,Int16Set & _rOut)1272cdf0e10cSrcweir 	void OControlExport::getSequenceInt16PropertyAsSet(const ::rtl::OUString& _rPropertyName, Int16Set& _rOut)
1273cdf0e10cSrcweir 	{
1274cdf0e10cSrcweir 		Sequence< sal_Int16 > aValueSequence;
1275cdf0e10cSrcweir 		DBG_CHECK_PROPERTY(_rPropertyName, Sequence< sal_Int16 >);
1276cdf0e10cSrcweir 		m_xProps->getPropertyValue(_rPropertyName) >>= aValueSequence;
1277cdf0e10cSrcweir 
1278cdf0e10cSrcweir 		const sal_Int16* pValues = aValueSequence.getConstArray();
1279cdf0e10cSrcweir 		for (sal_Int32 i=0; i<aValueSequence.getLength(); ++i, ++pValues)
1280cdf0e10cSrcweir 			_rOut.insert(*pValues);
1281cdf0e10cSrcweir 	}
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportListSourceAsElements()1284cdf0e10cSrcweir 	void OControlExport::exportListSourceAsElements()
1285cdf0e10cSrcweir 	{
1286cdf0e10cSrcweir 		// the string lists
1287cdf0e10cSrcweir 		Sequence< ::rtl::OUString > aItems, aValues;
1288cdf0e10cSrcweir 		DBG_CHECK_PROPERTY( PROPERTY_STRING_ITEM_LIST, Sequence< ::rtl::OUString > );
1289cdf0e10cSrcweir 		m_xProps->getPropertyValue(PROPERTY_STRING_ITEM_LIST) >>= aItems;
1290cdf0e10cSrcweir 
1291cdf0e10cSrcweir 		DBG_CHECK_PROPERTY( PROPERTY_LISTSOURCE, Sequence< ::rtl::OUString > );
1292cdf0e10cSrcweir 		if ( 0 == ( m_nIncludeDatabase & DA_LIST_SOURCE ) )
1293cdf0e10cSrcweir 			m_xProps->getPropertyValue(PROPERTY_LISTSOURCE) >>= aValues;
1294cdf0e10cSrcweir 		// if we exported the list source as attribute, we do not repeat it as sub elements
1295cdf0e10cSrcweir 
1296cdf0e10cSrcweir 		// the selection lists
1297cdf0e10cSrcweir 		Int16Set aSelection, aDefaultSelection;
1298cdf0e10cSrcweir 		getSequenceInt16PropertyAsSet(PROPERTY_SELECT_SEQ, aSelection);
1299cdf0e10cSrcweir 		getSequenceInt16PropertyAsSet(PROPERTY_DEFAULT_SELECT_SEQ, aDefaultSelection);
1300cdf0e10cSrcweir 
1301cdf0e10cSrcweir 		// the string for "true"
1302cdf0e10cSrcweir 		::rtl::OUString sTrue;
1303cdf0e10cSrcweir 		::rtl::OUStringBuffer sBuffer;
1304cdf0e10cSrcweir 		m_rContext.getGlobalContext().GetMM100UnitConverter().convertBool(sBuffer, sal_True);
1305cdf0e10cSrcweir 		sTrue = sBuffer.makeStringAndClear();
1306cdf0e10cSrcweir 
1307cdf0e10cSrcweir 		// loop through both lists ('til the maximum of both lengths)
1308cdf0e10cSrcweir 		const ::rtl::OUString* pItems = aItems.getConstArray();
1309cdf0e10cSrcweir 		const ::rtl::OUString* pValues = aValues.getConstArray();
1310cdf0e10cSrcweir 
1311cdf0e10cSrcweir 		sal_Int32 nItems = aItems.getLength();
1312cdf0e10cSrcweir 		sal_Int32 nValues = aValues.getLength();
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir 		sal_Int16 nMaxLen = (sal_Int16)std::max(nItems, nValues);
1315cdf0e10cSrcweir 
1316cdf0e10cSrcweir 		for	(sal_Int16 i=0; i<nMaxLen; ++i )
1317cdf0e10cSrcweir 		{
1318cdf0e10cSrcweir 			m_rContext.getGlobalContext().ClearAttrList();
1319cdf0e10cSrcweir 			if (i < nItems)
1320cdf0e10cSrcweir 			{
1321cdf0e10cSrcweir 				// there is an item at this position
1322cdf0e10cSrcweir 				AddAttribute(
1323cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
1324cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
1325cdf0e10cSrcweir 					*pItems);
1326cdf0e10cSrcweir 				++pItems;
1327cdf0e10cSrcweir 			}
1328cdf0e10cSrcweir 			if (i < nValues)
1329cdf0e10cSrcweir 			{
1330cdf0e10cSrcweir 				// there is an value at this position
1331cdf0e10cSrcweir 				AddAttribute(
1332cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_VALUE),
1333cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_VALUE),
1334cdf0e10cSrcweir 					*pValues);
1335cdf0e10cSrcweir 				++pValues;
1336cdf0e10cSrcweir 			}
1337cdf0e10cSrcweir 
1338cdf0e10cSrcweir 			Int16SetIterator aSelectedPos = aSelection.find(i);
1339cdf0e10cSrcweir 			if (aSelection.end() != aSelectedPos)
1340cdf0e10cSrcweir 			{	// the item at this position is selected
1341cdf0e10cSrcweir 				AddAttribute(
1342cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
1343cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED),
1344cdf0e10cSrcweir 					sTrue
1345cdf0e10cSrcweir 					);
1346cdf0e10cSrcweir 				aSelection.erase(aSelectedPos);
1347cdf0e10cSrcweir 			}
1348cdf0e10cSrcweir 
1349cdf0e10cSrcweir 			Int16SetIterator aDefaultSelectedPos = aDefaultSelection.find(i);
1350cdf0e10cSrcweir 			if (aDefaultSelection.end() != aDefaultSelectedPos)
1351cdf0e10cSrcweir 			{	// the item at this position is selected as default
1352cdf0e10cSrcweir 				AddAttribute(
1353cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED),
1354cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED),
1355cdf0e10cSrcweir 					sTrue
1356cdf0e10cSrcweir 					);
1357cdf0e10cSrcweir 				aDefaultSelection.erase(aDefaultSelectedPos);
1358cdf0e10cSrcweir 			}
1359cdf0e10cSrcweir 			SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
1360cdf0e10cSrcweir 		}
1361cdf0e10cSrcweir 
1362cdf0e10cSrcweir 		// There may be more "selected" or "default-selected" items than there are in the lists in real,
1363cdf0e10cSrcweir 		// so we need to store some additional "form:option" items which have no name and no label, but
1364cdf0e10cSrcweir 		// one or both of the selected flags.
1365cdf0e10cSrcweir 		// 21.05.2001 - 85388 - frank.schoenheit@germany.sun.com
1366cdf0e10cSrcweir 
1367cdf0e10cSrcweir 		if ( !aSelection.empty() || !aDefaultSelection.empty() )
1368cdf0e10cSrcweir 		{
1369cdf0e10cSrcweir 			sal_Int16 nLastSelected = -1;
1370cdf0e10cSrcweir 			if ( !aSelection.empty() )
1371cdf0e10cSrcweir 				nLastSelected = *(--aSelection.end());
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir 			sal_Int16 nLastDefaultSelected = -1;
1374cdf0e10cSrcweir 			if ( !aDefaultSelection.empty() )
1375cdf0e10cSrcweir 				nLastDefaultSelected = *(--aDefaultSelection.end());
1376cdf0e10cSrcweir 
1377cdf0e10cSrcweir 			// the maximum element in both sets
1378cdf0e10cSrcweir 			sal_Int16 nLastReferredEntry = std::max(nLastSelected, nLastDefaultSelected);
1379cdf0e10cSrcweir 			OSL_ENSURE(nLastReferredEntry >= nMaxLen, "OControlExport::exportListSourceAsElements: inconsistence!");
1380cdf0e10cSrcweir 				// if the maximum (selected or default selected) entry number is less than the maximum item count
1381cdf0e10cSrcweir 				// in both lists, the entry number should have been removed from the set
1382cdf0e10cSrcweir 
1383cdf0e10cSrcweir 			for (sal_Int16 i=nMaxLen; i<=nLastReferredEntry; ++i)
1384cdf0e10cSrcweir 			{
1385cdf0e10cSrcweir 				if (aSelection.end() != aSelection.find(i))
1386cdf0e10cSrcweir 				{	// the (not existent) item at this position is selected
1387cdf0e10cSrcweir 					AddAttribute(
1388cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeNamespace(CCA_CURRENT_SELECTED),
1389cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeName(CCA_CURRENT_SELECTED),
1390cdf0e10cSrcweir 						sTrue
1391cdf0e10cSrcweir 						);
1392cdf0e10cSrcweir 				}
1393cdf0e10cSrcweir 
1394cdf0e10cSrcweir 				if (aDefaultSelection.end() != aDefaultSelection.find(i))
1395cdf0e10cSrcweir 				{	// the (not existent) item at this position is selected as default
1396cdf0e10cSrcweir 					AddAttribute(
1397cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SELECTED),
1398cdf0e10cSrcweir 						OAttributeMetaData::getCommonControlAttributeName(CCA_SELECTED),
1399cdf0e10cSrcweir 						sTrue
1400cdf0e10cSrcweir 						);
1401cdf0e10cSrcweir 				}
1402cdf0e10cSrcweir 				SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, "option", sal_True, sal_True);
1403cdf0e10cSrcweir 			}
1404cdf0e10cSrcweir 		}
1405cdf0e10cSrcweir 	}
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir 	//---------------------------------------------------------------------
implStartElement(const sal_Char * _pName)1408cdf0e10cSrcweir 	void OControlExport::implStartElement(const sal_Char* _pName)
1409cdf0e10cSrcweir 	{
1410cdf0e10cSrcweir 		// before we let the base class start it's outer element, we add a wrapper element
1411cdf0e10cSrcweir 		const sal_Char *pOuterElementName = getOuterXMLElementName();
1412cdf0e10cSrcweir 		m_pOuterElement = pOuterElementName
1413cdf0e10cSrcweir 		   					? new SvXMLElementExport(
1414cdf0e10cSrcweir 										m_rContext.getGlobalContext(),
1415cdf0e10cSrcweir 										XML_NAMESPACE_FORM,
1416cdf0e10cSrcweir 										pOuterElementName, sal_True,
1417cdf0e10cSrcweir 										sal_True)
1418cdf0e10cSrcweir 							: 0;
1419cdf0e10cSrcweir 
1420cdf0e10cSrcweir 		// add the attributes for the inner element
1421cdf0e10cSrcweir 		exportInnerAttributes();
1422cdf0e10cSrcweir 
1423cdf0e10cSrcweir 		// and start the inner element
1424cdf0e10cSrcweir 		OElementExport::implStartElement(_pName);
1425cdf0e10cSrcweir 	}
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir 	//---------------------------------------------------------------------
implEndElement()1428cdf0e10cSrcweir 	void OControlExport::implEndElement()
1429cdf0e10cSrcweir 	{
1430cdf0e10cSrcweir 		// end the inner element
1431cdf0e10cSrcweir 		OElementExport::implEndElement();
1432cdf0e10cSrcweir 
1433cdf0e10cSrcweir 		// end the outer element if it exists
1434cdf0e10cSrcweir 		delete m_pOuterElement;
1435cdf0e10cSrcweir 		m_pOuterElement = NULL;
1436cdf0e10cSrcweir 	}
1437cdf0e10cSrcweir 
1438cdf0e10cSrcweir 	//---------------------------------------------------------------------
getOuterXMLElementName() const1439cdf0e10cSrcweir 	const sal_Char* OControlExport::getOuterXMLElementName() const
1440cdf0e10cSrcweir 	{
1441cdf0e10cSrcweir 		return 0;
1442cdf0e10cSrcweir 	}
1443cdf0e10cSrcweir 
1444cdf0e10cSrcweir 	//---------------------------------------------------------------------
getXMLElementName() const1445cdf0e10cSrcweir 	const sal_Char* OControlExport::getXMLElementName() const
1446cdf0e10cSrcweir 	{
1447cdf0e10cSrcweir 		return getElementName(m_eType);
1448cdf0e10cSrcweir 	}
1449cdf0e10cSrcweir 
1450cdf0e10cSrcweir 	//---------------------------------------------------------------------
examine()1451cdf0e10cSrcweir 	void OControlExport::examine()
1452cdf0e10cSrcweir 	{
1453cdf0e10cSrcweir         OSL_ENSURE( ( m_nIncludeCommon == 0 ) && ( m_nIncludeSpecial == 0 ) && ( m_nIncludeDatabase == 0 )
1454cdf0e10cSrcweir                  && ( m_nIncludeEvents == 0 ) && ( m_nIncludeBindings == 0),
1455cdf0e10cSrcweir                  "OControlExport::examine: called me twice? Not initialized?" );
1456cdf0e10cSrcweir 
1457cdf0e10cSrcweir         // get the class id to decide which kind of element we need in the XML stream
1458cdf0e10cSrcweir 		m_nClassId = FormComponentType::CONTROL;
1459cdf0e10cSrcweir 		DBG_CHECK_PROPERTY( PROPERTY_CLASSID, sal_Int16 );
1460cdf0e10cSrcweir 		m_xProps->getPropertyValue(PROPERTY_CLASSID) >>= m_nClassId;
1461cdf0e10cSrcweir         bool knownType = false;
1462cdf0e10cSrcweir 		switch (m_nClassId)
1463cdf0e10cSrcweir 		{
1464cdf0e10cSrcweir 			case FormComponentType::DATEFIELD:
1465cdf0e10cSrcweir                 m_eType = DATE;
1466cdf0e10cSrcweir                 knownType = true;
1467cdf0e10cSrcweir                 // NO BREAK
1468cdf0e10cSrcweir 			case FormComponentType::TIMEFIELD:
1469cdf0e10cSrcweir                 if ( !knownType )
1470cdf0e10cSrcweir                 {
1471cdf0e10cSrcweir                     m_eType = TIME;
1472cdf0e10cSrcweir                     knownType = true;
1473cdf0e10cSrcweir                 }
1474cdf0e10cSrcweir 				m_nIncludeSpecial |= SCA_VALIDATION;
1475cdf0e10cSrcweir                 // NO BREAK
1476cdf0e10cSrcweir 			case FormComponentType::NUMERICFIELD:
1477cdf0e10cSrcweir 			case FormComponentType::CURRENCYFIELD:
1478cdf0e10cSrcweir 			case FormComponentType::PATTERNFIELD:
1479cdf0e10cSrcweir                 if ( !knownType )
1480cdf0e10cSrcweir                 {
1481cdf0e10cSrcweir 				    m_eType = FORMATTED_TEXT;
1482cdf0e10cSrcweir                     knownType = true;
1483cdf0e10cSrcweir                 }
1484cdf0e10cSrcweir 				// NO BREAK
1485cdf0e10cSrcweir 			case FormComponentType::TEXTFIELD:
1486cdf0e10cSrcweir 			{	// it's some kind of edit. To know which type we need further investigation
1487cdf0e10cSrcweir 
1488cdf0e10cSrcweir 				if ( !knownType )
1489cdf0e10cSrcweir 				{
1490cdf0e10cSrcweir 					// check if it's a formatted field
1491cdf0e10cSrcweir 					if (m_xPropertyInfo->hasPropertyByName(PROPERTY_FORMATKEY))
1492cdf0e10cSrcweir 					{
1493cdf0e10cSrcweir 						m_eType = FORMATTED_TEXT;
1494cdf0e10cSrcweir 					}
1495cdf0e10cSrcweir 					else
1496cdf0e10cSrcweir 					{
1497cdf0e10cSrcweir 						// all other controls are represented by an ordinary edit control, but which XML control type
1498cdf0e10cSrcweir 						// it is depends on the current values of some properties
1499cdf0e10cSrcweir 
1500cdf0e10cSrcweir 						// if the EchoChar string is not empty, it is a password field
1501cdf0e10cSrcweir 						sal_Int16 nEchoChar = 0;
1502cdf0e10cSrcweir 						if (m_xPropertyInfo->hasPropertyByName(PROPERTY_ECHOCHAR))
1503cdf0e10cSrcweir 							// grid columns do not have this property ....
1504cdf0e10cSrcweir 							m_xProps->getPropertyValue(PROPERTY_ECHOCHAR) >>= nEchoChar;
1505cdf0e10cSrcweir 						if (nEchoChar)
1506cdf0e10cSrcweir 						{
1507cdf0e10cSrcweir 							m_eType = PASSWORD;
1508cdf0e10cSrcweir 							m_nIncludeSpecial |= SCA_ECHO_CHAR;
1509cdf0e10cSrcweir 						}
1510cdf0e10cSrcweir 						else
1511cdf0e10cSrcweir 						{
1512cdf0e10cSrcweir 							// if the MultiLine property is sal_True, it is a TextArea
1513cdf0e10cSrcweir 							sal_Bool bMultiLine = sal_False;
1514cdf0e10cSrcweir 							if (m_xPropertyInfo->hasPropertyByName(PROPERTY_MULTILINE))
1515cdf0e10cSrcweir 								// grid columns do not have this property ....
1516cdf0e10cSrcweir 								bMultiLine = ::cppu::any2bool(m_xProps->getPropertyValue(PROPERTY_MULTILINE));
1517cdf0e10cSrcweir 
1518cdf0e10cSrcweir                             if ( bMultiLine )
1519cdf0e10cSrcweir 								m_eType = TEXT_AREA;
1520cdf0e10cSrcweir 							else
1521cdf0e10cSrcweir 								// the only case left is represented by a Text element
1522cdf0e10cSrcweir 								m_eType = TEXT;
1523cdf0e10cSrcweir 						}
1524cdf0e10cSrcweir 					}
1525cdf0e10cSrcweir                     knownType = true;
1526cdf0e10cSrcweir 				}
1527cdf0e10cSrcweir 
1528cdf0e10cSrcweir 				// attributes which are common to all the types:
1529cdf0e10cSrcweir 				// common attributes
1530cdf0e10cSrcweir 				m_nIncludeCommon =
1531cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED |
1532cdf0e10cSrcweir 					CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
1533cdf0e10cSrcweir 
1534cdf0e10cSrcweir                 if  (   ( m_nClassId != FormComponentType::DATEFIELD )
1535cdf0e10cSrcweir                     &&  ( m_nClassId != FormComponentType::TIMEFIELD )
1536cdf0e10cSrcweir                     )
1537cdf0e10cSrcweir                     // date and time field values are handled differently nowadays
1538cdf0e10cSrcweir                     m_nIncludeCommon |= CCA_VALUE;
1539cdf0e10cSrcweir 
1540cdf0e10cSrcweir                 // database attributes
1541cdf0e10cSrcweir 				m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
1542cdf0e10cSrcweir 
1543cdf0e10cSrcweir 				// event attributes
1544cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir 				// only text and pattern fields have a ConvertEmptyToNull property
1547cdf0e10cSrcweir 				if  (   ( m_nClassId == FormComponentType::TEXTFIELD )
1548cdf0e10cSrcweir                     ||  ( m_nClassId == FormComponentType::PATTERNFIELD )
1549cdf0e10cSrcweir                     )
1550cdf0e10cSrcweir 					m_nIncludeDatabase |= DA_CONVERT_EMPTY;
1551cdf0e10cSrcweir 
1552cdf0e10cSrcweir 				// all controls but the file control fields have a readonly property
1553cdf0e10cSrcweir 				if ( m_nClassId != FormComponentType::FILECONTROL )
1554cdf0e10cSrcweir 					m_nIncludeCommon |= CCA_READONLY;
1555cdf0e10cSrcweir 
1556cdf0e10cSrcweir 				// a text field has a max text len
1557cdf0e10cSrcweir                 if ( m_nClassId == FormComponentType::TEXTFIELD )
1558cdf0e10cSrcweir 					m_nIncludeCommon |= CCA_MAX_LENGTH;
1559cdf0e10cSrcweir 
1560cdf0e10cSrcweir 				// max and min values and validation:
1561cdf0e10cSrcweir 				if (FORMATTED_TEXT == m_eType)
1562cdf0e10cSrcweir 				{	// in general all controls represented as formatted-text have these props
1563cdf0e10cSrcweir 					if  ( FormComponentType::PATTERNFIELD != m_nClassId )   // except the PatternField
1564cdf0e10cSrcweir 						m_nIncludeSpecial |= SCA_MAX_VALUE | SCA_MIN_VALUE;
1565cdf0e10cSrcweir 
1566cdf0e10cSrcweir 					if (FormComponentType::TEXTFIELD != m_nClassId)
1567cdf0e10cSrcweir 						// and the FormattedField does not have a validation flag
1568cdf0e10cSrcweir 						m_nIncludeSpecial |= SCA_VALIDATION;
1569cdf0e10cSrcweir 				}
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir 				// if it's not a password field or rich text control, the CurrentValue needs to be stored, too
1572cdf0e10cSrcweir 				if  (   ( PASSWORD != m_eType )
1573cdf0e10cSrcweir                     &&  ( DATE != m_eType )
1574cdf0e10cSrcweir                     &&  ( TIME != m_eType )
1575cdf0e10cSrcweir                     )
1576cdf0e10cSrcweir                 {
1577cdf0e10cSrcweir 				    m_nIncludeCommon |= CCA_CURRENT_VALUE;
1578cdf0e10cSrcweir                 }
1579cdf0e10cSrcweir 			}
1580cdf0e10cSrcweir 			break;
1581cdf0e10cSrcweir 
1582cdf0e10cSrcweir 			case FormComponentType::FILECONTROL:
1583cdf0e10cSrcweir 				m_eType = FILE;
1584cdf0e10cSrcweir 				m_nIncludeCommon =
1585cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE | CCA_DISABLED |
1586cdf0e10cSrcweir 					CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE |
1587cdf0e10cSrcweir 					CCA_VALUE;
1588cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
1589cdf0e10cSrcweir 				break;
1590cdf0e10cSrcweir 
1591cdf0e10cSrcweir 			case FormComponentType::FIXEDTEXT:
1592cdf0e10cSrcweir 				m_eType = FIXED_TEXT;
1593cdf0e10cSrcweir 				m_nIncludeCommon =
1594cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
1595cdf0e10cSrcweir 					CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
1596cdf0e10cSrcweir 				m_nIncludeSpecial = SCA_MULTI_LINE;
1597cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS;
1598cdf0e10cSrcweir 				break;
1599cdf0e10cSrcweir 
1600cdf0e10cSrcweir 			case FormComponentType::COMBOBOX:
1601cdf0e10cSrcweir 				m_eType = COMBOBOX;
1602cdf0e10cSrcweir 				m_nIncludeCommon =
1603cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_CURRENT_VALUE |
1604cdf0e10cSrcweir 					CCA_DISABLED | CCA_DROPDOWN | CCA_MAX_LENGTH | CCA_PRINTABLE | CCA_READONLY | CCA_SIZE |
1605cdf0e10cSrcweir 					CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE;
1606cdf0e10cSrcweir 				m_nIncludeSpecial = SCA_AUTOMATIC_COMPLETION;
1607cdf0e10cSrcweir 				m_nIncludeDatabase = DA_CONVERT_EMPTY | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE | DA_LIST_SOURCE_TYPE;
1608cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_SELECT;
1609cdf0e10cSrcweir 				break;
1610cdf0e10cSrcweir 
1611cdf0e10cSrcweir 			case FormComponentType::LISTBOX:
1612cdf0e10cSrcweir 				m_eType = LISTBOX;
1613cdf0e10cSrcweir 				m_nIncludeCommon =
1614cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_DROPDOWN |
1615cdf0e10cSrcweir 					CCA_PRINTABLE | CCA_SIZE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
1616cdf0e10cSrcweir 				m_nIncludeSpecial = SCA_MULTIPLE;
1617cdf0e10cSrcweir 				m_nIncludeDatabase = DA_BOUND_COLUMN | DA_DATA_FIELD | DA_INPUT_REQUIRED | DA_LIST_SOURCE_TYPE;
1618cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE | EA_ON_CLICK | EA_ON_DBLCLICK;
1619cdf0e10cSrcweir 				// check if we need to export the ListSource as attribute
1620cdf0e10cSrcweir 				{
1621cdf0e10cSrcweir 					// for a list box, if the ListSourceType is VALUE_LIST, no ListSource is stored, but instead
1622cdf0e10cSrcweir 					// a sequence of pairs which is build from the StringItemList and the ValueList
1623cdf0e10cSrcweir 					ListSourceType eListSourceType = ListSourceType_VALUELIST;
1624cdf0e10cSrcweir                 #if OSL_DEBUG_LEVEL > 0
1625cdf0e10cSrcweir 					sal_Bool bSuccess =
1626cdf0e10cSrcweir 				#endif
1627cdf0e10cSrcweir 					m_xProps->getPropertyValue(PROPERTY_LISTSOURCETYPE) >>= eListSourceType;
1628cdf0e10cSrcweir 					OSL_ENSURE(bSuccess, "OControlExport::examineControl: could not retrieve the ListSourceType!");
1629cdf0e10cSrcweir 					if (ListSourceType_VALUELIST != eListSourceType)
1630cdf0e10cSrcweir 					{
1631cdf0e10cSrcweir 						m_nIncludeDatabase |= DA_LIST_SOURCE;
1632cdf0e10cSrcweir 					}
1633cdf0e10cSrcweir 				}
1634cdf0e10cSrcweir 
1635cdf0e10cSrcweir 				break;
1636cdf0e10cSrcweir 
1637cdf0e10cSrcweir 			case FormComponentType::COMMANDBUTTON:
1638cdf0e10cSrcweir 				m_eType = BUTTON;
1639cdf0e10cSrcweir 				m_nIncludeCommon |= CCA_TAB_STOP | CCA_LABEL;
1640cdf0e10cSrcweir 				m_nIncludeSpecial = SCA_DEFAULT_BUTTON | SCA_TOGGLE | SCA_FOCUS_ON_CLICK | SCA_IMAGE_POSITION | SCA_REPEAT_DELAY;
1641cdf0e10cSrcweir 				// NO BREAK !
1642cdf0e10cSrcweir 			case FormComponentType::IMAGEBUTTON:
1643cdf0e10cSrcweir 				if (BUTTON != m_eType)
1644cdf0e10cSrcweir                 {
1645cdf0e10cSrcweir 					// not coming from the previous case
1646cdf0e10cSrcweir 					m_eType = IMAGE;
1647cdf0e10cSrcweir                 }
1648cdf0e10cSrcweir 				m_nIncludeCommon |=
1649cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_BUTTON_TYPE | CCA_DISABLED |
1650cdf0e10cSrcweir 					CCA_IMAGE_DATA | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TARGET_FRAME |
1651cdf0e10cSrcweir 					CCA_TARGET_LOCATION | CCA_TITLE;
1652cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CLICK	| EA_ON_DBLCLICK;
1653cdf0e10cSrcweir 				break;
1654cdf0e10cSrcweir 
1655cdf0e10cSrcweir 			case FormComponentType::CHECKBOX:
1656cdf0e10cSrcweir 				m_eType = CHECKBOX;
1657cdf0e10cSrcweir 				m_nIncludeSpecial = SCA_CURRENT_STATE | SCA_IS_TRISTATE | SCA_STATE;
1658cdf0e10cSrcweir 				// NO BREAK !
1659cdf0e10cSrcweir 			case FormComponentType::RADIOBUTTON:
1660cdf0e10cSrcweir 				m_nIncludeCommon =
1661cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL | CCA_PRINTABLE |
1662cdf0e10cSrcweir                     CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE | CCA_VALUE | CCA_VISUAL_EFFECT;
1663cdf0e10cSrcweir 				if (CHECKBOX != m_eType)
1664cdf0e10cSrcweir 				{	// not coming from the previous case
1665cdf0e10cSrcweir 					m_eType = RADIO;
1666cdf0e10cSrcweir 					m_nIncludeCommon |= CCA_CURRENT_SELECTED | CCA_SELECTED;
1667cdf0e10cSrcweir 				}
1668cdf0e10cSrcweir                 if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
1669cdf0e10cSrcweir                     m_nIncludeSpecial |= SCA_IMAGE_POSITION;
1670cdf0e10cSrcweir 				m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
1671cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
1672cdf0e10cSrcweir 				break;
1673cdf0e10cSrcweir 
1674cdf0e10cSrcweir 			case FormComponentType::GROUPBOX:
1675cdf0e10cSrcweir 				m_eType = FRAME;
1676cdf0e10cSrcweir 				m_nIncludeCommon =
1677cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_LABEL |
1678cdf0e10cSrcweir 					CCA_PRINTABLE | CCA_TITLE | CCA_FOR;
1679cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS;
1680cdf0e10cSrcweir 				break;
1681cdf0e10cSrcweir 
1682cdf0e10cSrcweir 			case FormComponentType::IMAGECONTROL:
1683cdf0e10cSrcweir 				m_eType = IMAGE_FRAME;
1684cdf0e10cSrcweir 				m_nIncludeCommon =
1685cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_IMAGE_DATA |
1686cdf0e10cSrcweir 					CCA_PRINTABLE | CCA_READONLY | CCA_TITLE;
1687cdf0e10cSrcweir 				m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
1688cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS;
1689cdf0e10cSrcweir 				break;
1690cdf0e10cSrcweir 
1691cdf0e10cSrcweir 			case FormComponentType::HIDDENCONTROL:
1692cdf0e10cSrcweir 				m_eType = HIDDEN;
1693cdf0e10cSrcweir 				m_nIncludeCommon =
1694cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_VALUE;
1695cdf0e10cSrcweir 				break;
1696cdf0e10cSrcweir 
1697cdf0e10cSrcweir 			case FormComponentType::GRIDCONTROL:
1698cdf0e10cSrcweir 				m_eType = GRID;
1699cdf0e10cSrcweir 				m_nIncludeCommon =
1700cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
1701cdf0e10cSrcweir 					CCA_TAB_INDEX | CCA_TAB_STOP | CCA_TITLE;
1702cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS;
1703cdf0e10cSrcweir 				break;
1704cdf0e10cSrcweir 
1705cdf0e10cSrcweir 			case FormComponentType::SCROLLBAR:
1706cdf0e10cSrcweir 			case FormComponentType::SPINBUTTON:
1707cdf0e10cSrcweir 				m_eType = VALUERANGE;
1708cdf0e10cSrcweir 				m_nIncludeCommon =
1709cdf0e10cSrcweir 					CCA_NAME | CCA_SERVICE_NAME | CCA_DISABLED | CCA_PRINTABLE |
1710cdf0e10cSrcweir                     CCA_TITLE | CCA_CURRENT_VALUE | CCA_VALUE | CCA_ORIENTATION;
1711cdf0e10cSrcweir                 m_nIncludeSpecial = SCA_MAX_VALUE | SCA_STEP_SIZE | SCA_MIN_VALUE | SCA_REPEAT_DELAY;
1712cdf0e10cSrcweir 
1713cdf0e10cSrcweir                 if ( m_nClassId == FormComponentType::SCROLLBAR )
1714cdf0e10cSrcweir                     m_nIncludeSpecial |= SCA_PAGE_STEP_SIZE ;
1715cdf0e10cSrcweir 
1716cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS;
1717cdf0e10cSrcweir                 break;
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir             default:
1720cdf0e10cSrcweir 				OSL_ENSURE(sal_False, "OControlExport::examineControl: unknown control type (class id)!");
1721cdf0e10cSrcweir                 // NO break!
1722cdf0e10cSrcweir 
1723cdf0e10cSrcweir             case FormComponentType::NAVIGATIONBAR:
1724cdf0e10cSrcweir                 // TODO: should we have an own file format for this?
1725cdf0e10cSrcweir                 // NO break
1726cdf0e10cSrcweir 
1727cdf0e10cSrcweir             case FormComponentType::CONTROL:
1728cdf0e10cSrcweir 				m_eType = GENERIC_CONTROL;
1729cdf0e10cSrcweir 				// unknown control type
1730cdf0e10cSrcweir 				m_nIncludeCommon = CCA_NAME | CCA_SERVICE_NAME;
1731cdf0e10cSrcweir 					// at least a name should be there, 'cause without a name the control could never have been
1732cdf0e10cSrcweir 					// inserted into it's parent container
1733cdf0e10cSrcweir 					// In addition, the service name is absolutely necessary to create the control upon reading.
1734cdf0e10cSrcweir 				m_nIncludeEvents = EA_CONTROL_EVENTS;
1735cdf0e10cSrcweir 					// we always should be able to export events - this is not control type dependent
1736cdf0e10cSrcweir 				break;
1737cdf0e10cSrcweir 		}
1738cdf0e10cSrcweir 
1739cdf0e10cSrcweir 		// in general, all control types need to export the control id
1740cdf0e10cSrcweir 		m_nIncludeCommon |= CCA_CONTROL_ID;
1741cdf0e10cSrcweir 
1742cdf0e10cSrcweir         // is is a control bound to a calc cell?
1743cdf0e10cSrcweir         if ( FormCellBindingHelper::livesInSpreadsheetDocument( m_xProps ) )
1744cdf0e10cSrcweir         {
1745cdf0e10cSrcweir             FormCellBindingHelper aHelper( m_xProps, NULL );
1746cdf0e10cSrcweir             {
1747cdf0e10cSrcweir                 if ( aHelper.isCellBinding( aHelper.getCurrentBinding( ) ) )
1748cdf0e10cSrcweir                 {
1749cdf0e10cSrcweir                     m_nIncludeBindings |= BA_LINKED_CELL;
1750cdf0e10cSrcweir                     if ( m_nClassId == FormComponentType::LISTBOX )
1751cdf0e10cSrcweir                         m_nIncludeBindings |= BA_LIST_LINKING_TYPE;
1752cdf0e10cSrcweir                 }
1753cdf0e10cSrcweir             }
1754cdf0e10cSrcweir 
1755cdf0e10cSrcweir             // is it a list-like control which uses a calc cell range as list source?
1756cdf0e10cSrcweir             {
1757cdf0e10cSrcweir                 if ( aHelper.isCellRangeListSource( aHelper.getCurrentListSource( ) ) )
1758cdf0e10cSrcweir                     m_nIncludeBindings |= BA_LIST_CELL_RANGE;
1759cdf0e10cSrcweir             }
1760cdf0e10cSrcweir         }
1761cdf0e10cSrcweir 
1762cdf0e10cSrcweir         // is control bound to XForms?
1763cdf0e10cSrcweir         if( getXFormsBindName( m_xProps ).getLength() > 0 )
1764cdf0e10cSrcweir         {
1765cdf0e10cSrcweir             m_nIncludeBindings |= BA_XFORMS_BIND;
1766cdf0e10cSrcweir         }
1767cdf0e10cSrcweir 
1768cdf0e10cSrcweir         // is (list-)control bound to XForms list?
1769cdf0e10cSrcweir         if( getXFormsListBindName( m_xProps ).getLength() > 0 )
1770cdf0e10cSrcweir         {
1771cdf0e10cSrcweir             m_nIncludeBindings |= BA_XFORMS_LISTBIND;
1772cdf0e10cSrcweir         }
1773cdf0e10cSrcweir 
1774cdf0e10cSrcweir         // does the control have an XForms submission?
1775cdf0e10cSrcweir         if( getXFormsSubmissionName( m_xProps ).getLength() > 0 )
1776cdf0e10cSrcweir         {
1777cdf0e10cSrcweir             m_nIncludeBindings |= BA_XFORMS_SUBMISSION;
1778cdf0e10cSrcweir         }
1779cdf0e10cSrcweir 	}
1780cdf0e10cSrcweir 
1781cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportCellBindingAttributes(bool _bIncludeListLinkageType)1782cdf0e10cSrcweir     void OControlExport::exportCellBindingAttributes( bool _bIncludeListLinkageType )
1783cdf0e10cSrcweir     {
1784cdf0e10cSrcweir         try
1785cdf0e10cSrcweir         {
1786cdf0e10cSrcweir             FormCellBindingHelper aHelper( m_xProps, NULL );
1787cdf0e10cSrcweir             Reference< XValueBinding > xBinding( aHelper.getCurrentBinding() );
1788cdf0e10cSrcweir             OSL_ENSURE( xBinding.is(), "OControlExport::exportCellBindingAttributes: invalid bindable or invalid binding!" );
1789cdf0e10cSrcweir             if ( xBinding.is() )
1790cdf0e10cSrcweir             {
1791cdf0e10cSrcweir                 // ....................................................
1792cdf0e10cSrcweir     			AddAttribute(
1793cdf0e10cSrcweir                     OAttributeMetaData::getBindingAttributeNamespace( BA_LINKED_CELL ),
1794cdf0e10cSrcweir                     OAttributeMetaData::getBindingAttributeName( BA_LINKED_CELL ),
1795cdf0e10cSrcweir                     aHelper.getStringAddressFromCellBinding( xBinding )
1796cdf0e10cSrcweir                 );
1797cdf0e10cSrcweir 
1798cdf0e10cSrcweir                 // ....................................................
1799cdf0e10cSrcweir                 if ( _bIncludeListLinkageType )
1800cdf0e10cSrcweir                 {
1801cdf0e10cSrcweir                     sal_Int16 nLinkageType = aHelper.isCellIntegerBinding( xBinding ) ? 1 : 0;
1802cdf0e10cSrcweir 
1803cdf0e10cSrcweir                     ::rtl::OUStringBuffer sBuffer;
1804cdf0e10cSrcweir 			        m_rContext.getGlobalContext().GetMM100UnitConverter().convertEnum(
1805cdf0e10cSrcweir                         sBuffer,
1806cdf0e10cSrcweir                         (sal_uInt16)nLinkageType,
1807cdf0e10cSrcweir                         OEnumMapper::getEnumMap( OEnumMapper::epListLinkageType )
1808cdf0e10cSrcweir                     );
1809cdf0e10cSrcweir 
1810cdf0e10cSrcweir                     AddAttribute(
1811cdf0e10cSrcweir                         OAttributeMetaData::getBindingAttributeNamespace( BA_LIST_LINKING_TYPE ),
1812cdf0e10cSrcweir                         OAttributeMetaData::getBindingAttributeName( BA_LIST_LINKING_TYPE ),
1813cdf0e10cSrcweir                         sBuffer.makeStringAndClear()
1814cdf0e10cSrcweir                     );
1815cdf0e10cSrcweir                 }
1816cdf0e10cSrcweir 
1817cdf0e10cSrcweir             }
1818cdf0e10cSrcweir         }
1819cdf0e10cSrcweir         catch( const Exception& )
1820cdf0e10cSrcweir         {
1821cdf0e10cSrcweir             OSL_ENSURE( sal_False, "OControlExport::exportCellBindingAttributes: caught an exception!" );
1822cdf0e10cSrcweir         }
1823cdf0e10cSrcweir     }
1824cdf0e10cSrcweir 
1825cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportXFormsBindAttributes()1826cdf0e10cSrcweir     void OControlExport::exportXFormsBindAttributes()
1827cdf0e10cSrcweir     {
1828cdf0e10cSrcweir         rtl::OUString sBindName = getXFormsBindName( m_xProps );
1829cdf0e10cSrcweir         AddAttribute( XML_NAMESPACE_XFORMS, XML_BIND, sBindName );
1830cdf0e10cSrcweir     }
1831cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportXFormsListAttributes()1832cdf0e10cSrcweir     void OControlExport::exportXFormsListAttributes()
1833cdf0e10cSrcweir     {
1834cdf0e10cSrcweir         rtl::OUString sBindName = getXFormsListBindName( m_xProps );
1835cdf0e10cSrcweir         AddAttribute( XML_NAMESPACE_FORM, XML_XFORMS_LIST_SOURCE, sBindName );
1836cdf0e10cSrcweir     }
1837cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportXFormsSubmissionAttributes()1838cdf0e10cSrcweir     void OControlExport::exportXFormsSubmissionAttributes()
1839cdf0e10cSrcweir     {
1840cdf0e10cSrcweir         rtl::OUString sSubmission = getXFormsSubmissionName( m_xProps );
1841cdf0e10cSrcweir         AddAttribute( XML_NAMESPACE_FORM, XML_XFORMS_SUBMISSION, sSubmission );
1842cdf0e10cSrcweir     }
1843cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportCellListSourceRange()1844cdf0e10cSrcweir     void OControlExport::exportCellListSourceRange( )
1845cdf0e10cSrcweir     {
1846cdf0e10cSrcweir         try
1847cdf0e10cSrcweir         {
1848cdf0e10cSrcweir             Reference< XListEntrySink > xSink( m_xProps, UNO_QUERY );
1849cdf0e10cSrcweir             Reference< XListEntrySource > xSource;
1850cdf0e10cSrcweir             if ( xSink.is() )
1851cdf0e10cSrcweir                 xSource = xSource.query( xSink->getListEntrySource() );
1852cdf0e10cSrcweir             OSL_ENSURE( xSource.is(), "OControlExport::exportCellListSourceRange: list source or sink!" );
1853cdf0e10cSrcweir             if ( xSource.is() )
1854cdf0e10cSrcweir             {
1855cdf0e10cSrcweir                 FormCellBindingHelper aHelper( m_xProps, NULL );
1856cdf0e10cSrcweir 
1857cdf0e10cSrcweir     			AddAttribute(
1858cdf0e10cSrcweir                     OAttributeMetaData::getBindingAttributeNamespace( BA_LIST_CELL_RANGE ),
1859cdf0e10cSrcweir                     OAttributeMetaData::getBindingAttributeName( BA_LIST_CELL_RANGE ),
1860cdf0e10cSrcweir                     aHelper.getStringAddressFromCellListSource( xSource )
1861cdf0e10cSrcweir                 );
1862cdf0e10cSrcweir             }
1863cdf0e10cSrcweir         }
1864cdf0e10cSrcweir         catch( const Exception& )
1865cdf0e10cSrcweir         {
1866cdf0e10cSrcweir             OSL_ENSURE( sal_False, "OControlExport::exportCellListSourceRange: caught an exception!" );
1867cdf0e10cSrcweir         }
1868cdf0e10cSrcweir     }
1869cdf0e10cSrcweir 
1870cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportImagePositionAttributes()1871cdf0e10cSrcweir     void OControlExport::exportImagePositionAttributes()
1872cdf0e10cSrcweir     {
1873cdf0e10cSrcweir         try
1874cdf0e10cSrcweir         {
1875cdf0e10cSrcweir             sal_Int16 nImagePosition = ImagePosition::Centered;
1876cdf0e10cSrcweir             OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_IMAGE_POSITION ) >>= nImagePosition );
1877cdf0e10cSrcweir             OSL_ENSURE( ( nImagePosition >= ImagePosition::LeftTop ) && ( nImagePosition <= ImagePosition::Centered ),
1878cdf0e10cSrcweir                 "OControlExport::exportImagePositionAttributes: don't know this image position!" );
1879cdf0e10cSrcweir 
1880cdf0e10cSrcweir             if ( ( nImagePosition < ImagePosition::LeftTop ) || ( nImagePosition > ImagePosition::Centered ) )
1881cdf0e10cSrcweir                 // this is important to prevent potential buffer overflows below, so don't optimize
1882cdf0e10cSrcweir                 nImagePosition = ImagePosition::Centered;
1883cdf0e10cSrcweir 
1884cdf0e10cSrcweir             if ( nImagePosition == ImagePosition::Centered )
1885cdf0e10cSrcweir             {
1886cdf0e10cSrcweir     		    AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_POSITION ), GetXMLToken( XML_CENTER ) );
1887cdf0e10cSrcweir             }
1888cdf0e10cSrcweir             else
1889cdf0e10cSrcweir             {
1890cdf0e10cSrcweir                 XMLTokenEnum eXmlImagePositions[] =
1891cdf0e10cSrcweir                 {
1892cdf0e10cSrcweir                     XML_START, XML_END, XML_TOP, XML_BOTTOM
1893cdf0e10cSrcweir                 };
1894cdf0e10cSrcweir                 XMLTokenEnum eXmlImageAligns[] =
1895cdf0e10cSrcweir                 {
1896cdf0e10cSrcweir                     XML_START, XML_CENTER, XML_END
1897cdf0e10cSrcweir                 };
1898cdf0e10cSrcweir 
1899cdf0e10cSrcweir                 XMLTokenEnum eXmlImagePosition = eXmlImagePositions[ nImagePosition / 3 ];
1900cdf0e10cSrcweir                 XMLTokenEnum eXmlImageAlign    = eXmlImageAligns   [ nImagePosition % 3 ];
1901cdf0e10cSrcweir 
1902cdf0e10cSrcweir     		    AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_POSITION ), GetXMLToken( eXmlImagePosition ) );
1903cdf0e10cSrcweir     		    AddAttribute( XML_NAMESPACE_FORM, GetXMLToken( XML_IMAGE_ALIGN    ), GetXMLToken( eXmlImageAlign    ) );
1904cdf0e10cSrcweir             }
1905cdf0e10cSrcweir 
1906cdf0e10cSrcweir             exportedProperty( PROPERTY_IMAGE_POSITION );
1907cdf0e10cSrcweir             // some of the controls which have an ImagePosition also have an ImageAlign for compatibility
1908cdf0e10cSrcweir             // reasons. Since the ImageAlign values simply represent a sub set of the ImagePosition values,
1909cdf0e10cSrcweir             // we don't need to export ImageAlign anymore
1910cdf0e10cSrcweir             exportedProperty( PROPERTY_IMAGE_ALIGN );
1911cdf0e10cSrcweir         }
1912cdf0e10cSrcweir         catch( const Exception& )
1913cdf0e10cSrcweir         {
1914cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
1915cdf0e10cSrcweir         }
1916cdf0e10cSrcweir     }
1917cdf0e10cSrcweir 
1918cdf0e10cSrcweir 	//---------------------------------------------------------------------
controlHasActiveDataBinding() const1919cdf0e10cSrcweir 	bool OControlExport::controlHasActiveDataBinding() const
1920cdf0e10cSrcweir     {
1921cdf0e10cSrcweir         try
1922cdf0e10cSrcweir         {
1923cdf0e10cSrcweir             // currently exchanging the data with a database column?
1924cdf0e10cSrcweir             ::rtl::OUString sBoundFieldPropertyName( RTL_CONSTASCII_USTRINGPARAM( "BoundField" ) );
1925cdf0e10cSrcweir             if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( sBoundFieldPropertyName ) )
1926cdf0e10cSrcweir             {
1927cdf0e10cSrcweir                 Reference< XPropertySet > xBoundField;
1928cdf0e10cSrcweir                 m_xProps->getPropertyValue( sBoundFieldPropertyName ) >>= xBoundField;
1929cdf0e10cSrcweir                 if ( xBoundField.is() )
1930cdf0e10cSrcweir                     return true;
1931cdf0e10cSrcweir             }
1932cdf0e10cSrcweir 
1933cdf0e10cSrcweir             // currently exchanging data with an external binding?
1934cdf0e10cSrcweir             Reference< XBindableValue > xBindable( m_xProps, UNO_QUERY );
1935cdf0e10cSrcweir             if ( xBindable.is() && xBindable->getValueBinding().is() )
1936cdf0e10cSrcweir                 return true;
1937cdf0e10cSrcweir         }
1938cdf0e10cSrcweir         catch( const Exception& )
1939cdf0e10cSrcweir         {
1940cdf0e10cSrcweir         	OSL_ENSURE( sal_False, "OColumnExport::controlHasActiveDataBinding: caught an exception!" );
1941cdf0e10cSrcweir         }
1942cdf0e10cSrcweir 
1943cdf0e10cSrcweir         return false;
1944cdf0e10cSrcweir     }
1945cdf0e10cSrcweir 
1946cdf0e10cSrcweir 	//---------------------------------------------------------------------
controlHasUserSuppliedListEntries() const1947cdf0e10cSrcweir 	bool OControlExport::controlHasUserSuppliedListEntries() const
1948cdf0e10cSrcweir     {
1949cdf0e10cSrcweir         try
1950cdf0e10cSrcweir         {
1951cdf0e10cSrcweir             // an external list source?
1952cdf0e10cSrcweir             Reference< XListEntrySink > xEntrySink( m_xProps, UNO_QUERY );
1953cdf0e10cSrcweir             if ( xEntrySink.is() && xEntrySink->getListEntrySource().is() )
1954cdf0e10cSrcweir                 return false;
1955cdf0e10cSrcweir 
1956cdf0e10cSrcweir             if ( m_xPropertyInfo.is() && m_xPropertyInfo->hasPropertyByName( PROPERTY_LISTSOURCETYPE ) )
1957cdf0e10cSrcweir             {
1958cdf0e10cSrcweir                 ListSourceType eListSourceType = ListSourceType_VALUELIST;
1959cdf0e10cSrcweir                 OSL_VERIFY( m_xProps->getPropertyValue( PROPERTY_LISTSOURCETYPE ) >>= eListSourceType );
1960cdf0e10cSrcweir                 if ( eListSourceType == ListSourceType_VALUELIST )
1961cdf0e10cSrcweir                     // for value lists, the list entries as entered by the user are used
1962cdf0e10cSrcweir                     return true;
1963cdf0e10cSrcweir 
1964cdf0e10cSrcweir                 // for every other type, the list entries are filled with some data obtained
1965cdf0e10cSrcweir                 // from a database - if and only if the ListSource property is not empty
1966cdf0e10cSrcweir                 return ( 0 == getScalarListSourceValue().getLength() );
1967cdf0e10cSrcweir             }
1968cdf0e10cSrcweir         }
1969cdf0e10cSrcweir         catch( const Exception& )
1970cdf0e10cSrcweir         {
1971cdf0e10cSrcweir         	OSL_ENSURE( sal_False, "OControlExport::controlHasUserSuppliedListEntries: caught an exception!" );
1972cdf0e10cSrcweir         }
1973cdf0e10cSrcweir 
1974cdf0e10cSrcweir         OSL_ENSURE( sal_False, "OControlExport::controlHasUserSuppliedListEntries: unreachable code!" );
1975cdf0e10cSrcweir             // this method should be called for list and combo boxes only
1976cdf0e10cSrcweir         return true;
1977cdf0e10cSrcweir     }
1978cdf0e10cSrcweir 
1979cdf0e10cSrcweir 	//=====================================================================
1980cdf0e10cSrcweir 	//= OColumnExport
1981cdf0e10cSrcweir 	//=====================================================================
1982cdf0e10cSrcweir 	//---------------------------------------------------------------------
OColumnExport(IFormsExportContext & _rContext,const Reference<XPropertySet> & _rxControl,const::rtl::OUString & _rControlId,const Sequence<ScriptEventDescriptor> & _rEvents)1983cdf0e10cSrcweir 	OColumnExport::OColumnExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxControl, const ::rtl::OUString& _rControlId,
1984cdf0e10cSrcweir 		const Sequence< ScriptEventDescriptor >& _rEvents)
1985cdf0e10cSrcweir 		:OControlExport(_rContext, _rxControl, _rControlId, ::rtl::OUString(), _rEvents)
1986cdf0e10cSrcweir 	{
1987cdf0e10cSrcweir 	}
1988cdf0e10cSrcweir 
1989cdf0e10cSrcweir 	//---------------------------------------------------------------------
~OColumnExport()1990cdf0e10cSrcweir 	OColumnExport::~OColumnExport()
1991cdf0e10cSrcweir 	{
1992cdf0e10cSrcweir 		implEndElement();
1993cdf0e10cSrcweir 	}
1994cdf0e10cSrcweir 
1995cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportServiceNameAttribute()1996cdf0e10cSrcweir 	void OColumnExport::exportServiceNameAttribute()
1997cdf0e10cSrcweir 	{
1998cdf0e10cSrcweir 		// the attribute "service name" (which has a slightly different meaning for columns
1999cdf0e10cSrcweir 		DBG_CHECK_PROPERTY( PROPERTY_COLUMNSERVICENAME, ::rtl::OUString );
2000cdf0e10cSrcweir 		::rtl::OUString sColumnServiceName;
2001cdf0e10cSrcweir 		m_xProps->getPropertyValue(PROPERTY_COLUMNSERVICENAME) >>= sColumnServiceName;
2002cdf0e10cSrcweir 		// the service name is a full qualified one (i.e. com.sun.star.form.TextField), but the
2003cdf0e10cSrcweir 		// real service name for the column (for use with the XGridColumnFactory) is only the last
2004cdf0e10cSrcweir 		// token of this complete name.
2005cdf0e10cSrcweir 		sal_Int32 nLastSep = sColumnServiceName.lastIndexOf('.');
2006cdf0e10cSrcweir 		OSL_ENSURE(-1 != nLastSep, "OColumnExport::startExportElement: invalid service name!");
2007cdf0e10cSrcweir 		sColumnServiceName = sColumnServiceName.copy(nLastSep + 1);
2008cdf0e10cSrcweir 		sColumnServiceName =
2009cdf0e10cSrcweir 			m_rContext.getGlobalContext().GetNamespaceMap().GetQNameByKey(
2010cdf0e10cSrcweir 				XML_NAMESPACE_OOO, sColumnServiceName );
2011cdf0e10cSrcweir 		// add the attribute
2012cdf0e10cSrcweir 		AddAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(CCA_SERVICE_NAME)
2013cdf0e10cSrcweir 					, OAttributeMetaData::getCommonControlAttributeName(CCA_SERVICE_NAME)
2014cdf0e10cSrcweir 					, sColumnServiceName);
2015cdf0e10cSrcweir 		// flag the property as "handled"
2016cdf0e10cSrcweir 		exportedProperty(PROPERTY_COLUMNSERVICENAME);
2017cdf0e10cSrcweir 
2018cdf0e10cSrcweir 	}
2019cdf0e10cSrcweir 
2020cdf0e10cSrcweir 	//---------------------------------------------------------------------
getOuterXMLElementName() const2021cdf0e10cSrcweir 	const sal_Char* OColumnExport::getOuterXMLElementName() const
2022cdf0e10cSrcweir 	{
2023cdf0e10cSrcweir 		return "column";
2024cdf0e10cSrcweir 	}
2025cdf0e10cSrcweir 
2026cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportAttributes()2027cdf0e10cSrcweir 	void OColumnExport::exportAttributes()
2028cdf0e10cSrcweir 	{
2029cdf0e10cSrcweir 		OControlExport::exportAttributes();
2030cdf0e10cSrcweir 
2031cdf0e10cSrcweir 		// the attribute "label"
2032cdf0e10cSrcweir 		exportStringPropertyAttribute(
2033cdf0e10cSrcweir 			OAttributeMetaData::getCommonControlAttributeNamespace(CCA_LABEL),
2034cdf0e10cSrcweir 			OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL),
2035cdf0e10cSrcweir 			PROPERTY_LABEL);
2036cdf0e10cSrcweir 
2037cdf0e10cSrcweir 		// the style attribute
2038cdf0e10cSrcweir 		::rtl::OUString sStyleName = m_rContext.getObjectStyleName( m_xProps );
2039cdf0e10cSrcweir 		if ( sStyleName.getLength() )
2040cdf0e10cSrcweir 		{
2041cdf0e10cSrcweir 			AddAttribute(
2042cdf0e10cSrcweir 				OAttributeMetaData::getSpecialAttributeNamespace( SCA_COLUMN_STYLE_NAME ),
2043cdf0e10cSrcweir 				OAttributeMetaData::getSpecialAttributeName( SCA_COLUMN_STYLE_NAME ),
2044cdf0e10cSrcweir 				sStyleName
2045cdf0e10cSrcweir 			);
2046cdf0e10cSrcweir 		}
2047cdf0e10cSrcweir 	}
2048cdf0e10cSrcweir 
2049cdf0e10cSrcweir 	//---------------------------------------------------------------------
examine()2050cdf0e10cSrcweir 	void OColumnExport::examine()
2051cdf0e10cSrcweir 	{
2052cdf0e10cSrcweir 		OControlExport::examine();
2053cdf0e10cSrcweir 
2054cdf0e10cSrcweir 		// grid columns miss some properties of the controls they're representing
2055cdf0e10cSrcweir 		m_nIncludeCommon &= ~(CCA_FOR | CCA_PRINTABLE | CCA_TAB_INDEX | CCA_TAB_STOP | CCA_LABEL);
2056cdf0e10cSrcweir 		m_nIncludeSpecial &= ~(SCA_ECHO_CHAR | SCA_AUTOMATIC_COMPLETION | SCA_MULTIPLE | SCA_MULTI_LINE);
2057cdf0e10cSrcweir 
2058cdf0e10cSrcweir 		if (FormComponentType::DATEFIELD != m_nClassId)
2059cdf0e10cSrcweir 			// except date fields, no column has the DropDown property
2060cdf0e10cSrcweir 			m_nIncludeCommon &= ~CCA_DROPDOWN;
2061cdf0e10cSrcweir 	}
2062cdf0e10cSrcweir 
2063cdf0e10cSrcweir 	//=====================================================================
2064cdf0e10cSrcweir 	//= OFormExport
2065cdf0e10cSrcweir 	//=====================================================================
2066cdf0e10cSrcweir 	//---------------------------------------------------------------------
OFormExport(IFormsExportContext & _rContext,const Reference<XPropertySet> & _rxForm,const Sequence<ScriptEventDescriptor> & _rEvents)2067cdf0e10cSrcweir 	OFormExport::OFormExport(IFormsExportContext& _rContext, const Reference< XPropertySet >& _rxForm,
2068cdf0e10cSrcweir 		const Sequence< ScriptEventDescriptor >& _rEvents)
2069cdf0e10cSrcweir 		:OElementExport(_rContext, _rxForm, _rEvents)
2070cdf0e10cSrcweir 		,m_bCreateConnectionResourceElement(sal_False)
2071cdf0e10cSrcweir 	{
2072cdf0e10cSrcweir 		OSL_ENSURE(m_xProps.is(), "OFormExport::OFormExport: invalid arguments!");
2073cdf0e10cSrcweir 	}
2074cdf0e10cSrcweir 
2075cdf0e10cSrcweir 	//---------------------------------------------------------------------
getXMLElementName() const2076cdf0e10cSrcweir 	const sal_Char* OFormExport::getXMLElementName() const
2077cdf0e10cSrcweir 	{
2078cdf0e10cSrcweir 		return "form";
2079cdf0e10cSrcweir 	}
2080cdf0e10cSrcweir 
2081cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportSubTags()2082cdf0e10cSrcweir 	void OFormExport::exportSubTags()
2083cdf0e10cSrcweir 	{
2084cdf0e10cSrcweir 		if ( m_bCreateConnectionResourceElement && m_xProps.is() )
2085cdf0e10cSrcweir 		{
2086cdf0e10cSrcweir 			m_rContext.getGlobalContext().ClearAttrList();
2087cdf0e10cSrcweir 			::rtl::OUString sPropValue;
2088cdf0e10cSrcweir 			m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue; // if set it is a file url
2089cdf0e10cSrcweir 			if ( !sPropValue.getLength() )
2090cdf0e10cSrcweir 				m_xProps->getPropertyValue( PROPERTY_URL ) >>= sPropValue;
2091cdf0e10cSrcweir 			if ( sPropValue.getLength() )
2092cdf0e10cSrcweir 				AddAttribute(
2093cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeNamespace(CCA_TARGET_LOCATION),
2094cdf0e10cSrcweir 					OAttributeMetaData::getCommonControlAttributeName(CCA_TARGET_LOCATION),
2095cdf0e10cSrcweir 					sPropValue);
2096cdf0e10cSrcweir 			if ( m_rContext.getGlobalContext().GetAttrList().getLength() )
2097cdf0e10cSrcweir 			{
2098cdf0e10cSrcweir 				SvXMLElementExport aFormElement(m_rContext.getGlobalContext(), XML_NAMESPACE_FORM, xmloff::token::XML_CONNECTION_RESOURCE, sal_True, sal_True);
2099cdf0e10cSrcweir 			}
2100cdf0e10cSrcweir 		}
2101cdf0e10cSrcweir 
2102cdf0e10cSrcweir 		// let the base class export the remaining properties and the events
2103cdf0e10cSrcweir 		OElementExport::exportSubTags();
2104cdf0e10cSrcweir 		// loop through all children
2105cdf0e10cSrcweir 		Reference< XIndexAccess > xCollection(m_xProps, UNO_QUERY);
2106cdf0e10cSrcweir 		OSL_ENSURE(xCollection.is(), "OFormLayerXMLExport::implExportForm: a form which is not an index access? Suspic�ous!");
2107cdf0e10cSrcweir 
2108cdf0e10cSrcweir 		if (xCollection.is())
2109cdf0e10cSrcweir 			m_rContext.exportCollectionElements(xCollection);
2110cdf0e10cSrcweir 	}
2111cdf0e10cSrcweir 
2112cdf0e10cSrcweir 	//---------------------------------------------------------------------
exportAttributes()2113cdf0e10cSrcweir 	void OFormExport::exportAttributes()
2114cdf0e10cSrcweir 	{
2115cdf0e10cSrcweir 		sal_Int32 i=0;
2116cdf0e10cSrcweir 
2117cdf0e10cSrcweir 		// ---------------------
2118cdf0e10cSrcweir 		// the string properties
2119cdf0e10cSrcweir 		{
2120cdf0e10cSrcweir 			static FormAttributes eStringPropertyIds[] =
2121cdf0e10cSrcweir 			{
2122cdf0e10cSrcweir 				faName, /*faAction,*/ faCommand, faFilter, faOrder
2123cdf0e10cSrcweir 			};
2124cdf0e10cSrcweir 			static ::rtl::OUString aStringPropertyNames[] =
2125cdf0e10cSrcweir 			{
2126cdf0e10cSrcweir 				PROPERTY_NAME, /*PROPERTY_TARGETURL,*/ PROPERTY_COMMAND, PROPERTY_FILTER, PROPERTY_ORDER
2127cdf0e10cSrcweir 			};
2128cdf0e10cSrcweir 			sal_Int32 nIdCount = sizeof(eStringPropertyIds) / sizeof(eStringPropertyIds[0]);
2129cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
2130cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof(aStringPropertyNames) / sizeof(aStringPropertyNames[0]);
2131cdf0e10cSrcweir 			OSL_ENSURE((nIdCount == nNameCount),
2132cdf0e10cSrcweir 				"OFormExport::exportAttributes: somebody tampered with the maps (1)!");
2133cdf0e10cSrcweir 		#endif
2134cdf0e10cSrcweir 			for (i=0; i<nIdCount; ++i)
2135cdf0e10cSrcweir 				exportStringPropertyAttribute(
2136cdf0e10cSrcweir 					OAttributeMetaData::getFormAttributeNamespace(eStringPropertyIds[i]),
2137cdf0e10cSrcweir 					OAttributeMetaData::getFormAttributeName(eStringPropertyIds[i]),
2138cdf0e10cSrcweir 					aStringPropertyNames[i]);
2139cdf0e10cSrcweir 
2140cdf0e10cSrcweir             // #i112082# xlink:type is added as part of exportTargetLocationAttribute
2141cdf0e10cSrcweir 
2142cdf0e10cSrcweir             // now export the data source name or databaselocation or connection resource
2143cdf0e10cSrcweir 			::rtl::OUString sPropValue;
2144cdf0e10cSrcweir 			m_xProps->getPropertyValue( PROPERTY_DATASOURCENAME ) >>= sPropValue;
2145cdf0e10cSrcweir             m_bCreateConnectionResourceElement = !sPropValue.getLength();
2146cdf0e10cSrcweir 			if ( !m_bCreateConnectionResourceElement )
2147cdf0e10cSrcweir 			{
2148cdf0e10cSrcweir 				INetURLObject aURL(sPropValue);
2149cdf0e10cSrcweir                 m_bCreateConnectionResourceElement = ( aURL.GetProtocol() == INET_PROT_FILE );
2150cdf0e10cSrcweir 				if ( !m_bCreateConnectionResourceElement )
2151cdf0e10cSrcweir 					exportStringPropertyAttribute(
2152cdf0e10cSrcweir 						OAttributeMetaData::getFormAttributeNamespace(faDatasource),
2153cdf0e10cSrcweir 						OAttributeMetaData::getFormAttributeName(faDatasource),
2154cdf0e10cSrcweir 						PROPERTY_DATASOURCENAME);
2155cdf0e10cSrcweir 			}
2156cdf0e10cSrcweir 			else
2157cdf0e10cSrcweir 				exportedProperty(PROPERTY_URL);
2158cdf0e10cSrcweir 			if ( m_bCreateConnectionResourceElement )
2159cdf0e10cSrcweir 				exportedProperty(PROPERTY_DATASOURCENAME);
2160cdf0e10cSrcweir 		}
2161cdf0e10cSrcweir 
2162cdf0e10cSrcweir 		// ----------------------
2163cdf0e10cSrcweir 		// the boolean properties
2164cdf0e10cSrcweir 		{
2165cdf0e10cSrcweir 			static FormAttributes eBooleanPropertyIds[] =
2166cdf0e10cSrcweir 			{
2167cdf0e10cSrcweir 				faAllowDeletes, faAllowInserts, faAllowUpdates, faApplyFilter, faEscapeProcessing, faIgnoreResult
2168cdf0e10cSrcweir 			};
2169cdf0e10cSrcweir 			static const ::rtl::OUString* pBooleanPropertyNames[] =
2170cdf0e10cSrcweir 			{
2171cdf0e10cSrcweir 				&PROPERTY_ALLOWDELETES, &PROPERTY_ALLOWINSERTS, &PROPERTY_ALLOWUPDATES, &PROPERTY_APPLYFILTER, &PROPERTY_ESCAPEPROCESSING, &PROPERTY_IGNORERESULT
2172cdf0e10cSrcweir 			};
2173cdf0e10cSrcweir 			static sal_Int8 nBooleanPropertyAttrFlags[] =
2174cdf0e10cSrcweir 			{
2175cdf0e10cSrcweir 				BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE, BOOLATTR_DEFAULT_TRUE, BOOLATTR_DEFAULT_FALSE
2176cdf0e10cSrcweir 			};
2177cdf0e10cSrcweir 			sal_Int32 nIdCount = sizeof(eBooleanPropertyIds) / sizeof(eBooleanPropertyIds[0]);
2178cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
2179cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof(pBooleanPropertyNames) / sizeof(pBooleanPropertyNames[0]);
2180cdf0e10cSrcweir 			sal_Int32 nFlagsCount = sizeof(nBooleanPropertyAttrFlags) / sizeof(nBooleanPropertyAttrFlags[0]);
2181cdf0e10cSrcweir 			OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nFlagsCount),
2182cdf0e10cSrcweir 				"OFormExport::exportAttributes: somebody tampered with the maps (2)!");
2183cdf0e10cSrcweir 		#endif
2184cdf0e10cSrcweir 			for (i=0; i<nIdCount; ++i)
2185cdf0e10cSrcweir 				exportBooleanPropertyAttribute(
2186cdf0e10cSrcweir 					OAttributeMetaData::getFormAttributeNamespace(eBooleanPropertyIds[i]),
2187cdf0e10cSrcweir 					OAttributeMetaData::getFormAttributeName(eBooleanPropertyIds[i]),
2188cdf0e10cSrcweir 					*(pBooleanPropertyNames[i]),
2189cdf0e10cSrcweir 					nBooleanPropertyAttrFlags[i]
2190cdf0e10cSrcweir 				);
2191cdf0e10cSrcweir 		}
2192cdf0e10cSrcweir 
2193cdf0e10cSrcweir 		// -------------------
2194cdf0e10cSrcweir 		// the enum properties
2195cdf0e10cSrcweir 		{
2196cdf0e10cSrcweir 			static FormAttributes eEnumPropertyIds[] =
2197cdf0e10cSrcweir 			{
2198cdf0e10cSrcweir 				faEnctype, faMethod, faCommandType, faNavigationMode, faTabbingCycle
2199cdf0e10cSrcweir 			};
2200cdf0e10cSrcweir 			static const sal_Char* pEnumPropertyNames[] =
2201cdf0e10cSrcweir 			{
2202cdf0e10cSrcweir 				PROPERTY_SUBMIT_ENCODING, PROPERTY_SUBMIT_METHOD, PROPERTY_COMMAND_TYPE, PROPERTY_NAVIGATION, PROPERTY_CYCLE
2203cdf0e10cSrcweir 			};
2204cdf0e10cSrcweir 			static OEnumMapper::EnumProperties eEnumPropertyMaps[] =
2205cdf0e10cSrcweir 			{
2206cdf0e10cSrcweir 				OEnumMapper::epSubmitEncoding, OEnumMapper::epSubmitMethod, OEnumMapper::epCommandType, OEnumMapper::epNavigationType, OEnumMapper::epTabCyle
2207cdf0e10cSrcweir 			};
2208cdf0e10cSrcweir 			static sal_Int32 nEnumPropertyAttrDefaults[] =
2209cdf0e10cSrcweir 			{
2210cdf0e10cSrcweir 				FormSubmitEncoding_URL, FormSubmitMethod_GET, CommandType::COMMAND, NavigationBarMode_CURRENT, TabulatorCycle_RECORDS
2211cdf0e10cSrcweir 			};
2212cdf0e10cSrcweir 			static sal_Bool nEnumPropertyAttrDefaultFlags[] =
2213cdf0e10cSrcweir 			{
2214cdf0e10cSrcweir 				sal_False, sal_False, sal_False, sal_False, sal_True
2215cdf0e10cSrcweir 			};
2216cdf0e10cSrcweir 			sal_Int32 nIdCount = sizeof(eEnumPropertyIds) / sizeof(eEnumPropertyIds[0]);
2217cdf0e10cSrcweir 		#if OSL_DEBUG_LEVEL > 0
2218cdf0e10cSrcweir 			sal_Int32 nNameCount = sizeof(pEnumPropertyNames) / sizeof(pEnumPropertyNames[0]);
2219cdf0e10cSrcweir 			sal_Int32 nDefaultCount = sizeof(nEnumPropertyAttrDefaults) / sizeof(nEnumPropertyAttrDefaults[0]);
2220cdf0e10cSrcweir 			sal_Int32 nDefaultFlagCount = sizeof(nEnumPropertyAttrDefaultFlags) / sizeof(nEnumPropertyAttrDefaultFlags[0]);
2221cdf0e10cSrcweir 			sal_Int32 nMapCount = sizeof(eEnumPropertyMaps) / sizeof(eEnumPropertyMaps[0]);
2222cdf0e10cSrcweir 			OSL_ENSURE((nIdCount == nNameCount) && (nNameCount == nDefaultCount) && (nDefaultCount == nDefaultFlagCount) && (nDefaultFlagCount == nMapCount),
2223cdf0e10cSrcweir 				"OFormExport::exportAttributes: somebody tampered with the maps (3)!");
2224cdf0e10cSrcweir 		#endif
2225cdf0e10cSrcweir 			for (i=0; i<nIdCount; ++i)
2226cdf0e10cSrcweir 				exportEnumPropertyAttribute(
2227cdf0e10cSrcweir 					OAttributeMetaData::getFormAttributeNamespace(eEnumPropertyIds[i]),
2228cdf0e10cSrcweir 					OAttributeMetaData::getFormAttributeName(eEnumPropertyIds[i]),
2229cdf0e10cSrcweir 					pEnumPropertyNames[i],
2230cdf0e10cSrcweir 					OEnumMapper::getEnumMap(eEnumPropertyMaps[i]),
2231cdf0e10cSrcweir 					nEnumPropertyAttrDefaults[i],
2232cdf0e10cSrcweir 					nEnumPropertyAttrDefaultFlags[i]
2233cdf0e10cSrcweir                 );
2234cdf0e10cSrcweir 		}
2235cdf0e10cSrcweir 
2236cdf0e10cSrcweir 		// the service name
2237cdf0e10cSrcweir 		exportServiceNameAttribute();
2238cdf0e10cSrcweir 		// the target frame
2239cdf0e10cSrcweir 		exportTargetFrameAttribute();
2240cdf0e10cSrcweir 		// the target URL
2241cdf0e10cSrcweir 		exportTargetLocationAttribute(true);    // #i110911# add type attribute (for form, but not for control)
2242cdf0e10cSrcweir 
2243cdf0e10cSrcweir 		// master fields
2244cdf0e10cSrcweir 		exportStringSequenceAttribute(
2245cdf0e10cSrcweir 			OAttributeMetaData::getFormAttributeNamespace(faMasterFields),
2246cdf0e10cSrcweir 			OAttributeMetaData::getFormAttributeName(faMasterFields),
2247cdf0e10cSrcweir 			PROPERTY_MASTERFIELDS);
2248cdf0e10cSrcweir 		// detail fields
2249cdf0e10cSrcweir 		exportStringSequenceAttribute(
2250cdf0e10cSrcweir 			OAttributeMetaData::getFormAttributeNamespace(faDetailFiels),
2251cdf0e10cSrcweir 			OAttributeMetaData::getFormAttributeName(faDetailFiels),
2252cdf0e10cSrcweir 			PROPERTY_DETAILFIELDS);
2253cdf0e10cSrcweir 	}
2254cdf0e10cSrcweir //.........................................................................
2255cdf0e10cSrcweir }	// namespace xmloff
2256cdf0e10cSrcweir //.........................................................................
2257