1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _XMLOFF_XFORMSAPI_HXX
24 #define _XMLOFF_XFORMSAPI_HXX
25 
26 //
27 // this is a collection of several functions to make dealing with the XForms
28 // API a little easier
29 //
30 
31 #include <com/sun/star/uno/Any.hxx>
32 
33 namespace rtl { class OUString; }
34 namespace com { namespace sun { namespace star {
35     namespace beans { class XPropertySet; }
36     namespace frame { class XModel; }
37     namespace uno { template<class A> class Reference; }
38     namespace xforms { class XDataTypeRepository; }
39 } } }
40 class SvXMLNamespaceMap;
41 
42 
43 #define OUSTRING(msg) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(msg))
44 
45 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_createXFormsModel();
46 
47 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_createXFormsBinding();
48 
49 void lcl_addXFormsModel(
50     const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xDocument,
51     const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel );
52 
53 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_findXFormsBinding( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& );
54 
55 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_findXFormsSubmission( com::sun::star::uno::Reference<com::sun::star::frame::XModel>&, const rtl::OUString& );
56 
57 void lcl_setValue(
58     com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xPropSet,
59     const rtl::OUString& rName,
60     const com::sun::star::uno::Any rAny );
61 
62 template<typename T>
lcl_setValue(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> & xPropSet,const rtl::OUString & rName,T & aValue)63 void lcl_setValue(
64     com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xPropSet,
65     const rtl::OUString& rName,
66     T& aValue )
67 {
68     lcl_setValue( xPropSet, rName, com::sun::star::uno::makeAny( aValue ) );
69 }
70 
71 
72 com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_getXFormsModel( const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& );
73 
74 sal_uInt16 lcl_getTypeClass(
75     const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository,
76     const SvXMLNamespaceMap& rNamespaceMap,
77     const rtl::OUString& rXMLName );
78 
79 rtl::OUString lcl_getTypeName(
80     const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository,
81     const SvXMLNamespaceMap& rNamespaceMap,
82     const rtl::OUString& rXMLName );
83 
84 rtl::OUString lcl_getBasicTypeName(
85     const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository,
86     const SvXMLNamespaceMap& rNamespaceMap,
87     const rtl::OUString& rXMLName );
88 
89 #endif
90