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