1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19 #pragma once
20
21
22 // this is a collection of several functions to make dealing with the XForms
23 // API a little easier
24
25
26 #include <com/sun/star/uno/Any.hxx>
27
28 namespace com::sun::star {
29 namespace beans { class XPropertySet; }
30 namespace frame { class XModel; }
31 namespace uno { template<class A> class Reference; }
32 namespace xforms { class XDataTypeRepository; class XModel2; }
33 }
34 class SvXMLNamespaceMap;
35
36 css::uno::Reference<css::xforms::XModel2> xforms_createXFormsModel();
37
38 void xforms_addXFormsModel(
39 const css::uno::Reference<css::frame::XModel>& xDocument,
40 const css::uno::Reference<css::xforms::XModel2>& xModel );
41
42 css::uno::Reference<css::beans::XPropertySet> xforms_findXFormsBinding( css::uno::Reference<css::frame::XModel> const &, const OUString& );
43
44 css::uno::Reference<css::beans::XPropertySet> xforms_findXFormsSubmission( css::uno::Reference<css::frame::XModel> const &, const OUString& );
45
46 void xforms_setValueAny(
47 css::uno::Reference<css::beans::XPropertySet> const & xPropSet,
48 const OUString& rName,
49 const css::uno::Any& rAny );
50
51 template<typename T>
xforms_setValue(css::uno::Reference<css::beans::XPropertySet> & xPropSet,const OUString & rName,const T & aValue)52 inline void xforms_setValue(
53 css::uno::Reference<css::beans::XPropertySet>& xPropSet,
54 const OUString& rName,
55 const T& aValue )
56 {
57 xforms_setValueAny( xPropSet, rName, css::uno::makeAny( aValue ) );
58 }
59 template<>
xforms_setValue(css::uno::Reference<css::beans::XPropertySet> & xPropSet,const OUString & rName,const css::uno::Any & aValue)60 inline void xforms_setValue(
61 css::uno::Reference<css::beans::XPropertySet>& xPropSet,
62 const OUString& rName,
63 const css::uno::Any& aValue )
64 {
65 xforms_setValueAny( xPropSet, rName, aValue );
66 }
67
68 sal_uInt16 xforms_getTypeClass(
69 const css::uno::Reference<css::xforms::XDataTypeRepository>& xRepository,
70 const SvXMLNamespaceMap& rNamespaceMap,
71 const OUString& rXMLName );
72
73 OUString xforms_getTypeName(
74 const css::uno::Reference<css::xforms::XDataTypeRepository>& xRepository,
75 const SvXMLNamespaceMap& rNamespaceMap,
76 const OUString& rXMLName );
77
78 OUString xforms_getBasicTypeName(
79 const css::uno::Reference<css::xforms::XDataTypeRepository>& xRepository,
80 const SvXMLNamespaceMap& rNamespaceMap,
81 const OUString& rXMLName );
82
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
84