masterfix DEV300: #i10000# build fix
[LibreOffice.git] / forms / source / xforms / submission.hxx
blob36a687a3d5e59ea73c71d59408e0372967139178
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _SUBMISSION_HXX
29 #define _SUBMISSION_HXX
32 // includes for parent classes
33 #include <cppuhelper/implbase2.hxx>
34 #include <propertysetbase.hxx>
35 #include <com/sun/star/util/XModifyBroadcaster.hpp>
36 #include <com/sun/star/container/XNamed.hpp>
37 #include <com/sun/star/xml/dom/events/XEventListener.hpp>
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
39 #include <com/sun/star/xml/dom/XNode.hpp>
40 #include <com/sun/star/xml/dom/XDocument.hpp>
41 #include <com/sun/star/xml/dom/XDocumentFragment.hpp>
42 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
43 #include <com/sun/star/xforms/XSubmission.hpp>
45 // includes for member variables
46 #include <com/sun/star/uno/Reference.hxx>
47 #include <com/sun/star/uno/Sequence.hxx>
48 #include <computedexpression.hxx>
49 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
51 // forward declaractions
52 namespace com { namespace sun { namespace star {
53 namespace xforms { class XModel; }
54 namespace uno { class Any; }
55 namespace beans { class UnknownPropertyException;
56 class PropertyVetoException; }
57 namespace lang { class IllegalArgumentException;
58 class WrappedTargetException; }
59 } } }
60 namespace xforms { class Model; }
63 namespace xforms
66 /** An XForms submission.
68 * See http://www.w3.org/TR/xforms/ for more information.
70 typedef cppu::ImplInheritanceHelper2<
71 PropertySetBase,
72 com::sun::star::lang::XUnoTunnel,
73 com::sun::star::xforms::XSubmission
74 > Submission_t;
76 class Submission : public Submission_t
78 // submission properties
79 rtl::OUString msID;
80 rtl::OUString msBind;
81 ComputedExpression maRef;
82 rtl::OUString msAction;
83 rtl::OUString msMethod;
84 rtl::OUString msVersion;
85 bool mbIndent;
86 rtl::OUString msMediaType;
87 rtl::OUString msEncoding;
88 bool mbOmitXmlDeclaration;
89 bool mbStandalone;
90 rtl::OUString msCDataSectionElement;
91 rtl::OUString msReplace;
92 rtl::OUString msSeparator;
93 com::sun::star::uno::Sequence< rtl::OUString > msIncludeNamespacePrefixes;
95 private:
97 /// the Model to which this Submission belongs; may be NULL
98 com::sun::star::uno::Reference<com::sun::star::xforms::XModel> mxModel;
100 // this will extract the document from the model that will be submitted
101 com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocumentFragment >
102 createSubmissionDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject,
103 sal_Bool bRemoveWSNodes = sal_False);
104 com::sun::star::uno::Reference< com::sun::star::xml::dom::XDocument >
105 getInstanceDocument(const com::sun::star::uno::Reference< com::sun::star::xml::xpath::XXPathObject >& aObject);
107 com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory > m_aFactory;
108 public:
109 Submission();
110 virtual ~Submission() throw();
113 // property methods: get/set value
116 /// get XForms model
117 com::sun::star::uno::Reference<com::sun::star::xforms::XModel>
118 getModel() const;
120 /// set XForms model
121 void setModel(
122 const com::sun::star::uno::Reference<com::sun::star::xforms::XModel>& );
124 rtl::OUString getID() const; /// get ID for this submission
125 void setID( const rtl::OUString& ); /// set ID for this submission
127 rtl::OUString getBind() const;
128 void setBind( const rtl::OUString& );
130 rtl::OUString getRef() const;
131 void setRef( const rtl::OUString& );
133 rtl::OUString getAction() const;
134 void setAction( const rtl::OUString& );
136 rtl::OUString getMethod() const;
137 void setMethod( const rtl::OUString& );
139 rtl::OUString getVersion() const;
140 void setVersion( const rtl::OUString& );
142 bool getIndent() const;
143 void setIndent( bool );
145 rtl::OUString getMediaType() const;
146 void setMediaType( const rtl::OUString& );
148 rtl::OUString getEncoding() const;
149 void setEncoding( const rtl::OUString& );
151 bool getOmitXmlDeclaration() const;
152 void setOmitXmlDeclaration( bool );
154 bool getStandalone() const;
155 void setStandalone( bool );
157 rtl::OUString getCDataSectionElement() const;
158 void setCDataSectionElement( const rtl::OUString& );
160 rtl::OUString getReplace() const;
161 void setReplace( const rtl::OUString& );
163 rtl::OUString getSeparator() const;
164 void setSeparator( const rtl::OUString& );
166 com::sun::star::uno::Sequence< rtl::OUString > getIncludeNamespacePrefixes() const;
167 void setIncludeNamespacePrefixes( const com::sun::star::uno::Sequence< rtl::OUString >& );
170 /** perform the submission
171 * @returns if submission was successful */
172 bool doSubmit( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler );
175 /// release the model (note: Binding is unusable without model)
176 void releaseModel();
179 // helpers for UNO tunnel
180 static com::sun::star::uno::Sequence<sal_Int8> getUnoTunnelID();
181 static Submission* getSubmission( const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& );
185 private:
187 /// check whether object is live, and throw suitable exception if not
188 /// (to be used be API methods before acting on the object)
189 void liveCheck()
190 throw( com::sun::star::uno::RuntimeException );
192 /// get the model implementation
193 xforms::Model* getModelImpl() const;
194 xforms::Model* getModelImpl( const com::sun::star::uno::Reference<com::sun::star::xforms::XModel>& xModel ) const;
198 protected:
201 // XPropertySet & friends:
202 // implement abstract methods from PropertySetHelper
205 virtual sal_Bool SAL_CALL convertFastPropertyValue(
206 com::sun::star::uno::Any& rConvertedValue,
207 com::sun::star::uno::Any& rOldValue,
208 sal_Int32 nHandle,
209 const com::sun::star::uno::Any& rValue )
210 throw ( com::sun::star::lang::IllegalArgumentException );
212 private:
213 void initializePropertySet();
216 public:
219 // XNamed:
220 // get/set name
223 virtual rtl::OUString SAL_CALL getName()
224 throw( com::sun::star::uno::RuntimeException );
226 virtual void SAL_CALL setName( const rtl::OUString& )
227 throw( com::sun::star::uno::RuntimeException );
232 // XUnoTunnel
235 virtual sal_Int64 SAL_CALL getSomething(
236 const com::sun::star::uno::Sequence<sal_Int8>& )
237 throw( com::sun::star::uno::RuntimeException );
241 // XSubmission
244 virtual void SAL_CALL submit( )
245 throw ( com::sun::star::util::VetoException,
246 com::sun::star::lang::WrappedTargetException,
247 com::sun::star::uno::RuntimeException );
248 virtual void SAL_CALL submitWithInteraction(
249 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& aHandler )
250 throw ( com::sun::star::util::VetoException,
251 com::sun::star::lang::WrappedTargetException,
252 com::sun::star::uno::RuntimeException );
253 virtual void SAL_CALL addSubmissionVetoListener(
254 const ::com::sun::star::uno::Reference< ::com::sun::star::form::submission::XSubmissionVetoListener >& listener )
255 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
256 virtual void SAL_CALL removeSubmissionVetoListener(
257 const ::com::sun::star::uno::Reference< ::com::sun::star::form::submission::XSubmissionVetoListener >& listener )
258 throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
261 // XPropertySet
262 // (need to disambiguate this)
264 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
265 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
266 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
267 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
268 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
269 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
270 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
274 } // namespace xforms
276 #endif