xref: /AOO41X/main/xmloff/source/forms/propertyexport.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
29*cdf0e10cSrcweir #define _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "formattributes.hxx"
32*cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
33*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
35*cdf0e10cSrcweir #include <callbacks.hxx>
36*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
37*cdf0e10cSrcweir #include "callbacks.hxx"
38*cdf0e10cSrcweir #include "strings.hxx"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir //.........................................................................
41*cdf0e10cSrcweir namespace xmloff
42*cdf0e10cSrcweir {
43*cdf0e10cSrcweir //.........................................................................
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #define BOOLATTR_DEFAULT_FALSE			0x00
46*cdf0e10cSrcweir #define BOOLATTR_DEFAULT_TRUE			0x01
47*cdf0e10cSrcweir #define BOOLATTR_DEFAULT_VOID			0x02
48*cdf0e10cSrcweir #define BOOLATTR_DEFAULT_MASK			0x03
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #define BOOLATTR_INVERSE_SEMANTICS		0x04
51*cdf0e10cSrcweir 	// if sal_True, indicates that the semantic of the property refered by <arg>_pPropertyName</arg>
52*cdf0e10cSrcweir 	// is inverse to the semantic of the XML attribute.<br/>
53*cdf0e10cSrcweir 	// I.e. if the property value is <TRUE/>, <FALSE/> has to be written and vice versa.
54*cdf0e10cSrcweir 	// <p>Be careful with <arg>_bDefault</arg> and <arg>_bInverseSemantics</arg>: if <arg>_bInverseSemantics</arg>
55*cdf0e10cSrcweir 	// is <TRUE/>, the current property value is inverted <em>before</em> comparing it to the default.</p>
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 	class IFormsExportContext;
58*cdf0e10cSrcweir 	//=====================================================================
59*cdf0e10cSrcweir 	//= OPropertyExport
60*cdf0e10cSrcweir 	//=====================================================================
61*cdf0e10cSrcweir 	/** provides export related tools for attribute handling
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir 		<p>(The name is somewhat misleading. It's not only a PropertyExport, but in real a ElementExport.
64*cdf0e10cSrcweir 		Anyway.)</p>
65*cdf0e10cSrcweir 	*/
66*cdf0e10cSrcweir 	class OPropertyExport
67*cdf0e10cSrcweir 	{
68*cdf0e10cSrcweir 	private:
69*cdf0e10cSrcweir 		DECLARE_STL_STDKEY_SET(::rtl::OUString, StringSet);
70*cdf0e10cSrcweir 		StringSet		m_aRemainingProps;
71*cdf0e10cSrcweir 			// see examinePersistence
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 		void exportRelativeTargetLocation(const ConstAsciiString& _sPropertyName,sal_Int32 _nProperty,bool _bAddType);
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 	protected:
76*cdf0e10cSrcweir 		IFormsExportContext&	m_rContext;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
79*cdf0e10cSrcweir 						        m_xProps;
80*cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >
81*cdf0e10cSrcweir 						        m_xPropertyInfo;
82*cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >
83*cdf0e10cSrcweir 						        m_xPropertyState;
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir 		// caching
86*cdf0e10cSrcweir 		::rtl::OUString		m_sValueTrue;
87*cdf0e10cSrcweir 		::rtl::OUString		m_sValueFalse;
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir 	public:
90*cdf0e10cSrcweir 		/** constructs an object capable of handling attributes for export
91*cdf0e10cSrcweir 			@param	_rContext
92*cdf0e10cSrcweir 				the export context to which's attribute list the property translation should be added
93*cdf0e10cSrcweir 			@param	m_xControl
94*cdf0e10cSrcweir 				the property set to be exported
95*cdf0e10cSrcweir 		*/
96*cdf0e10cSrcweir 		OPropertyExport(IFormsExportContext& _rContext,
97*cdf0e10cSrcweir 			const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxProps);
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 	protected:
100*cdf0e10cSrcweir 		/** examines a property set given for all properties which's value are to made persistent
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 			<p>upon return the <method>m_aRemainingProps</method> will be filled with the names of all properties
103*cdf0e10cSrcweir 			which need to be stored</p>
104*cdf0e10cSrcweir 		*/
105*cdf0e10cSrcweir 		void examinePersistence();
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 		/**
108*cdf0e10cSrcweir 		*/
109*cdf0e10cSrcweir 		void exportRemainingProperties();
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir 		/** indicates that a property has been handled by a derived class, without using the helper methods of this
112*cdf0e10cSrcweir 			class.
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 			<p>Calling this method is necessary in case you use the suggested mechanism for the generic export of
115*cdf0e10cSrcweir 			properties. This means that you want to use <method>exportRemainingProperties</method>, which exports
116*cdf0e10cSrcweir 			all properties which need to ('cause they haven't been exported with one of the other type-specific
117*cdf0e10cSrcweir 			methods).</p>
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 			<p>In this case you should call exportedProperty for every property you export yourself, so the property
120*cdf0e10cSrcweir 			will be flagged as <em>already handled</em></p>
121*cdf0e10cSrcweir 		*/
122*cdf0e10cSrcweir 		void exportedProperty(const ::rtl::OUString& _rPropertyName)
123*cdf0e10cSrcweir 			{ m_aRemainingProps.erase(_rPropertyName); }
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 		/** add an attribute which is represented by a string property to the export context
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir 			@param _nNamespaceKey
128*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
129*cdf0e10cSrcweir 				provided by the export context.
130*cdf0e10cSrcweir 			@param _pAttributeName
131*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace
132*cdf0e10cSrcweir 			@param _pPropertyName
133*cdf0e10cSrcweir 				the name of the property to ask the control for
134*cdf0e10cSrcweir 		*/
135*cdf0e10cSrcweir 		void exportStringPropertyAttribute(
136*cdf0e10cSrcweir 			const sal_uInt16 _nNamespaceKey,
137*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
138*cdf0e10cSrcweir 			const ::rtl::OUString& _rPropertyName
139*cdf0e10cSrcweir 		);
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 		/** add an attribute which is represented by a boolean property to the export context
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 			@param _nNamespaceKey
144*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
145*cdf0e10cSrcweir 				provided by the export context.
146*cdf0e10cSrcweir 			@param _pAttributeName
147*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace (it's added automatically)
148*cdf0e10cSrcweir 			@param _pPropertyName
149*cdf0e10cSrcweir 				the name of the property to ask the control for
150*cdf0e10cSrcweir 			@param _nBooleanAttributeFlags
151*cdf0e10cSrcweir 				specifies the default and the "alignment" (inverse semantics) of the boolean property
152*cdf0e10cSrcweir 		*/
153*cdf0e10cSrcweir 		void exportBooleanPropertyAttribute(
154*cdf0e10cSrcweir 			const sal_uInt16 _nNamespaceKey,
155*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
156*cdf0e10cSrcweir 			const ::rtl::OUString& _rPropertyName,
157*cdf0e10cSrcweir 			const sal_Int8 _nBooleanAttributeFlags);
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 		/** add an attribute which is represented by a sal_Int16 property to the export context
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 			@param _nNamespaceKey
162*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
163*cdf0e10cSrcweir 				provided by the export context.
164*cdf0e10cSrcweir 			@param _pAttributeName
165*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace (it's added automatically)
166*cdf0e10cSrcweir 			@param _pPropertyName
167*cdf0e10cSrcweir 				the name of the property to ask the control for
168*cdf0e10cSrcweir 			@param _nDefault
169*cdf0e10cSrcweir 				the default of the attribute. If the current property value equals this default, no
170*cdf0e10cSrcweir 				attribute is added.
171*cdf0e10cSrcweir 		*/
172*cdf0e10cSrcweir 		void exportInt16PropertyAttribute(
173*cdf0e10cSrcweir 			const sal_uInt16 _nNamespaceKey,
174*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
175*cdf0e10cSrcweir 			const ::rtl::OUString& _rPropertyName,
176*cdf0e10cSrcweir 			const sal_Int16 _nDefault);
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 		/** add an attribute which is represented by a sal_Int32 property to the export context
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 			@param _nNamespaceKey
181*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
182*cdf0e10cSrcweir 				provided by the export context.
183*cdf0e10cSrcweir 			@param _pAttributeName
184*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace (it's added automatically)
185*cdf0e10cSrcweir 			@param _pPropertyName
186*cdf0e10cSrcweir 				the name of the property to ask the control for
187*cdf0e10cSrcweir 			@param _nDefault
188*cdf0e10cSrcweir 				the default of the attribute. If the current property value equals this default, no
189*cdf0e10cSrcweir 				attribute is added.
190*cdf0e10cSrcweir 		*/
191*cdf0e10cSrcweir 		void exportInt32PropertyAttribute(
192*cdf0e10cSrcweir 			const sal_uInt16 _nNamespaceKey,
193*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
194*cdf0e10cSrcweir 			const ::rtl::OUString& _rPropertyName,
195*cdf0e10cSrcweir 			const sal_Int32 _nDefault);
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 		/** add an attribute which is represented by a enum property to the export context
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 			@param _nNamespaceKey
200*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
201*cdf0e10cSrcweir 				provided by the export context.
202*cdf0e10cSrcweir 			@param _pAttributeName
203*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace (it's added automatically)
204*cdf0e10cSrcweir 			@param _pPropertyName
205*cdf0e10cSrcweir 				the name of the property to ask the control for
206*cdf0e10cSrcweir 			@param _pValueMap
207*cdf0e10cSrcweir 				the map to use when converting the property value to an attribute value
208*cdf0e10cSrcweir 			@param _nDefault
209*cdf0e10cSrcweir 				the default of the attribute. If the current property value equals this default, no
210*cdf0e10cSrcweir 				attribute is added.
211*cdf0e10cSrcweir 		*/
212*cdf0e10cSrcweir 		void exportEnumPropertyAttribute(
213*cdf0e10cSrcweir 			const sal_uInt16 _nNamespaceKey,
214*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
215*cdf0e10cSrcweir 			const sal_Char* _pPropertyName,
216*cdf0e10cSrcweir 			const SvXMLEnumMapEntry* _pValueMap,
217*cdf0e10cSrcweir 			const sal_Int32 _nDefault,
218*cdf0e10cSrcweir 			const sal_Bool _bVoidDefault = sal_False);
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 		// some very special methods for some very special attribute/property pairs
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 		/** add the hlink:target-frame attribute to the export context.
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 			<p>The value of this attribute is extracted from the TargetFrame property of the object given.</p>
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 			<p>The property needs a special handling because conflicts between the default values for the attribute
227*cdf0e10cSrcweir 			and the property.</p>
228*cdf0e10cSrcweir 		*/
229*cdf0e10cSrcweir 		void exportTargetFrameAttribute();
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 		/** add the form:href attribute to the export context.
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 			<p>The value of this attribute is extracted from the TargetURL property of the object given.</p>
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir 			<p>The property needs a special handling because the URL's need to be made relative</p>
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 			<p>If _bAddType is set, an additional xlink:type="simple" attribute is also added.</p>
238*cdf0e10cSrcweir 		*/
239*cdf0e10cSrcweir 		inline void exportTargetLocationAttribute(bool _bAddType) { exportRelativeTargetLocation(PROPERTY_TARGETURL,CCA_TARGET_LOCATION,_bAddType); }
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 		/** add the form:image attribute to the export context.
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 			<p>The value of this attribute is extracted from the ImageURL property of the object given.</p>
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 			<p>The property needs a special handling because the URL's need to be made relative</p>
246*cdf0e10cSrcweir 		*/
247*cdf0e10cSrcweir 		inline void exportImageDataAttribute() { exportRelativeTargetLocation(PROPERTY_IMAGEURL,CCA_IMAGE_DATA,false); }
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 		/** flag the style properties as 'already exported'
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 			<p>We don't have style support right now, so the only thing the method does is removing the style-relevant
252*cdf0e10cSrcweir 			properties from the list of yet-to-be-exported properties (<member>m_aRemainingProps</member>)</p>
253*cdf0e10cSrcweir 		*/
254*cdf0e10cSrcweir 		void flagStyleProperties();
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir 		/** add an arbitrary attribute extracted from an arbitrary property to the export context
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir 			<p>The current value of the property specified wiht <arg>_pPropertyName</arg> is taken and converted
259*cdf0e10cSrcweir 			into a string, no matter what type it has. (Okay, there are the usual limitations: We know Date, Datetime,
260*cdf0e10cSrcweir 			double, integer ... to name just a few).</p>
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 			<p>In case the property value is <NULL/> (void), no attribute is added</p>
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 			<p>In case the property value is an empty string, and the property is a not allowed to be <NULL/> (void),
265*cdf0e10cSrcweir 			no attribute is added</p>
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir 			<p>In case the property value is a sequence of any type, no attribute is added, 'cause sequences can't be
268*cdf0e10cSrcweir 			transported as attribute. In the debug version, an additional assertion will occur if you nonetheless try
269*cdf0e10cSrcweir 			to do this.</p>
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 			@param _nNamespaceKey
272*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
273*cdf0e10cSrcweir 				provided by the export context.
274*cdf0e10cSrcweir 			@param _pAttributeName
275*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace (it's added automatically)
276*cdf0e10cSrcweir 			@param _pPropertyName
277*cdf0e10cSrcweir 				the name of the property to ask the object for
278*cdf0e10cSrcweir 		*/
279*cdf0e10cSrcweir 		void exportGenericPropertyAttribute(
280*cdf0e10cSrcweir 			const sal_uInt16 _nAttributeNamespaceKey,
281*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
282*cdf0e10cSrcweir 			const sal_Char* _pPropertyName);
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 		/** exports a property value, which is a string sequence, as attribute
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 			<p>The elements of the string sequence given are quoted and concatenated, with the characters used for
287*cdf0e10cSrcweir 			this to be choosen by the caller</p>
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir 			<p>If you use the quote character, no check (except assertions) is made if one of the list items
290*cdf0e10cSrcweir 			containes the quote character</p>
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 			<p>If you don't use the quote character, no check (except assertions) is made if one of the list items
293*cdf0e10cSrcweir 			containes the separator character (which would be deadly when reimporting the string)</p>
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 			@param _nNamespaceKey
296*cdf0e10cSrcweir 				the key of the namespace to use for the attribute name. Is used with the namespace map
297*cdf0e10cSrcweir 				provided by the export context.
298*cdf0e10cSrcweir 			@param _pAttributeName
299*cdf0e10cSrcweir 				the name of the attribute to add. Must not contain any namespace (it's added automatically)
300*cdf0e10cSrcweir 			@param _pPropertyName
301*cdf0e10cSrcweir 				the name of the property to ask the object for
302*cdf0e10cSrcweir 			@param _aQuoteCharacter
303*cdf0e10cSrcweir 				the character to use to quote the sequence elements with. May be 0, in this case no quoting happens
304*cdf0e10cSrcweir 			@param _aListSeparator
305*cdf0e10cSrcweir 				the character to use to separate the list entries
306*cdf0e10cSrcweir 		*/
307*cdf0e10cSrcweir 		void exportStringSequenceAttribute(
308*cdf0e10cSrcweir 			const sal_uInt16 _nAttributeNamespaceKey,
309*cdf0e10cSrcweir 			const sal_Char* _pAttributeName,
310*cdf0e10cSrcweir 			const ::rtl::OUString& _rPropertyName,
311*cdf0e10cSrcweir 			const sal_Unicode _aQuoteCharacter = '"',
312*cdf0e10cSrcweir 			const sal_Unicode _aListSeparator = ',');
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir         /** determines whether the given property is to be exported
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir             <p>Currently, the method simply checks whether the property's state is <em>not</em> PropertyState.DEFAULT,
317*cdf0e10cSrcweir             or whether the property is a dynamic property (i.e. added via an <code>XPropertyContainer</code>).
318*cdf0e10cSrcweir             So, take care when using the method - the heuristics is not applicable for all properties.</p>
319*cdf0e10cSrcweir         */
320*cdf0e10cSrcweir         bool shouldExportProperty( const ::rtl::OUString& i_propertyName ) const;
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 		/** tries to convert an arbitrary <type scope="com.sun:star.uno">Any</type> into an string
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 			<p>If the type contained in the Any is not supported, the returned string will be empty. In the
325*cdf0e10cSrcweir 			debug version, an additional assertion occurs.</p>
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 			@param	_rValue
328*cdf0e10cSrcweir 				the value to convert
329*cdf0e10cSrcweir 		*/
330*cdf0e10cSrcweir 		::rtl::OUString implConvertAny(
331*cdf0e10cSrcweir 			const ::com::sun::star::uno::Any& _rValue);
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 		/**
334*cdf0e10cSrcweir 			@return
335*cdf0e10cSrcweir 				token which can be used in the <code>form:property</code> element's <code>type</code> attribute
336*cdf0e10cSrcweir 				to describe the type of a value.<br/>
337*cdf0e10cSrcweir 				Possible types returned are
338*cdf0e10cSrcweir 				<ul>
339*cdf0e10cSrcweir 					<li><b>boolean</b>: <arg>_rValue</arg> was interpreted as boolean value before converting
340*cdf0e10cSrcweir 						it into a string</li>
341*cdf0e10cSrcweir 					<li><b>float</b>: <arg>_rValue</arg> was interpreted as 64 bit floating point 16bit integer, 32bit integer or 64 bit integer value before
342*cdf0e10cSrcweir 						converting it into a string</li>
343*cdf0e10cSrcweir 					<li><b>string</b>: <arg>_rValue</arg> did not need any conversion as it already was a string</li>
344*cdf0e10cSrcweir 				</ul>
345*cdf0e10cSrcweir 				If the type is not convertable, float is returned
346*cdf0e10cSrcweir 		*/
347*cdf0e10cSrcweir 		::xmloff::token::XMLTokenEnum implGetPropertyXMLType(const ::com::sun::star::uno::Type& _rType);
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir #ifdef DBG_UTIL
350*cdf0e10cSrcweir 				void AddAttribute(sal_uInt16 _nPrefix, const sal_Char* _pName, const ::rtl::OUString& _rValue);
351*cdf0e10cSrcweir                 void AddAttribute( sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue );
352*cdf0e10cSrcweir 				void AddAttributeASCII( sal_uInt16 nPrefix, const sal_Char *pName, const sal_Char *pValue );
353*cdf0e10cSrcweir 				void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, const ::rtl::OUString& _rValue);
354*cdf0e10cSrcweir 				void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, ::xmloff::token::XMLTokenEnum _eValue );
355*cdf0e10cSrcweir #else
356*cdf0e10cSrcweir 		//  in the product version, inline this, so it does not cost us extra time calling into our method
357*cdf0e10cSrcweir 		inline	void AddAttribute(sal_uInt16 _nPrefix, const sal_Char* _pName, const ::rtl::OUString& _rValue)
358*cdf0e10cSrcweir 			{ m_rContext.getGlobalContext().AddAttribute(_nPrefix, _pName, _rValue); }
359*cdf0e10cSrcweir         inline void AddAttribute( sal_uInt16 _nPrefix, const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue )
360*cdf0e10cSrcweir             { m_rContext.getGlobalContext().AddAttribute( _nPrefix, _rName, _rValue ); }
361*cdf0e10cSrcweir 		inline	void AddAttributeASCII( sal_uInt16 _nPrefix, const sal_Char* _pName, const sal_Char *pValue )
362*cdf0e10cSrcweir 			{ m_rContext.getGlobalContext().AddAttributeASCII(_nPrefix, _pName, pValue); }
363*cdf0e10cSrcweir 		inline void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, const ::rtl::OUString& _rValue)
364*cdf0e10cSrcweir 			{ m_rContext.getGlobalContext().AddAttribute(_nPrefix, _eName, _rValue); }
365*cdf0e10cSrcweir 		inline void AddAttribute(sal_uInt16 _nPrefix, ::xmloff::token::XMLTokenEnum _eName, ::xmloff::token::XMLTokenEnum _eValue )
366*cdf0e10cSrcweir 			{ m_rContext.getGlobalContext().AddAttribute(_nPrefix, _eName, _eValue); }
367*cdf0e10cSrcweir #endif
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir #ifdef DBG_UTIL
370*cdf0e10cSrcweir 	protected:
371*cdf0e10cSrcweir 		/** check a given property set for the existence and type correctness of a given property
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 			<p>This method is available in the non-product version only.</p>
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 			@param _rPropertyName
376*cdf0e10cSrcweir 				the name of the property to ask the control model for
377*cdf0e10cSrcweir 			@param _pType
378*cdf0e10cSrcweir 				the expected type of the property. May be NULL, in this case no type check is made.
379*cdf0e10cSrcweir 			@return sal_True, if the property exists and is of the correct type
380*cdf0e10cSrcweir 		*/
381*cdf0e10cSrcweir 		void dbg_implCheckProperty(
382*cdf0e10cSrcweir 			const ::rtl::OUString& _rPropertyName,
383*cdf0e10cSrcweir 			const ::com::sun::star::uno::Type* _pType);
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir //		void dbg_implCheckProperty(
386*cdf0e10cSrcweir //			const sal_Char* _rPropertyName,
387*cdf0e10cSrcweir //			const ::com::sun::star::uno::Type* _pType)
388*cdf0e10cSrcweir //		{
389*cdf0e10cSrcweir //			dbg_implCheckProperty(::rtl::OUString::createFromAscii(_rPropertyName), _pType);
390*cdf0e10cSrcweir //		}
391*cdf0e10cSrcweir #endif
392*cdf0e10cSrcweir 	};
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 	//=====================================================================
395*cdf0e10cSrcweir 	//= helper
396*cdf0e10cSrcweir 	//=====================================================================
397*cdf0e10cSrcweir #ifdef DBG_UTIL
398*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY(name, type)	\
399*cdf0e10cSrcweir 		dbg_implCheckProperty(name, &::getCppuType(static_cast< type* >(NULL)))
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY_NO_TYPE(name)	\
402*cdf0e10cSrcweir 		dbg_implCheckProperty(name, NULL)
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY_ASCII( name, type ) \
405*cdf0e10cSrcweir 		dbg_implCheckProperty( ::rtl::OUString::createFromAscii( name ), &::getCppuType(static_cast< type* >(NULL)))
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY_ASCII_NO_TYPE( name ) \
408*cdf0e10cSrcweir 		dbg_implCheckProperty( ::rtl::OUString::createFromAscii( name ), NULL )
409*cdf0e10cSrcweir #else
410*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY(name, type)
411*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY_NO_TYPE(name)
412*cdf0e10cSrcweir 	#define DBG_CHECK_PROPERTY_ASCII_NO_TYPE( name )
413*cdf0e10cSrcweir #endif
414*cdf0e10cSrcweir 
415*cdf0e10cSrcweir //.........................................................................
416*cdf0e10cSrcweir }	// namespace xmloff
417*cdf0e10cSrcweir //.........................................................................
418*cdf0e10cSrcweir 
419*cdf0e10cSrcweir #endif // _XMLOFF_FORMS_PROPERTYEXPORT_HXX_
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir 
422